query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /widgets GET /widgets.json
def index @widgets = Widget.all respond_to do |format| format.html # index.html.erb format.json { render json: @widgets } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @widget = Widget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @widget }\n end\n end", "def widget_data\n widget = WidgetService.widget(params[:widget_id])\n render json: {\n id: widget.id,\n dataset: widget.dataset,\n visualization: widget.widget_config,\n name: widget.name,\n description: widget.description,\n metadata: widget.metadata\n }\n end", "def set_widget\n if !logged_in?\n userresponse = RestClient::Request.new({\n method: :get,\n url: ENV['API_URL'] + 'widgets/visible?client_id='+ ENV['CLIENT_ID'] + '&client_secret=' + ENV['CLIENT_SECRET'] +'&term=',\n headers: { content_type: 'application/json'}\n }).execute do |userresponse, request, result|\n case userresponse.code\n when 400\n [ :error, JSON.parse(userresponse) ]\n when 200\n [ :success, JSON.parse(userresponse) ]\n json=JSON.parse(userresponse)\n rec = Array.new\n json[\"data\"][\"widgets\"].each do |item|\n widget= Widget.new \n widget.id=item[\"id\"]\n widget.name=item[\"name\"]\n widget.description=item[\"description\"]\n widget.kind=item[\"kind\"]\n widget.userid=item[\"user\"][\"id\"]\n widget.username=item[\"user\"][\"name\"]\n widget.owner=item[\"owner\"]\n rec << widget\n end\n @widgetlist= WidgetList.new\n @widgetlist.widgets = rec\n else\n fail \"Invalid response #{userresponse.to_str} received.\"\n end\n end\n else\n response = RestClient::Request.new({\n method: :get,\n url: ENV['API_URL'] + '/widgets',\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n rec = Array.new\n json[\"data\"][\"widgets\"].each do |item|\n widget= Widget.new \n widget.id=item[\"id\"]\n widget.name=item[\"name\"]\n widget.description=item[\"description\"]\n widget.kind=item[\"kind\"]\n widget.userid=item[\"user\"][\"id\"]\n widget.username=item[\"user\"][\"name\"]\n widget.owner=item[\"owner\"]\n rec << widget\n end\n @widgetlist= WidgetList.new\n @widgetlist.widgets = rec\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n end\n end", "def widget_data\n widget = Widget.find(params[:widget_id])\n data = widget.get_filtered_dataset false, 10000\n render json: {id: widget.id,\n visualization: widget.visualization,\n name: widget.name,\n description: widget.description,\n data: data['data']}.to_json\n end", "def widget_data\n widget = Widget.find(params[:widget_id])\n datasets = []\n @site.contexts.each {|c| c.context_datasets.each {|cd| datasets << cd.dataset_id}}\n if datasets.include? widget.dataset_id # To get only a widget for a dataset for this site\n data = widget.get_filtered_dataset false, 10000\n render json: {id: widget.id,\n visualization: widget.visualization,\n name: widget.name,\n description: widget.description,\n data: data['data']}.to_json\n else\n render json: {}\n end\n end", "def get_widgets_list\n dataset_array = []\n @site.contexts.each {|c| c.context_datasets.each {|d| dataset_array << d.dataset_id}}\n dataset_array.uniq!\n widgets = WidgetService.from_datasets dataset_array\n widgets.map do |w|\n { id: w.id, name: w.name,\n visualization: w.widget_config, description: w.description }\n end\n end", "def show\n @pwidget = Pwidget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pwidget }\n end\n end", "def index\n @simple_widgets = SimpleWidget.all\n end", "def show\n @component_widget = ComponentWidget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_widget }\n end\n end", "def widgets\n @widgets\n end", "def index\n @entries = Entry.all\n\n if params.has_key? :widget\n show_layout = false\n else\n show_layout = true\n end\n \n respond_to do |format|\n format.html { render :layout => show_layout }\n format.json { render json: @entries }\n end\n end", "def index\n @user_widgets = UserWidget.all\n end", "def new\n @widget = Widget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @widget }\n end\n end", "def widget\n @widget = \"#{params[:name].camelize}Widget\".constantize.new(current_user)\n respond_to do |format|\n format.js\n end\n end", "def load_widgets\n if params[:all_widgets]\n @widgets = Widget.find(:all)\n else\n @widgets = @potato_man.theme_package.widgets\n end\n end", "def find_widgets widgets_description\n @widgets.find_all widgets_description\n end", "def get_widget_by_id(id, board_id)\n if id == nil\n raise 'Widget ID not found!'\n end\n widgets_url = URI(\"https://api.miro.com/v1/boards/#{board_id}/widgets/#{id}\")\n result = send_get(widgets_url)\n widget = JSON.parse(result)\n puts CIGREEN + \"GOT WIDGET: \" + CEND + \"#{result}\"\n return widget\nend", "def available_widgets\n options = {:page_template => page.page_template, :block => block_type}\n UbiquoDesign::Structure.get(options)[:widgets].map(&:keys).flatten\n end", "def find(filter)\n res = nil\n Wait.until(timeout: @timeout, interval: @interval) do\n uri = HttpClient.compose_uri(@host, @port, \"/#{API_VERSION}/widgets\", filter)\n res = HttpClient.http_get(uri)\n Response.new(res) if res.is_a?(Net::HTTPOK)\n end\n rescue Error::TimeoutError\n rescue_errors(res)\n end", "def widget_page\n @widget = WidgetService.widget(params[:widget_id])\n @title = @widget.name\n @description = @widget.description\n\n render :widget_page, layout: 'standalone'\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def jmaki_load_widget(name)\n # Return previously parsed content (if any)\n if !@jmaki_widgets\n @jmaki_widgets = { }\n end\n previous = @jmaki_widgets[name]\n if previous\n return previous\n end\n content = \"\"\n filename = JMAKI_RESOURCES + name.tr('.', '/') + \"/widget.json\"\n File.open(filename, \"r\") do |file|\n while line = file.gets(nil)\n content += line\n end\n end\n current = jmaki_parse_json(content, filename)\n @jmaki_widgets[name] = current\n current\n end", "def index\n authorize! :admin, :dashboard\n @twitter_blocks = TwitterBlock.paginate(\n :per_page => 20,\n :page => params[:page],\n :order => 'id ASC'\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @twitter_blocks }\n end\n end", "def index\n # This one demonstrates standard usage.\n @widgets = Widget.all\n paginate @widgets\n end", "def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('widget', 'get', 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 show\n render json: @wellist\n end", "def show\n render json: @social_networking\n end", "def index\n @walls = Wall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @walls }\n end\n end", "def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end", "def index\n render_not_found('organization') unless parent_organization\n @widgets = parent_organization.widgets\n end", "def index\n render json: @owner.cats\n end", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('widget', '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 widget_url(server_id, style = 'shield')\n \"#{api_base}/guilds/#{server_id}/widget.png?style=#{style}\"\n end", "def fetch_json\n res = open(\"http://www.cleanairmakemore.com/widget_json.cfm\").read\n\n # Documented in views/burn/phx/data.json.\n s = res.index(\"facts\")\n json = res[0, s-4] + \"}\"\n\n # json = File.read(\"views/burn/phx/data.json\")\n json\n end", "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "def create\n #@widget.valid?\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+widget_params[:name]+'\",\n \"description\" : \"'+widget_params[:description]+'\",\n \"kind\" : \"'+widget_params[:kind]+'\"\n }}'\n response = RestClient::Request.new({\n method: :post,\n url: ENV['API_URL'] + '/widgets',\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully created.' }\n format.json { render :show, status: :created, location: @widget }\n else\n format.html { render :new }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render \"api/v1/bounties/show\"\n end", "def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end", "def create\n if widgets\n authorize! :create_impac_widgets, widgets.build(widget_create_params)\n\n if @widget = widgets.create(widget_create_params)\n MnoEnterprise::EventLogger.info('widget_create', current_user.id, 'Widget Creation', widget)\n @nocontent = true # no data fetch from Connec!\n render 'show'\n else\n render_bad_request('create widget', @widget.errors)\n end\n else\n render_not_found('widget')\n end\n end", "def get_widgets_deployment_with_http_info(deployment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: WidgetsApi.get_widgets_deployment ...\"\n end\n \n \n # verify the required parameter 'deployment_id' is set\n fail ArgumentError, \"Missing the required parameter 'deployment_id' when calling WidgetsApi.get_widgets_deployment\" if deployment_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/widgets/deployments/{deploymentId}\".sub('{format}','json').sub('{' + 'deploymentId' + '}', deployment_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 local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\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 => 'WidgetDeployment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WidgetsApi#get_widgets_deployment\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_widgets widgets_description\n @form.find_widgets widgets_description\n end", "def index\n workouts = @ws.workouts\n render json: workouts\n end", "def show\n render json: @laboratory\n end", "def new\n @pwidget = Pwidget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pwidget }\n end\n end", "def index\n widgets_per_page = 7\n @search = Widget.searchlogic(params[:search])\n\n if params[:shared] && has_role_with_hierarchy?(:registrado)\n @groups = Group.all :conditions => [\"id IN (?)\", GroupsUsers.find(:all, :conditions => { :user_id => current_user.id }).map(&:group_id).join(',').to_i]\n @widgets = Widget.all :conditions => [\"id IN (?)\", GroupsWidgets.find(:all, :conditions => [\"group_id IN (?)\", @groups.map(&:id).join(',').to_i]).map(&:widget_id).join(',').to_i]\n elsif params[:my_widgets] && has_role_with_hierarchy?(:registrado)\n @widgets = Widget.all :conditions => { :user_id => current_user.id, :approved => true }\n else\n # si admin/superadmin? all_widgets : all_public and my_widgets\n if has_role_with_hierarchy?(:administrador) \n @widgets = @search.paginate :page => params[:page], \n :conditions => { :approved => true },\n :per_page => widgets_per_page\n else\n @widgets = @search.paginate :page => params[:page], \n :conditions => { :public => true, :approved => true },\n :per_page => widgets_per_page\n end\n end\n \n @categories = Category.type_of_widgets\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end", "def index\n @buildings = @buildings.order(:name)\n session[:sidebar] = 'building'\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @buildings }\n end\n end", "def index\n @wbr_data = WbrDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wbr_data }\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def widget_params\n params.require(:widget).permit(:id, :name, :description, :kind, :searchkey)\n end", "def show\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim }\n end\n end", "def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end", "def widget\n html = \"<div class='widget'>\"\n html += provider.widget(internal_id)\n html += \"</div>\"\n return html.html_safe\n end", "def index\n @blogs = Blog.all\n\n render json: @blogs\n end", "def getData\n @widget = Widget.find(params[:id])\n wtype = WidgetType.find(@widget.widget_type_id)\n \n # Return a hash of datas obtained from each source\n srcdata = {}\n str2lst(@widget.sources).each do |source_id|\n src = Source.find(source_id)\n # TBD: There is a TS call inside. Make this non-blocking, also catch error and put error in the hash\n sdata = src.getData()\n logger.debug(\"getData():sdata = #{sdata}\")\n srcdata[source_id] = sdata\n end\n logger.debug(\"getData():srcdata = #{srcdata}\")\n\n metadata = WidgetType.getMetaData(srcdata)\n data = {:srcdata => srcdata, :metadata => metadata}\n\n # The final returned hash looks like this\n # data -> {\n # srcdata -> { ... },\n # metadata -> { ... }\n # };\n render :json => {:data => data}\n end", "def new\n @component_widget = ComponentWidget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @component_widget }\n end\n end", "def index\n @choices = Choice.all\n\n render json: @choices\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end", "def index\n @platforms = Platform.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @platforms }\n end\n end", "def demo\n render json: Cat.all\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n @author_widget_categories = WidgetCategory.fetch_data(current_user).includes(:author_widgets)\n end", "def index\n @wods = Wod.order(\"created_at DESC\")\n\n render json: @wods\n end", "def index\n @wks = Wk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wks }\n end\n end", "def find_widgets_index widgets_description\n @widgets.find_index_all widgets_description\n end", "def index\n render json: Story.all\n end", "def get_tweets\n # TODO-JW: look into -- respond_to :json\n @card = Card.find(params[:id])\n @api = Twitter.user_timeline(@card.twitter_handle, options={count: 10})\n if @api\n tweets = []\n @api.each_with_index do |tweet,i|\n tweets[i] = {}\n tweets[i][:tweet_id] = String(tweet.id)\n tweets[i][:text] = auto_link(tweet.text)\n tweets[i][:created] = tweet.created_at\n tweets[i][:user_id] = tweet.user.screen_name\n end\n render json: tweets \n else\n [].to_json\n end\n end", "def index\n @blogs = Blog.all\n render json: @blogs\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\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 @shots = Shot.all\n\n render json: @shots\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def show\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_list }\n end\n end", "def widgets\n @form.widgets\n end", "def index\n @wowolinks = Wowolink.all\n respond_to do |format|\n format.json {\n render :json => @wowolinks, :layout => false\n }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def show\n @bot = Bot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bot }\n end\n end", "def widget_issues_list\n @snapshot = Snapshot.find(params[:snapshot_id]) if params[:snapshot_id]\n @dashboard_configuration = Api::DashboardConfiguration.new(nil, :period_index => params[:period], :snapshot => @snapshot)\n render :partial => 'project/widgets/issues/issues_list'\n end", "def find_widget widget_description\n @widgets.find widget_description\n end", "def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end", "def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end", "def show\n @wbr_datum = WbrDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wbr_datum }\n end\n end", "def index\n @wigs = Wig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wigs }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end", "def index\n @blocks = Block.all\n\n render json: @blocks\n end", "def show\n @take = Take.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @take }\n end\n end", "def show\n @webling = Webling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @webling }\n end\n end", "def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end", "def show\n render json: @app\n end", "def show\n render json: @tweet\n end", "def jmaki_widget(name, options = {})\n\n # Set up variables we will need\n result = \"\"\n nameSlashed = name.tr('.', '/')\n widgetDir = \"/resources/\" + nameSlashed # FIXME - relative to context path?\n\n # Decorate the options hash with our required attributes\n options['name'] = name\n if !options['uuid']\n options['uuid'] = jmaki_generate_uuid(name)\n end\n options['widgetDir'] = widgetDir\n# puts \"options = \" + options.inspect \n\n # Render the widget-specific libraries and stylesheets\n widget = jmaki_load_widget(name)\n# puts \"Loaded data is \" + widget.inspect\n config = widget['config']\n if config\n type = config['type']\n if type\n id = type['id']\n if ((id != nil) && !jmaki_type_include?(id))\n # preload\n preload = type['preload']\n if preload\n result += jmaki_generate_script(preload)\n end\n #apikey\n apikey = type['apikey']\n gkeys = config['apikeys']\n if !apikey\n apikey = \"\"\n elsif gkeys\n for i in 0...gkeys.length \n # check if we have a global apikey ex. google\n if gkeys[i]['id'] == apikey\n urlkeys = gkeys[i]['keys'];\n # check if we can match the url to one of the keys\n #FIXME -use global variables to compute the webRoot\n railsURI = request.request_uri \n requestURI = request.env['REQUEST_URI'] \n webRoot = requestURI[0, (requestURI.length - railsURI.length)] + \"/\"\n for i in 0...urlkeys.length \n # check the apikey against the webRoot and account for wildcards\n if urlkeys[i]['url'] == webRoot || urlkeys[i]['url'] == '*'\n # set the key equal to the new apikey\n apikey = urlkeys[i]['key']\n end\n end\n end \n end \n end\n # libs\n libs = type['libs']\n dynamicallyLoadable = type['dynamicallyLoadable']\n if libs\n for i in 0...libs.length\n scriptName = \"\"\n # if the lib starts with http don't add the widget dir\n if libs[i].match(/^http/)\n scriptName = libs[i] + apikey\n else\n scriptName = widgetDir + \"/\" + libs[i] + apikey\n end \n # use jmaki script loader when dynamicallyLoadable is false\n # the uuid is needed to identify the widget to the end user\n if dynamicallyLoadable != nil && !dynamicallyLoadable\n script = \"jmaki.writeScript('\" + scriptName + \"','\" + options['uuid'] + \"');\"\n result += jmaki_generate_script(script)\n else \n result += jmaki_generate_js(scriptName)\n end\n end\n end\n # postload\n postload = type['postload']\n if postload\n result += jmaki_generate_script(postload)\n end\n # themes\n themes = type['themes']\n if themes\n defaultTheme = nil\n for i in 0...themes.length\n # check each theme if its the default. Last one with default wins\n if @jmakiGlobalTheme && themes[i]['id']\n if @jmakiGlobalTheme == themes[i]['id']\n theme = themes[i]['style']\n end\n end\n if themes[i]['default']\n defaultTheme = themes[i]['style'] \n end\n end\n if theme == nil\n theme = defaultTheme \n end\n\n if theme\n if theme.match(/^http/)\n result += jmaki_generate_css(theme)\n else\n result += jmaki_generate_css(widgetDir + \"/\" + theme)\n end\n end \n end \n # styles\n styles = type['styles']\n if styles\n for i in 0...styles.length\n if styles[i].match(/^http/)\n result += jmaki_generate_css(styles[i])\n else\n result += jmaki_generate_css(widgetDir + \"/\" + styles[i])\n end \n end\n end\n jmaki_type_include(id)\n end\n end\n end\n\n # Render link to widget stylesheet (if any)\n # FIXME - allow \"component.css\" override with \"style\" attribute\n if (File.exist?(JMAKI_RESOURCES + nameSlashed + \"/component.css\"))\n result += jmaki_generate_css(widgetDir + \"/component.css\")\n end\n\n # Render link to widget javascript (assumed to exist)\n # FIXME - allow \"component.js\" override with \"script\" attribute\n result += jmaki_generate_js(widgetDir + \"/component.js\")\n\n # Create an empty options hash if we did not receive one\n if !options\n options = { }\n end\n\n # Deal with the widget template (if any), including parameter replacements\n # FIXME - override local filename with \"template\" attribute\n template = nil\n templateFilename = JMAKI_RESOURCES + nameSlashed + \"/component.htm\"\n if (File.exist?(templateFilename))\n template = jmaki_generate_content(templateFilename)\n elsif (File.exist?(templateFilename + \"l\"))\n template = jmaki_generate_content(templateFilename + \"l\")\n end\n if template\n # FIXME - do substitutions in writeTemplate() other than ${uuid}\n template = template.gsub('${uuid}', options['uuid'])\n result += template\n end\n\n# puts \"OPTIONS=\" + options.to_json\n\n # Render the widget constructor call\n result += \"<script type='text/javascript'>\\n\" +\n \" jmaki.addWidget(\" + options.to_json + \");\\n\" +\n \"</script>\\n\"\n\n # Return the completed result\n result\n\n end", "def index \n render json: Tuning.all\n end", "def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end" ]
[ "0.7177016", "0.7001222", "0.6949288", "0.6806375", "0.66883814", "0.6652928", "0.6529962", "0.65087163", "0.6492304", "0.6387974", "0.6324118", "0.63024807", "0.6256441", "0.62365276", "0.6211567", "0.61187756", "0.6062224", "0.60185045", "0.5998205", "0.5934863", "0.58620954", "0.5829809", "0.58047396", "0.57958573", "0.57880014", "0.57772374", "0.57614815", "0.57543963", "0.5732314", "0.5697942", "0.56911516", "0.5685535", "0.5676492", "0.56711227", "0.56630737", "0.5655823", "0.56293404", "0.562766", "0.5624793", "0.56213105", "0.56207335", "0.56173503", "0.5605148", "0.5598622", "0.55844575", "0.55802506", "0.55715954", "0.5569412", "0.5569124", "0.55475605", "0.5540227", "0.55357087", "0.55339724", "0.5532884", "0.5528002", "0.55242205", "0.55132455", "0.55082715", "0.55067974", "0.5500676", "0.5498774", "0.5497709", "0.54941356", "0.5490497", "0.5486333", "0.5485483", "0.5478342", "0.5476476", "0.54720265", "0.5468944", "0.5462648", "0.5458962", "0.54582393", "0.5453213", "0.54482263", "0.54464763", "0.54382694", "0.5433111", "0.5432531", "0.54315716", "0.54298544", "0.54269946", "0.542691", "0.5424458", "0.5424174", "0.54235154", "0.54231846", "0.5415628", "0.54149556", "0.5412266", "0.5411241", "0.5410953", "0.5410833", "0.5406906", "0.5403403", "0.54032964", "0.5400418", "0.539695", "0.5392871", "0.5392822" ]
0.75650525
0
DELETE /widgets/1 DELETE /widgets/1.json
def destroy @widget = Widget.find(params[:id]) @widget.destroy respond_to do |format| format.html { redirect_to widgets_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @simple_widget.destroy\n respond_to do |format|\n format.html { redirect_to simple_widgets_url, notice: 'Simple widget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @widget = Widget.find(params[:id])\n @widget.destroy\n respond_to do |format|\n format.html { redirect_to(widgets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @widget.destroy\n respond_to do |format|\n format.html { redirect_to widgets_url, notice: 'Widget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pwidget = Pwidget.find(params[:id])\n @pwidget.destroy\n\n respond_to do |format|\n format.html { redirect_to pwidgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @component_widget = ComponentWidget.find(params[:id])\n @component_widget.destroy\n\n respond_to do |format|\n format.html { redirect_to component_widgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy_impac_widgets, widget\n\n if widget.destroy\n MnoEnterprise::EventLogger.info('widget_delete', current_user.id, 'Widget Deletion', widget)\n head status: :ok\n else\n render_bad_request('destroy widget', 'Unable to destroy widget')\n end\n end", "def delete_widget widget\n @widgets.delete widget\n end", "def delete_widget widget\n @widgets.delete widget\n end", "def destroy\n @author_widget.destroy\n respond_to do |format|\n format.html {redirect_to author_widgets_url, notice: t('widget_destroy_success')}\n format.json {head :no_content}\n end\n end", "def destroy\n @user_widget.destroy\n respond_to do |format|\n format.html { redirect_to user_widgets_url, notice: 'User widget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @widget_form.destroy\n respond_to do |format|\n format.html { redirect_to widget_forms_url, notice: 'Widget form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @thickness.destroy\n respond_to do |format|\n format.html { redirect_to thicknesses_url }\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 things_url }\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 things_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end", "def delete\n api_client.delete(url)\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @twenty.destroy\n respond_to do |format|\n format.html { redirect_to twenties_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @react.destroy\n respond_to do |format|\n format.html { redirect_to reacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @butterfly = Butterfly.find(params[:id])\n @butterfly.destroy\n\n respond_to do |format|\n format.html { redirect_to butterflies_url }\n format.json { head :no_content }\n end\n end", "def delete_widget_at i\n @widgets.delete_at i\n end", "def delete_widget_at i\n @widgets.delete_at i\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @dogshare.destroy\n respond_to do |format|\n format.html { redirect_to dogshares_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @bot = Bot.find(params[:id])\n @bot.destroy\n\n respond_to do |format|\n format.html { redirect_to bots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wait = Wait.find(params[:id])\n @wait.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tatoo.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "def destroy\n @bottling = Bottling.find(params[:id])\n @bottling.destroy\n\n respond_to do |format|\n format.html { redirect_to bottlings_url }\n format.json { head :ok }\n end\n end", "def destroy\n streak, success = jsonapi_destroy.to_a\n\n if success\n render json: { meta: {} }\n else\n render_errors_for(streak)\n end\n end", "def destroy\n @wrapper.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @twentytwo.destroy\n respond_to do |format|\n format.html { redirect_to twentytwos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @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 DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @backend.destroy\n respond_to do |format|\n format.html { redirect_to backends_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api.destroy\n respond_to do |format|\n format.html { redirect_to apis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\nrender json: 1\n end", "def destroy\n @observations.destroy\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end", "def destroy\n @client.delete( name )\n end", "def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n @databox.destroy\n render json: { post: @databox }\n# respond_to do |format|\n# format.html { redirect_to databoxes_url }\n# format.json { head :no_content }\n# end\n end", "def destroy\n @line_item.destroy\n respond_to do |format|\n format.js {}\n format.json { head :no_content }\n end\n end", "def delete\n render json: UserBoards.delete(params[\"id\"])\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @wig = Wig.find(params[:id])\n @wig.destroy\n\n respond_to do |format|\n format.html { redirect_to wigs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lot = Lot.find(params[:id])\n @lot.destroy\n\n respond_to do |format|\n format.html { redirect_to myadmin_lots_url }\n format.json { head :no_content }\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @thermostat.destroy\n respond_to do |format|\n format.html { redirect_to thermostats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @draw = Draw.find(params[:id])\n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html {redirect_to boats_url}\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(things_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_state.destroy\n\n head :no_content\n end", "def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuff_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n id = @api_v1_canvas.id\n @api_v1_canvas.destroy\n respond_to do |format|\n format.html do\n redirect_to api_v1_canvases_url, notice: 'Canvas was successfully destroyed.'\n end\n\n format.json do\n msg = { id: id }\n broadcast(\"deleted\", msg)\n head :no_content\n end\n end\n end", "def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end", "def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end", "def destroy\n @behatweb = Behatweb.find(params[:id])\n @behatweb.destroy\n\n respond_to do |format|\n format.html { redirect_to behatwebs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.delete(@name)\n end", "def destroy\n @kolegij = Kolegij.find(params[:id])\n @kolegij.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cow.destroy\n respond_to do |format|\n format.html { redirect_to kine_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @drawing = Drawing.find(params[:id])\n @drawing.destroy\n\n head :no_content\n end", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attr.destroy\n respond_to do |format|\n format.html { redirect_to attrs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7491588", "0.7396286", "0.7394976", "0.71619344", "0.7030359", "0.6919996", "0.6899113", "0.6899113", "0.6814794", "0.6786082", "0.6743239", "0.66606027", "0.66476583", "0.6640038", "0.66333085", "0.656067", "0.6553023", "0.6533894", "0.65147823", "0.6480145", "0.6480145", "0.6467124", "0.6452809", "0.64469355", "0.6429388", "0.6416514", "0.64143425", "0.6409089", "0.6409089", "0.6409089", "0.6409089", "0.64036965", "0.6381846", "0.6379616", "0.63732964", "0.6372074", "0.6356791", "0.6356791", "0.6348822", "0.6339633", "0.63389814", "0.633755", "0.63330656", "0.63251233", "0.63238454", "0.6315014", "0.63064533", "0.6303838", "0.6298294", "0.62958497", "0.62900835", "0.62839293", "0.62839293", "0.6268563", "0.62682396", "0.6264564", "0.62643015", "0.62610304", "0.6258169", "0.6257379", "0.6235019", "0.6233654", "0.6232041", "0.62312573", "0.622842", "0.62278754", "0.62233514", "0.62178004", "0.6215081", "0.6204677", "0.6203492", "0.6203492", "0.62015665", "0.6195454", "0.6193471", "0.6192454", "0.6192212", "0.6191473", "0.6187048", "0.6184571", "0.61798424", "0.6178858", "0.61782724", "0.6177879", "0.6177514", "0.6177514", "0.61706656", "0.6170388", "0.61702913", "0.61677766", "0.6166925", "0.61665547", "0.61665463", "0.6163431", "0.6161563", "0.6159762", "0.6159762", "0.6157028", "0.6157016" ]
0.77379686
1
Setting up a Mock to simulate the requests.
def setup @requester = Rack::MockRequest.new(SampleApp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_request( params, response_body )\n mock_post = {}\n mock_post.expects(:set_form_data).with(params)\n #mock.expects(:[]=).with('user-agent', anything)\n\n url = Smsinabox.uri\n Net::HTTP::Post.expects(:new).with( url.path ).returns(mock_post)\n\n response = Net::HTTPSuccess.new('1.1', 200, 'OK')\n response.instance_variable_set :@body, response_body\n response.instance_variable_set :@read, true\n\n mock_http = Object.new\n mock_http.expects(:start).returns(response)\n\n Net::HTTP.expects(:new).with( url.host, url.port ).returns(mock_http)\nend", "def mock_req\n Waxx::Req.new(ENV, {}, 'GET', \"/test/test/1\", {}, {}, {}, Time.new).freeze\n end", "def mas_net_http_get(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Get)\n Net::HTTP::Get.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend", "def mock_request(script = \"test\" , headers = {})\n unless @mock_request\n @mock_request = mock(\"MockAgiRequest[script=#{script}]\")\n @mock_request.stub!(\n :extension => \"test\",\n :priority => \"1\",\n :context => \"default\",\n :uniqueId => \"123456789.7\", \n :language => \"en\",\n :channel => \"SIP/127.0.0.1-00000003\",\n :type => \"SIP\",\n :script => script,\n :requestURL => \"agi://fake_test_host:1234/#{script}\") #[?param1=value1&param2=value2]. \"\n end\n @mock_request\nend", "def require_requests_and_mock\n requests.each do |request|\n require_item(request, @request_path)\n if service::Mock.method_defined?(request.last)\n mocked_requests << request.last\n else\n service::Mock.module_eval <<-EOS, __FILE__, __LINE__\n def #{request.last}(*args)\n Fog::Mock.not_implemented\n end\n EOS\n end\n end\n end", "def mas_net_http(response, obj_stubs = {})\n http = mock(Net::HTTP, obj_stubs)\n Net::HTTP.stub!(:new).and_return(http)\n http.stub!(:request).and_return(response)\n http.stub!(:start).and_yield(http)\n http.stub!(:use_ssl=)\n http.stub!(:verify_mode=)\n http\nend", "def mas_net_http_post(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Post)\n Net::HTTP::Post.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend", "def setup\n if @request.present?\n @request.env['HTTP_ACCEPT'] = 'application/json'\n @request.headers['x-api-key'] = 'some_api_key'\n end\n ActiveSupport::Cache::FileStore.any_instance.stubs(:read).returns(\"anandsai_auth\")\n end", "def setup_base_mocks\n client = mock(\"Heroku::Client\")\n Heroku::Client.expects(:new).with(\"heroku_username\", \"heroku_password\").returns(client)\n client\n end", "def mock(*args)\n Spec::Mocks::Mock.new(*args)\n end", "def stubbed_net_http(response, obj_stubs = {}, host = 'twitter.com', port = 80)\n http = Net::HTTP.new(host, port)\n Net::HTTP.stub!(:new).and_return(http)\n http.stub!(:request).and_return(response)\n http\nend", "def mock\n self.known_queues = Set.new\n self.connection.close if self.connection(ensure_started: false)\n self.connection = BunnyMock.new(self.config).start\n end", "def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end", "def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end", "def request\n @request ||= Rack::MockRequest.new(mack_app)\n end", "def setup\n @controller = MainController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end", "def mock(*args)\n Rspec::Mocks::Mock.new(*args)\n end", "def mock_methods_for_testing! #:nodoc:\n request.headers['mock_methods'].each do |method_name, return_value|\n (class << self; self; end).instance_eval do\n define_method(method_name) { |*not_used| return_value }\n end\n end\n end", "def setup\n # For debugging only: print the test name before it runs\n # puts \"#{self.class.name}::#{self.method_name}\"\n Sidekiq::Testing.inline!\n Rails.application.reload_routes!\n Media.any_instance.stubs(:archive_to_archive_is).returns(nil)\n Media.any_instance.stubs(:archive_to_archive_org).returns(nil)\n Media.any_instance.stubs(:archive_to_perma_cc).returns(nil)\n Media.any_instance.stubs(:archive_to_video).returns(nil)\n Media.any_instance.unstub(:parse)\n OpenURI.unstub(:open_uri)\n Twitter::REST::Client.any_instance.unstub(:user)\n Twitter::REST::Client.any_instance.unstub(:status)\n Media.any_instance.unstub(:follow_redirections)\n Media.any_instance.unstub(:get_canonical_url)\n Media.any_instance.unstub(:try_https)\n Airbrake.unstub(:configured?)\n Airbrake.unstub(:notify)\n Media.any_instance.unstub(:url)\n Media.any_instance.unstub(:original_url)\n Media.any_instance.unstub(:data_from_page_item)\n Media.any_instance.unstub(:oembed_get_data_from_url)\n Media.any_instance.unstub(:doc)\n Media::ARCHIVERS['archive_is'][:enabled] = true\n Media::ARCHIVERS['archive_org'][:enabled] = true\n clear_bucket(create: true)\n Media.stubs(:request_metrics_from_facebook).returns({ 'share_count' => 123 })\n Media.stubs(:supported_video?).returns(false)\n end", "def mock_send_request_to_items_microservice\n items_query_params = \"?bibId=998&limit=25&offset=0\"\n stub_request(:get, \"#{ENV.fetch('ITEMS_MICROSERVICE_URL_V01', nil)}\" + items_query_params).\n with(\n headers: {\n 'Authorization' => 'Bearer testoken',\n 'Content-Type' => 'application/json'\n }).to_return(status: 200, body: ITEM_JSON_REQUEST_BODY, headers: {})\n\n items_query_params = \"?bibId=999&limit=25&offset=0\"\n stub_request(:get, \"#{ENV.fetch('ITEMS_MICROSERVICE_URL_V01', nil)}\" + items_query_params).\n with(\n headers: {\n 'Authorization' => 'Bearer testoken',\n 'Content-Type' => 'application/json'\n }).to_return(status: 200, body: ITEM_JSON_REQUEST_BODY, headers: {})\n end", "def request(action = :echo)\n @request = Rack::MockRequest.new(RocketPants::CacheMiddleware.new(controller_class.action(action)))\n end", "def setup\n @controller = CardioController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end", "def mock_send_request_to_patron_creator_service\n stub_request(:post, ENV.fetch('PATRON_MICROSERVICE_URL_V02', nil))\n .to_return(\n {\n status: 201,\n body: {\n 'status' => 'success'\n }.to_json,\n headers: {}\n },\n {\n status: 500,\n body: {\n 'status' => 'failure'\n }.to_json, headers: {}\n }\n )\n end", "def http\n if ActiveResource::HttpMock.enabled?\n ActiveResource::HttpMock.new(@site)\n else\n http_without_mock\n end\n end", "def stub_request_for_installation_token\n self.extend WebMock::API\n stub_request(:post,\n \"https://api.github.com/app/installations/#{ENV[\"INSTALLATION_ID\"]}/access_tokens\").\n to_return(\n status: 201,\n headers: { 'Content-Type' => 'application/json; charset=utf-8' },\n body: %Q({\n \"token\": \"47b0a82c8819bfe66fa88568b9a93dc9b4a8867c\",\n \"expires_at\": \"#{Time.now.utc.xmlschema}\"\n }))\nend", "def setup\n @controller = UserController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end", "def __mock_reset; end", "def flexmock_get\n @mock\n end", "def flexmock_get\n @mock\n end", "def setup\r\n @controller = InvoicesController.new\r\n @request = ActionController::TestRequest.new\r\n @response = ActionController::TestResponse.new\r\n\r\n @first = Invoice.find(:first) \r\n @request.user_agent = 'Firefox'\r\n @request.host = \"quentin.#{DOMAIN_NAME}\"\r\n login_as :quentin\r\n end", "def setup\n @controller = AuthorController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end", "def mock(method, endpoint)\n url = \"https://#{ENV[\"SHOPIFY_SHOP\"]}/admin/#{endpoint}.json\"\n body = load_fixture method, endpoint\n \n stub_request(method, url).to_return(body: body, status: 200)\n end", "def setup\n @request = ActionController::TestRequest.new\n @request.env['REQUEST_URI'] = \"http://localhost\"\n @request.env['HTTP_USER_AGENT'] = \"TestUA\"\n TLA_CONFIG['caching'] = false\n TLA_CONFIG['testing'] = true\n end", "def test_make_sure_the_testing_structure_works\n make_controller :mock\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end", "def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def stub_server_interface\n @handler.stubs(:accept_header ).returns \"format_one,format_two\"\n @handler.stubs(:content_type_header).returns \"text/yaml\"\n @handler.stubs(:set_content_type ).returns \"my_result\"\n @handler.stubs(:set_response ).returns \"my_result\"\n @handler.stubs(:path ).returns \"/my_handler/my_result\"\n @handler.stubs(:http_method ).returns(\"GET\")\n @handler.stubs(:params ).returns({})\n @handler.stubs(:content_type ).returns(\"text/plain\")\n end", "def init\n if RSpec::Mocks::Version::STRING >= '3.0'\n require 'rspec/mocks/standalone'\n else\n RSpec::Mocks.setup(self) unless self.respond_to? :allow\n end\n end", "def mock(name, options={})\n Spec::Mocks::Mock.new(name, options)\n end", "def setup\n @account = accounts(:test_account)\n @user = @account.users.first\n \n # All requests are at account domain with logged-in user unless\n # otherwise specified in the test method\n @request.host = \"#{@account.domain}.ticktockapp.com\"\n @request.session = {:user_id => @user.id}\n end", "def setup(env)\n @request = Mack::Request.new(env) \n @response = Mack::Response.new\n @cookies = Mack::CookieJar.new(self.request, self.response)\n @runner_helpers = []\n Mack::RunnerHelpers::Registry.registered_items.each do |helper|\n help = helper.new\n help.start(self.request, self.response, self.cookies)\n @runner_helpers << help\n end\n end", "def mock_proxy\n @mock_proxy ||= Proxy.new(self, Mock === self ? @name : self.class.name)\n end", "def mock_oauth_request(result = nil)\n instance_double('oauth_request', execute: result)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def setup_request_environment(controller_class)\n controller_class.class_eval do\n def rescue_action(e)\n raise e\n end\n end\n @controller = controller_class.new\n @controller.request = @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n \n @controller.params = {}\n @controller.send(:initialize_current_url)\n end", "def mock_images\n WebMock.stub_request(:any, /http\\:\\/\\/example\\.com\\/(.+)\\.png/).to_return(\n status: 200, body: File.read(File.join(Rails.root, 'test/fixtures/files/image.png')), headers: { content_type: 'image/png' }\n )\n\n WebMock.stub_request(:any, \"http://image.host/another_image.png\").to_return(\n status: 200, body: File.read(File.join(Rails.root, 'test/fixtures/files/another_image.png')), headers: { content_type: 'image/png' }\n )\n\n WebMock.stub_request(:any, \"http://malicious.host/image.png\").to_return(\n status: 200, body: File.read(File.join(Rails.root, 'test/fixtures/files/bad.js')), headers: { content_type: 'image/png' }\n )\n\n WebMock.stub_request(:any, \"http://text.host/text.txt\").to_return(\n status: 200, body: File.read(File.join(Rails.root, 'test/fixtures/files/text.txt')), headers: { content_type: 'text/plain' }\n )\n\n WebMock.stub_request(:any, \"http://404.host/image.png\").to_return(status: 404)\n\n WebMock.stub_request(:get, \"https://bio.tools/api/tool?q=Training%20Material%20Example\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).\n to_return(:status => 200, :body => \"\", :headers => {})\n\n WebMock.stub_request(:get, \"https://bio.tools/api/tool?q=Material%20with%20suggestions\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).\n to_return(:status => 200, :body => \"\", :headers => {})\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def setup\n @controller = ImpasseTestCaseController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n User.current = nil\n end", "def setup\n @dog = Dog.new\n flexmock(@dog, :bark => :grrr)\n end", "def mock_response(status_code, body_str='')\n response_class = Net::HTTPResponse::CODE_TO_OBJ[status_code.to_s]\n response = response_class.new('1.1', status_code.to_s, '')\n response.instance_eval(\"def body; #{body_str.inspect}; end\")\n response\nend", "def mock_framework\n mock_with :mspec unless @mock_framework\n @mock_framework\n end", "def setup_base_mocks\n RunGit.any_instance.expects(:git).with(:init)\n RunGit.any_instance.expects(:git).with(:add => \".\")\n end", "def mock_browser_at_creation mock_browser = nil\n puts \"MOCKING BROWSER\"\n if mock_browser.nil?\n allow_any_instance_of(AdminModule::Pages).to receive(:browser).and_return(HardBrowserMock.new)\n else\n allow_any_instance_of(AdminModule::Pages).to receive(:browser).and_return(mock_browser)\n end\nend", "def mas_net_http_response(status = :success, \n body = '', \n obj_stubs = {})\n response = Spec::Mocks::Mock.new(Net::HTTPResponse)\n response.stub!(:body).and_return(body)\n case status\n when :success || 200\n _create_http_response(response, \"200\", \"OK\")\n when :created || 201\n _create_http_response(response, \"201\", \"Created\")\n when :redirect || 301\n _create_http_response(response, \"301\", \"Redirect\")\n when :not_authorized || 401\n _create_http_response(response, \"401\", \"Not Authorized\")\n when :forbidden || 403\n _create_http_response(response, \"403\", \"Forbidden\")\n when :file_not_found || 404\n _create_http_response(response, \"404\", \"File Not Found\")\n when :server_error || 500\n _create_http_response(response, \"500\", \"Server Error\")\n end\n response\nend", "def setup\n @client = @@client\n end", "def mock_app(options)\n builder = Rack::Builder.new\n builder.use Rack::YandexMetrika, options\n builder.run controller\n @app = builder.to_app\n end", "def setup\n @gateway = flexmock('gateway')\n @db = Catalog::Test::MetadataDatabase.new\n\n @handler_clazz = GetRecordsHandler\n @default_input = {:service => 'CSW', :version => '2.0.2', :typenames => 'csw:Record'}\n @default_args = [@gateway]\n end", "def setup\n build_defaults\n build_site_stub\n build_context_stub\n end", "def initialize(host, params)\n @host = host\n @params = params\n self.validate_request(@params)\n @stubbed_response = params.stubbed_response if params.respond_to?(:stubbed_response)\n end", "def setup\n flexmock(Woofer).new_instances.should_receive(:woof => :grrr)\n end", "def mock_send_request_to_s3_adapter\n stub_request(:get, \"https://my-library-nyc-config.s3.amazonaws.com/test/feature_flag.yml\")\n .to_return(\n { status: 200, body: { 'status' => 'success' }.to_json, headers: {} },\n { status: 500, body: { 'status' => 'failure' }.to_json, headers: {} }\n )\n end", "def initialize(*args)\n options = Hash === args.last ? args.pop : {}\n @mock = MockConfig.new(args, options)\n end", "def initialize(verb, uri, &callback)\n @webmock_stub = ::WebMock::RequestStub.new(verb, uri)\n @callback = callback\n end", "def testear_que_no_se_ensucia_la_clase_mockeada\n PersonalHome.mockear(:cantidad_personas) do\n 100\n end\n\n respuesta = PersonalHome.new.cantidad_personas\n respuesta.deberia ser 100\n end", "def http_start_stub_good_01(host, port, o)\n http = Net::HTTP.new('localhost')\n http.stub(:request, nil) do\n yield(http)\n end # http.stub(:request)\n response = Net::HTTPResponse.new(1.0, 200, \"OK\")\n response.body = get_login_good_01_body()\n response.instance_variable_set(:@header, get_login_good_01_header())\n return response\n end", "def mock_app(base=Padrino::Application, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Padrino::Application, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Padrino::Application, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Padrino::Application, &block)\n @app = Sinatra.new(base, &block)\n end", "def test_truth\n r = Request.new()\n end", "def setup\n @response ||= {}\n end", "def setup\r\n @controller = ExpenseTypesController.new\r\n @request = ActionController::TestRequest.new\r\n @response = ActionController::TestResponse.new\r\n\r\n @request.user_agent = 'Firefox'\r\n @request.host = \"jose.#{DOMAIN_NAME}\"\r\n login_as :jose\r\n end", "def test_check\n body = {}.to_json\n @srv.should_receive(:make_request).once.and_return(flexmock(:body => body))\n @cls.check\n end", "def setup\n # mocking session, overwriting as needed\n @session = stub( 'session_setup',\n :puts => \"send\", \n :gets => \"receive\")\n \n YAML.expects( :load_file ).returns( DATA )\n \n @aserver = Uwchat::AuthServer.new\n @aserver.user = DATA.keys.first\n end", "def setup\n @controller = BackofficeController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n \n @request.user_agent = 'Firefox'\n @request.host = \"www.#{DOMAIN_NAME}\"\n end", "def stub_http_response_with(filename)\n format = filename.split('.').last.intern\n data = file_fixture(filename)\n response = Net::HTTPOK.new('1.1', 200, 'Content for you')\n allow(response).to receive(:body).and_return(data)\n\n request = HTTParty::Request.new(Net::HTTP::Get,\n 'http://localhost',\n format: format)\n allow(request).\n to receive_message_chain(:http, :request).\n and_return(response)\n\n expect(HTTParty::Request).to receive(:new).and_return(request)\nend", "def create_mock( name )\n return flexmock( name )\n\tend", "def test_api_call\n settings = Wovnrb.get_settings\n token = settings['project_token']\n url = 'wovn.io/dashboard'\n stub = stub_request(:get, \"#{settings['api_url']}?token=#{token}&url=#{url}\").\n to_return(:body => '{\"test_body\": \"a\"}')\n\n i = Wovnrb::Interceptor.new(get_app, settings)\n\n i.call(Wovnrb.get_env)\n assert_requested(stub, :times => 1)\n end", "def test_api_call\n settings = Wovnrb.get_settings\n token = settings['project_token']\n url = 'wovn.io/dashboard'\n stub = stub_request(:get, \"#{settings['api_url']}?token=#{token}&url=#{url}\").\n to_return(:body => '{\"test_body\": \"a\"}')\n\n i = Wovnrb::Interceptor.new(get_app, settings)\n\n i.call(Wovnrb.get_env)\n assert_requested(stub, :times => 1)\n end", "def stub_meetup_calls!\n stub_request(:get, /api.meetup.com/).\n with(\n headers: {\n 'Accept'=>'*/*',\n 'Accept-Charset'=>'UTF-8',\n 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',\n 'User-Agent'=>'Ruby'\n }).\n to_return(status: 200, body: json_fixture, headers: {})\nend", "def stub_actionnetwork_request(path, method:, body: nil)\n stub_request(method, \"https://actionnetwork.org/api/v2#{path}\")\n .with(body: body, headers: { 'OSDI-API-Token' => api_key })\nend", "def test_run_simulation\n prng = Minitest::Mock.new(\"prng\")\n driver1 = Minitest::Mock.new(\"Driver1\")\n driver1.expect :print_results, nil\n driver2 = Minitest::Mock.new(\"Driver2\")\n driver2.expect :print_results, nil\n def @c.traverse_city(prng, driver); nil; end;\n @c.add_driver driver1\n @c.add_driver driver2\n @c.run_simulation prng\n assert_mock driver1\n assert_mock driver2\n end", "def setup(opts_given = {})\n opts = {:stub_amqp => true, :use_transactional => true, :mock_soap => true}.merge(opts_given)\n if opts[:stub_amqp]\n @messages_sent = []\n AmqpListener.stubs(:send_to_exchange).returns(true).with do |arg1, arg2|\n # puts \"new message to #{arg1}\"\n @messages_sent << [arg1, arg2]\n true\n end\n AmqpListener.stubs(:send).returns(true).with do |arg1, arg2|\n # puts \"new message to #{arg1}\"\n @messages_sent << [arg1, arg2]\n true\n end\n end\n if opts[:use_transactional]\n CommitCallback.adapt_for_transactional_test!(ActiveRecord::Base.connection)\n else\n ActiveRecord::Base.connection.rollback_db_transaction\n ActiveRecord::Base.connection.decrement_open_transactions \n end\n \n Savon::Client.any_instance.stubs(:publish_case_manager_xml).yields(mock{stubs(:body=).returns(true)}).returns(\"a good response, since eai doesn't send anything else\")\n User.current_user= User.current_user || User.new(:username => \"tribute_test_user\", :user_number => 1337, :remote_roles => {})\n end", "def initalize(mock_session)\n @headers = {}\n\n if mock_session.is_a?(MockSession)\n @rack_mock_session = mock_session\n else\n @rack_mock_session = MockSession.new(mock_session)\n end\n @default_host = @rack_mock_session.default_host\n end", "def mock_uri\n uri = \"http://www.amazon.co.jp/dp/4797357401/ref=sr_1_2?ie=UTF8&qid=1290766740&sr=8-2\"\n io = Mock.new\n io.expects(:read => File.read(\"#{Rails.root}/test/fixtures/amazon_data.html\", :encoding => 'UTF-8'))\n Wish.any_instance.stubs(:open).with(uri).returns(io)\n uri\n end", "def test_initialize_turns\n turns = Minitest::Mock.new('turns')\n simulator = Sim.new(nil, turns, nil)\n assert_equal simulator.turns, turns\n end", "def get(*params); raise('Stub or mock required.') end", "def mock_brew_proxy\n Brew.stubs(:get_connection => Brew.get_connection)\n brew = mock()\n Brew.get_connection.instance_variable_set('@proxy', brew)\n brew\n end", "def mock_devices options\n mac = '11:22:33:44:55:%02d' % options[:id]\n escaped_mac = mac.gsub /:/, '%3A'\n allow(Mac).to receive(:addrs) { [mac] }\n\n if options[:register_fail]\n stub_request(:put, \"http://hivemind/api/devices/update_state.json\").\n to_return(:status => 500, :body => \"{}\", :headers => {})\n\n stub_request(:post, \"http://hivemind/api/devices/register.json\").\n with(body: /%5Bmacs%5D%5B%5D=#{escaped_mac}/).\n to_return(:status => 500, :body => '', :headers => {})\n else\n stub_request(:post, \"http://hivemind/api/devices/register.json\").\n with(body: /%5Bmacs%5D%5B%5D=#{escaped_mac}/).\n to_return(:status => 200, :body => {id: options[:id], connected_devices: options[:hm_devices]}.to_json, :headers => {})\n\n stub_request(:put, \"http://hivemind/api/devices/poll.json\").\n with(body: /%5Bdevice_id%5D=#{options[:id]}/).\n to_return(:status => 200, :body => \"{}\", :headers => {})\n\n stub_request(:put, \"http://hivemind/api/devices/update_state.json\").\n with(body: /%5Bdevice_id%5D=#{options[:id]}/).\n to_return(:status => 200, :body => \"{}\", :headers => {})\n \n end\n\n if options[:poll_fail]\n stub_request(:put, \"http://hivemind/api/devices/poll.json\").\n with(body: /id%5D=#{options[:id]}/).\n to_return(:status => 500, :body => '{}', :headers => {})\n else\n stub_request(:put, \"http://hivemind/api/devices/poll.json\").\n with(body: /id%5D=#{options[:id]}/).\n to_return(:status => 200, :body => {connected_devices: options[:hm_devices]}.to_json, :headers => {})\n end\n allow(DeviceAPI::Android).to receive(:devices) { options[:adb_devices] }\nend", "def setup\n# Connection.establish_connection_schema('railstest')\n @controller = CustomerController.new \n @request = ActionController::TestRequest.new \n @response = ActionController::TestRespons e.new\n end", "def stub_twilio_request\n allow_any_instance_of(TwilioService).to receive(:send_message)\nend", "def initialize\n @redis = MockRedis.new( :url => ENV[\"REDISTOGO_URL\"] ) # later, that env variable will be filled.\n end", "def set_api_stub\n return @_api_stub if @_api_stub\n @_api_stub = Her::API.new\n allow(MnoEnterprise::BaseResource).to receive(:her_api).and_return(@_api_stub = Her::API.new)\n @_api_stub\n end", "def setup_request\n return Typhoeus::Request.new(\n endpoint_url,\n method: @method,\n params: @params,\n body: @body,\n headers: @headers)\n end" ]
[ "0.7454988", "0.73365533", "0.6954197", "0.6949394", "0.6843992", "0.6829548", "0.6791436", "0.66415495", "0.6638607", "0.6506976", "0.64272404", "0.63936895", "0.6391782", "0.6391782", "0.63868284", "0.62820786", "0.6260012", "0.62329465", "0.62270343", "0.62055707", "0.61795694", "0.6163248", "0.61414224", "0.6106929", "0.6072672", "0.60648996", "0.60576195", "0.60513437", "0.60513437", "0.6035197", "0.6027361", "0.6018361", "0.6011272", "0.59998953", "0.5977893", "0.5958797", "0.5957065", "0.5957065", "0.5957065", "0.59391296", "0.5929358", "0.5923056", "0.5918327", "0.5915988", "0.5909388", "0.59058493", "0.5904681", "0.5904681", "0.5904681", "0.5904681", "0.59008336", "0.5895532", "0.5880387", "0.5879695", "0.5876347", "0.5872007", "0.58703774", "0.58669686", "0.5812472", "0.58097464", "0.5803982", "0.5788484", "0.577648", "0.5765024", "0.57368124", "0.5735612", "0.5734916", "0.5725815", "0.57111436", "0.5710406", "0.56972885", "0.56791526", "0.56791526", "0.56791526", "0.56791526", "0.5678909", "0.56764686", "0.5673691", "0.56624746", "0.56547016", "0.5648111", "0.56475556", "0.5642829", "0.56418943", "0.56418943", "0.56417775", "0.5631111", "0.56204814", "0.56185573", "0.5607147", "0.56045246", "0.5601662", "0.5591283", "0.55839866", "0.55722064", "0.55660355", "0.5565748", "0.555943", "0.55550015", "0.55528545" ]
0.7829217
0
Test if the main route is returning the expected message.
def test_settings # At the sample_app.rb we set a :config, lets check if it was injected into # the controller and if we can retrieve it back. For this, we created a # service, and here we will call that service. request = @requester.get URI.escape('/settingsTest') # The response should be OK (200) assert_equal 200, request.status # Content type should be JSON assert_equal 'application/json', request.content_type # Checking if the response contains the expceted text expected_body = 'This is just a settings test.' assert_contains expected_body, request.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test? value\n actual_response = begin\n message.send_to value, publicly: publicly\n rescue\n # Methods that raise can't pass any test\n return false\n end\n \n response.test? actual_response\n end", "def test!\n begin\n send_message!(:recipient_number => '_', :body => '')\n rescue Excon::Errors::Error\n false\n rescue MessageRejectedError\n true\n else\n false # Gateway is being weird, should never accept that message\n end\n end", "def route_applies?(route, message, robot)\n RouteValidator.new(self, route, message, robot).call\n end", "def test? route\n root = nav.root.to_s\n\n ok = case route\n when String\n root == route.sub(/^\\//,'')\n when Symbol\n route.to_s == root\n when Regexp\n !!(route =~ root)\n when Array\n !!route.map(&:to_s).include?(root)\n else\n raise 'Route type %s is not supported' % route.class\n end\n\n nav.shift if ok\n\n ok\n end", "def valid_response?(message)\n return true\n end", "def test!\n begin\n send_message!(:recipient_email => '_', :subject => 'meh')\n rescue Excon::Errors::Error, Timeout::Error\n false\n rescue MessageRejectedError, RecipientRejectedError\n true\n else\n false # Gateway is being weird, should never accept that message\n end\n end", "def test_homepage\n\t\tget '/'\n\t\tassert last_response.ok?,\n\t\t\t\"Homepage loaded without an error.\"\n\t\tassert last_response.body.include?('Please leave me a message below!'),\n\t\t\t\"Expected text present.\"\n\tend", "def check_response(code = :success, expected_msg = nil, line = nil)\n line = line ? \" [*_test:\" + line.to_s + \"]\" : \"\"\n assert_response code, \"expected \" + code.to_s + \", server response: \" + response.body.to_s + line\n if (code.class == Symbol)\n # Not sure why this list isn't the right one: (has :ok instead). Should fix once...\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:success] = 200\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:redirect] = 302\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code]\n end\n return if (code == 302) # redirect, html body\n\n body = JSON.parse(response.body)\n #Success payloads should contain one of these.\n assert (body[0] && body[0][\"server_time\"]) ||\n body[\"status\"] == code ||\n body[\"status\"] == \"destroyed\" ||\n body[\"server_time\"] ||\n body[\"device_id\"] ||\n body[\"key_data\"] ||\n body[\"authtoken\"], \"success payload not one of the usual patterns\" + line\n return if ! expected_msg\n\n if expected_msg.class == Symbol\n expected_msg = ApplicationController.MESSAGES[expected_msg]\n assert expected_msg != nil, \"oops, your check_response passed a non-existant expected message symbol!\" + line\n end\n\n if (code == 200)\n return assert body[\"message\"] = expected_msg, \"wrong message\" + line\n end\n\n # Simple generic check against message template to see that we got\n # the right one - there will be at least 12 chars without a\n # substitution at either start or end in all our MESSAGES strings.\n # Or a whole string without formatting anywhere (when array of validation errors is stringified).\n len = 12\n ret_msg = body[\"error\"]\n # Handle short expected strings (INVALID_PARAM)\n assert ret_msg.start_with?(expected_msg.first(len)) ||\n ret_msg.end_with?(expected_msg.last(len)) ||\n ret_msg.include?(expected_msg),\n \"reply error message doesn't match:\\\"\" + ret_msg + \"\\\"!=\\\"\"+ expected_msg + \"\\\"\" + line\n end", "def test_home_message_negative\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.real_rubies_found(-2)\n\t\ttest_main.home_message\n\t\tassert mocked_Graph\n\tend", "def routed?\n\t\t\t@routed\n\t\tend", "def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end", "def matches_message?(message)\n match_message(message).any?\n end", "def route_check_true\n if @route.nil?\n puts 'Маршрут не установлен!!!'\n else\n true\n end\n end", "def check_for_winner(message)\n return unless @@direct_matches.length == 4\n puts message\n exit\n end", "def test_main_menu_message\n skip\n game = Game.new\n expected = \"Welcome to BATTLESHIP\\nEnter p to play. Enter q to quit.\"\n \n assert_equal expected, game.main_menu_message\n end", "def expect_message(type); end", "def ok?\n first[OK] == 1 || reply.nil?\n end", "def check_ok_response( socket, msg )\n result = socket.recv( 100 )\n logger.debug( \"Result for #{msg} : #{result}\" )\n raise \"Invalid response for #{msg}\" unless result == \"OK\\n\"\n end", "def test_home_message_1\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.real_rubies_found(0)\n\t\ttest_main.home_message\n\t\tassert mocked_Graph\n\tend", "def route_error\n \t@route_err = \"What the heck! I don't know that one, are you sure that's the address you wanted? Click me to return to the home page.\"\n end", "def check_router\n # checks if the router is ready for us ?\n out_socket.send( \"READY\\n\", 0 )\n result = out_socket.recv( 100 )\n logger.debug( \"RESP TO READY #{result}\" )\n raise \"The router does not seem ready to receive commands\" unless result == \"YES\\n\" \n end", "def match(message)\n @block ? @block.call(message) : true\n end", "def test(message, expected, actual)\n if expected == actual\n puts \"Pass - #{message}\"\n else\n puts \"Fail - #{message}\"\n end\nend", "def triggered?(msg)\n if understood?(msg)\n return reply\n end\n nil\n end", "def ok_msg(message)\n puts \"OK - #{message}\"\n exit 0\n end", "def test(msg, expected, actual)\n if expected == actual\n puts \"pass!! #{msg}\"\n else\n puts \"fail!! #{msg}\"\n end\nend", "def check_request_for_route(request)\n match = ::Merb::Router.match(request)\n if match[0].nil? && match[1].empty?\n raise ::Merb::ControllerExceptions::BadRequest, \"No routes match the request. Request uri: #{request.uri}\"\n else\n match[1]\n end\n end", "def test_routes(routes, check_for = value)\n routes.should_not be_empty\n routes.each do |route|\n send(route[:method], route[:route]).body.should == check_for\n $after_filter.should == check_for\n $after_filter = \"\"\n end\n end", "def partial_failure?\n deep_find(:ack, '').downcase.eql?('partialfailure')\n end", "def test_no_route_single_connection\n routes = Routes.new ''\n assert_equal('NO SUCH ROUTE', routes.find_by_exact_stops('a', 'b').to_s)\n end", "def check_error_response(last_response)\n refute_match 'Sinatra doesn&rsquo;t know this ditty', last_response.body, \"unmatched url\"\n end", "def expected?\n false\n end", "def test_return_no_error\n response, error = resolver_returning_response.query_raw(Dnsruby::Message.new, :return)\n assert_nil error\n assert_equal :response_from_send_plain_message, response\n end", "def flexmock_received?(*args)\n @mock.flexmock_received?(*args)\n end", "def expect_success_status\n is_expected.to respond_with 200\n end", "def assert_error_occurred\n @status.wont_equal 0\n end", "def received msg\n send <<END\nI see you!\nfailed test: #{@current_test.inspect}\nEND\n\n send <<END\n you sent:\n#{msg}\nEND\n end", "def matched?\n !failed?\n end", "def route_applies?(route, intent, robot)\n # RouteValidator.new(self, route, message, robot).call\n\n if !intent.nil?\n intent.to_sym == route.intent\n end\n end", "def test_application_running\n get '/v1/main'\n assert last_response.ok?\n assert last_response.body.include?('Hello world')\n end", "def test_request\n get \"/example/route\"\n assert last_response.ok?\n body = last_response.body\n assert body[\"Hello\"]\n end", "def ok?\n run unless ran?\n\n @status.success?\n end", "def ok(message)\n\tputs \"OK - #{message}\"\n\texit 0\nend", "def ok(message)\n\tputs \"OK - #{message}\"\n\texit 0\nend", "def verify_messages_received\n # TODO: this doesn't provide good enough error messages to fix the error.\n # Error msg should tell exactly what went wrong. (AH).\n \n return if @expected_received_count == :any\n return if (@expected_received_count < 0) && (@received_count >= @expected_received_count.abs)\n return if @expected_received_count == @received_count\n \n count_message = make_count_message(@expected_received_count)\n\n message = \"Mock '#{@mock_name}' expected '#{@sym}' #{count_message}, but received it #{@received_count} times\"\n begin\n Kernel::raise(Spec::Api::MockExpectationError, message)\n rescue => error\n error.backtrace.insert(0, @expected_from)\n Kernel::raise error\n end\n end", "def response?(params); end", "def test_no_route_with_single_connection\n routes = Routes.new ''\n assert_equal('NO SUCH ROUTE', routes.find_by_exact_stops('a', 'b').to_s)\n end", "def test_should_not_message_self\n assert_no_difference 'Message.count' do\n post :create,\n :message => {\n :recipient_id => users(:quentin).id,\n :content => 'How are <strong>you</strong> going?' }\n assert_response :redirect\n end\n end", "def check_message(params)\n unless params[:message].blank?\n continue(params)\n else\n fail(:no_message_given)\n end\n end", "def test_receiving\n incoming = ActionMessenger::Message.new\n incoming.to = 'trejkaz@trypticon.org/tests'\n incoming.body = 'Ping'\n \n @messenger.fake_received(incoming)\n \n assert_equal [ incoming ], SimpleMessenger.received\n end", "def test_default_message\n @service.run\n\n assert_equal 'Hello, World!', @env.find('/message').value\n end", "def test_bad_response\n assert_log_matches('Server error when requesting an association') {\n assert_equal(call_negotiate([mk_message({})]), nil)\n }\n end", "def test_success\n assert_equal('kaboodle', make_request.handle)\n end", "def receive_test\n setup_http\n\n if update_status?\n receive_test_status\n else\n simple_failure(\"Nothing happened\")\n end\n end", "def success?\n reply_code == 0\n end", "def must_match(exp, msg=nil)\n MatchAssay.assert!(self, exp, :message=>msg, :backtrace=>caller)\n end", "def should_flash(type)\n should \"return #{type} message\" do\n json = JSON.parse(@response.body)\n assert_not_nil json['messages']\n assert_not_nil json['messages'][type.to_s]\n end\n end", "def print_success_message\n puts \"You have that!\"\n true #why should this return true also? #see my comment on line 53, and look at how it's called on line 96.\n end", "def test_raise_no_error\n response, _error = resolver_returning_response.query_raw(Dnsruby::Message.new, :raise)\n assert_equal :response_from_send_plain_message, response\n end", "def verify\n head :ok\n end", "def message_for(test); end", "def message_for(test); end", "def word\n @expected.empty? ? finish_response : continue_response\n end", "def test_get_existing_message_id\n id = Message.all.first&.id\n return if id.nil?\n\n get \"/messages/#{id}\"\n assert last_response.ok?\n assert_equal 'application/vnd.api+json', last_response.headers['Content-Type']\n\n response_body = JSON.parse last_response.body\n data = response_body['data']\n\n verify_message Message[data['id']], data\n end", "def XXX_deleted_20150502_test_homepage_is_claim_page_for_now\n get '/'\n assert last_response.ok?\n assert_match /claim your prize/, last_response.body\nend", "def is_on_page? page_text, negation = ''\n should_not_have_exception = false\n should_have_exception = false\n begin\n wait_for(timeout: 5) { has_text? page_text }\n # If negation is not nil, we should raise an error if this message was found on the view\n should_not_have_exception = true unless negation == ''\n rescue\n # only raise exception if negation is nil, otherwise this is the expected behaviour\n should_have_exception = true if negation == ''\n end\n raise \"Unexpected Page. The page should not have: '#{page_text}'\" if should_not_have_exception\n raise \"Unexpected Page. Expected was: '#{page_text}'\" if should_have_exception\n end", "def assert_ok\n assert last_response.ok?,\n \"Expected OK from this responses:\\n#{last_response.inspect}\"\n end", "def is_ok?\n code == OK_CODE\n end", "def ok(msg='')\n if msg.empty?\n puts \"ok\"\n else\n puts \"ok (#{msg})\"\n end\n end", "def should_print_message(timestamp, message)\n \n end", "def test_message\n @service.message('test message')\n @service.run\n\n assert_equal 'test message', @env.find('/message').value\n end", "def test_success_scenario\n assert last_response.ok?\n end", "def test_404_page\n get '/launchpads'\n assert last_response.ok?\n assert last_response.body.include?('Endpoint Not Found')\n end", "def has_named_route?(name); end", "def RESPOND?(message)\n @it.respond_to?(message)\n end", "def confirm_gift_message_warning()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n wait_for_landing_page_load\n gift_messsage_error.should_exist\n invalid_gc_msg = gift_messsage_error.inner_text\n invalid_gc_msg.should match(\"Gift message cannot exceed 50 characters\")\n end", "def success?\n type == :ok\n end", "def any_empty_routing?\n self.empty?(self, \"routings\", false)\n end", "def receive_test\n setup_http\n\n http_get(\"#{BASE_URL}\")\n\n { ok: true, message: \"OAuth token is valid\" }\n rescue => ex\n { ok: false, message: ex.message }\n end", "def message?\n false\n end", "def check_routes path, controller, action \n\t\t\tassert_routing path, { :controller => controller, :action => action} \n\t\tend", "def test\n data = Fyb.private.test.perform.parse\n data['msg'] == 'success'\n end", "def should_block_access\n should_respond_with :missing\n should_render_template \"404\"\n should_not_set_the_flash\n end", "def response_received?\n !! @status\n end", "def response_received?\n !! @status\n end", "def test_process_outbound_message\n sm = StateMachine.new\n ap = ApMessageIo.new(state_machine: sm)\n\n # Export our unit test actions to the state machine\n ap.export_action_pack(state_machine: sm, dir: 'test/actions')\n sm.execute\n wait_for_run_phase('RUNNING', sm, 10)\n\n # Startup, write a shutdown message and wait for exit\n write_message_file(sm.query_property('in_pending'), 'ACTION_TEST_ACTION')\n\n sleep(2)\n write_message_file(sm.query_property('in_pending'), 'SYS_NORMAL_SHUTDOWN')\n wait_for_run_phase('SHUTDOWN', sm, 10)\n\n # Look for our outbound message file\n @found_out = false\n Dir[\"#{sm.query_property('out_pending')}/*\"].each do |file|\n @found_out = true if File.foreach(file).grep(/\"action\":\"THIRD_PARTY_ACTION\"/).any?\n end\n assert(@found_out, 'Outbound message file not found')\n end", "def test_can_get_ping\n get '/ping'\n assert last_response.ok?\n assert_equal 'PONG', last_response.body\n end", "def _test_message ; process_test_case(\"message\") ; end", "def test_post_message\n to_number = \"+15005550007\"\n msg = \"I'm texting to a valid number.\"\n \n assert_nothing_raised {@texts_controller.post_message(to_number,msg)}\n end", "def private_message?\n location !~ /^#/\n end", "def success?(*) end", "def must_be_true(msg=nil)\n TrueAssay.assert!(self, :message=>msg, :backtrace=>caller)\n end", "def is_route?\n self.object_type.downcase.to_s == \"route\"\n end", "def common_route\n different_route = Configuration .get_config_value('DifferentRoutes')\n (different_route.nil? ? false : (different_route.to_i == 0))\n end", "def test_accept_community\n assert public_trap_passes? \"public\"\n assert public_trap_passes? [\"test\", \"public\"]\n assert public_trap_passes? nil\n end", "def passed?\n !failed?\n end", "def test_create_standalone_message_about_nothing\r\n reply_to = nil\r\n about = nil\r\n send_message(@andy, @kevin, reply_to, about)\r\n end", "def assert(test_num, message)\n\tif yield\n\t\tputs \"#{test_num}: PASS\"\n\telse\n \t\tputs \"#{test_num}: FAILED #{message} \" \n \tend\nend", "def test_not_found\n get '/does_not_exist'\n assert_equal 'Try again.', last_response.body\n end", "def success?() end", "def test\n return true if expected_header == actual_header\n\n message = \"expected #{expected_header.inspect}, got #{actual_header.inspect}\"\n raise(UnexpectedHeader, message)\n end" ]
[ "0.62412435", "0.610836", "0.60953873", "0.6055863", "0.59984016", "0.59120303", "0.5897065", "0.58238727", "0.5786979", "0.57147366", "0.5694067", "0.56639355", "0.5643365", "0.5638906", "0.5635893", "0.5630261", "0.5574508", "0.55699563", "0.55440193", "0.55433464", "0.55207497", "0.5498663", "0.54845303", "0.5466469", "0.54400605", "0.5435396", "0.54262495", "0.5418993", "0.53971696", "0.5390103", "0.538893", "0.5388353", "0.5367679", "0.5365256", "0.5363293", "0.5354894", "0.53421456", "0.53416216", "0.53405404", "0.53338915", "0.53299236", "0.53289175", "0.5320597", "0.5320597", "0.53156096", "0.5313768", "0.53052694", "0.5291957", "0.52912694", "0.52819884", "0.52583927", "0.5239714", "0.5235844", "0.5233746", "0.52314377", "0.5228564", "0.5223552", "0.5219045", "0.5216997", "0.5214629", "0.5208773", "0.5208773", "0.52038807", "0.51967543", "0.51897043", "0.5187231", "0.5184186", "0.5183011", "0.51822305", "0.51779056", "0.51772934", "0.5176634", "0.5175079", "0.51687485", "0.5168617", "0.5160557", "0.5157848", "0.5154874", "0.5140808", "0.51331484", "0.513148", "0.5128725", "0.5124204", "0.51209867", "0.51209867", "0.51208895", "0.51157326", "0.51107484", "0.5104366", "0.50973547", "0.5086133", "0.50840783", "0.50806403", "0.5077041", "0.50764734", "0.50750434", "0.5071523", "0.5068171", "0.5065327", "0.506056", "0.50547194" ]
0.0
-1
This generates RSpec tests from the JSON test cases of the citeproctests suite. Filter applied to each test to decide whether we should run it. Use this to stay sane while the Processor is not featurecomplete!
def filter(file, fixture) # return ['affix_InterveningEmpty.json'].include?(File.basename(file)) # File.basename(file) =~ /bugreports_greek/i # File.basename(file) =~ /sort_stripmark/i # return File.basename(file) =~ /^date_rawparsesimpledate/i true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end", "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def generate_tests\n for tweet_json in TWEET_JSONS\n test_description = \"tweet_json: '#{tweet_json}'\"\n #puts \"scheduling test #{test_description}\"\n generate_one_test test_description, tweet_json\n end\nend", "def test_cases(*args, **kwargs, &block)\n if block_given?\n process_block(&block)\n elsif kwargs.length.positive?\n process_kwargs(**kwargs)\n elsif args.length.positive?\n add_tests(*args)\n else\n @tests || {}\n end\n end", "def tests\n @tests ||= @spec['tests'].collect do |test|\n Test.new(@data, test)\n end\n end", "def gen_tests\n puts \"Generating tests from announcements at '#{Settings[:announces_file]}' and depositing them in '#{Settings[:test_dir]}'...\"\n announces = File.open(Settings[:announces_file],'r')\n servers = JSON.parse(announces.read)\n servers.each do |server_name, components|\n IronCuke::Proctor.write_tests(server_name, components, Settings[:test_dir])\n end\nend", "def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end", "def test_cases; end", "def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test_case|\n\n models = test_case.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }\n errors = models.delete(:errors)\n\n @group.it(File.basename(path[0..-6])) do\n pending unless errors\n results = described_class.new.validate(models, apply_schema: false)\n unless runner.results_match?(results, errors)\n expect(results).to eq(errors)\n end\n end\n\n end\n end\n end", "def testcase_processed\n\t\n\t\tcontinue = true\n\n\t\tthread = ::Thread.new do\n\t\t\n\t\t\tkill_browser\n\n\t\t\tcase @current_pass\n\t\t\t\twhen 1\n\t\t\t\t\t# Initial verification\n\t\t\t\t\t@genopts.keep\n\t\t\t\twhen 2\n\t\t\t\t\t# Reducing elements\n\t\t\t\t\t@elems.keep\n\t\t\t\twhen 3\n\t\t\t\t\t# Reducing idx's\n\t\t\t\t\t@idxs.keep\n\t\t\t\twhen 4\n\t\t\t\t\t# Final verification\n\t\t\t\t\t# booo, pass 4 has failed!?!.\n\t\t\t\t\tcontinue = false\n\t\t\t\telse\n\t\t\t\t\tcontinue = false\n\t\t\tend\n\n\t\t\t# while we still have testcases to generate...\n\t\t\tif( continue )\n\t\t\t\t# we go again an try the next testcase in a new browser instance\n\t\t\t\tspawn_browser\n\t\t\telse\n\t\t\t\t@reduction_server.stop\n\t\t\t\t::Thread.current.kill\n\t\t\tend\n\t\tend\n\t\t\n\t\tthread.join\n\t\t\n\t\treturn continue\n\tend", "def test_cases\n @test_cases ||= Dir.glob(model.spec_dir + '**/**/?*Spec.as')\n end", "def generate_alltest\n\n end", "def generate_alltestc\n\n end", "def generate_examples_section\n @catalog['resources'].each do |r|\n\n type = r['type']\n title = r['title'].gsub /'/, \"\\\\\\\\'\"\n parameters = r['parameters']\n\n if parameters.nil?\n @content +=\n \" it 'is expected to contain #{type.downcase} #{title}' do\\n\" +\n \" is_expected.to #{matcher(type)}('#{title}')\\n\" +\n \" end\\n\\n\"\n next\n end\n\n @content +=\n \" it 'is expected to contain #{type.downcase} #{title}' do\\n\" +\n \" is_expected.to #{matcher(type)}('#{title}').with({\\n\"\n\n parameters.each do |k, v|\n unless type == 'File' and k == 'content'\n if v.class == String\n v.gsub! /'/, \"\\\\\\\\'\"\n @content += \" '#{k}' => '#{v}',\\n\"\n elsif [Integer, TrueClass, FalseClass].include?(v.class)\n @content += \" '#{k}' => '#{v}',\\n\"\n elsif [Array, Hash].include?(v.class)\n @content += \" '#{k}' => #{v},\\n\"\n else\n raise \"Unhandled input at #{type}[#{title}] of class #{v.class}\"\n end\n end\n end\n\n @content += \" })\\n end\\n\\n\"\n\n ensr = parameters['ensure']\n cont = parameters['content']\n\n if type == 'File' and\n not cont.nil? and\n (ensr == 'file' or ensr == 'present' or\n not parameters.has_key?('ensure'))\n\n mod = cont.clone\n\n if parameters.has_key?('content')\n begin\n mod.gsub!('\\\\') { '\\\\\\\\' }\n mod.gsub! /\"/, '\\\"'\n mod.gsub! /\\@/, '\\@'\n mod.gsub! /\\$;/, '\\\\$;'\n rescue\n end\n end\n\n if not cont.nil?\n if @options[:md5sums]\n generate_md5sum_check(title, cont)\n else\n generate_content_check(title, mod)\n end\n end\n end\n end\n end", "def tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def fast_and_slow_test_files_to_run\n test_files_to_run = all_test_files_to_run\n\n if adapter_class == KnapsackPro::Adapters::RSpecAdapter && KnapsackPro::Config::Env.rspec_split_by_test_examples?\n require 'rspec/core/version'\n unless Gem::Version.new(::RSpec::Core::Version::STRING) >= Gem::Version.new('3.3.0')\n raise 'RSpec >= 3.3.0 is required to split test files by test examples. Learn more: https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases'\n end\n\n slow_test_files = get_slow_test_files\n\n KnapsackPro.logger.info(\"Generating RSpec test examples JSON report for slow test files to prepare it to be split by test examples (by individual 'it's. Thanks to that a single slow test file can be split across parallel CI nodes). Analyzing #{slow_test_files.size} slow test files.\")\n\n # generate RSpec JSON report in separate process to not pollute RSpec state\n cmd = [\n 'RACK_ENV=test',\n 'RAILS_ENV=test',\n KnapsackPro::Config::Env.rspec_test_example_detector_prefix,\n 'rake knapsack_pro:rspec_test_example_detector',\n ].join(' ')\n unless Kernel.system(cmd)\n raise \"Could not generate JSON report for RSpec. Rake task failed when running #{cmd}\"\n end\n\n # read JSON report\n detector = KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector.new\n test_file_example_paths = detector.test_file_example_paths\n\n KnapsackPro::TestFilesWithTestCasesComposer.call(test_files_to_run, slow_test_files, test_file_example_paths)\n else\n test_files_to_run\n end\n end", "def test_class\n while @traversal.continue_generation?\n yield produce_test \n end\n end", "def prepare_for_tests( runs, collectors )\n if Maadi::Expert::Expert::is_expert?( @expert ) and Maadi::Organizer::Organizer::is_organizer?( @organizer )\n if @organizer.works_with?( @expert.domain )\n Maadi::post_message(:Info, 'Expert and Organizer are compatible')\n else\n Maadi::post_message(:Warn, \"Expert (#{@expert.domain}) is NOT compatible with Organizer (#{@organizer.supported_domains.join(', ')})\")\n return false\n end\n\n unless @expert.is_ready?\n @expert.prepare\n end\n\n unless @organizer.is_ready?\n @organizer.prepare\n end\n\n if @expert.is_ready? && @organizer.is_ready?\n collectors.each do |collector|\n collector.log_options( @expert )\n collector.log_options( @organizer )\n end\n\n parameters = @expert.parameters( 'all' )\n ready = @organizer.available_parameters( parameters, runs )\n\n if ready\n Maadi::post_message(:More, 'Generator is ready')\n return true\n end\n else\n Maadi::post_message(:Warn, 'Expert or Organizer NOT ready')\n end\n else\n Maadi::post_message(:Warn, 'Expert or Organizer NOT correct type/initialized')\n end\n\n return false\n end", "def compile\n @tests.each do |test_hash|\n Liquid::Template.new.parse(test_hash[:liquid])\n Liquid::Template.new.parse(test_hash[:layout])\n end\n end", "def prepare\n super\n\n @test_list = @builder.tests\n\n @test_list.each do |item|\n if @options[\"#{item}_RATIO\"].to_i >= 1\n 1.upto(@options[\"#{item}_RATIO\"].to_i) do\n @tests.push item\n end\n end\n end\n end", "def tests\n config.tests(subject)\n end", "def tests(*args)\n @xml.xpath('./tests/test').collect do |xml_test|\n content = if xml_test.at_xpath('./Paragraph')\n xml_test.at_xpath('./Paragraph').text.split(\"\\n\").collect(&:strip).reject{|line| line.empty?}.join(\"\\n\")\n else\n 'n/a'\n end\n {\n id: xml_test.attributes['id'],\n status: xml_test.attributes['status'],\n content: content\n }\n end\n end", "def generate_cat1_tests(cat3_tests, args = nil)\n opts = args ? @options.merge(args) : @options\n\n print \"Generating Cat I tests...\"\n\n cat3_tests.each do |t|\n if !ProductTest.where({_type: \"QRDAProductTest\", calculated_product_test: t.id}).exists?\n t.generate_qrda_cat1_test\n end\n end\n\n puts \"done\"\n end", "def test_scenario2\n data = [{'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e.csv',\n 'params' => {\"combiner\" => 0}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_c1.csv',\n 'params' => {\"combiner\" => 1, \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_c2.csv',\n 'params' => {\"combiner\" => 2, \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_v.csv',\n 'params' => {\"operating_kind\" => \"votes\", \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_p.csv',\n 'params' => {\"operating_kind\" => \"probability\", \"probability\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_c.csv',\n 'params' => {\"operating_kind\" => \"confidence\", \"confidence\" => true}}\n ]\n\n puts\n puts \"Scenario: Successfully creating a batch prediction for an ensemble\"\n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a #{item['filename']} file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create an ensemble of #{item['number_of_models']} models and #{item['tlp']} tlp\"\n # \"tlp\"=> item[\"tlp\"]\n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> item[\"number_of_models\"], \"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}, 'missing_splits' => false})\n\n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(@api.ok(ensemble), true)\n\n puts \"When I create a batch prediction for the dataset with the ensemble and params <%s>\" % JSON.generate(item['params'])\n batch_prediction = @api.create_batch_prediction(ensemble, dataset, item['params'])\n\n puts \"And I wait until the batch prediction is ready\"\n assert_equal(BigML::HTTP_CREATED, batch_prediction[\"code\"])\n assert_equal(@api.ok(batch_prediction), true) \n\n puts \"And I download the created predictions file to #{item['local_file']}\"\n filename = @api.download_batch_prediction(batch_prediction, item[\"local_file\"])\n assert_not_nil(filename)\n\n puts \"Then the batch prediction file is like #{item['predictions_file']}\"\n assert_equal(FileUtils.compare_file(item[\"local_file\"], item[\"predictions_file\"]), true)\n\n\n end\n\n end", "def tests\n parser.flow_items\n end", "def create_tests( inspection_type, filter_record )\n\n inspection_type.qc_inspection_type_tests.each do |inspection_type_test|\n #next if filter_record.attributes[inspection_type_test.filter_column] != inspection_type_test.filter_value\n # filter_value can have a comma-separated list of codes, so split them out into an array:\n filter_checks = inspection_type_test.filter_value.split(/\\s*,\\s*/)\n next unless filter_checks.include?(filter_record.attributes[inspection_type_test.filter_column])\n\n # Create a test\n qc_inspection_test = QcInspectionTest.new( :qc_inspection_id => self.id,\n :passed => false,\n :username => self.username,\n :status => QcInspectionTest::STATUS_CREATED,\n :optional => inspection_type_test.optional,\n :cull_test => inspection_type_test.cull_test,\n :qc_inspection_type_test_id => inspection_type_test.id)\n qc_inspection_test.inspection_test_number = MesControlFile.next_seq_web(MesControlFile::QC_INSPECTION_TEST)\n unless qc_inspection_test.save\n qc_inspection_test.errors.each_full do |msg|\n errors.add_to_base \"Inspection Test: #{msg}\"\n end\n return false\n end\n\n # Create Cull result and measurements:\n if qc_inspection_test.cull_test?\n qc_result = QcResult.new( :qc_test_id => inspection_type_test.qc_test_id, :sample_no => 1)\n if qc_inspection_test.qc_results << qc_result\n inspection_type_test.qc_test.qc_measurement_types.each do |qc_measurement_type|\n qc_result.add_cull_measurement( qc_measurement_type )\n end\n else\n qc_result.errors.each_full do |msg|\n errors.add_to_base \"QC Result: #{msg}\"\n end\n return false\n end\n else\n # Optimized insert for non-cull tests:\n\n # NB. This uses PostgreSQL-specific generate_series function:\n query = \"INSERT INTO qc_results(qc_inspection_test_id, qc_test_id, sample_no)\n select #{qc_inspection_test.id}, #{inspection_type_test.qc_test_id}, sample_no\n from generate_series(1,#{inspection_type_test.sample_size}) x(sample_no)\"\n self.connection.execute(query)\n\n # Insert measurements while bypassing validation:\n query = \"INSERT INTO qc_result_measurements(qc_measurement_type_id, qc_result_id, qc_measurement_code, \n qc_measurement_description, test_uom, test_criteria, test_method, sample_no)\n select qc_measurement_types.id, qc_results.id, qc_measurement_types.qc_measurement_code,\n qc_measurement_types.qc_measurement_description, qc_measurement_types.test_uom,\n qc_measurement_types.test_criteria, qc_measurement_types.test_method, qc_results.sample_no\n from qc_measurement_types\n join qc_results on qc_results.qc_test_id = qc_measurement_types.qc_test_id\n where qc_measurement_types.qc_test_id = #{inspection_type_test.qc_test_id}\n and qc_results.qc_inspection_test_id = #{qc_inspection_test.id}\"\n self.connection.execute(query)\n end\n end\n true\n end", "def tests; end", "def tests; end", "def run\n test_using_random_sample\n test_using_first_of\n end", "def create_feature_options_with_test_runner\n create_feature_options_without_test_runner\n\n option_filter\n end", "def bench_filters\n skip 'TODO'\n end", "def generate_test_class(data: [], linkstatus_url_log: {}, w_pipe: {})\n test_cond = @test_cond\n # Common proccessing\n # e.g.) TestSampleAppPcE2e1, TestSampleAppPcHttpstatus1\n test_class_name = make_test_class_name(data)\n # Select super class by test category\n super_suite_class = eval format('Bucky::TestEquipment::TestCase::%<test_category>sTestCase', test_category: data[:test_category].capitalize)\n # Define test suite class\n test_classes.const_set(test_class_name.to_sym, Class.new(super_suite_class) do |_klass|\n extend TestClassGeneratorHelper\n include TestClassGeneratorHelper\n define_method(:suite_data, proc { data[:suite] })\n define_method(:suite_id, proc { data[:test_suite_id] })\n define_method(:simple_test_class_name) do |original_name|\n match_obj = /\\Atest_(.+)\\(.+::(Test.+)\\)\\z/.match(original_name)\n \"#{match_obj[1]}(#{match_obj[2]})\"\n end\n define_method(:w_pipe, proc { w_pipe })\n\n # Class structure is different for each test category\n case data[:test_category]\n when 'linkstatus' then\n data[:suite][:cases].each_with_index do |t_case, i|\n method_name = make_test_method_name(data, t_case, i)\n description(\n t_case[:case_name],\n define_method(method_name) do\n puts \"\\n#{simple_test_class_name(name)}\"\n t_case[:urls].each do |url|\n linkstatus_check_args = { url: url, device: data[:suite][:device], exclude_urls: data[:suite][:exclude_urls], link_check_max_times: test_cond[:link_check_max_times], url_log: linkstatus_url_log }\n linkstatus_check(linkstatus_check_args)\n end\n end\n )\n end\n\n when 'e2e' then\n if data[:suite][:setup_each]\n def setup\n super\n puts \"[setup]#{simple_test_class_name(name)}\"\n add_test_procedure(suite_data[:setup_each][:procs])\n end\n end\n\n if data[:suite][:teardown_each]\n def teardown\n puts \"[teardown]#{simple_test_class_name(name)}\"\n add_test_procedure(suite_data[:teardown_each][:procs])\n super\n end\n end\n\n # Generate test case method\n data[:suite][:cases].each_with_index do |t_case, i|\n # e.g.) test_sample_app_pc_e2e_1_2\n method_name = make_test_method_name(data, t_case, i)\n method_obj = proc do\n puts \"\\n#{simple_test_class_name(name)}\\n #{t_case[:desc]} ....\"\n add_test_procedure(t_case[:procs])\n end\n description(t_case[:case_name], define_method(method_name, method_obj))\n end\n end\n end)\n end", "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end", "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end", "def test_aux(_tests, _action_feats, _user_feats)\n\n _tests.each do |sym, test|\n\n # extract action feature\n action_feat = _action_feats[sym]\n\n # special \"nil\" test\n test_name = test.fetch(:test, @def_test)\n if test_name == :nil\n return false unless action_feat.nil?\n next\n end\n\n # make sure action feat is avaliable\n return false if action_feat.nil?\n\n # extract user feature\n if test.has_key? :value\n user_feat = test[:value]\n else\n user_feat = _user_feats[test.fetch(:key, sym)]\n # TODO: maybe the following tests belong to the \"compare features\" section\n return false if user_feat.nil?\n next if user_feat == :wildcard # Wildcard matches always\n end\n\n # compare features.\n case test_name\n when :equals; return false unless user_feat == action_feat\n when :equals_int; return false unless user_feat.to_i == action_feat.to_i\n when :if_higher; return false unless user_feat > action_feat\n when :if_lower; return false unless user_feat < action_feat\n else\n # call custom test\n if @owner.respond_to? test_name\n return false unless @owner.send(test_name, action_feat, user_feat)\n end\n end\n end\n\n return true\n end", "def run_fe_tests\n end", "def add_filtering_tests\n measure = ApplicationController.helpers.pick_measure_for_filtering_test(measure_ids, bundle)\n reload_relations\n\n return if product_tests.filtering_tests.any?\n criteria = %w(races ethnicities genders payers age).shuffle\n filter_tests = []\n filter_tests.concat [build_filtering_test(measure, criteria[0, 2]), build_filtering_test(measure, criteria[2, 2])]\n filter_tests << build_filtering_test(measure, ['providers'], 'NPI, TIN & Provider Location')\n filter_tests << build_filtering_test(measure, ['providers'], 'NPI & TIN', false)\n criteria = ApplicationController.helpers.measure_has_diagnosis_criteria?(measure) ? ['problems'] : criteria.values_at(4, (0..3).to_a.sample)\n filter_tests << build_filtering_test(measure, criteria)\n ApplicationController.helpers.generate_filter_records(filter_tests)\n end", "def run\n each_test do |liquid, layout, assigns, page_template, template_name|\n compile_and_render(liquid, layout, assigns, page_template, template_name)\n end\n end", "def run_tests(&block)\n\n @sources.each do |source|\n result = test_source(File.absolute_path(source))\n block.call({ :source => source, :result => result })\n end\n\n end", "def test_scenario2\n data = [{'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'measure' => 'average_phi',\n 'value' => '0.98029',\n 'params' => {\"combiner\" => 0},\n 'tlp' => 1},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'measure' => 'average_phi',\n 'value' => '0.95061',\n 'params' => {\"combiner\" => 1},\n 'tlp' => 1},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'measure' => 'average_phi',\n 'value' => '0.98029',\n 'params' => {\"combiner\" => 2},\n 'tlp' => 1},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'measure' => 'average_phi',\n 'value' => '0.98029',\n 'params' => {\"operating_kind\" => \"votes\"},\n 'tlp' => 1},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'measure' => 'average_phi',\n 'value' => '0.97064',\n 'params' => {\"operating_kind\" => \"probability\"},\n 'tlp' => 1}, \n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'measure' => 'average_phi',\n 'value' => '0.95061',\n 'params' => {\"operating_kind\" => \"confidence\"},\n 'tlp' => 1},\n ]\n \n puts\n puts \"Scenario: Successfully creating an evaluation for an ensemble\" \n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create an ensemble of #{item['number_of_models']} models and #{item['tlp']} tlp\"\n \n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> item[\"number_of_models\"], \n \"seed\" => 'BigML', \n 'ensemble_sample'=>{'rate' => 0.7, \n 'seed' => 'BigML'}, \n 'missing_splits' => false})\n \n\n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(@api.ok(ensemble), true)\n\n puts \"When I create an evaluation for the ensemble with the dataset\"\n evaluation = @api.create_evaluation(ensemble, dataset, item[\"params\"])\n\n puts \"And I wait until the evaluation is ready\"\n assert_equal(BigML::HTTP_CREATED, evaluation[\"code\"])\n assert_equal(@api.ok(evaluation), true)\n\n puts \"Then the measured #{item['measure']} is #{item['value']}\"\n evaluation = @api.get_evaluation(evaluation)\n assert_equal(item[\"value\"].to_f, evaluation[\"object\"][\"result\"][\"model\"][item[\"measure\"]].to_f) \n\n end\n\n end", "def test_displaying_cat1\n setup_product_tests(true, true, false, true, filt1: 'val1')\n\n assert displaying_cat1?(@product_test.tasks.find_by(_type: 'C1Task'))\n assert displaying_cat1?(@f_test.tasks.find_by(_type: 'Cat1FilterTask'))\n\n assert_equal false, displaying_cat1?(@product_test.tasks.find_by(_type: 'C2Task'))\n assert_equal false, displaying_cat1?(@f_test.tasks.find_by(_type: 'Cat3FilterTask'))\n end", "def test_file_to_group(test_file_map, using_or)\n puts \"\\nAnalyzing #{@test_files.length} test files... Stand by.\"\n @test_files.each do |tf|\n @skip = false\n ################\n test_class = Kernel.const_get(test_file_map[tf])\n \n # Lower cases the group only if each element in the grouping array is a string.\n # Note: The check is there to work around cases like below.\n # @properties[:grouping] = [CAD, CONNECT_AWLI, CONNECT], JOBS, JOBS_GRP5\n test_class.properties[:grouping].map!{|g| g.downcase if g.kind_of?(String)}\n \n ## Check if the test has any group that we need not run.\n @skip = false\n test_class.properties[:grouping].each do |g|\n if @groups_not_to_run.include?(g)\n @skip = true\n end\n end\n \n ## check if tcid is present in the file. if not then skip the file\n next if (test_class.properties[:tcid].nil? || test_class.properties[:tcid].length < 1)\n \n # If tcid is present, then ensure that they are numbers only!\n @skip_tcid = false\n test_class.properties[:tcid].each do |tc|\n @skip_tcid = true if !is_a_number?(tc)\n end\n \n # Check for priority\n if test_class.properties[:priority].nil?\n # If not defined or if not as per argument 'priority' then skip this test class\n puts \"PRIORITY property not defined. Skipping file: #{tf}\" if $debug_mode == \"true\"\n next\n end\n \n # If @priority_to_run is equal to MASTER PRIORITY then do not check if priority to run exists in the test class.\n # If @priority_to_run is not equal to MASTER PRIORITY then check if priority to run matches @priority_to_run in\n # the test class; skip test if it does not match.\n # puts \"@priority_to_run = #{@priority_to_run}\"\n @check_priority = (@priority_to_run.eql?(\"\") or @priority_to_run.eql?(MASTER_PRIORITY.downcase))\n if @check_priority == false\n @target_priority_present = test_class.properties[:priority].include?(@priority_to_run)\n if @target_priority_present == false\n next\n end\n end\n ##########################\n # Get the grouping and service property from the file and add it to the @file_group hash\n # Basically file_groups is a hash with file name as key and an array of all groups\n # present in the file as the value\n @file_groups[tf] = [] if test_class.properties[:grouping].length > 0 \n test_class.properties[:grouping].each { |group| @file_groups[tf] << group } \n ##########################\n # Get the tcid property from the file and add it to the @file_tcids hash\n # Basically @file_tcids is a hash with file name as key and an array of all tcid\n # present in the file as the value\n tcids = test_class.properties[:tcid]\n @file_tcids[tf] = tcids unless tcids.empty?\n end\n \n # \"and\" operator is default\n # for each file, compare the intersection of groups vs groups to run.\n # if the intersection exactly matches groups to run, lets see about running it.\n @file_groups.each_pair { |f, g| @files_to_run << f if (@groups_to_run & g) == @groups_to_run and !(@groups_not_to_run & g).any? }\n \n if @priority_to_run.eql?(\"\")\n puts \"\\nFound #{@files_to_run.length} tests grouped for execution. Priority was not defined, so taking as ALL.\"\n else\n puts \"\\nFound #{@files_to_run.length} tests grouped for execution which have the desired priority = #{@priority_to_run} to run:\"\n end\n end", "def run_tests_for(test_pattern)\n reload!\n \n test_pattern.chomp!\n case test_pattern\n when 'all'\n title = 'All Tests'\n pattern = '{unit,functional,integration}/**/*'\n when 'units'\n title = 'Unit Tests'\n pattern = 'unit/**/*'\n when 'functionals'\n title = 'Functional Tests'\n pattern = 'functional/**/*'\n when 'integration'\n title = 'Integration Tests'\n pattern = 'integration/**/*'\n else\n # A title of \"nil\" will be filled in after the tests are loaded\n title = nil\n pattern = test_pattern.gsub(':', '/')\n end\n \n files = Dir.glob(\"#{pattern}.rb\")\n files.each do |file|\n load file\n print '.'\n end\n \n # No title yet? Pull the \"best\" title out of the list of contexts\n if !title\n if Test::Spec::CONTEXTS.any?\n title = Test::Spec::CONTEXTS.keys.sort.first\n else\n title = 'unknown'\n end\n end\n \n title += \" (#{files.length} files)\"\n \n suite = Test::Unit::TestSuite.new(title)\n Test::Spec::CONTEXTS.each do |title, container|\n suite << container.testcase.suite\n end\n \n # Run the test suite and return true/false\n Test::Unit::UI::Console::TestRunner.run(suite).passed?\n end", "def run_tests\n test_suite = self.task.tests.order(:order)\n testsStrings = test_suite.map do |test|\n test_string = task.fxn_name + \"(\"\n test_string + \"...\"+test.parsed_inputs.to_s + \")\"\n end\n formated_user_code = self.solution.gsub(\"\\n\", \" \")\n data = JSON.dump({user_code: formated_user_code, tests: testsStrings})\n uri = URI.parse(\"https://wci7v1nq8j.execute-api.us-west-2.amazonaws.com/v1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = data\n response = http.request(request)\n response = JSON.parse(response.body)\n if response[\"errorMessage\"]\n message = response[\"errorMessage\"]\n if message.include?(\"timed out\")\n message = \"Task timed out after 4.00 seconds\"\n end\n return {error: true, error_message: message }\n end\n user_results = response[\"results\"]\n test_results = {log: response[\"log\"].gsub(\"\\n\", \"<br/>\"), results: {} }\n test_suite.each_with_index do |test, idx|\n result = user_results[idx]\n passed = result == test.output\n test_result = {\n passed: passed,\n expected: test.output.to_s,\n received: result.to_s\n }\n test_results[:results][test.order] = test_result\n end\n handle_completion(test_results[:results])\n test_results\n end", "def _test_numbers ; process_test_case(\"numbers\") ; end", "def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend", "def pytest_generate_tests(metafunc)\n if Set.new([test_rh_updates, test_rhsm_registration_check_repo_names]).include?(metafunc.function)\n return\n end\n # Generates tests specific to RHSM or SAT6 with proxy-on or off \n argnames = [\"reg_method\", \"reg_data\", \"proxy_url\", \"proxy_creds\"]\n argvalues = []\n idlist = []\n begin\n holder = metafunc.config.pluginmanager.get_plugin(\"appliance-holder\")\n stream = holder.held_appliance.version.stream()\n all_reg_data = conf.cfme_data.get(\"redhat_updates\", {})[\"streams\"][stream]\n rescue KeyError\n logger.warning(\"Could not find rhsm data for stream in yaml\")\n metafunc.parametrize(argnames, [pytest.param(nil, nil, nil, nil, marks: pytest.mark.skip(\"Could not find rhsm data for stream in yaml\"))])\n return\n end\n if metafunc.fixturenames.include?(\"reg_method\")\n for reg_method in REG_METHODS\n reg_data = all_reg_data.get(reg_method)\n if is_bool(!reg_data || !reg_data.get(\"test_registration\", false))\n next\n end\n proxy_data = conf.cfme_data.get(\"redhat_updates\", {}).get(\"http_proxy\", false)\n if is_bool(proxy_data && reg_data.get(\"use_http_proxy\", false))\n proxy_url = proxy_data[\"url\"]\n proxy_creds_key = proxy_data[\"credentials\"]\n proxy_creds = conf.credentials[proxy_creds_key]\n argval = [reg_method, reg_data, proxy_url, proxy_creds]\n argid = (\"{}-{}\").format(reg_method, \"proxy_on\")\n idlist.push(argid)\n argvalues.push(argval)\n end\n argval = [reg_method, reg_data, nil, nil]\n argid = (\"{}-{}\").format(reg_method, \"proxy_off\")\n idlist.push(argid)\n argvalues.push(argval)\n end\n return metafunc.parametrize(argnames, argvalues, ids: idlist, scope: \"function\")\n end\nend", "def initialize_with_test_runner\n initialize_without_test_runner\n\n @test_priorities = {}\n @test_filters = Hash.new { |h, k| h[k] = [] }\n end", "def test_all\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING NO-SERVICE TEST\"\n passed << one_test(@config['init_scenario'])\n # Stop testing if our initial test fails.\n unless passed.first == true\n @log.error \"Initial setup failed.. sleeping 60 seconds for debugging.\"\n sleep 60\n stop_vm() if @options[:vmm_enabled]\n return passed\n end\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING TESTS\"\n scenarios = get_scenarios\n test_counter = 0\n scenarios.each do |scenario|\n test_counter += 1\n @log.info \"Running test for #{scenario} - #{test_counter} of #{scenarios.size}\"\n passed << one_test(scenario)\n end\n stop_vm() if @config[:vmm_enabled]\n all_passed = passed.select{|p| p == false}.size == 0\n @log.info \"Number of tests run : #{passed.size}\"\n @log.info \"Result of ALL tests: Passed? #{all_passed}\"\n @results['test_stop'] = Time.now()\n @results['elapsed_time'] = @results['test_stop'] - @results['test_start']\n return all_passed\n end", "def tests(context = {})\n run_context(context)\n end", "def scenarios\n @@scenarios ||= (\n ss = []\n\n feature = feature_build(feature_a)\n examples = run_feature(feature, '/path/to/test1.feature')\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0])\n ss << TurnipFormatter::Resource::Scenario::Failure.new(examples[1])\n\n feature = feature_build(feature_b)\n examples = run_feature(feature, '/path/to/test2.feature')\n ss << TurnipFormatter::Resource::Scenario::Pending.new(examples[0])\n\n feature = feature_build(feature_c)\n examples = run_feature(feature, '/path/to/test3.feature')\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0])\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[1])\n\n ss\n )\n end", "def scenarios\n @@scenarios ||= (\n ss = []\n\n feature = feature_build(feature_a)\n examples = run_feature(feature, '/path/to/test1.feature')\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0])\n ss << TurnipFormatter::Resource::Scenario::Failure.new(examples[1])\n\n feature = feature_build(feature_b)\n examples = run_feature(feature, '/path/to/test2.feature')\n ss << TurnipFormatter::Resource::Scenario::Pending.new(examples[0])\n\n feature = feature_build(feature_c)\n examples = run_feature(feature, '/path/to/test3.feature')\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0])\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[1])\n\n ss\n )\n end", "def run_tests\n tests_passed = true\n %w(desktop mobile kc_dm).each do |profile|\n tests_passed &= execute_test(profile)\n end\n tests_passed\n end", "def pre_testdata\n RVTEST_DATA_BEGIN()\n TEST_DATA()\n RVTEST_DATA_END()\n end", "def running_test_case; end", "def configure_test_pack\n # Apply the required set of filters to the selected tests iteratively.\n @logger.debug('Applying test selection filters...')\n @test_filters.each_pair { |key, values| @test_names = @test_pack.filter_test_names(key, values, @test_names) }\n # Update the list of tests with implicit includes (due to dependencies).\n @logger.debug('Checking for dependencies...')\n implicit_includes = []\n @test_names.each { |test_name| implicit_includes << @test_pack.get_test_dependencies(test_name, true) }\n @test_names = [@test_names + implicit_includes].flatten.uniq\n # Validate if the list of selected tests are valid.\n validate_selected_tests\n # Configure the test pack with the new list of test names.\n super\n end", "def generate_cat3_tests(args = nil)\n opts = args ? @options.merge(args) : @options\n\n print \"Generating Cat III tests...\"\n\n tests = Measure.top_level.collect do |t|\n opts[:test_type] = t.type == \"ep\" ? \"CalculatedProductTest\" : \"InpatientProductTest\"\n opts[:measure_ids] = [t.hqmf_id]\n self.generate_test(opts)\n end\n\n puts \"done\"\n return tests\n end", "def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end", "def start_tests(files)\n end", "def get_tests(children)\n children.each_with_object({}) do |c, memo|\n memo[c.description] = {}\n memo[c.description]['groups'] = get_tests(c.children) unless c.children.empty?\n unless c.examples.empty?\n memo[c.description]['tests'] = c.examples.map { |e|\n e.description unless e.pending?\n }.compact\n end\n next if c.examples.empty?\n memo[c.description]['pending_tests'] = c.examples.map { |e|\n e.description if e.pending?\n }.compact\n end\nend", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def process_test_results(force: false, xunit_viewer: \"xunit-viewer\")\n process_test_results_xunit(force: force, xunit_viewer: xunit_viewer)\n end", "def self_test(switches)\n #Visual test to see if we loaded data correctly.\n switches.each do |s|\n pp s\n end\nend", "def test\n return\n # TODO\n # skips test framework, but we can probably just bastardize the options in the same way as with :skip_bundle\n # either make `test` build the actual directories etc., or use a script\n # either way, this method is stupid.\n end", "def test\n return\n # TODO\n # skips test framework, but we can probably just bastardize the options in the same way as with :skip_bundle\n # either make `test` build the actual directories etc., or use a script\n # either way, this method is stupid.\n end", "def process_specs\n source_path = configuration['specs']['source_path']\n destin_path = configuration['specs']['destin_path']\n ignored_paths = configuration['specs']['ignored_paths']\n ignored_methods = configuration['specs']['ignored_methods']\n\n find_files_without(source_path, ignored_paths).each do |path|\n next unless path.include?('/models/') || path.include?('/controllers/') || path.include?('/helpers/')\n @spec_template = indent_template(spec_template, 0)\n @spec_describe_template = spec_describe_template.gsub(' ' * 8, ' ' * 2).strip.prepend(' ' * 2)\n\n spath = path.split(\"./#{source_path}/\")[1]\n dpath = \"./#{destin_path}/#{spath}\".gsub('.rb', '_spec.rb')\n\n unless File.exists?(dpath)\n methods_names_source = extract_methods_names_from_file(path)\n specs_methods_to_string = methods_names_source.map do |method_name|\n @spec_describe_template.gsub('%{method_name}', method_name)\n end.join(\"\\n\\n\")\n\n @spec_template = @spec_template.gsub('%{class}', extract_spec_name(path))\n @spec_template = @spec_template.gsub('%{methods}', specs_methods_to_string)\n @spec_template = @spec_template.gsub('%{file_path}', path)\n @spec_template = @spec_template.gsub('%{class_type}', extract_spec_type(path))\n @spec_template = @spec_template.gsub('%{author_name}', extract_author_name)\n\n FileUtils.mkdir_p(File.dirname(dpath))\n File.new(dpath, 'w+').puts(@spec_template)\n end\n end\n end", "def _test_text ; process_test_case(\"text\") ; end", "def runTests(testDirPath)\n\n if IS_WINDOWS\n @tags ||= [\"~@wip\", \"~@sandbox\", \"~@not-windows\"]\n else\n @tags ||= [\"~@wip\", \"~@sandbox\"]\n end\n\n sh \"cucumber #{testDirPath} #{EXPAND} --tags #{@tags.join(' --tags ')} #{OTHER_TAGS} #{COLOR} --strict -f junit --out ./target -f pretty\" do |success, exit_code|\n if success\n $failures[testDirPath[testDirPath.rindex('/')+1..-1]] = \"Passed\"\n else\n $failures[testDirPath[testDirPath.rindex('/')+1..-1]] = \"Failed\"\n $SUCCESS=false\n raise \"Tests Failed\" unless (ENV['FAILSLOW'])\n end\n end\nend", "def testable\n require_parameters :resource\n\n resource=Project.by_key(params[:resource])\n not_found(\"Not found: #{params[:resource]}\") unless resource\n access_denied unless has_role?(:user, resource)\n\n testable = java_facade.testable(resource.key)\n json = {}\n if testable\n resource = testable.component\n json[:key] = resource.key\n json[:name] = resource.name if resource.name\n json[:longName] = resource.longName if resource.longName\n json[:coveredLines] = testable.testedLines\n\n json[:coverages] = testable.coverageBlocks.map do |coverage|\n test_case = coverage.testCase\n coverage_json = {}\n coverage_json[:lines] = coverage.lines\n coverage_json[:name] = test_case.name\n coverage_json[:status] = test_case.status.to_s if test_case.status\n coverage_json[:durationInMs] = test_case.durationInMs\n coverage_json[:testPlan] = test_case.testPlan.component.key\n\n coverage_json.delete_if { |k, v| v.nil? }\n coverage_json\n end\n\n end\n json.delete_if { |k, v| v.nil? }\n\n respond_to do |format|\n format.json { render :json => jsonp(json) }\n format.xml { render :xml => xml_not_supported }\n format.text { render :text => text_not_supported }\n end\n end", "def parse_tests(records, expected_result)\n comment = nil\n records.each do |test|\n if test[0].is_a?(Array)\n if test.size != 3 || !test[1].is_a?(String) || !test[2].is_a?(String)\n raise \"Bad test: #{test.inspect} (#{test.size} #{test[1].class} #{test[2].class})\"\n end\n mapprevOutScriptPubKeys = {} # Outpoint => Script\n inputs = test[0]\n inputs.each do |input|\n raise \"Bad test: input is not an array: #{test.inspect}\" if !input.is_a?(Array)\n raise \"Bad test: input is an array of 3 items: #{test.inspect}\" if input.size != 3\n previd, previndex, scriptstring = input\n \n outpoint = BTC::Outpoint.new(transaction_id: previd, index: previndex)\n \n mapprevOutScriptPubKeys[outpoint] = parse_script(scriptstring)\n end\n \n tx = BTC::Transaction.new(hex: test[1])\n flags = parse_flags(test[2])\n \n if debug_filter(test)\n validation_proc = lambda do\n validation_passed = BTC::Validation.new.check_transaction(tx, BTC::ValidationState.new)\n if expected_result\n validation_passed.must_equal expected_result\n end\n script_passed = false\n \n if validation_passed\n tx.inputs.each do |txin|\n output_script = mapprevOutScriptPubKeys[txin.outpoint]\n raise \"Bad test: output script not found: #{test.inspect}\" if !output_script\n sig_script = txin.signature_script\n if !sig_script\n sig_script = BTC::Script.new(data: txin.coinbase_data)\n end\n \n checker = BTC::TransactionSignatureChecker.new(transaction: tx, input_index: txin.index)\n extensions = []\n extensions << BTC::P2SHExtension.new if (flags & BTC::ScriptFlags::SCRIPT_VERIFY_P2SH) != 0\n extensions << BTC::CLTVExtension.new if (flags & BTC::ScriptFlags::SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY) != 0\n interpreter = BTC::ScriptInterpreter.new(\n flags: flags,\n extensions: extensions,\n signature_checker: checker,\n raise_on_failure: expected_result,\n )\n #Diagnostics.current.trace do\n script_passed = interpreter.verify_script(signature_script: sig_script, output_script: output_script)\n if !script_passed\n break\n end\n #end\n end\n end\n (script_passed && validation_passed).must_equal expected_result\n end # proc\n \n yield(comment || test.inspect, validation_proc)\n end # if not filtered\n \n comment = nil\n else\n comment ||= \"\"\n comment += test[0].gsub(/\\.$/,\"\") + \". \"\n comment.gsub!(/\\. $/, \"\")\n end\n end\n end", "def generate\n\t\tputs '####### Generation of TestClasses begins'\n\t\t@java_map.each { |key, value|\n\t\t\tif @java_map.has_key?(key +'Test') || key.end_with?('Test')\n\t\t\t\tputs key + ' already has a Test (Test will not be generated)'\n\t\t\telsif value.is_a? JavaClass\n\t\t\t\tif value.abstract\n\t\t\t\t\tputs key + ' is abstract (Test will not be generated)'\n\t\t\t\telse\n\t\t\t\t\tgenerate_test_class value\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend", "def my_tests\n end", "def test_replacements(tests, method, options = {})\n tests.each do |test|\n text = Ramparts.send(method, test[:text], options) do\n INSERTABLE\n end\n if text.casecmp(test[:filtered]) != 0\n raise \"Expected: #{test[:filtered]}\\nGot: #{text}\\nBlock '#{test[:filtered]}'\"\n end\n end\nend", "def test_classes\n if(@fiber && @input_classes.size == 0)\n @fiber.transfer [:error, \"Could not find any classes\"]\n end\n @input_classes.each do |c|\n if @regression_file.nil?\n single_class_test(c)\n else\n double_class_test(c,@regression_file)\n end\n end\n end", "def make_test_cmd multi = false # :nodoc:\n framework = SUPPORTED_TEST_FRAMEWORKS[testlib]\n raise \"unsupported test framework #{testlib}\" unless framework\n\n tests = [\"rubygems\", framework] +\n test_globs.map { |g| Dir.glob(g) }.flatten\n tests.map! {|f| %(require \"#{f}\")}\n\n cmd = \"#{Hoe::RUBY_FLAGS} -e '#{tests.join(\"; \")}' #{FILTER}\"\n\n if multi then\n ENV['EXCLUDED_VERSIONS'] = multiruby_skip.join \":\"\n cmd = \"-S multiruby #{cmd}\"\n end\n\n cmd\n end", "def create_files\n tests.each do |test|\n FileUtils.mkdir(test.id.to_s) unless Dir.exist?(test.id.to_s) if test.option[:dir]\n files = []\n files << test.action.split('?').first\n files += test.option[:implicit]\n files << test.result_rdf if test.result_rdf\n files << test.result_json if test.result_json\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end", "def testing\n yield @test if @test\n end", "def build_test\n \n return if skip_method(__method__)\n \n build_test_fixtures\n build_test_helper\n build_functional_test\n build_integration_test\n build_unit_test\n end", "def doTests( *tests )\n tests.find_all {|name,data|\n ! doTest(name)\n }\nend", "def tests(options = {:activated => true, :rspec => false})\n @options[:tests] = options\n end", "def get_test_cases()\n test_cases = []\n test_cases.push(\"\"\"\n X|X|O|O|X|X|*\n O|O|X|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|O\n O|O|X|X|O|X|X\n \"\"\")\n test_cases.push(\"\"\"\n X|X|O|O|X|X|*\n O|O|X|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|O\n O|O|X|X|O|X|X\n \"\"\")\n test_cases.push(\"\"\"\n X|X|X|O|X|O|*\n X|O|O|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|X\n O|O|X|X|O|X|X\n \"\"\"\n )\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n *|*|X|*|*|*|*\n *|O|X|*|*|*|X\n O|O|O|O|*|*|X\n O|O|X|X|X|O|X\n \"\"\")\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n O|X|*|*|*|*|*\n X|X|*|O|*|*|O\n O|X|*|O|*|*|X\n X|O|X|X|*|O|O\n X|O|O|X|*|O|X\n \"\"\")\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n X|*|*|*|*|*|*\n X|*|*|*|*|*|*\n X|*|O|O|O|O|*\n \"\"\")\n\n return test_cases\n\n end", "def run_specs(example_groups)\n @configuration.reporter.report(@world.example_count(example_groups)) do |reporter|\n @configuration.with_suite_hooks do\n with_context_hooks, without_context_hooks = example_groups.partition(&:any_context_hooks?)\n success = run_in_parallel(without_context_hooks, reporter)\n success &&= with_context_hooks.map { |g| g.run(reporter) }.all?\n success ? 0 : @configuration.failure_exit_code\n end\n end\n end", "def call(tests)\n Result::Test.new(\n output: '',\n passed: true,\n runtime: 0.0,\n tests: tests\n )\n end", "def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend", "def run\n @rspec_test_name = PATH_TO_RSPEC_SPEC_FOLDER + @rspec_test_name\n unless File.exists?(\"#{@rspec_test_name}\")\n @@failed_tests.push(\"Test not exists: #{@rspec_test_name}\")\n @@failed_tests_counter +=1\n return 1\n end\n @cmd = `rspec #{@rspec_test_name}`\n describe_test(@rspec_test_name, @cmd, $?.exitstatus)\n generate_and_expand_output\n end", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def parse_respec_tests_list(str, opts)\n str = str.strip\n if RESPECTESTS_ANNOTATIONS.include?(str)\n opts['class'] = \"#{str}\"\n else\n opts['data-tests'] = \"#{str}\"\n end\n end", "def investigate\n puts \"\\nRequesting JSON from #{url} and testing\"\n tests.each_pair do |test, block|\n print \" - #{test}\\n\"\n check test, block\n end\n summary\n exit_status\n end", "def fetch_scenarios\n scenarios = []\n text = file_raw\n while match = FeatureElement::Scenario::PATTERN.match(text)\n FeatureElement::Scenario.new(self, match[0]).tap do |scenario|\n# scenarios.push(scenario) if cfm.filter.pass?(scenario.tags)\n scenarios.push(scenario)\n end\n text = match.post_match\n end\n scenarios\n end", "def run_app_tests\n end", "def test_case; end", "def tests\n @test_definitions.collect do |test_definition|\n Test.new(self, test_definition)\n end\n end", "def tests\n @test_definitions.collect do |test_definition|\n Test.new(self, test_definition)\n end\n end", "def tests\n execution_variables['tests']\n end", "def test(argv = ARGV)\n if spec_file?(argv) && defined?(RSpec)\n # disable autorun in case the user left it in spec_helper.rb\n RSpec::Core::Runner.disable_autorun!\n exit RSpec::Core::Runner.run(argv)\n else\n Zeus::M.run(argv)\n end\n end", "def all_tests\n example_group_index.keys.each_with_object([]) do |full_description, aggregate|\n expression = Expression.try_parse(full_description) or next\n\n aggregate << Test.new(self, expression)\n end\n end", "def all_tests\n where(opcode: %w(Test characterize), exact: true)\n end", "def setup_test_files\n project.test_sources.each do |src|\n compile_task objectsify(src), src\n end\n end", "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend" ]
[ "0.64630777", "0.6173405", "0.59937876", "0.59777164", "0.58224833", "0.5764137", "0.5728051", "0.57245797", "0.57183367", "0.5688263", "0.5656706", "0.5611224", "0.56076324", "0.55968714", "0.5587575", "0.55847114", "0.55438536", "0.5542112", "0.5476488", "0.54625565", "0.5459591", "0.5452307", "0.54454577", "0.54397845", "0.5427003", "0.5410771", "0.54095393", "0.5400035", "0.5400035", "0.53582144", "0.535043", "0.53501594", "0.5348418", "0.53446853", "0.531047", "0.52881116", "0.52782416", "0.52739", "0.5273669", "0.5256668", "0.5256579", "0.5256473", "0.5249616", "0.52447534", "0.52386963", "0.52380556", "0.52294445", "0.5220364", "0.51760054", "0.5167996", "0.5165624", "0.5156258", "0.5156258", "0.5147815", "0.51474476", "0.51436174", "0.51358205", "0.5135206", "0.5120097", "0.5117458", "0.51149577", "0.51142466", "0.5111547", "0.5078682", "0.5077926", "0.5077926", "0.5072445", "0.50632536", "0.50630206", "0.5059863", "0.5055228", "0.5043532", "0.5036761", "0.50349474", "0.50267166", "0.5014728", "0.49931288", "0.49894935", "0.49889615", "0.49794483", "0.49755073", "0.49725303", "0.49715292", "0.4968656", "0.49654654", "0.49625126", "0.4947235", "0.4946139", "0.49370435", "0.49332482", "0.4929243", "0.4928434", "0.49236372", "0.49125656", "0.49125656", "0.49125275", "0.49083215", "0.4908271", "0.49055782", "0.49044824", "0.4900272" ]
0.0
-1
Examples: got_three? [1, 2, 2, 2, 3] => true got_three? ['a', 'a', 'b'] => false got_three? ['a', 'a', 'a'] => true got_three? [1, 2, 1, 1] => false
def got_three? nums nums.select.with_index {|n,i| n if nums[i] == nums[i+1] && nums[i] == nums[i+2]}.size > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def got_three?(array)\n\tarray.each_with_index do |item, i|\n\t\tnext_item = array[i+1]\n\t\tnext_next_item = array[i+2]\n\t\treturn true if item == next_item && item == next_next_item\n\tend\n\tfalse\nend", "def got_three?(array)\n\tarray.each_cons 3 do |x, y, z|\n\t\treturn true if x == y && y == z\n\tend\n\treturn false\nend", "def got_three? array\n\tarray.each_cons(3){ |x| return true if x.all?{|y| y==x[0]} }\n\tfalse\nend", "def got_three? array\n\tarray.each.with_index{|x,i| return true if (x == array[i+1] && x == array[i+2])}\n\treturn false\nend", "def got_three?(array_list)\n a=nil \n for i in array_list\n if array_list.join.include?(\"#{i.to_s*3}\")\n a=true \n break \n else \n a=false \n end \n end \n a\nend", "def got_three?(arr)\n batches = []\n arr.each_cons(3) {|a, b, c| batches << [a, b, c]}\n r = 0\n batches.each do |batch|\n if batch.uniq.length == 1\n r += 1; break\n end\n end\n if r > 0\n true\n else\n false\n end\nend", "def got_three?(array)\n\noutcome =false\ni = 0\n\tuntil i == array.length\n\t\toutcome = true if array[i] == array[i + 1] && array[i + 1] == array[i + 2]\n\t\ti += 1\n\tend\n\treturn outcome\nend", "def got_three?(elements)\n elements.each_cons 3 do |a, b, c|\n if a == b && b == c \t\n \t return true\n end \n end \n \treturn false\nend", "def got_three? (arr)\n\tcount = 0\n \tlast = arr.first\n \tarr.each do |d|\n \tif d==last\n \t\tcount += 1\n \t\treturn true if count==3\n \telse\n \t\tlast = d\n \t\tcount = 1\n \tend\n \tend\n \tfalse\nend", "def got_three?(array)\n\tanswer = false\n\tcounter = 0\n\n\twhile counter <= array.length - 1 do \t\t\t\t\t\t\t\t\t\t\n\n\t\tarray.each do |element|\n\t\t\t# element 1\n\t\t\t# counter 1 \n\t\t\tif element == array[counter + 1] && element == array[counter+2]\n\t\t\t\treturn true\n\t\t\tend\n\t\tcounter += 1\n\t\tend\t\n\n\n\tend\t\n\tanswer\nend", "def got_three(array)\n array.each_with_index do |item, index|\n return true if item == array[index+1] && item == array[index+2]\n end\n false\nend", "def got_three?(arr)\n !!(arr.map(&:to_s).join =~ /(.)\\1\\1/)\nend", "def got_three? array\n three = false\n array.each_cons(3) do |a, b, c|\n three = true if (a == b && a == c)\n end\n three\nend", "def got_three?(numbers)\n numbers.each_cons(3) do |a, b, c|\n if a == b && b == c\n return true\n end\n return false\n end\nend", "def got_three?(array)\n\tnew_arr = []\n\tarray.each_with_index { |e,i| (array[i] == array[i+1] && array[i+1] == array[i+2]) ? new_arr << 'yes' : new_arr << 'no' }\n\tnew_arr.include?('yes') ? true : false\nend", "def got_three?(array) # def got_three?(elements)\n array.each_cons 3 do |a, b, c| # elements.each_cons 3 do |a, b, c|\n if a == b && b == c # return true if a == b && b == c\n return true # end\n else # false\n false # end\n end\n end\nend", "def got_three?(array)\n comp = ''\n num = 0\narray.each do |value|\n if value == comp && num == 1\n return true\n elsif value == comp\n num = 1\n else\n comp = value\n num = 0\n end\nend\n false\nend", "def got_three?(array)\n r = []\n r_2 = []\n array.each_cons(2) { |a, b| r << [a, b] }\n r.each_cons (2) {|e1, e2| r_2 << (e1 == e2)}\n r_2.include? true\nend", "def got_three?(ary)\n ans = false\n for i in 0..(ary.size - 3) do\n if ary[i] == ary[i + 1] && ary[i] == ary[i + 2]\n ans = true\n end\n end\n ans\nend", "def got_three?(elements)\n elements.each_cons 3 do |a, b, c| # iterates the given block for each array of consecutive <n> elements.\n return true if a == b && b == c # return true when the condition is true (note this happens is inside the iterator)\n end\n false # else return false\nend", "def got_three?(el)\n count = 0\n \n while count < el.length \n char = el[count]\n num = 0\n el.each {|x| num +=1 if x == char}\n if num >= 3\n three = true\n char2 = char\n end\n count +=1\n \n end\n if three == true\n el.each_cons 3 do |a, b, c|\n if a == b && b == c\n return true\n end\n end\n end\n false\n end", "def got_three?(array)\n counter = 0\n array.each_index do |i|\n if array[i+1] && array[i] == array[i+1]\n counter +=1\n return true if counter == 2\n else\n counter = 0\n end\n end\n false\nend", "def got_three? (arr)\n thrice = false\n arr.each_with_index {|x,i| thrice=true if arr[i]==arr[i+1]&&arr[i+1]==arr[i+2]}\n thrice\n end", "def got_three?(array)\n\tcontrol_point = false\n\tfor i in 0..array.length-3\n\t\tif array[i] == array[i+1] && array[i] == array[i+2]\n\t\t\tcontrol_point = true\n\t\tend\n\tend\n\tcontrol_point\nend", "def got_three? a\n b = a.uniq.sort\n arr = []\n x = 0\n while x < b.count\n c = (b[x].to_s + ' ') * 2 + b[x].to_s\n arr << (a.join(\" \").include? c) \n x = x + 1\n end\n arr.include? true\nend", "def got_three?(input)\n input.each_with_index do |x, i|\n if i >= 2 && x == input[i-1] && x == input[i-2]\n return true\n end\n end\n false\nend", "def got_three? (array)\n arr=[]\n(1..array.length-2).each{|x| arr.push(true) if array[x-1]== array[x] && array[x+1]== array[x] }\narr.include?(true)\nend", "def got_three?(arr)\n count = 0 # This is a counter that looks for consecutive instances of an element\n i = 3 # This the number of consecutive instanes we're looking for (three in a row)\n previous = arr.first # Start the counter from the first array element\n arr.each do |n| \n if n == previous # If the current element is the same as the last element,\n count += 1 # then add to the counter\n return true if count == i # If the counter reaches 3, then return true\n else\n previous = n # Otherwise reset the counter to 1\n count = 1\n end\n end\n false\nend", "def three_set?\n collected_dice = @dice_cup.group_by { |i| i }\n\n collected_dice.each_value do |v|\n if v.length >= 3\n return true\n end\n end\n\n false # No sets of three... :-(\n end", "def has_multiple_of_three?(numbers)\n numbers.any?{ |element| element % 3 == 0 }\nend", "def got_three?(input)\n result = false\n input.each_index do |i|\n result = input[i] == input[i + 1] && input[i + 1] == input[i + 2]\n break if result\n end\n result\nend", "def got_three?(array)\n three_in_a_row = false\n elems_limit = array.size - 3\n return three_in_a_row if elems_limit < 0\n for index in 0..elems_limit\n three_in_a_row = ( (array[index] == array[index+1]) && (array[index] == array[index+2]) )\n break if three_in_a_row\n end\n three_in_a_row\nend", "def threed(list)\n i = 0\n count_3 = 0\n while i < (list.size)\n if list[i] == 3 && list[i + 1] == 3\n return false\n end\n \n if list[i] == 3\n count_3 += 1\n end\n\n if count_3 > 3\n return false\n end\n i += 1\n end\n\n if count_3 == 3\n return true\n else \n return false\n end\nend", "def threed(list)\n num3 = 0\n\n (list.length).times do |i|\n\n if i < list.length\n if list[i] == 3\n num3 += 1\n end\n if list[i] == 3 && list[i+1] == 3\n return false\n end\n elsif i + 1 == list.length\n i += 1\n if list[i] == 3 \n num3 += 1\n end\n if list[i] ==3 && list[i-1] == 3\n return false\n end\n end\n\n end\n if num3 != 3\n return false\n else\n return true\n end\nend", "def three_of_a_kind?\n repeat_counts.include? 3\n end", "def threed(list)\n count3 = 0 \n next_to = 0\n list.each do |n|\n if n == 3\n count3 += 1\n end \n end \n (list.size-1).times do |n|\n if list[n] == list[n+1]\n return false\n end \n end\n if count3 == 3\n return true\n elsif count3 > 3 || count3 < 3 \n return false\n end \nend", "def got_three chunks\n\nchunks.sort.chunk{ |e| e }.select { |e, chunk| chunk.size == 3 }.map.any?\n\nend", "def got_three?(string)\n threeinarow = false\n string.each_with_index do |thing, index|\n if string[index] == thing && string[index+1] == thing && string[index+2] == thing\n threeinarow = true\n end\n end\n return threeinarow\n\nend", "def got_three? array\n\n array.each_with_object(Hash.new(0)) do |word,counts|\n counts[word] += 1\n return true if counts[word] >= 3\n\n end\n\nend", "def by_three?(number)\n if number%3 == 0\n return true\n else\n return false\n end\nend", "def by_three?(n)\n return n % 3 == 0\nend", "def by_three?(number)\n if number % 3 == 0\n return true\n else\n return false\n end\nend", "def array_test\n @words.each_with_index do |word, i|\n # binding.pry\n seq = \"#{word} #{@words[i+1]} #{@words[i+2]}\"\n if @three_word_sequences.include? seq\n return true\n end\n end\n return false\n end", "def check_three(array)\n one = array[0]\n two = array[1]\n three = array[2]\n if bk_quotes(one) || bk_parens(one) || check_bk(one) || fr_parens(two) || fr_quotes(two)\n array.clear\n elsif bk_quotes(two) || bk_parens(two) || check_bk(two) || fr_parens(three) || fr_quotes(three)\n array.clear\n end\n end", "def got_three?(a) #no idea why thisis not working #wasn't calling the method got_three?\n #iterating over each index and using the .any? method (which returns true as long as the block is not false or nil)\n #so when a[index 1] is the same as index 2 AND index 3, the block is true and the any? method returns true.\n #if not it will return false.\n a.each_index.any? {|i| a[i] == a[i+1] && a[i+1] == a[i+2]}\nend", "def unique_three(string)\n sorted_string = string.split('').sort\n\n sorted_string.each_with_index do |val, idx|\n if idx == sorted_string.length - 1\n return true\n elsif val == sorted_string[idx + 1]\n return false\n end\n end\nend", "def three_of_a_kind?\n cards_by_rank.values.first.count >= 3\n end", "def three_pairs?(dice)\n get_by_number(dice).values == [2, 2, 2]\n end", "def by_three?(x)\n if x % 3 == 0 \n return true\n else \n return false \n end\nend", "def check_three_and_two(arr)\n answer = Hash.new\n arr.each { |x| answer[x] = arr.count(x)}\n if answer.keys.count == 2 && (answer.values.include?(2) && answer.values.include?(3))\n p true\n else\n p false\n end\nend", "def got_three?(array)\n returned = false\n array.each_cons(3) { |new|\n if new.max == new.min \n returned = true\n end\n }\nreturned\nend", "def three_of_a_kind?\n # Go over all the cards and see if we have three of them \n # However, we have to skip any wildcards, since they're always the same\n givens = self.all_not_wild\n return true unless givens.size > 0\n # If all cards are wild, it's also a three of a kind \n for given in givens do \n same = find_same_rank(given)\n # >= because a four of a kind is also a three of a kind\n return true if same.size >= 3\n end\n return false\n end", "def three_of_a_kind?\n n_of_a_kind? 3\n end", "def three_even?(list) # Return true if list has 3 even values next to each other\n (list.size - 2).times do |index|\n if list[index] % 2 == 0 && list[index+1] % 2 == 0 && list[index+2] % 2 == 0\n return true\n end\n end\n return false\nend", "def three_even?(list)\n count = 0\n (list.size-2).times do |i| \n if(list[i]%2 == 0 && list[i+1]%2 == 0 && list[i+2]%2 == 0) #I checked three values at once to minimize the errors that could occur when using a method that checks one value at a time \n return true\n end\n end\n return false\nend", "def multiple?\r\n not single?\r\n end", "def several?\n several = (count > 1) if several.nil?\n end", "def is_three_of_a_kind( hand )\n\tkind = check_kind( 3, hand )\n\treturn 0 != kind.length ? kind : [ 0 ]\nend", "def winner?\n (self.array & [\"a1\",\"a2\",\"a3\"]).length == 3 || (self.array & [\"b1\",\"b2\",\"b3\"]).length == 3 || (self.array & [\"c1\",\"c2\",\"c3\"]).length == 3 || (self.array & [\"a1\",\"b1\",\"c1\"]).length == 3 || (self.array & [\"a2\",\"b2\",\"c2\"]).length == 3 || (self.array & [\"a3\",\"b3\",\"c3\"]).length == 3 || (self.array & [\"a1\",\"b2\",\"c3\"]).length == 3 || (self.array & [\"c1\",\"b2\",\"a3\"]).length == 3\n end", "def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tgroupMaker(array).any? {|x| x.class != Array} ? false : true\nend", "def single_number(nums)\n nums.sort.uniq.each do |i|\n if appears_three?(nums.sort, i)\n return i\n end\nend\nreturn -1\nend", "def three_numbers(str)\n digits = str.split.map { |word| word.scan(/\\d+/).sort_by(&:size) }\n digits.each do |set|\n if set.size == 2 && set.first.size == 1 && set.last.size == 2\n set[1], set[2] = set.last[0], set.last[1]\n end\n set.map!(&:to_i).uniq!\n return false unless set.size == 3\n end\n true\nend", "def any_three?\n results=[]\n [@hand1Values, @hand2Values].each do |handV|\n freqHash = Hash.new(0) \n handV.each { |h| freqHash [h] += 1}\n results << freqHash.values.any? { |freq| freq >= 3}\n end\n\n results\n end", "def found_multiple?\n @flags.size > 1\n end", "def three_in_a_row?\n\t\tthree_in_a_row = false\n\t\toccurrences = 0\n\t\tboard = @board.board\n\t\tboard.each do |row|\n\t\t\tif (current_letter = row[0]) != \"_\"\n\t\t\t\trow.each do |element|\n\t\t\t\t\tif element == current_letter\n\t\t\t\t\t\toccurrences += 1\n\t\t\t\t\telse\n\t\t\t\t\t\toccurrences = 0\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tnext\n\t\t\tend\n\t\t\tif occurrences == 3\n\t\t\t\treturn [true, current_letter]\n\t\t\tend\n\t\tend\n\t\t[three_in_a_row]\n\tend", "def three_vowels?\n vowels = %w[a e i o u]\n vowel_count = 0\n split('').each do |l|\n vowel_count += 1 if vowels.include?(l)\n return true if vowel_count >= 3\n end\n\n false\n end", "def accept_multiple_sets?\n return true\n end", "def divisible_by_three(number)\n if number % 3 == 0 \n return true\n else \n return false \n end\nend", "def same_or_dif? card_arr\n card_arr.uniq.size != 2\nend", "def is_magic_three(array)\n # Your code goes here\n if array == [0]\n true\n else\n sumas = array.combination(3).to_a.collect { |item| item.inject(0, :+) }\n\n puts sumas\n check = sumas.collect { |item| true if item == 0 }\n puts check\n check.include? true\n end\nend", "def three_even?(list)\n (list.size-2).times do |n| #changed list.each to list.size-2 to grab three numbers in the code \n if list[n]%2==0 && list[n+1]%2==0 && list[n+1]%2==0 #this checks if the three number next to each other are even\n return true\n end \n end \n return false #if the program doesn't return true by the time it reaches this line of code, a false is returned\nend", "def can_be_divided_by_three(number)\n is_divisible_by_3 = number % 3\n is_divisible_by_3 == 0\nend", "def divisible_by_three?(number)\n number % 3 == 0\nend", "def three_of_a_kind(hand)\n\t\thand_num = check_num(hand)\n\t\ti = 0\n\t\twhile i < hand_num.size\n\t\t\tif hand_num.count(hand_num[i]) == 3\n\t\t\t\treturn 3\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\t\treturn 0\n\tend", "def all_different?\n a = self.to_a.drop(1)\n self.each do |e|\n return false if a.include?(e)\n a.shift\n end\n return true\n end", "def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tabg_maker(array).any? {|x| x.class != Array} ? false : true\nend", "def three_in_row(array)\n for i in (0...array.length)\n if array[i]==array[i+1] && array[i]== array[i+2]\n return true\n end\n end\n return false\nend", "def divisible_by_three(num)\n num%3 == 0 ? true : false\nend", "def three_in_a_row(token, board)\n board.each do |thash|\n if thash.values.all? { |value| value == token}\n return true # returns true (won game) if seen once\n end\n end\n return false # return false if not three in a row yet\nend", "def is_divisible_by_three?(number)\n return true if number % 3 == 0\nend", "def mult_of_three_nums(arr)\n arr.combination(3).to_a.each do |subarr|\n return true if subarr.reduce(:*) == arr.max\n end\n false\nend", "def check_for_inconsistency(elements)\n elements.any?{|e| e != elements.first}\n end", "def is_triangle(side1,side2,side3)\n sides = [side1,side2,side3]\n unique_sides = sides.uniq.length\n raise TriangleError if triangle_error_found?(sides)\n type_of_triangle(unique_sides)\nend", "def valid_triangle?(s1, s2, s3)\n triangle = [s1,s2,s3]\n triangle.sort!\n triangle[2] < triangle[0] + triangle[1] ? true : false\nend", "def isTriangle(a,b,c)\n # your code\n a, b, c = [a, b, c].sort\n if a + b > c\n true\n else \n false\n end\nend", "def multiple?; end", "def has_divisible_with_inject arr\n arr.inject(false) do |has, num|\n has || num%3 == 0\n end\nend", "def multiple?(type)\n (type.is_a?(Array) || type.is_a?(Set)) && type.size > 1\n end", "def repeats_twice?(arr)\n\nend", "def areSimilar(a, b)\n count = 0\n \n for i in 0..(a.count-1)\n if a[i] != b[i]\n count += 1\n end\n end\n \n if count < 3\n if a.sort == b.sort\n return true\n end\n end\n \n false\nend", "def three_in_a_column?\n\t\tboard = @board.board\n\t\tthree_in_a_column = false\n\t\toccurrences = 0\n\t\t3.times do |column|\n\t\t\tif (current_letter = board[0][column]) != \"_\"\n\t\t\t\t3.times do |row|\n\t\t\t\t\tif board[row][column] == current_letter\n\t\t\t\t\t\toccurrences += 1\n\t\t\t\t\telse\n\t\t\t\t\t\toccurrences = 0\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tnext\n\t\t\tend\n\t\t\tif occurrences == 3\n\t\t\t\treturn [true, current_letter]\n\t\t\tend\n\t\tend\n\t\t[three_in_a_column]\n\tend", "def mult_of_three_nums(array)\n max_num = array.max\n array.each do |x|\n array.each do |y|\n array.each do |z|\n return true if (x * y * z) == max_num\n end\n end\n end\n false\nend", "def mult_of_three_nums(arr)\n max_num = arr.max\n\n arr.each_with_index do |num, idx|\n arr.each_with_index do |num2, idx2|\n next if idx2 == idx\n arr.each_with_index do |num3, idx3|\n next if idx3 == idx2 || idx3 == idx\n return true if (num * num2 * num3) == max_num\n end\n end\n end\n false\nend", "def mult_of_three_nums(arr)\n max_num = arr.max\n\n arr.each_with_index do |num, idx|\n arr.each_with_index do |num2, idx2|\n next if idx2 == idx\n arr.each_with_index do |num3, idx3|\n next if idx3 == idx2 || idx3 == idx\n return true if (num * num2 * num3) == max_num\n end\n end\n end\n false\nend", "def mult_of_three_nums(arr)\n subarr = []\n max = arr.max\n 0.upto(arr.length - 3) do |first_num|\n 1.upto(arr.length - 2) do |second_num|\n 2.upto(arr.length - 1) do |third_num|\n return true if ((arr[first_num] * arr[second_num] * arr[third_num] == max) && (third_num > second_num) && (second_num > first_num))\n end\n end\n end\n return false\nend", "def three_identical_markers?(squares)\n markers = squares.select(&:marked?).collect(&:marker)\n return false if markers.size != 3\n markers.min == markers.max\n end", "def ice_cream_shop(arr, favorite)\n\n return false if arr.length == 0 \n\n if favorite == arr.pop \n return true\n else\n ice_cream_shop(arr, favorite)\n end\nend", "def third_anagram?(str, target)\n str.split(\"\").sort == target.split(\"\").sort\nend", "def mod_three(numbers)\n numbers.map { |number| number % 3 }.select { |number| number % 3 != 0 }\nend", "def is_isosceles?\n return @length_one == @length_two || @length_one == @length_three ||\n @length_two == @length_three\n end" ]
[ "0.767272", "0.75537056", "0.74402785", "0.7432608", "0.74202883", "0.73590654", "0.7332149", "0.7306207", "0.7295782", "0.72500783", "0.70646054", "0.7059264", "0.70497346", "0.7029385", "0.7026653", "0.7019442", "0.70008224", "0.6906877", "0.6895376", "0.68645", "0.68620276", "0.68341166", "0.6829112", "0.6810792", "0.67633444", "0.6754265", "0.66501623", "0.66441214", "0.6642862", "0.66347045", "0.6594294", "0.64854014", "0.646621", "0.6448304", "0.64112073", "0.6410928", "0.6395558", "0.6340925", "0.63230455", "0.6245476", "0.62225556", "0.62211615", "0.6200413", "0.6193556", "0.618865", "0.6184275", "0.61477625", "0.61406463", "0.61313176", "0.61252064", "0.6108019", "0.6075828", "0.6039639", "0.59613407", "0.5899346", "0.5879497", "0.5859077", "0.58582944", "0.584987", "0.5845087", "0.58198464", "0.5811261", "0.5807235", "0.5791676", "0.5766333", "0.57357234", "0.5716951", "0.57048935", "0.5675122", "0.5674108", "0.5671468", "0.5669999", "0.5660165", "0.56526595", "0.56388974", "0.5638194", "0.5628428", "0.56227374", "0.5600392", "0.55928844", "0.55849445", "0.5579298", "0.5571254", "0.5558502", "0.55576783", "0.55517423", "0.55355275", "0.55149573", "0.55128974", "0.5507692", "0.5505094", "0.5500791", "0.54963964", "0.54963964", "0.54781", "0.54770386", "0.5476961", "0.54702705", "0.5461253", "0.5457953" ]
0.64015144
36
created method copied from orders controllers
def create product_id = params [:product_id] product = Product.find_by(id: product_id) quantity = params[:quantity] carted_products = CartedProduct.create( :user_id current_user.id, :product_id params[:product_id], :quantity params [:quantity], :status "carted" ) flash [:success] = "Product added to cart" redirect_to "/" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @order = current_order\n @order_items = current_order.order_items\n @products = current_order.products\n end", "def index\n @order = Order.all\n @order_item = current_order.order_items.new\n end", "def get_orders\n orders\n end", "def orders\r\n @orders ||= OrdersController.new(configuration: @configuration)\r\n end", "def set_order\n \tcustomer = Customer.find(params[:customer_id])\n \t@order = customer.orders.find(params[:id])\n\n \t#*TEST- Currently using Fictious customer 5 as a test\n \t# @order = Order.find(params[:id])\n\n\n # @order = Order.find(params[:id])\n # respond_with (@orders)\n\n\n end", "def index\n @orders = Order.all\n #Для подстановки нужны следующие переменные\n @clients=Client.all\n @deliveries=Delivery.all\n @employees=Employee.all\n @ordereds=Ordered.all\n end", "def index # class method\n @orders = Order.all\n end", "def index # class method\n @orders = Order.all\n end", "def index \n @orders = Order.all \n end", "def index\n @orders = order.all\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def index\n @orders = Order.all\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def index\n @catalog_items = CatalogItem.all\n\n order_items = []\n @catalog_items.each do |catalog_item|\n order_items << OrderItem.new(\n catalog_item: catalog_item,\n quantity: 0,\n unit_price: catalog_item.price\n )\n\n end\n\n\n @order = Order.new(\n order_items: order_items\n )\n end", "def bought_orders\n @orders = current_user.bought_orders\n\n end", "def bought_orders\n @orders = current_user.bought_orders\n\n end", "def index\n #here we find all orders in the orders table and add to the @orders variable.\n @orders = Order.all\n end", "def index\n authorize Order\n @orders = Order.where(user_id: current_user.id)\n @order_details = Array.new\n @orders.each do |order|\n @total_amount, @total_discount, @discounts = calculate_total_amount(order.order_items)\n @order_details[order.id] = {\n total_amount: @total_amount,\n total_discount: @total_discount,\n discounts: @discounts\n }\n end\n end", "def after_save_new_order\n end", "def index\n @orders = Order::Preorder.all\n end", "def index\n # Find all unarchived orders for the store which are ready for showing in admin (i.e. have gone to checkout)\n @orders = Breeze::Commerce::Order.unarchived.includes(:line_items).find_all{ |o| o.show_in_admin? }\n # # @filters = Breeze::Commerce::Order::FILTERS\n # # if params[:show] && @filters.collect{|f| f[:scope]}.include?(params[:show])\n # # @orders = @orders.send(params[:show])\n # # end \n @orders = @orders.to_a.sort_by{ |o| params[:sort] ? o.send(params[:sort]) : - o.created_at.to_i }.paginate(:page => params[:page], :per_page => 15)\n\n @billing_statuses = Breeze::Commerce::OrderStatus.billing.order_by(:sort_order.asc) # DRY up this repeated code\n @shipping_statuses = Breeze::Commerce::OrderStatus.shipping.order_by(:sort_order.asc)\n end", "def index\n @info_dispatch_orders = InfoDispatchOrder.all\n end", "def show\n\t\trespond_with @order\n\tend", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def find_order\n @order = Order.find(params[:id])\n end", "def orders\n @title = t('views.account.title.page_orders')\n @page = :order\n render :index\n end", "def index\n @cart = current_cart\n @orders = Order.where(cart_id: @cart.id)\n @order=@orders.first\n end", "def index\n \t@orders = Order.order('id desc')\n \t#since line items belong to orders, we don't have to do anything to specify line items\n end", "def index\n @orders = Order.where(:customer_id => params[:customer_id])\n @order = @orders.first \n end", "def index\n if params[:company_id]\n @company = Company.find(params[:company_id])\n @orders = @company.orders\n @account_managers = @current_agency.account_managers if @current_agency.present?\n @order = @company.orders.new if @company.present?\n \n else\n # @orders = @current_company.orders.active.order(created_at: :desc) if @current_company.present?\n @orders = @current_agency.orders.active.order(created_at: :desc) if @current_agency.present?\n end\n \n \n authorize @orders\n\n end", "def set_order\n @order = Order.find(params[:id])\n #Также нужны переменные\n @client=Client.find(@order.client_id)\n @delivery=Delivery.find(@order.delivery_id)\n @employee=Employee.find(@order.employee_id)\n @ordered=Ordered.where(\"order_id=?\",@order.id)\n end", "def my_order\n @orders = Order.where(user: current_user)\n end", "def index\n\n if current_user.status==User.STATUS_SHOPPER\n @orders=current_user.orders.order(\"created_at DESC\").all\n else\n @orders=Order.order(\"created_at DESC\").all\n end\n\n end", "def index\n @customers = Customer.where(order_id: params[:order_id])\n @order = Order.find(params[:order_id])\n end", "def index\n @product_in_orders = ProductInOrder.all\n end", "def create\n @order = Order.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n @order.save_referer(session[:referer])\n\n respond_to do |format|\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n session[:referer] = nil\n Notifier.order_received(@order).deliver\n\n\n #if @order.line_items.find_all { |line_item| line_item.product.category.dealers_only == true }.size != 0\n # Notifier.order_dealer_send(@order).deliver\n #else\n # Notifier.order_send(@order).deliver\n #end\n\n Notifier.order_send(@order).deliver\n\n format.html { redirect_to('/content/happy', :notice => 'Пасибки за заказ') }\n format.xml { render :xml => @order, :status => :created,\n :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def index\n @orders = current_user.orders\n end", "def index\n @orders = current_user.orders\n end", "def index\n @orders = Order.user_orders current_user\n end", "def index\n authorize Order\n super\n end", "def manage\n authorize Order\n @orders = Order.all\n @order_details = Array.new\n @orders.each do |order|\n @total_amount, @total_discount, @discounts = calculate_total_amount(order.order_items)\n @order_details[order.id] = {\n total_amount: @total_amount,\n total_discount: @total_discount,\n discounts: @discounts\n }\n end\n end", "def index\n @productorders = Productorder.all\n end", "def create\n @order = Order.new(order_params)\n @order.products_inorder << @products\n @order.user = @products.first.user\n\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to_relative_path('inorder') and return }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render template: \"/admin/products/inorder/action\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def show_orders\n @promotion = Promotion.find(params[:id])\n @title = t(:orders_for) + \" \" + @promotion.code\n @orders = Order.paginate(\n :order => 'created_on DESC',\n :conditions => [\"promotion_id = ?\", @promotion.id],\n :page => params[:page],\n :per_page => 30\n )\n end", "def index\n @orderproducts = Orderproduct.where(product_id: params[:product_id])\n @orders = []\n @orderproducts.each do |orderproduct|\n order = Order.find_by(id: orderproduct.order_id)\n @orders << order\n end\n end", "def create\n @order = Order.new(order_params)\n @cart.line_items.each do |i|\n qty = i.quantity\n product = Product.find(i.product_id)\n product.quantity_update(product, qty)\n end\n @order.add_line_items_from_cart(@cart)\n if user_signed_in?\n @order.user_id = current_user.id\n end\n \n respond_to do |format|\n \n # Dynamically update Products quantity (same as in ProdController)\n # dynamically_update_products\n \n if @order.save && @order.pay_type == \"Karta kredytowa\"\n format.html { redirect_to new_charge_url }\n format.json { render :show, status: :created, location: @order }\n elsif @order.save && @order.pay_type != \"Karta kredytowa\"\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n OrderMailer.received(@order).deliver_later\n format.html { redirect_to store_index_url,\n notice: 'Zamówienie zostało złożone.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.line_items.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # Set default status to new order\n @order = Order.new(order_params.merge({\"status\" => \"Ordering\"}))\n\n # Check duplicate of order from product\n @order_check = Order.where(product: @order.product, brand: @order.brand).count(:id)\n\n # Update history after request new order\n @history = History.new({\"order_code\" => SecureRandom.hex, \"brand\" => @order.brand, \"product\" => @order.product, \"amount\" => @order.amount})\n\n @history.save\n\n respond_to do |format|\n\n # Order duplication check\n if @order_check == 0\n\n # Set notice after order save action\n if @order.save\n format.html { redirect_to orders_path, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n else\n # Select exist order to update amount\n @order_update = Order.where(product: @order.product, brand: @order.brand).take\n\n # Set notice after order update action\n if @order_update.update({\"amount\" => @order_update.amount + @order.amount})\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def index\n @order_items = OrderItem.all\n end", "def my_orders\n @orders = current_user.orders.all\n end", "def new4\n @order = Order.find( :first,\n :conditions => [\"user_id = ? and status = ? and id = ?\", self.current_user.id, \"incomplete\", params[:id]])\n begin\n @order.step = \"step4\"\n @order.status = \"ordered\"\n \n #Set status to confirmed, call show action\n #This is basically what the orignial create would do\n respond_to do |format|\n if @order.update_attributes(params[:order])\n # Remove ordered items from the cart \n @dels = Deliverable.find( :all, :conditions => [\"order_id = ?\", @order.id])\n @cart.cart_items.each do |c|\n @dels.each do |d|\n if c.listing_id == d.listing_id\n c.destroy\n end\n end \n end \n @user = User.find(@order.user_id)\n @seller = Seller.find(@order.seller_id)\n \n #Send confirmation email to buyer\n @deliverables = Deliverable.find(:all, :conditions => [\"order_id = ?\", @order.id])\n @shop = Shop.find(:first, :conditions => [\"seller_id = ?\", @seller.id])\n @seller_user = @seller.user\n logger.info @seller_user.id.to_s\n \n SystemMailer.deliver_ordered(@user, @seller, @order, @deliverables, @shop)\n \n current_language = session[:locale]\n I18n.locale = @seller.user.userpage.preferred_language\n SystemMailer.deliver_sale(@user, @seller_user, @seller, @order, @deliverables, @shop)\n I18n.locale = current_language\n \n \n format.html { redirect_to @order}\n format.xml { render @order }\n else\n flash[:notice_bad] = t(\"controllers.orders.s14\")\n format.html { render :controller => \"carts\", :action => \"show\" }\n end\n end\n rescue\n flash[:notice_bad] = t(\"controllers.orders.s15\")\n redirect_to orders_path\n else\n end\n end", "def process_order\n order\n respond_to do |format|\n format.html # process_order.html.erb\n format.json { render json: order }\n end\n end", "def buyer_orders \n if current_user && current_user.seller\n @items_info = find_buyers_orders.sort_by { |k| item_is_shipped(k[3],k[0].id) ? 1 : 0 }\n else\n redirect_to signin_path\n end\n end", "def index\n # @line_items = LineItem.all\n @line_items = LineItem.where(order_id:@order.id)\n end", "def perform\n Magento2::Api.configure('dz4xnhhgfsfuyj00g6bkel0jq6mwdak2', 'hhjnlf59qh2m7an9sdpfcu0o9nox78y6', 'ie5iafduhqs1dydynidsjki582oti17w', 'mva5hldj17elic6muxmf53fq7zmm7xl5', \"https://mall2door.net\")\n orders = Magento2::Api.get(\"/rest/en/V1/orders\", {searchCriteria: 'all' })\n all_orders = orders[:items]\n all_orders.each do |order|\n unless order[:status].present?\n order_id = order[:increment_id]\n id = order[:entity_id]\n status = order[:state]\n params = {\n entity_id: id,\n increment_id: order_id,\n status: status,\n }\n if status\n Magento2::Api.put(\"/rest/en/V1/orders/create\", {entity: params})\n end\n end\n end\n end", "def create\n #@order = Order.new(params[:order])\n\n cart = session[:cart]\n\n @order.add_line_items_to_order_from_cart(cart)\n\n @order.user = current_user\n\n respond_to do |format|\n if @order.save\n #Send an email to admin\n UserMailer.order_created_to_admin(@order).deliver\n #empty cart\n session.delete(:cart)\n \n format.html { redirect_to :dashboard, notice: \"L'ordine è stato creato correttamente.\" }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def prepare_new_order\n @order = Order.new(order_params)\n @order.user_id = current_user.id\n @product = Product.find(params[:orders][:product_id])\n @order.product = @product\n @order.price_cents = @product.price_cents\n end", "def set_order\n @my_order = Order.find(params[:id])\n end", "def create\n @order = Order.new(params[:order])\n @addresses = Address.where(:user_id => current_user.id)\n @order.status = 0;\n @order.delivery_cost = @order.delivery.cost\n @order.user = current_user\n @order_positions = current_user.basket.order_positions\n @order.order_positions = @order_positions\n @order.value = sum_price(@order_positions)\n\n respond_to do |format|\n if @order.save\n @order_positions.each do |op|\n op.container = @order\n op.save\n p = op.product\n p.availability -= op.amount\n p.save\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def orders\n @title = \"Your Orders\"\n @orders = @customer.orders.paginate(\n :page => params[:page],\n :per_page => 10\n )\n end", "def index\n @ordereds = Ordered.all\n end" ]
[ "0.6964524", "0.6920195", "0.6870869", "0.6856147", "0.6799975", "0.6797019", "0.6772585", "0.6772585", "0.6760496", "0.67488563", "0.6729735", "0.6718411", "0.6714629", "0.6714629", "0.6712981", "0.6692532", "0.6692532", "0.665753", "0.6655762", "0.6651076", "0.66486585", "0.66464114", "0.66427016", "0.6633588", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.66083705", "0.65963614", "0.6592716", "0.6589462", "0.6586197", "0.65810317", "0.65807337", "0.65712506", "0.6539435", "0.6520246", "0.65121436", "0.65057564", "0.6504979", "0.649975", "0.649975", "0.64981985", "0.64941734", "0.64932644", "0.64930385", "0.64884865", "0.6487944", "0.64859295", "0.6484284", "0.6481004", "0.64749926", "0.64645857", "0.6460111", "0.6458543", "0.6449221", "0.6448647", "0.6448479", "0.64460164", "0.64422727", "0.6439776", "0.6427419", "0.64265716", "0.6425793" ]
0.0
-1
Used by the search bar to query for student names
def names cached_json_for_searchbar = current_educator.student_searchbar_json if cached_json_for_searchbar render json: cached_json_for_searchbar else render json: SearchbarHelper.names_for(current_educator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results\n @students = Student.where('name LIKE ?', \"%#{params[:q]}%\")\n end", "def fees_student_structure_search_logic # student search fees structure\n query = params[:query]\n unless query.length < 3\n @students_result = Student.find(:all,\n :conditions => [\"first_name LIKE ? OR middle_name LIKE ? OR last_name LIKE ?\n OR admission_no = ? OR (concat(first_name, \\\" \\\", last_name) LIKE ? ) \",\n \"#{query}%\", \"#{query}%\", \"#{query}%\", \"#{query}\", \"#{query}\"],\n :order => \"batch_id asc,first_name asc\") unless query == ''\n else\n @students_result = Student.find(:all,\n :conditions => [\"admission_no = ? \", query],\n :order => \"batch_id asc,first_name asc\") unless query == ''\n end\n render :layout => false\n end", "def autocomplete_sn\n render :partial => 'autocomplete', :object => Scientificname.find(:all, :conditions => ['name ILIKE ?', params[:sn] + '%' ])\n end", "def index\n @allstudents = Student.all\n @inclass = StudentRoster.joins(:student).where(course: @course).pluck(:student_id)\n @students = @allstudents.where.not(id: @inclass).order(:created_at)\n\n @search = params[:search] ? true : false\n if @search\n @students = @students.where(\"first_name ilike ? OR last_name ilike ?\", \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n else\n @students\n end\n end", "def index\n @students = Student.all\n if params['term']\n @students = Student.where(Student.arel_table[:login].matches(\"#{params[:term]}%\")).limit(10)\n end\n end", "def index\n @q = Student.search(params[:q])\n @students = @q.result.page(params[:page])\n end", "def search\n\t\tquery_str = \"\"\n\t\tis_first = true\n\t\tval_list = []\n\n\t\tparams.each do |key, value|\n\t\t\tif key == 'first_name' or key == 'last_name' or key == 'dot_number'\n\t\t\t\t\tquery_str += \" AND \" unless is_first\n\n\t\t\t\t\tis_first = false\n\t\t\t\t\tquery_str += key + \" = ?\"\n\t\t\t\t\tval_list << value\n\t\t\tend\n\t\tend\n\n\t\tputs query_str\n\n\t\trender json: Student.where(query_str, *val_list)\n\tend", "def index\n @students = params[:query].present? ? Student.find_by_query(params[:query]) : Student.all_students\n end", "def index\n @students = Student.all\n @filters = Filter.all\n #name = \"Vadim\"\n #@students= Student.where(\"name like ? \", name)\n #add this gem later\n #@items = Item.paginate(:page => params[:page], :per_page => 2)\n end", "def find\n\n# puts params[:search_string]\n @students = Student.find(:all, :conditions=>[\"name LIKE ?\", \"%#{params[:search_string]}%\"])\n\n respond_to do |format|\n\n format.html # index.html.erb\n format.xml { render :xml => @students }\n\n end #end do\n\n end", "def index\n @search = Student.search(params[:q])\n @students = @search.result\n @students = @students.page(params[:page]||1) \n end", "def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Name)\n show_selected_names(query)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search_form')\n end\n end", "def search\n \tif params[:search].blank? \n \tredirect_to(root_path, notice: \"Empty Search field! Please try again\") and return \n \telse\n \t\t@parameter = params[:search].downcase \n \t@results = Course.all.where(\"course_name LIKE :search\", search: \"%#{@parameter}%\" ) \n \t@answers = Trainer.all.where(\"first_name LIKE :search\", search: \"%#{@parameter}%\" )\n \tend \n end", "def search\n @search = Ransack::Search.new(Student)\n end", "def search\n @query = params[:query]\n @students = Student.search(@query)\n @total_hits = @students.size\n end", "def index\n if params[:query].present?\n sql_query = \"name ILIKE :query OR syllabus ILIKE :query\"\n @schools = School.where(sql_query, query: \"%#{params[:query]}%\")\n else\n @schools = School.all\n end\n end", "def index\n\t\tpage_size = 10\n\t\t# If :q is passed in, it is a regular query string that we need to clean of weird characters.\n\t\t# If :qq is passed in, it is an advanced query string that we should pass verbatim.\n\t\t@query_string = params[:q]\n\t\tif @query_string\n\t\t\tsession[:search_current] = @query_string\n\t\t\t@query_string = @query_string.gsub(/[^\\w\\- ]/, '') if @query_string\n\t\telse\n\t\t\t@query_string = params[:qq]\n\t\t\tsession[:search_current] = @query_string\n\t\tend\n\t\t@curr_page = params[:page] || '0'\n\t\t@curr_page = @curr_page.to_i\n\t\thsh = { :query => @query_string, :start => @curr_page*page_size, :page_size => page_size }\n\t\tif session[:search_only_students] == 'true'\n\t\t\thsh[:schools] = [ 'school:LLS', 'school:LFA']\n\t\tend\n\t\tresponse_hash = solr().search(hsh)\n\t\t@page_title = 'Student List'\n\t\tif response_hash[:error]\n\t\t\t@error_msg = response_hash[:error]\n\t\t\t@total_hits = 0\n\t\t\t@total_pages = 1\n\t\t\t@students = []\n\t\t\tlogger.warn \"Search Query Error: #{@error_msg} ||||| /#{@query_string}/\"\n\t\telse\n\t\t\tresponse = response_hash[:response]\n\t\t\t@suggestions = response_hash[:suggestions]\n\t\t\t@total_hits = response['numFound']\n\t\t\t@total_pages = ((@total_hits + 0.0) / page_size).ceil()\n\t\t\t@students = Student.convert_solr_response(response['docs'])\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @students }\n\t\tend\n\tend", "def searchauthor\n end", "def results\n if current_user.admin?\n @students = Student.all.search(params[:search])\n else\n @students = current_user.students.search(params[:search]) \n end\n \n respond_to do |format|\n format.html\n format.js\n end\n end", "def search\n @users = User.where('full_name ilike ?', \"%#{params[:query].strip}%\")\n if @users.length.zero?\n flash[:notice] = \"#{params[:query]} not found\"\n redirect_to users_path\n else\n render 'index'\n end\n end", "def search_by_name(name)\n name = name.capitalize\n result_name = []\n @name_list.each_value do |element|\n if element.include? name\n result_name.push(element)\n end\n end\n if result_name.empty?\n puts \"Nobody has name is #{name}\"\n else\n puts \"\\nList member of #{name} keyword\"\n result_name.each do |element|\n index = @name_list.values.index(element)\n show_profile(index, @name_list, @dob_list)\n end\n puts \"\\n\"\n end\n end", "def filter_students_by_initial(initial, student_names)\n student_name_array = extract_name(student_names)\n return (student_name_array.select{ |student_name| student_name[0] == initial.to_s.capitalize})\nend", "def search\n @users = User.all.order(:user_id)\n if params[:search][:annual].present?\n @users = @users.where(\"annual like '%\" + params[:search][:annual] + \"%' \").order(:user_id) \n end\n if params[:search][:name].present?\n @users = @users.where(\"name like '%\" + params[:search][:name] + \"%' \").order(:user_id)\n end\n @name = params[:search][:name]\n @annual = params[:search][:annual]\n render :index\n end", "def search\n end", "def search\n\n end", "def index\n \n if current_user.admin?\n @students = Student.all.search(params[:search])\n else\n @students = current_user.students.search(params[:search]) \n end\n \n respond_to do |format|\n format.html\n format.js\n end\n \n # flash[:danger] = \"No record found\" if @students.nil? || @students.blank?\n\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search_results\n @individual = Individual.by_uid( params[:'names-search-uid'] )\n if @individual\n redirect_to display_path( @individual.uid )\n else\n redirect_to :search\n end\n end", "def searchByName\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\t\t\tresults = Doctor.where(\"first_name LIKE ?\", \"%#{prms['name'][0]}%\")\n\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\t\tend\n\tend", "def find\n\t\trender json: Subject.where(\"name LIKE ?\",\"%#{params[:term].titlecase}%\")\n\tend", "def search_person(name = \"\")\n\t\t@nutshell.search_person(name)\n\tend", "def search \n\n end", "def search; end", "def search\n\n end", "def find\n puts params[:search_string]\n @results = Clientworkout.where(client_name: params[:search_string])\n #@results = Clientworkout.where('lower(client_name)=?' params[:search_string])\n end", "def search\n @patients = Patient.where(name: params[:search][:name])\n render :index\n end", "def index\n @total_count = Manage::Student.count()\n puts @total_count\n offset = params[:start]\n limit = params[:limit]\n query = '%' + params[:query].to_s + '%'\n @manage_students = Manage::Student.where(\"stuid like ? or name like ?\",query,query).limit(limit).offset(offset)\n end", "def index\n @students = Student.search @year_selected, @degree_selected\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @students }\n end\n end", "def searchName\n @nombre=params[:nombre]\n @death_record_items=buscarNombre(@nombre)\n end", "def search(first_name)\n result = @conn.exec(\"SELECT * FROM students WHERE first_name = '#{first_name}';\")\n result.each do |student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend\nend", "def find_student(student_name)\n\tputs \"Welcome back! Feel free to drink some Butterbeer!\"\nend", "def search\n if id = search_params[:room_id]\n students = Student.roomFilter(id)\n else\n students = Student.all\n end\n query = search_params[:query_string] || \"\"\n students = students.search(query)\n render json: students, root: false\n end", "def show\n\n @student = Student.find(params[:id])#search_stdId(params[:Id])\n\n end", "def search\n searcher = @admin || @user\n query = params[:query]\n if query.blank?\n redirect_to(:action => 'index', :admin_id => @admin.id)\n else\n query.strip!\n\n case params[:type]\n when 'student' then\n @students = Student.students_of_teacher(searcher).search_data(query, filtered_params)\n when 'teacher' then\n @teachers = searcher.children.unblocked.search_data(query, filtered_params)\n else\n @students = Student.students_of_teacher(searcher).search_data(query, filtered_params)\n @teachers = searcher.children.unblocked.search_data(query, filtered_params)\n end\n end\n end", "def search_prof\n # Search for email or name of professor\n term = \"%#{params[:term]}%\"\n @users = User.all(:conditions => [\"(LOWER(first_name) LIKE LOWER(?) OR LOWER(last_name) LIKE LOWER(?) OR LOWER(email) LIKE LOWER(?)) AND role = ?\", term, term, term, \"Professor\"])\n\n # Return a JSON with \"label\" and \"value\" as key required by JQUeryUI autocomplete\n result = Array.new\n @users.each do |user| \n label = user.first_name + \" \" + user.last_name + \" - \" + user.email\n item = Hash[ \"label\" => label, \"value\" => user.email ]\n result.push item\n end\n\n render :json => result\n end", "def name\n search_string = (params[:search_string] || '').upcase\n @drugs = Drug.where([\"name LIKE ?\", '%' + search_string + '%']).select(\"name\")\n render plain: \"<li>\" + @drugs.map{|drug| drug.name }.join(\"</li><li>\") + \"</li>\"\n end", "def get_matching_students\n\t\tstudent\n\tend", "def students\n @users = User.paginate(:page => params[:page], :per_page => 20).student\n @filter = \"All Students\"\n render :index\n end", "def search\r\nend", "def search\n begin\n if params[:email] != \"\" && params[:study_name] != \"\"\n @header = \"Studies: #{params[:study_name]} by #{params[:email]}\"\n @studies = Study.where(originator: params[:email], name: params[:study_name], active: true, public: true)\n elsif params[:email] != \"\"\n @header = \"Studies: #{params[:email]}\"\n @studies = Study.where(originator: params[:email], active: true, public: true)\n elsif params[:study_name] != \"\"\n @header = \"Studies: #{params[:study_name]}\"\n @studies = Study.where(name: params[:study_name], active: true, public: true)\n else\n redirect_to(studies_path)\n return\n end\n @studies = @studies.reverse_each\n rescue\n redirect_to(studies_path)\n end\n end", "def search_by_name\n puts 'Enter a name to search for'\n lookup_name = gets.chomp\n result = @search.name(lookup_name)\n puts \"\\n#{formatted_search_result(result)}\"\n rescue EntryNotFoundError => e\n puts e.message\n end", "def search\n @users = User.search_by_name(params[:search_name]).paginates_per(page: params[:page])\n end", "def auto_complete_model_for_person_fullname\n @result = Person.non_student.find_all{|p| p.fullname.downcase.include?(params[:person][:fullname].downcase)}[0..10]\n render :partial => \"auto_complete\", :object => @result, :locals => { :highlight_phrase => params[:person][:fullname] }\n end", "def get_names\n\t face = html.search(\".student .card\")\n\t students = []\n\t face.collect do |element|\n\t students << element.text\n\t end\n\t end", "def index\n @users = if params[:term]\n puts 'hello'\n User.where('first_name ILIKE ? OR last_name ILIKE ?', \"%#{params[:term]}%\", \"%#{params[:term]}%\")\n else\n User.all\n end\n end", "def find_student(student_surname)\n Student.find(student_surname)\n end", "def search\n # if nothing is in the search field, show all champions\n if params[:search].blank?\n redirect_to champions_path\n \n #otherwise if the search matches show all champions that match\n elsif params[:search]\n @parameter = params[:search].downcase\n @search_results = Champion.all.where(\"lower(name) like ?\", \"#{@parameter}%\")\n \n #if the search doesnt match a champion\n else\n flash.alert = \"Could not find a champion with that query\"\n end\n end", "def recipe_name_search\n key_word = User.prompt.ask(\"Please piece of recipe name\")\n key_word == nil ? (key_word = 'bdncjkascndxasklxnasmndxb') : (key_word)\n recipe_query = Recipe.all.filter{|recipe| recipe.name.include?(key_word.capitalize())}\n\n if recipe_query != []\n recipe_viewer(recipe_query)\n else\n puts 'Invalid Search!'.colorize(:red);\n end\n end", "def index\n @calenders = Calender.where('name like ?', \"%#{params[:q]}%\").all\n end", "def students\n CrmLegacyContact.paginate(select: [:first_name, :last_name],\n where: {local_status: :student},\n sort: [:first_name, :asc],\n account_name: self.name,\n per_page: 1000)\n end", "def index\n if params[:search]\n @user = User.all.includes(:user).where(\"user.first_name\" => params[:search]).all\n end\n end", "def first_letter_filter\n\tputs \"Choose first letter of student name to filter:\"\n\tletter = gets.chomp\n\tselected_students = @students.select { |student| student[:name].chars.first == letter }\n\tlist(selected_students)\nend", "def index\n\n start_date = DateTime.new(2015,01,1)\n end_date = DateTime.new(2015,02,28)\n if params[:search]\n @students = Student.index_search(params[:search]).order(\"last_name ASC\").paginate(:page => params[:page]).where(\"created_at between (?) and (?)\", start_date, end_date)\n else\n @students = Student.order(\"last_name ASC\").paginate(:page => params[:page]).where(\"created_at between (?) and (?)\", start_date, end_date)\n end\n # if params[:search]\n # @query = Student.solr_search do\n # fulltext params[:search]\n # end\n # @students = @query.results\n # else\n # @students = Student.all\n # @students = Student.paginate(:page => params[:page], :per_page => 4)\n # end\n end", "def index\n @books = Book.where([\"name LIKE ?\", \"%#{params[:search]}%\"])\n end", "def search(category, query_term)\n result = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\")\n result.each do |student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend\nend", "def index\n @books = params[:search] ? Book.select{|book| book.title.downcase.include?(params[:search].downcase)} : Book.all\n end", "def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end", "def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end", "def search\nend", "def search\n @filters = params.slice(:university)\n\n if params[:search].present?\n \n @tutor_profiles = TutorProfile.where(\"teaching_subject LIKE :teaching_subject or degree_subject LIKE :teaching_subject\", {teaching_subject: \"%#{params[:search]}%\"}).where(@filters)\n else\n @tutor_profiles = TutorProfile.where(@filters).paginate(:page => params[:page], :per_page => 10)\n end\n end", "def selection(students)\n\tputs \"Please enter a letter\"\n\tletter = gets.chomp.upcase\n\tstudents.select {|student| student[:name][0] == letter}\nend", "def index\n @users = User.where(\"first_name LIKE ? OR last_name like ?\",\n \"%#{params[:search]}%\", \"%#{params[:search]}%\").paginate(:per_page => 10,:page => params[:page])\n if @users.count == 0\n flash.now[:warning] = t(\"user.search.no_results\")\n end\n end", "def search\n query = \"%\" + params[:search] + \"%\"\n @course = Course.where(\"name LIKE ?\", query)\n # if params[:search]\n # @course = Course.where(params:[:search]).order(\"created_at DESC\")\n # else\n # @course = Course.all.order(\"created_at DESC\")\n #This was causing an error with the search\n #@courses = Course.all;\n #end\n end", "def search(category, query_term)\n result = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\")\n result.each do |student|\n student.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\nend", "def search_by_name\n query = params[:query]\n users = User.search_users(query)\n render :json => users.to_json(:check_user => current_user)\n end", "def students\n filters = []\n filters.push(\"{SCHOOL_TFPID} = '#{goddamn_school}'\") if goddamn_school\n Student.some(\n shard: self.goddamn_city,\n sort: [\"Name\", :asc],\n filterByFormula: \"AND(#{filters.join(',')})\"\n )\n end", "def list_names # :nologin:\n query = create_query(:Name, :all, :by => :name)\n show_selected_names(query)\n end", "def index\n if params[:q]\n @users = User.where(\"lower(name) like lower(?)\", \"%#{params[:q]}%\")\n else \n @users = User.paginate(page: params[:page], :per_page => 10)\n end\n end", "def search_patients\n\t\t# Searching for patients as per user entered term\n\t\tpatients = current_user.patients.search_by_name(params[:term]).collect{|patient| {label: patient_search_meta(patient),name: \"#{patient.firstname} #{patient.lastname}\",value: patient.id.to_s} }.to_json\n\t\trespond_to do |format|\n\t\t format.json { render :json => patients }\n\t\tend\n\tend", "def index\n @full_name = params[:full_name] || \"\"\n\n if @full_name != \"\"\n @users = User.all.where(\"lower(first_name) like lower(?)\",\"%#{@full_name}%\").or(User.where(\"lower(last_name) like lower(?)\",\"%#{@full_name}%\")).or(User.where(\"lower(email) like lower(?)\",\"%#{@full_name}%\")).paginate(page: params[:page], per_page: 30).order('id desc')\n else\n @users = User.all.paginate(page: params[:page], per_page: 30).order('id desc')\n end\n end", "def searchtitle\n end", "def search\n limit = set_limit\n @names = Year.name_search(params[:q]).paginate(per_page: limit, page: params[:page])\n render json: @names, each_serializer: YearNameSerializer, meta: meta_attributes(@names), :callback => params[:callback]\n end", "def auto_complete_for_person_name\n \tname = params[:person][:name].downcase\n \tnames = name.strip.split(' ')\n \t\n find_options = {\n :order => \"last_name, first_name ASC\",\n\t :limit => 10 }\n\n\t\tif names.size > 1\n\t\t\t# there are two names provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' AND LOWER(last_name) LIKE '%#{names[1]}%' OR LOWER(first_name) LIKE '%#{names[1]}%' AND LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\telse\n\t\t\t# only the first name or last name has been provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' OR LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\tend\n\t\n\t\t@items = Person.find(:all, find_options)\n\t\n\t\tRails.logger.info(\"@items.size = #{@items.size}\")\n\n render :inline => \"<%= auto_complete_result @items, 'name' %>\"\n end", "def search(query); end", "def new\n @student = Student.new\n @search = User.search(params[:q])\n if !params[:q].nil?\n if !params[:q].empty?\n @done = params[:q]\n @users = @search.result\n else\n @done = \"set\"\n @users = []\n end\n else\n @users = []\n end\n end", "def search\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n @data = search_term(sname)\n render partial: \"shared/search\"\n end", "def index\n query = ''\n searchparam = \"\"\n if params[:search] && params[:search] != ''\n query += ' lower(name) LIKE ?'\n searchparam = \"%#{params[:search].downcase}%\"\n end\n\n @users = User.where(query, searchparam).paginate(page: params[:page])\n @searched = query != ''\n end", "def action_search( contacts )\n puts\n pattern = ask \"Search for? \"\n puts\n contacts.each do |contact|\n\n #Patttern works on the first letter of first/sur name\n if contact[:name] =~ /\\b#{pattern}/i\n show ( contact )\n puts\n end\n end\nend", "def autocomplete_on\n\t\tconditions = if params[:name]\n [\"name LIKE :name\", { :name => \"%#{params['name']}%\"} ]\n else\n {}\n end\n\t\t @objects = params[:model_name].classify.constantize.find(:all, :conditions => conditions)\n\t\t render :text => '<ul>'+ @objects.map{ |e| '<li>' + e.name + '</li>' }.join(' ')+'</ul>'\n\tend", "def index\n if params[:search] then\n @users = User.where(\"(lower(full_name) LIKE :search) OR (lower(forum_name) LIKE :search)\", search: \"%#{params[:search]}%\".downcase)\n @users = @users.order(:aclx_id).paginate(:page => params[:page], :per_page => 5)\n end\n end" ]
[ "0.77691644", "0.70885986", "0.7067542", "0.7053378", "0.6966976", "0.69378936", "0.69339037", "0.69176066", "0.6900299", "0.68917316", "0.6811309", "0.6806033", "0.67982584", "0.6761124", "0.667696", "0.667419", "0.66474766", "0.66440314", "0.6641849", "0.66322756", "0.6601221", "0.65609825", "0.6548133", "0.6522376", "0.65141237", "0.6509896", "0.6472148", "0.6472148", "0.6472148", "0.6472148", "0.6472148", "0.6472148", "0.6472148", "0.6472148", "0.6472148", "0.6472148", "0.6457502", "0.6456062", "0.64538777", "0.6453833", "0.6452865", "0.64370704", "0.64356637", "0.6435174", "0.64351594", "0.643357", "0.6414066", "0.640909", "0.64056623", "0.64044434", "0.6394701", "0.6388476", "0.63871366", "0.63768363", "0.63628757", "0.6349333", "0.63403237", "0.63318056", "0.6323598", "0.63222176", "0.63124305", "0.6310466", "0.6305267", "0.62943983", "0.62832814", "0.6280723", "0.62712616", "0.6262456", "0.6251102", "0.6251031", "0.62436384", "0.6237044", "0.6230789", "0.62299675", "0.6226356", "0.6218143", "0.62160337", "0.6212032", "0.6211082", "0.620605", "0.6186564", "0.6184371", "0.61813563", "0.61727154", "0.6172493", "0.6165955", "0.61650765", "0.61638767", "0.6160938", "0.6159028", "0.6155319", "0.6140639", "0.613659", "0.6127636", "0.6124472", "0.6123765", "0.6123473", "0.61201835", "0.61184126" ]
0.70174825
5
Admin only; get a sample of students for looking at data across the site
def sample_students_json raise Exceptions::EducatorNotAuthorized unless current_educator.can_set_districtwide_access? seed = params.fetch(:seed, '42').to_i n = params.fetch(:n, '40').to_i authorized_sample_students = authorized do Student.active.sample(n, random: Random.new(seed)) end sample_students_json = authorized_sample_students.as_json({ only: [:id, :grade, :first_name, :last_name], include: { school: { only: [:id, :name, :school_type] } } }) render json: { sample_students: sample_students_json } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end", "def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end", "def index\n @interesting_things = @student.interesting_things\n @other_interesting_things = Student.where.not(id: @student.id).map do|student|\n student.interesting_things[@student.id % Student.count] || student.interesting_things.sample\n end.compact\n end", "def students\n users\n end", "def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end", "def students\n users.students\n end", "def get_matching_students\n\t\tstudent\n\tend", "def students\n Rollcall::Student.find_all_by_school_id schools\n end", "def students\n @users = User.paginate(:page => params[:page], :per_page => 20).student\n @filter = \"All Students\"\n render :index\n end", "def students\n self.course_person.all(:type => \"student\").persons\n end", "def index\n @students = current_user.groups[0].students\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def students\n self.boating_tests.collect{|test| test.student} \n end", "def print_students_list\n\t@students.each do |student|\n\t\tputs \"#{student[:name]} (#{student[:cohort]} cohort)\"\n\tend\nend", "def students\n if current_user.is_admin?\n @students= User.find(:all, :conditions => \"is_teacher = '0' and is_admin = '0'\")\n respond_to do |format|\n format.xml { render :xml => @students }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end", "def setup\n @student = students(:data1)\n end", "def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\"\n end\nend", "def all_students(teacher_user)\n counter = 0 \n while counter <= Student.all.count \n list = Student.all.map do |pupil|\n pupil.name\n end\n counter += 1\n end\n puts list\n end", "def get_students\n registrations.select{|r| !r.instructor}.map{|r| r.user}\n end", "def list\n @students= Student.all\n end", "def fetch_students\n @students = []\n CSV.foreach('data/students_info.csv', headers: true, col_sep: ',') do |row|\n @students << { name: row['name'], detention: row['detention'], tt_path: row['tt_path'] }\n end\n end", "def show\n \n if current_user.teacher.nil?\n @students = []\n @groups = []\n else\n @student = current_user.teacher.students.find(params[:id])\n @groups = current_user.teacher.groups\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "def index\n @students = Student.by_registration_time\n \n @nsbe_students = Student.get_nsbe.by_registration_time\n @shpe_students = Student.get_shpe.by_registration_time\n end", "def print_student_list\n #print the list if there is at least one student in there\n if @students.count > 0\n @students.each do |student|\n puts \"Name = #{student[:name]} (#{student[:cohort]} cohort), hobby = #{student[:hobby]}, Country = #{student[:country]}\".center(80)\n end\n end\nend", "def index\n #@students = Student.all.page params[:page]\n if current_student.admin?\n @students = Student.page params[:page]\n else\n @student = current_student\n end\n end", "def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\".center(100)\n end\nend", "def index\n if current_user.admin? or current_user.editor? #checks if user is admin, if so displays all of the students in database.\n @students = Student.all\n if params[:search]\n @students = Student.search(params[:search]).order(\"created_at DESC\")\n else\n @students = Student.all.order('created_at DESC')\n end\n elsif user_signed_in?\n @students = Student.all.where(:user_id => current_user.id) #Only displays the the users student. \n end\n\n\n authorize @students\n end", "def show_students\n print_header\n print_students_list\n print_footer\nend", "def students # Want: student id and student names on Users Table\n return User.joins(:sections).where(:sections => {:id => self.id}).all\n end", "def index\n @people_students = People::Student.all\n end", "def show\n @courses = @student.courses\n @groups = @student.groups\n end", "def get_grades(student, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#a. create method to return student's grade\n\tschool[:students].each do |s|\n\t\tputs s[:grade] if s[:name] == student\n\tend\nend", "def get_students\n ret=[]\n self.get_class_schools.each do |classe|\n ret.concat classe.students\n end\n #puts \"========================== teacher.get_students: #{ret.count}\"\n ret\n end", "def default_students\n\nstudents = [\n {name: \"Dr. Hannibal Lecter\",cohort: :november, hobby: :sport, weight: 87, age: 64},\n {name: \"Darth Vader\", cohort: :november, hobby: :reading, weight: 87, age: 53},\n {name: \"Nurse Ratched\", cohort: :november, hobby: :music, weight: 100, age: 42},\n {name: \"Michael Corleone\", cohort: :november, hobby: :coding, weight: 68, age: 24},\n {name: \"Alex DeLarge\", cohort: :november, hobby: :coding, weight: 130, age: 28},\n {name: \"The Wicked Witch of the West\", cohort: :november ,hobby: :gaming, weight: 120, age: 43},\n {name: \"Terminator\", cohort: :november, hobby: :music, weight: 72, age: 34},\n {name: \"Freddy Krueger\", cohort: :november, hobby: :reading, weight: 55, age: 18},\n {name: \"The Joker\", cohort: :november, hobby: :sport, weight: 30, age: 45},\n {name: \"Joffrey Baratheon\", cohort: :november, hobby: :music, weight: 70, age: 30},\n {name: \"Norman Bates\", cohort: :november, hobby: :music, weight: 80, age: 25}\n]\nend", "def index\n\t@people = Student.all\nend", "def index\n @admin_students = Admin::Student.all\n if @admin_classroom.present?\n @admin_students = @admin_classroom.students\n end\n \n end", "def print_student_list(students)\n\tstudents_by_cohort = students.sort_by {|a| a[:cohort]}\n\tstudents_by_cohort.each do |student|\n\t\tputs \"#{student[:name]} (#{student[:cohort]}) cohort\".center(@width)\n\tend\nend", "def students\n student_size = User.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n if current_offset + direction < student_size && current_offset + direction >= 0\n offset = current_offset + direction\n @students = User.all.offset(offset).take(10) \n render :json => @students\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\tend", "def students\n course_enrollments.where(course_role: CourseRole.student).map(&:user)\n end", "def students \n sk = Sektion.where(:teacher_id => self.id).map(&:id)\n sids = StudentRoster.where(:sektion_id => sk).map(&:student_id).uniq\n return Student.where(:id => sids)\n end", "def show_students\n print_header\n print_student_list\n print_footer\nend", "def show_students\n print_header\n print_student_list\n print_footer\nend", "def show_students\n print_header\n print_students_list\n print_footer\nend", "def show_students\n print_header\n print_students_list\n print_footer\nend", "def show_students\n print_header\n print_students_list\n print_footer\nend", "def show_all_students\n Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def course_students\n return student_terms.find_all_by_term_type(\"Course\")\n end", "def graduation\n @batch = Batch.shod(params[:id])\n @students ||= @batch.students\n authorize! :read, @batch\n end", "def print_student_list(students)\n puts \"Students:\"\n puts \"----------------\"\n students.each do |student|\n puts \"#{student[:name]}, Cohort: #{student[:cohort]}\"\n end\n puts \"Overall, we have #{students.count} students\"\nend", "def index\n @q = Student.search(params[:q])\n @students = @q.result.page(params[:page])\n end", "def index\n @students = Student.where(group: 'student')\n end", "def collect_students(section = nil, student_attr = nil)\n @students ||= (\n student_list = data.collect{|row| row[0].to_s.sub(/COMMA\\s*/,', ').strip}\n students = student_list.collect do |student|\n s = section.rollbook_entries.detect{|rbe| rbe.student.send(student_attr) == student}\n s && s.id\n end\n students)\n end", "def get_students\n StudentInCourse.where(:course_id => id).collect(&:user_id)\n end", "def show\n authorize @institute\n @admins = User.where(role:3,institute_id: @institute.id)\n @students = User.where(role:1,institute_id: @institute.id)\n end", "def print_student_data(student)\n puts \" - Cohort: #{student[:cohort]}\"\n # puts \" - Hobbies: #{student[:hobbies].join(\", \")}\"\n # puts \" - Height: #{student[:height]}cm\"\n # puts \" - Country of birth: #{student[:birth_country]}\"\nend", "def index\n if current_user.role.title == 'admin'\n @students = Student.all\n @studentsSorted = @students.sort_by{|s| s[:id]}.reverse\n @groups = Group.all \n elsif current_user.teacher.nil?\n @students = []\n @groups = []\n else\n @students = current_user.teacher.students\n @students.sort! { |a,b| a.groups.where(\"group.idTeacher = ?\", current_user.teacher.id)[0].name.downcase <=> b.groups.where(\"group.idTeacher = ?\", current_user.teacher.id)[0].name.downcase }\n @groups = current_user.teacher.groups\n\n #current_user.teacher.students.each do |s|\n # if (!s.group.nil? && !@groups.include?(s.group))\n # @groups.push(s.group)\n # end\n #end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def index\n @students = Student.all\n end", "def index\n @students = Student.all\n end", "def students\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n student_ids = Array.new\n @courses.each{ |c|\n student_ids.push(c.courseStudents)\n }\n student_ids.each{ |array|\n array.each{ |student|\n @students.push(student)\n }\n }\n @students.uniq!\n end", "def print_student_list\n existing_cohorts = get_cohort_list\n existing_cohorts.each do |cohort|\n puts \"The students in the #{cohort.to_s} cohort are:\"\n @students.each do |student|\n if student[:cohort] == cohort\n puts student[:name]\n end\n end\n end\nend", "def show \n @average_age = @instructor.average_age\n @students = @instructor.students.sort_by {|student| student.name}\n end", "def index\n @studenttests = Studenttest.all\n end", "def index\n @student = Student.all\n end", "def students\n students = self.users.where(\"participants.role_id = 4 and accepted = 2\").order('lastname').all\n return students\n end", "def student_index\n end", "def students\n CrmLegacyContact.paginate(select: [:first_name, :last_name],\n where: {local_status: :student},\n sort: [:first_name, :asc],\n account_name: self.name,\n per_page: 1000)\n end", "def print_students_list\n if @students.length > 0\n print_info_each_student\n else puts \"No students in database\"\n end\nend", "def index\n @sample_users = SampleUser.all\n end", "def index\n @group_students = GroupStudent.all\n end", "def index\n @students = Student.all\n @user = User.all\n\n end", "def list_students_by(year=Date.today.to_s[0,4])\n\t\t#pesquisar por ano e depois pedir os alunos\n\n\t\tclassroom = Classroom.find(:first, :conditions => \"year='#{year}' AND name='#{self.name}'\" )\t\t\n\t\treturn classroom.students\n\tend", "def index\n @find_students = FindStudent.all\n end", "def index\n if params[:goto]\n student = Student.find_by_name(params[:goto])\n redirect_to student and return if student\n student = Student.find_by_number(params[:goto])\n redirect_to student and return if student\n redirect_to students_path and return\n end\n do_it(:order,'number')\n do_it(:per,50)\n \n @students = Student\n @students = Course.find(params[:course_id]).students if params[:course_id]\n @students = @students.where(klass_id:Grade.find(params[:grade_id]).klasses.collect(&:id)) if params[:grade_id]\n @students = @students.where(klass_id:params[:klass_id]) if params[:klass_id]\n @students = @students.where(paixuzi:params[:paixuzi]) if params[:paixuzi]\n @students = @students.where(surname:FamilyName.find(params[:surname_id]).hanzi) if params[:surname_id]\n @students = @students.where(number_prefix:params[:number_prefix]) if params[:number_prefix]\n @students = @students.where(klass2_id:params[:klass2_id]) if params[:klass2_id]\n @students = @students.order(params[:order])\n @students = @students.page(params[:page]).per(params[:per])\n @order = params[:order]\n end", "def external\n @plan_subjects = PlanSubject.find_unfinished_external_for(@user)\n @students = @plan_subjects.map {|ps| ps.study_plan.index.student}.uniq\n end", "def filtered_students\n group_id ? students_from_group(group_id) : course.course_users.student\n end", "def show\n @students = Student.where(school: @school.id)\n @teachers = Teacher.where(school: @school.id) \n end", "def index\n @students_records = @student.records\n end", "def students\n filters = []\n filters.push(\"{SCHOOL_TFPID} = '#{goddamn_school}'\") if goddamn_school\n Student.some(\n shard: self.goddamn_city,\n sort: [\"Name\", :asc],\n filterByFormula: \"AND(#{filters.join(',')})\"\n )\n end", "def get_student\n @student = Student.find(params[:student_id])\n end", "def guardian_students\n id=session[:user_id]\n @guardian=MgGuardian.find_by(:mg_user_id=>\"#{id}\")\n logger.info(\"=================================================\")\n logger.info(id)\n @sql = \"SELECT S.first_name ,S.last_name,S.admission_number, S.id from mg_students S,mg_guardians G ,mg_student_guardians M Where M.has_login_access=1 And M.mg_guardians_id = #{@guardian.id} And S.id = M.mg_student_id and G.id = M.mg_guardians_id\"\n\n @StudentListQuery=MgStudent.find_by_sql(@sql)\n\n render :layout => false\nend" ]
[ "0.701497", "0.6813282", "0.6725721", "0.6725324", "0.6707405", "0.6706399", "0.6561929", "0.646718", "0.6463248", "0.64573634", "0.64201087", "0.6418952", "0.6411673", "0.64110625", "0.63979673", "0.63894325", "0.6331304", "0.62793434", "0.62716544", "0.6265985", "0.6256011", "0.6242042", "0.62349355", "0.62261474", "0.61759156", "0.6168842", "0.616422", "0.61590725", "0.61474234", "0.61468095", "0.6142767", "0.6134339", "0.61333334", "0.612384", "0.61159027", "0.6109597", "0.61092365", "0.6108329", "0.6099157", "0.6098519", "0.6098519", "0.6095458", "0.6095458", "0.6095458", "0.6091747", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6090352", "0.6088249", "0.6083573", "0.6067194", "0.60644495", "0.60467136", "0.6041989", "0.60351026", "0.6034876", "0.6033695", "0.6029919", "0.60297877", "0.60297877", "0.6027704", "0.6027408", "0.60264367", "0.6023912", "0.60202", "0.60027134", "0.5997588", "0.59796935", "0.597052", "0.5967545", "0.5959876", "0.59564155", "0.595224", "0.59466887", "0.59464234", "0.5940078", "0.59380525", "0.5932979", "0.59169406", "0.59156585", "0.5912258", "0.5903126" ]
0.7318946
0
The feed of mutable data that changes most frequently and is owned by Student Insights. restricted_notes: If false display nonrestricted notes, if true display only restricted notes.
def student_feed(student, restricted_notes: false) { event_notes: student.event_notes .select {|note| note.is_restricted == restricted_notes} .map {|event_note| EventNoteSerializer.dangerously_include_restricted_note_text(event_note).serialize_event_note }, transition_notes: student.transition_notes .select {|note| note.is_restricted == restricted_notes}, services: { active: student.services.active.map {|service| ServiceSerializer.new(service).serialize_service }, discontinued: student.services.discontinued.map {|service| ServiceSerializer.new(service).serialize_service } }, deprecated: { interventions: student.interventions.map { |intervention| DeprecatedInterventionSerializer.new(intervention).serialize_intervention } } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_for_restricted_notes(current_educator, params)\n authorization = current_educator.can_view_restricted_notes?\n intention = (params.fetch(:include_restricted_notes, 'false').downcase == 'true')\n if authorization && intention\n [true, false]\n else\n [false]\n end\n end", "def starred_notes\n fetch_notes_for nil, true\n end", "def student_feed(student, restricted_notes: false)\n {\n event_notes: student.event_notes\n .select {|note| note.is_restricted == restricted_notes}\n .map {|event_note| EventNoteSerializer.new(event_note).serialize_event_note },\n services: {\n active: student.services.active.map {|service| ServiceSerializer.new(service).serialize_service },\n discontinued: student.services.discontinued.map {|service| ServiceSerializer.new(service).serialize_service }\n },\n deprecated: {\n interventions: student.interventions.map { |intervention| DeprecatedInterventionSerializer.new(intervention).serialize_intervention }\n }\n }\n end", "def show\n @notifications = Notification.where(user: current_user).where(notification_obeject_id: params[:id]).where(read: false)\n @notifications.each do |note|\n note.read = true\n note.save\n end\n end", "def index\n @personal_notes = Note.where(:user_id => current_user.id)\n @public_notes = Note.where(:isPublic => true).where.not(:user_id => current_user.id)\n @shared_notes = Note.where(:id => NotesUser.where(:user_id => current_user.id).select(:note_id))\n #@notes = Note.all\n end", "def show\n if reader = @diary_entry.readers.where(user_id: @current_user.id).first\n reader.mark_as_read\n else\n \"\"\n end\n\n @comment = Comment.new\n end", "def notes\n @notes\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def notes\n @data[:notes]\n end", "def private_notes\n end", "def private_notes\n \n end", "def starred_notes_for(field)\n fetch_notes_for field, true\n end", "def index\n #@notes = Note.all\n @notes = current_user.notes\n end", "def show\n @note = Note.find(params[:id])\n restrict_access(\"notes\") if @note.firm_id != @firm.id \n end", "def show\n @all_notes = Note.all\n @current_user = User.find_by username: session[:user]\n @notes = []\n @all_notes.each do |note|\n if @collection.note_ids.include? note.id\n @notes.push(note)\n end\n end\n @current_user = User.find_by username: session[:user]\n if @collection.owner.id == @current_user.id or @collection.user_ids.include? @current_user.id\n @users = User.all\n else\n respond_to do |format|\n format.html { redirect_to root_path, alert: \"You don't have permission to see this collection.\" }\n format.json { render :show, status: :created, location: @collection }\n end\n end\n end", "def list_notes\n notes = if unsafe_params[:editable]\n Note.editable_by(@context).where.not(title: nil).accessible_by_private\n else\n Note.accessible_by(@context).where.not(title: nil)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n notes = notes.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:note_types].present?\n fail \"Param note_types can only be an Array of Strings containing 'Note', 'Answer', or 'Discussion'\" unless unsafe_params[:note_types].is_a?(Array) && unsafe_params[:note_types].all? { |type| %w(Note Answer Discussion).include?(type) }\n\n note_types = unsafe_params[:note_types].map { |type| type == \"Note\" ? nil : type }\n notes = notes.where(note_type: note_types)\n end\n\n result = notes.order(id: :desc).map do |note|\n if note.note_type == \"Discussion\"\n note = note.discussion\n elsif note.note_type == \"Answer\"\n note = note.answer\n end\n describe_for_api(note, unsafe_params[:describe])\n end\n\n render json: result\n end", "def index\n # all the notes owned by the user.\n @notes = current_user.notes\n # all the notes the user can read and write\n @canEditNotes = Accessor.select(:note_id).where(\"accessor_id = ? AND access_rights = ?\", current_user, true)\n @canEditNotes.each do |p|\n p.note = Note.find(p.note_id)\n end\n #all the notes the user can only read\n @canView = Accessor.select(:note_id).where(\"accessor_id = ? AND access_rights = ?\", current_user, false)\n @canView.each do |p|\n p.note = Note.find(p.note_id)\n end\n\n\n respond_to do |format|\n format.html {}\n format.js {render 'index.js.erb'}\n end\n end", "def index\n @user_feedback_notes = UserFeedbackNote.all\n end", "def show\n @publications = @user.publications.order(:id)\n @subscriptions = @user.subscriptions.order(:id)\n moderating_forums = []\n @user.moderated_forums.order(:id).each do |forum|\n moderating_forums.push(forum) if @user.accepted(forum.id)\n end\n @moderating = moderating_forums\n requests_forums = []\n @user.moderated_forums.order(:id).each do |forum|\n requests_forums.push(forum) unless @user.accepted(forum.id)\n end\n @requests = requests_forums\n @starred = @user.favorite_publications.order(:id)\n end", "def show\n if @note.public_view or @shared_user_ids.include?(session[:user_id]) or (!@note.public_view and @shared_user_ids.any?)\n @comments = Comment.where('note_id = ?', params[:id])\n others_comment_ids = []\n # Get the user ids from all comments for a note\n @comments.each do |single_comment|\n unless single_comment.created_by.to_s.eql? session[:user_id].to_s\n others_comment_ids.push(single_comment.created_by)\n end\n end\n ###\n @user_names = {}\n ###\n user_details = UserProfile.where('id in (?)', others_comment_ids)\n user_details.each do |detail|\n @user_names[detail.id.to_s] = detail.name\n end\n end\n end", "def visible_notes\n user = params.permit(:latitude, :longitude)\n center = Geokit::LatLng.new(user[:latitude], user[:longitude])\n render json: GeoNote.within(base_radius, units: :meters, origin: center).all.select{|geonote| not is_treasure(geonote)}\n end", "def notes_show_formatted\n Observation.show_formatted(notes)\n end", "def read_only\n if !(@restaurant.creator_id == @review.user_id) \n \"readonly\"\n end\n end", "def safe_is_restricted_value(unsafe_is_restricted)\n if current_educator.can_view_restricted_notes?\n unsafe_is_restricted\n else\n false\n end\n end", "def notes(params = {})\n @notes ||= MailchimpAPI::Note.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))\n end", "def notebook\n @pagy, @private_notes = pagy(PrivateNote.where(user: current_user).order(created_at: :desc), items: 5)\n authorize @private_notes\n end", "def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end", "def notes\n @attributes[:notes]\n end", "def notes\n @attributes[:notes]\n end", "def index\n # Get shared notes for the user\n @shared_note_ids = ShareNote.where('user_profile_id = ?', session[:user_id]).pluck(:note_id)\n @notes = Note.where(\n 'created_by = ? or public_view = ? or id in (?)',\n session[:user_id], true, @shared_note_ids\n )\n ###\n # Get usernames for public note\n @user_names = {}\n @notes.each do |note|\n unless note.created_by.to_s.eql? session[:user_id].to_s\n user_details = UserProfile.find(note.created_by)\n @user_names[user_details.id.to_s] = user_details.name\n end\n end\n end", "def index\n @permission_requests = PermissionRequest.where(reviewed: false)\n end", "def notes\n data_series.find_all { |ds| ds.options[:note].present? }\n .map { |ds| { ds_name: ds.name, body: ds.options[:note] }}\n end", "def show\n @notes = @bookmark.notes\n end", "def show\n @as_note = AsNote.find(params[:id])\n #@position = @as_note.ownerships.where(\"user_id = ?\",current_user).first.position\n @appliers = PermissionRequest.where(\"as_note_id = ? and current_status != ?\", @as_note.id, \"closed\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @as_note }\n end\n end", "def notifications\n @other_user = @login_user\n @notifications = DiscussionGroupUser.where(['user_id =? AND is_member=?', @login_user.id, false])\n @disc_notifications = NonSiteUser.where([\"email=? AND invitable_type=? and invitation_type=?\",@login_user.email,\"Discussion\",\"Invited\"])\n respond_to do |format|\n format.html\n end\n end", "def show\n @note = Note.find(params[:id])\n @comments = @note.comments\n @messages = Array.new\n\n @note.infos.each do |message|\n @messages << message\n end\n\n @comments.each do |comment|\n comment.infos.each do |message|\n @messages << message\n end\n end\n\n @messages.each do |message|\n if message.user_id == current_user.id\n message.read = 0 # 0 means read and 1 means unread\n message.refer = 0\n message.save!\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.js # show.js.erb\n end\n end", "def show\n # The purpose of this block is to build two lists of trials, one being the\n # trials that a clinician manages, the other being trials that they are\n # just participating in. It removes duplicates from the watching list, if\n # they are in the managed list.\n managed = current_user.clinical_trials\n excludes = managed.pluck(:id)\n\n tcids = current_user.trial_clinicians.pluck(:clinical_trial_id)\n\n if tcids.empty?\n watching = []\n else\n watching = ClinicalTrial.where('id in (?)', tcids)\n if !excludes.empty?\n watching = watching.where('id not in (?)', excludes)\n end\n end\n\n @managed_list = managed\n @watching_list = watching\n end", "def set_sidebar\n @notes_list = current_user.notes\n @permission_notes_list = current_user.permissions\n puts current_user.id\n end", "def dashboard\n \t#can now use @user as variable to reference logged in user\n \t@user = User.find(current_user.id)\n \t@note = User.find(current_user.id).notes\n end", "def index\n @internal_notes = InternalNote.all\n end", "def character_notes\n self.object.character_notes.map do |note|\n {\n c_note_id: note.id,\n c_note_title: note.title,\n c_note_content: note.content,\n visible_to_other_players: note.visible_to_other_players,\n amount_spent: note.amount_spent,\n amount_earned: note.amount_earned\n }\n end\n end", "def comments\n object.comments.approved\n end", "def show\n #@tmp = params[:user_id]\n @sharedUsers = NotesUser.where(:note_id => @note.id)\n end", "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end", "def all_notes\n self.has_notes? ? self.annotations.map {|n| n.body }.join(' ') : '' \n end", "def show\n @notes = @hold.notes\n respond_with(@hold)\n end", "def news_topics_comments\r\n @story = hacker_news_client.item(params[:id])\r\n @comments = (@story['kids'] || []).map do |comment|\r\n hacker_news_client.item(comment)\r\n end\r\n end", "def comments\n @data['comments']\n end", "def comments\n @data['comments']\n end", "def comments\n @data['comments']\n end", "def show\n @potd = Potd.find(params[:id])\n @from_preview = false\n\n @commentable = @potd\n @comments = @commentable.comments\n @comment = Comment.new\n\n @potd.mark_as_read! :for => current_user\n @potd.comments.each do |comment|\n comment.mark_as_read! :for => current_user\n end\n\n @active_school_day = most_recent_day_for_material(@potd)\n load_prev_and_next_day\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potd }\n end\n end", "def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end", "def show\n @reading_list = ReadingList.includes(:papers).find(params[:id])\n if not ReadingListsHelper::has_access(@reading_list, current_user, ReadingListsHelper::READONLY)\n @paper_mgt_notification = 'User not authorized.'\n respond_to do |format|\n format.html { redirect_to current_user.reading_lists, alert: @paper_mgt_notification }\n end\n return\n end\n\n @is_owner = false\n @has_modify_rights = false\n rights = ReadingListsHelper::get_shared_list_access_rights(@reading_list, current_user)\n if rights == ReadingListsHelper::OWNER\n @is_owner = true\n @has_modify_rights = true\n elsif rights == ReadingListsHelper::READWRITE\n @has_modify_rights = true\n end\n\n @reading_list_share = ReadingListShare.new\n @reading_list_share.reading_list = @reading_list\n\n if params[:from_group]\n @group = Group.find(params[:from_group])\n else\n @group = nil\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading_list }\n end\n end", "def notes( params={} )\n notes = get_connections(\"notes\", params)\n return map_connections notes, :to => Facebook::Graph::Note\n end", "def get_your_bottles\n bottles = get_bottles\n your_bottles = bottles.map do |bottle|\n # if user_id == viewer_id, the entry is private and should not be displayed alongside bottles\n if bottle.is_read && bottle.user_id != bottle.viewer_id\n bottle\n end\n end\n return your_bottles.compact\n end", "def show\n render json: @notes\n end", "def collection\n return @client.api_helper.collection(\"notes\")\n end", "def show\n @documents = @maintenance.documents\n end", "def index\n create_sessions(current_user.role.name,current_user) if session[:sp_session].nil?\n secretary = is_secretary?\n lawyer_user_ids = get_lawyer_user_ids\n livian_user_ids = @user_ids\n created_by_user_ids = lawyer_user_ids\n created_by_user_ids << current_user.id if secretary\n @notes = Communication.get_notes(params,created_by_user_ids,secretary,current_user,livian_user_ids)\n @notes_count = Communication.get_notes_count(lawyer_user_ids, livian_user_ids, secretary, current_user)\n @tasks_count,@overdue_task_count,@upcoming_task_count,@todays_task_count = UserTask.get_task_count(lawyer_user_ids,livian_user_ids,secretary,current_user)\n filtered_list\n end", "def secratary_details_notes_list\n @notes= Communication.get_secratary_details_notes_list(params[:secratary_id])\n @skill_types = Physical::Liviaservices::SkillType.find(:all)\n @user_name = params[:secratary_id].blank? ? nil : User.get_user_name(params[:secratary_id])\n render :partial =>'secratary_details_notes_list' \n end", "def index\n\t\trender json: current_user.noteBooks.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n # render json: NoteBook.all.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n\tend", "def index\n @notes = Note.where(published_state:true)\n end", "def get_comments\n @public_comments = @user_key.comments.public_only.chronological\n @private_comments = @user_key.comments.private_only.chronological\n @comment = @user_key.comments.build\n end", "def index\n if current_user.admin\n # (10 years is a suitably long time to not matter chasing debts...)\n @lessons_to_debrief = Lesson.where(\n start_time: 10.years.ago..Time.now,\n attended: nil )\n .order(\"start_time DESC\")\n @lessons_not_paid = Lesson.where( start_time: 10.years.ago..Time.now )\n .where.not( attended: nil )\n .where( paid: false )\n .order(\"start_time DESC\")\n @lessons_completed = Lesson.where(\n start_time: 1.month.ago..Time.now,\n attended: true,\n paid: true)\n .order(\"start_time DESC\")\n else\n @lessons = current_user.lessons.where.not( student_notes: nil )\n .where( student_has_read_note: false )\n end\n end", "def getComments\r\n\t\t\t\t\treturn @comments\r\n\t\t\t\tend", "def show\n @user_story_acceptance_criterions = @user_story.user_story_acceptance_criterions\n end", "def show\n @active_goals = @supported_user.goals.where(:active => true)\n @recent_journal_entries = @supported_user.journal_entries.order(:dateTimeOfTraining).reverse.last(20)\n end", "def local_notes options = {}\n # if user is creator or admin, add link to admin\n allow_admin = !options[:disable_admin] && current_user && !current_user.admin?\n path = \"#{controller_name}/#{action_name}\"\n\n notes = Note.where(:path=>path)\n\n if notes.empty? && options[:fixed]\n notes = [Note.create!(:path=>path, :title => options[:default_title])]\n end\n\n str = notes.map do |note|\n in_place_edit_panel(note, path)\n end.join.html_safe\n\n klasses = \"card\"\n str << content_tag(:div, link_to(\"Add New Note\", notes_path(:path=>path), :method=>:post, :remote=>true), :class=>klasses, :id=>\"add_#{path.gsub(/\\//,'_')}\") if allow_admin\n\n str\n end", "def index\n @user_has_notes = UserHasNote.all\n end", "def staff_request_fields\n staff_request_all_fields - %i[nonop_source justification review_comment created_at updated_at]\n end", "def update!(notes)\n fetch_notes\n show_notes\n push_notes(notes)\n end", "def index\n authorize! :update, @user, :message => 'Not authorized as an administrator.'\n @wanteds = Wanted.all\n end", "def index\n @notes_lists = @note.notes_lists.all\n end", "def show\n @objectives = @rubric.objectives\n @rubric_notes = StudentRubric.where(\"user_id = ? AND rubric_id = ?\", current_user.id, @rubric.id).first\n end", "def comments\n @comments\n end", "def comments\n @comments\n end", "def read_only_recommended\n @read_only = 2\n end", "def index\n @pagy, @private_notes = pagy(PrivateNote.order(created_at: :desc), items: 25)\n authorize @private_notes\n end", "def notes_from_training\n end", "def show\n @link = Link.find(params[:id])\n @from_preview = false\n\n @commentable = @link\n @comments = @commentable.comments\n @comment = Comment.new\n\n @link.mark_as_read! :for => current_user\n @link.comments.each do |comment|\n comment.mark_as_read! :for => current_user\n end\n \n @active_school_day = most_recent_day_for_material(@link)\n load_prev_and_next_day\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end", "def sole_authored_works\n @sole_authored_works = []\n works.find(:all, :conditions => 'posted = 1').each do |w|\n if self.is_sole_author_of?(w)\n @sole_authored_works << w\n end\n end\n return @sole_authored_works \n end", "def condition_note\r\n self.notes\r\n end", "def safe_is_restricted_value_for_update(safe_params)\n if current_educator.can_view_restricted_notes?\n safe_params[:is_restricted]\n else\n false\n end\n end", "def mark_notifications_read\n return if params[:notification_id].blank? or !user_signed_in?\n n = Notification.find(params[:notification_id])\n current_subject.mark_as_read n\n end", "def local_notes options = {}\n # if user is creator or admin, add link to admin\n allow_admin = !options[:disable_admin] && current_user && !current_user.admin?\n path = \"#{controller_name}/#{action_name}\"\n\n notes = Note.where(:path=>path)\n\n if notes.empty? && options[:fixed]\n notes = [Note.create!(:path=>path, :title => options[:default_title])]\n end\n\n str = notes.map do |note|\n in_place_edit_panel(note, path)\n end.join.html_safe\n\n str << content_tag(:div, link_to(\"Add New Note\", notes_path(:path=>path), :method=>:post, :remote=>true), :class=>'panel', :id=>\"add_#{path.gsub(/\\//,'_')}\") if allow_admin\n\n str\n end", "def exposed_attributes\n [ :id, :student_id, :curriculum_id, :accuracy, :baseline, :trial_days_actual, :trial_days_total,\n :description, :is_completed, :baseline_date, :due_date\n ]\n end", "def exposed_attributes\n [ :id, :goal_id, :user_id, :accuracy, :time_to_complete, :note, :due_date ]\n end", "def comments\n\t\t\t@comments ||= read_comments\n\t\tend", "def index\n @interviews = current_user.roles.first.name == \"admin\" ? Interview.all : Interview.where(\"interviewer_id =? \", current_user.id)\n end", "def notifications\n return notification_data_source.notifications\n end", "def comments\n @comments\n end", "def notations; end", "def index\n @comments = @secret.comments\n end", "def notes; end", "def notes; end", "def notes; end" ]
[ "0.65092534", "0.6358749", "0.61997056", "0.5780791", "0.57209456", "0.5720443", "0.57096505", "0.5693249", "0.5693249", "0.5693249", "0.5693249", "0.5645508", "0.56433904", "0.5620788", "0.56049854", "0.5557341", "0.5539582", "0.55262303", "0.54622674", "0.5405722", "0.54021513", "0.5396031", "0.5395", "0.5311509", "0.53046197", "0.5280027", "0.52698755", "0.5266417", "0.5256495", "0.52527916", "0.5252492", "0.5252492", "0.5252417", "0.52397066", "0.52352023", "0.5233965", "0.5229973", "0.5223353", "0.52212423", "0.5219928", "0.5209642", "0.5182582", "0.5177623", "0.5173634", "0.51627266", "0.5153122", "0.5127696", "0.5127412", "0.51113546", "0.51091695", "0.5106251", "0.5105443", "0.5105443", "0.5105443", "0.5100102", "0.50981456", "0.50920165", "0.50860983", "0.50811905", "0.50785446", "0.5076239", "0.5068662", "0.5067203", "0.50664246", "0.5064561", "0.5061556", "0.50585085", "0.5057914", "0.50572586", "0.5050598", "0.5049773", "0.50440997", "0.5038877", "0.50375", "0.5027845", "0.5025351", "0.5018534", "0.5012943", "0.50080484", "0.50080484", "0.5005749", "0.5004314", "0.50034034", "0.5003141", "0.49977747", "0.49946696", "0.49938574", "0.49883988", "0.4986211", "0.49817374", "0.4980717", "0.49790162", "0.49775973", "0.4976585", "0.49727145", "0.49724638", "0.49639747", "0.49593288", "0.49593288", "0.49593288" ]
0.62550634
2
GET /actionables GET /actionables.json
def index @actionables = Actionable.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end", "def index\n @user_actions = UserAction.all\n render json: @user_actions\n end", "def abilities\n get('/ability/')\n end", "def accessories\n render json: { collections: Collection.published_accessories }\n end", "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "def actions\n return @actions if @actions\n @actions = Client.get(\"/boards/#{id}/actions\").json_into(Action)\n end", "def list\n List.from_response client.get(\"/actions/#{action_id}/list\")\n end", "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end", "def index\n @action_names = ActionName.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @action_names }\n end\n end", "def index\n @abilities = Ability.all\n end", "def actions\n client.actions\n end", "def my_attractions\n my_attractions = Attraction.attractions_by_user(current_user.id)\n render :json => Attraction.just_attraction_data(my_attractions), :except => @@render_exclude_options\n end", "def index\n @my_actions = MyAction.all\n end", "def show\n head :forbidden\n\n # @action = Action.find(params[:id])\n\n # render json: @action\n end", "def index\n @traits = Trait.all\n @trait_action_object_hash = Trait.action_object_hash\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traits }\n end\n end", "def index\r\n @aes_actions = Action.all\r\n end", "def index\n @requests = Request.accessible_by(current_ability)\n\n \n\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 #@food_items automatically set to FoodItem.accessible_by(current_ability)\n\n respond_to do |format|\n format.html { render 'index', layout: !(request.xhr?) }\n format.json { render json: @food_items }\n end\n end", "def index\n @through_tables = ThroughTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @through_tables }\n end\n end", "def index\n @cables = Cable.all\n end", "def index\n @cables = Cable.all\n end", "def index\n @player_actions = PlayerAction.all\n end", "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "def index\n @weapons = Weapon.all\n\n render json: @weapons\n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def index\n @task_contexts = TaskContext.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_contexts }\n end\n end", "def index\n @modalities = Modality.all\n json_response(@modalities)\n end", "def index\n @accessories = Accessory.all\n end", "def index\n @cables = Cable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cables }\n end\n end", "def index\n @actions = Action.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @actions }\n end\n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def index\n @actionlists = Actionlist.all\n end", "def index\n @wallet_actions = WalletAction.all\n end", "def actions\r\n return @actions\r\n end", "def index\n @resources = Resource.where(\"is_approved = true\")\n render json: @resources, status: 200\n end", "def show\n render json: @accessory_category\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def show\n @attraction = Attraction.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @attraction }\n end\n end", "def index\n @kactions = Kaction.all\n end", "def index\n @client_accessories = ClientAccessory.all\n end", "def index\n @city_actions = CalendarAction.city_actions\n @people_actions = CalendarAction.people_actions\n end", "def index\n @weapons = Weapon.all\n render :json => @weapons, :include => :special_rules\n \n end", "def actions\n @actions\n end", "def index\n \n @shareables = Shareable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shareables }\n end\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def index\n @actiontypes = Actiontype.all\n end", "def index\n @eatables = Eatable.all\n end", "def get_actions(type=nil)\n res = []\n \n @actions.each do |a|\n if a.is_a?(type) or type.nil?\n res.push a\n end\n end\n \n return res\n end", "def index\n @championships = Championship.all\n\n render json: @championships\n end", "def index\n @admission_types = AdmissionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @admission_types }\n end\n end", "def actions\n []\n end", "def actions\n @actions || []\n end", "def index\n @game_codes = GameCode.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_codes }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def index\n @tredit_actions = TreditAction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tredit_actions }\n end\n end", "def index\n @tournaments = Tournament.accessible_by(current_ability)\n @index_type = \"All\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tournaments }\n end\n end", "def index\n @abuse_categories = AbuseCategory.find(:all , :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @abuse_categories }\n end\n end", "def index\n getProfile\n @availabilities = @therapist.get_availabilities\n @rec_Availabilities = @therapist.get_recuring_availabilities(2000,1)\n respond_to do |format|\n format.html { redirect_to availabitity_index, notice: \"Appointment declined.\"}\n format.json { render :status => 200, :json => { action: :index,\n availabilities: @availabilities,\n rec_availabilities: @rec_Availabilities,\n user: @user, therapist: @therapist}}\n end\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def index\n @accessories = Accessory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accessories }\n end\n end", "def index\n @accessory_categories = AccessoryCategory.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @accessory_categories\n end", "def index\n @unit_actions = UnitAction.all\n end", "def index\n authorize @model, :index?\n\n # @collection = @model.all\n\n render json: Oj.dump(\n collection: @model.all\n )\n end", "def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end", "def index\n @dosha_actions = DoshaAction.all\n end", "def index\n @character_sheets = CharacterSheet.all \n @character_sheet = @character_sheets.first \n @skills = Skill.all\n @abilities = @character_sheet.abilities if @character_sheet\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @character_sheets }\n end\n end", "def actions\n @actions ||= []\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def index\n @reward_categories = RewardCategory.all\n respond_with(@reward_categories) do |format|\n format.json { render :json => @reward_categories.as_json }\n end\n end", "def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end", "def index\n @warriors = Warrior.all\n render :json => @warriors, :include => [:skills, :equipment_lists,]\n\n end", "def index\n @habilities = Hability.all\n end", "def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n respond_to do |format|\n format.json { render :json => @admins }\n format.xml { render :xml => @admins }\n format.html\n end\n end", "def actions() ; info[:actions] ; end", "def actions() ; info[:actions] ; end", "def index\n @goals = current_user.goals.where(archived: false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @achievements = Achievement.all\n respond_with @achievements\n end", "def index\n @responsibilities = Responsibility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responsibilities }\n end\n end", "def resource_actions\n @resource_actions ||= []\n end", "def index\n #@usemap = true\n\n @stories = Story.editable_user(current_user.id) \n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @stories }\n end\n end", "def actions\n @actions ||= []\n end", "def index\n @resources = resource_class.send(:all)\n render json: @resources\n end", "def index\n @equipment_lists = EquipmentList.all\n render :json => @equipment_lists, :include => [:weapons, :armours, :equipments]\n end", "def activos\n render :json => Producto.activo.all\n end", "def resources_actions\n @resources_actions ||= []\n end", "def index\n @scene_of_actions = SceneOfAction.all\n end", "def actions\n if @title == 'Action Items'\n @actions\n else\n Agenda.find('Action-Items').actions[@title]\n end\n end", "def index\n @admittings = Admitting.all\n render json: @admittings\n end", "def index\n @action_ideas = ActionIdea.all\n end", "def index\n if current_user\n @flats = Flat.all\n else\n @flats = Flat.where('displayed=? and approved=?', true, true).all\n end\n\n @facilities=Facility.where(\"is_building=?\", true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flats }\n end\n end", "def index\n #@shipmment_items = ShipmmentItem.all\n @shipmment_items = ShipmmentItem.accessible_by(current_ability)\n\n end", "def index\n @remedy_actions = RemedyAction.all\n end", "def index\n @faction_assets = FactionAsset.all\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def index\n @ticket_actions = TicketAction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_actions }\n end\n end", "def index\n @assets = Asset.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n format.xml { render xml: @assets }\n end\n end", "def index\n @adopters = Adopter.where(filtering_params)\n\n render json: @adopters\n end", "def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end" ]
[ "0.6987696", "0.6675143", "0.66332257", "0.6281451", "0.62372965", "0.6201639", "0.612287", "0.60770136", "0.6061981", "0.60551727", "0.60406095", "0.6033963", "0.60148203", "0.59778607", "0.5972194", "0.5968946", "0.59606934", "0.5938351", "0.5928417", "0.59201765", "0.588164", "0.5871835", "0.5871835", "0.5868715", "0.5844016", "0.5832913", "0.5820015", "0.5819112", "0.5815221", "0.58129424", "0.57793", "0.57778215", "0.57773393", "0.5762778", "0.57512903", "0.57411224", "0.57283914", "0.57154083", "0.5709904", "0.5700749", "0.569966", "0.56991655", "0.5696746", "0.56793225", "0.56774455", "0.567527", "0.56575966", "0.5657079", "0.5656237", "0.56447977", "0.5644726", "0.56434155", "0.5638887", "0.5623283", "0.56228703", "0.5619314", "0.5617384", "0.56166047", "0.5611803", "0.56039244", "0.56032294", "0.55966294", "0.5595697", "0.55938864", "0.5591114", "0.559101", "0.55849534", "0.5578643", "0.55703706", "0.55698717", "0.5561532", "0.5560174", "0.55578566", "0.5556536", "0.5552495", "0.555125", "0.555125", "0.554164", "0.5539998", "0.5531054", "0.5529891", "0.5513158", "0.5512799", "0.5512595", "0.5511261", "0.5509461", "0.55072063", "0.5506316", "0.5506293", "0.5501032", "0.5498434", "0.549318", "0.5490833", "0.5489465", "0.5485591", "0.54822516", "0.5481012", "0.54799247", "0.5474263", "0.54729736" ]
0.75978374
0
GET /actionables/1 GET /actionables/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @actionables = Actionable.all\n end", "def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end", "def show\n head :forbidden\n\n # @action = Action.find(params[:id])\n\n # render json: @action\n end", "def index\n @user_actions = UserAction.all\n render json: @user_actions\n end", "def show\n @attraction = Attraction.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @attraction }\n end\n end", "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "def abilities\n get('/ability/')\n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def accessories\n render json: { collections: Collection.published_accessories }\n end", "def show\n @action_name = ActionName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @action_name }\n end\n end", "def index\n @action_names = ActionName.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @action_names }\n end\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 @objectives = @goal.objectives.all \n render json: @objectives \n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def list\n List.from_response client.get(\"/actions/#{action_id}/list\")\n end", "def show\n render json: @accessory_category\n end", "def show\n @accessory_act = AccessoryAct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @accessory_act }\n end\n end", "def actions\n return @actions if @actions\n @actions = Client.get(\"/boards/#{id}/actions\").json_into(Action)\n end", "def show\n @action_type = ActionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @action_type }\n end\n end", "def index\n @weapons = Weapon.all\n\n render json: @weapons\n end", "def index\n @my_actions = MyAction.all\n end", "def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end", "def index\n @through_tables = ThroughTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @through_tables }\n end\n end", "def index\n @traits = Trait.all\n @trait_action_object_hash = Trait.action_object_hash\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traits }\n end\n end", "def actions\n client.actions\n end", "def show\n @through_table = ThroughTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @through_table }\n end\n end", "def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end", "def index\n @accessories = Accessory.all\n end", "def index\n @action_items = Actionitem.find :all\n @actions = Action.find :all\n\n session[:current_action] = params[:action_id] || 1 \n\n @action_now = Action.find(session[:current_action])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @actionitems }\n end\n end", "def index\n @abilities = Ability.all\n end", "def index\n @modalities = Modality.all\n json_response(@modalities)\n end", "def index\n @character_sheets = CharacterSheet.all \n @character_sheet = @character_sheets.first \n @skills = Skill.all\n @abilities = @character_sheet.abilities if @character_sheet\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @character_sheets }\n end\n end", "def index\n \n @shareables = Shareable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shareables }\n end\n end", "def index\n @player_actions = PlayerAction.all\n end", "def index\n #@food_items automatically set to FoodItem.accessible_by(current_ability)\n\n respond_to do |format|\n format.html { render 'index', layout: !(request.xhr?) }\n format.json { render json: @food_items }\n end\n end", "def get_action_info action_detail\n get_one_of action_detail\nend", "def index\n @actions = Action.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @actions }\n end\n end", "def index\n @cables = Cable.all\n end", "def index\n @cables = Cable.all\n end", "def index\n @actionlists = Actionlist.all\n end", "def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end", "def index\r\n @aes_actions = Action.all\r\n end", "def index\n @actiontypes = Actiontype.all\n end", "def show\n @instance_action = InstanceAction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance_action }\n end\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def index\n @unit_actions = UnitAction.all\n end", "def index\n @requests = Request.accessible_by(current_ability)\n\n \n\n end", "def index\n @cables = Cable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cables }\n end\n end", "def index\n @admission_types = AdmissionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @admission_types }\n end\n end", "def index\n @championships = Championship.all\n\n render json: @championships\n end", "def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end", "def index\n @client_accessories = ClientAccessory.all\n end", "def index\n @tredit_actions = TreditAction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tredit_actions }\n end\n end", "def ability(id)\n get(\"/ability/#{id}\")\n end", "def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mission }\n end\n end", "def index\n @resources = Resource.where(\"is_approved = true\")\n render json: @resources, status: 200\n end", "def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mission }\n end\n end", "def index\n @tournaments = Tournament.accessible_by(current_ability)\n @index_type = \"All\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tournaments }\n end\n end", "def index\n @accessories = Accessory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @accessories }\n end\n end", "def index\n @wallet_actions = WalletAction.all\n end", "def show\n @controller_action = ControllerAction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @controller_action }\n end\n end", "def index\n @weapons = Weapon.all\n render :json => @weapons, :include => :special_rules\n \n end", "def create\n @actionable = Actionable.new(actionable_params)\n\n respond_to do |format|\n if @actionable.save\n format.html { redirect_to @actionable, notice: 'Actionable was successfully created.' }\n format.json { render :show, status: :created, location: @actionable }\n else\n format.html { render :new }\n format.json { render json: @actionable.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @kactions = Kaction.all\n end", "def show\n @idea = Idea.find(params[:id])\n @member = member\n\n respond_to do |format|\n format.html do\n\t\t\t\t@sorted_idea_actions = @idea.idea_actions\n\t\t\t\trender :open_in_app\n\t\t\tend\n format.json do\n\t\t\t\t@sorted_idea_actions = @idea.idea_actions.member_first(current_member).incomplete_first\n\t\t\t\trender 'show'\n\t\t\tend\n end\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def show\n @deliverable = Deliverable.find(params[:id])\n @artifact = Artifact.find_by_deliverable_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deliverable }\n end\n end", "def show\n @equipment = Equipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipment }\n end\n end", "def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end", "def index\n @warriors = Warrior.all\n render :json => @warriors, :include => [:skills, :equipment_lists,]\n\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def index\n @habilities = Hability.all\n end", "def index\n @allocations = Allocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @allocations }\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 index\n @faction_assets = FactionAsset.all\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def show\n @action_list = ActionList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @action_list }\n end\n end", "def index\n @abuse_categories = AbuseCategory.find(:all , :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @abuse_categories }\n end\n end", "def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n @assets = @uploadable.assets\n respond_to do |format|\n format.html\n format.json { render json: @asset}\n end\n end", "def index\n authorize @model, :index?\n\n # @collection = @model.all\n\n render json: Oj.dump(\n collection: @model.all\n )\n end", "def index\n @responsibilities = Responsibility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responsibilities }\n end\n end", "def index\n @am_run_observation_types = AmRunObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @am_run_observation_types }\n end\n end", "def index\n @airplanes = Airplane.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @airplanes }\n end\n end", "def index\n @tools = Tool.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tools }\n end\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def index\n @person_equipments = PersonEquipment.all\n respond_to do |format|\n format.html\n format.json { render json: @person_equipments }\n end\n end", "def show\n @medium_mission = MediumMission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_mission }\n end\n end", "def index\n @task_contexts = TaskContext.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_contexts }\n end\n end", "def index\n getProfile\n @availabilities = @therapist.get_availabilities\n @rec_Availabilities = @therapist.get_recuring_availabilities(2000,1)\n respond_to do |format|\n format.html { redirect_to availabitity_index, notice: \"Appointment declined.\"}\n format.json { render :status => 200, :json => { action: :index,\n availabilities: @availabilities,\n rec_availabilities: @rec_Availabilities,\n user: @user, therapist: @therapist}}\n end\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def show\n render json: @championship\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def index\n @accessory_categories = AccessoryCategory.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @accessory_categories\n end", "def json_index_bundles\n\n @bundles = Bundle.where(\"active = 'y'\").order(:id)\n respond_to do |format|\n format.json { render json: @bundles.as_json()\n\n }\n end\n\n end", "def index\n champions = Champion.all\n render json: champions\n end", "def index\n @weapons_types = WeaponsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weapons_types }\n end\n end", "def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end", "def show\n render :json => @equipment_list, :include => [:weapons, :armours, :equipments]\n end", "def show\n @action_deduct = ActionDeduct.find(params[:id], :include => [:action_deduct_factors])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @action_deduct }\n format.json\t{\n\t \trender :json => mapping_to_hash(@action_deduct, ActionDeduct.json_mapping_table)\n\t }\n end\n end", "def index\n @choices = Choice.all\n\n render json: @choices\n end" ]
[ "0.71377814", "0.6579138", "0.6454183", "0.64122903", "0.61221945", "0.60725254", "0.60469925", "0.60214025", "0.6020366", "0.59657323", "0.59524304", "0.59500164", "0.5922773", "0.59190243", "0.58986944", "0.58745486", "0.58651984", "0.5864266", "0.58069384", "0.58045906", "0.57996476", "0.5776103", "0.5764812", "0.5759104", "0.5755048", "0.57492524", "0.57295465", "0.5723915", "0.5704456", "0.5696852", "0.5685322", "0.5677649", "0.56707513", "0.5663329", "0.5658519", "0.5658396", "0.5654945", "0.5642127", "0.5642127", "0.5632071", "0.5631496", "0.56281626", "0.56245124", "0.5616115", "0.56101394", "0.56029946", "0.560159", "0.55961084", "0.55921155", "0.5585747", "0.5583195", "0.5575861", "0.5567922", "0.55662054", "0.55421096", "0.55374455", "0.5537117", "0.55348766", "0.5533644", "0.55312735", "0.5527264", "0.55223626", "0.5522028", "0.55182254", "0.55102783", "0.55075824", "0.55070084", "0.55000776", "0.5487828", "0.5484819", "0.5475348", "0.5472653", "0.5472145", "0.5469015", "0.5462801", "0.5444291", "0.54433197", "0.54427266", "0.54406095", "0.5437858", "0.5437281", "0.54315597", "0.5420873", "0.54186606", "0.5417795", "0.5417577", "0.54151", "0.54150015", "0.54114497", "0.5407468", "0.5406991", "0.5405832", "0.5400506", "0.5400094", "0.539362", "0.5393592", "0.539273", "0.53887886", "0.5387329", "0.53869337", "0.5385554" ]
0.0
-1
POST /actionables POST /actionables.json
def create @actionable = Actionable.new(actionable_params) respond_to do |format| if @actionable.save format.html { redirect_to @actionable, notice: 'Actionable was successfully created.' } format.json { render :show, status: :created, location: @actionable } else format.html { render :new } format.json { render json: @actionable.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @actionables = Actionable.all\n end", "def create_actionable\n actionable_node = Neography::Node.create(\"object_id\" => self.id, \"object_type\" => self.class.to_s)\n actionable_node.add_to_index(\"actionables_nodes_index\", \"class0id\", \"#{self.class.to_s}0#{self.id}\")\n end", "def collection_post_action(action)\n action = action.to_s.gsub('bulk_', '').to_sym\n\n raise 'expected post, patch or put http action' unless (request.post? || request.patch? || request.put?)\n raise \"expected #{resource_name} to respond to #{action}!\" if resources.to_a.present? && !resources.first.respond_to?(\"#{action}!\")\n\n successes = 0\n\n ActiveRecord::Base.transaction do\n successes = resources.select do |resource|\n begin\n resource.public_send(\"#{action}!\") if EffectiveResources.authorized?(self, action, resource)\n rescue => e\n false\n end\n end.length\n end\n\n render json: { status: 200, message: \"Successfully #{action_verb(action)} #{successes} / #{resources.length} selected #{resource_plural_name}\" }\n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def bulk_action_params\n params.require(:bulk_action).permit(\n :action_type,\n :description,\n :pids,\n manage_release: [:tag, :what, :who, :to],\n set_governing_apo: [:new_apo_id],\n manage_catkeys: [:catkeys]\n )\n end", "def index\n @user_actions = UserAction.all\n render json: @user_actions\n end", "def set_actionable\n @actionable = Actionable.find(params[:id])\n end", "def post(action, **args); end", "def action_params\n params.require(:new_action).permit(:action_type, :ship_id)\n end", "def action_params\n params.require(:action).permit(:name, :status, :user_id)\n end", "def network_action_params\n params.require(:network_action).permit(:actor_id, :owner_id, :status, :priority, :network_event_id, :action_type, :description, :member_ids => [])\n end", "def create\n @accessory = Accessory.new(params[:accessory])\n\n if @accessory.save\n render json: @accessory, status: :created, location: @accessory\n else\n render json: @accessory.errors, status: :unprocessable_entity\n end\n end", "def create\n @accessory_act = AccessoryAct.new(params[:accessory_act])\n\n respond_to do |format|\n if @accessory_act.save\n format.html { redirect_to @accessory_act, :notice => 'Accessory act was successfully created.' }\n format.json { render :json => @accessory_act, :status => :created, :location => @accessory_act }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @accessory_act.errors, :status => :unprocessable_entity }\n end\n end\n end", "def actionable_params\n params.require(:actionable).permit(:student_requested_job, :employeer_requested_student_for_job, :student_approved_for_job, :appeared_at_job, :student_did_job_well, :job_id, :student_id)\n end", "def api_post(action, data)\n api_request(action, data, 'POST')\n end", "def create\n @action_idea = ActionIdea.new(action_idea_params)\n\n respond_to do |format|\n if @action_idea.save\n format.html { redirect_to @action_idea, notice: 'Action idea was successfully created.' }\n format.json { render :show, status: :created, location: @action_idea }\n else\n format.html { render :new }\n format.json { render json: @action_idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @action = params[:action_military_retreat_army_action]\n \n army = Military::Army.find(@action[:army_id])\n \n raise NotFoundError.new('army not found') if army.nil?\n raise BadRequestError.new('not owner of army') unless army.owner == current_character\n\n army.battle_retreat = @action[:retreat]\n raise BadRequestError.new('not owner of army') unless army.save \n\n respond_to do |format|\n format.html { redirect_to action_path, notice: 'Retreat army action was successfully executed.' }\n format.json { render json: {}, status: :created }\n end\n end", "def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end", "def actions=(action)\n @actions << action \n end", "def actionlist_params\n params.require(:actionlist).permit(:name)\n end", "def create\n @instance_action = InstanceAction.new(params[:instance_action])\n\n respond_to do |format|\n if @instance_action.save\n format.html { redirect_to @instance_action, notice: 'Instance action was successfully created.' }\n format.json { render json: @instance_action, status: :created, location: @instance_action }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def ability_params\n params.require(:ability).permit(:child_id, :skill_id, :status)\n end", "def actions\n client.actions\n end", "def create\n @user_action = UserAction.new(user_action_params)\n\n respond_to do |format|\n if @user_action.save\n format.html { redirect_to @user_action, notice: 'User action was successfully created.' }\n format.json { render :show, status: :created, location: @user_action }\n else\n format.html { render :new }\n format.json { render json: @user_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @actionable.update(actionable_params)\n format.html { redirect_to @actionable, notice: 'Actionable was successfully updated.' }\n format.json { render :show, status: :ok, location: @actionable }\n else\n format.html { render :edit }\n format.json { render json: @actionable.errors, status: :unprocessable_entity }\n end\n end\n end", "def action_idea_params\n params.require(:action_idea).permit(:user_id, :name, :description, :references, :category, :date_created, :active, :tags)\n end", "def create\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequestError.new('tried to join an alliance although character is already in an alliance') unless current_character.alliance.nil?\n raise UnauthorizedError.new('no character given') if params[:auto_join_alliance_action][:character_id].nil?\n raise UnauthorizedError.new('tried to access another character') if params[:auto_join_alliance_action][:character_id].to_i != current_character.id\n raise ForbiddenError.new('joining new alliance not allowed') if !current_character.can_join_or_create_alliance?\n\n\n alliance = Fundamental::Alliance.select_auto_join_alliance(current_character)\n\n raise NotFoundError.new('no suitable alliance found') if alliance.nil?\n raise ConflictError.new(\"too many members in alliance\") if alliance.full?\n raise ForbiddenError.new('auto join is disabled for this alliance') if !alliance.auto_joinable\n \n alliance.add_character(current_character)\n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def create\n @accounting_action = AccountingAction.new(accounting_action_params)\n\n respond_to do |format|\n if @accounting_action.save\n format.html { redirect_to @accounting_action, notice: 'Ação foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @accounting_action }\n else\n format.html { render :new }\n format.json { render json: @accounting_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_aliases(actions)\n resp = post do |req|\n req.url \"/_aliases\"\n req.body = { :actions => Array.new(actions) }\n end\n resp.body\n end", "def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end", "def create\n idea_hash = params[:idea]\n idea_hash[:idea_actions] = idea_hash[:idea_actions].blank? ? [] : idea_hash[:idea_actions].map { | action_attrs | IdeaAction.new(action_attrs.merge(member: current_member)) }\n idea_hash[:talks] = idea_hash[:talks].blank? ? [] : idea_hash[:talks].map { | talk_attrs | Talk.find(talk_attrs[:id]) }\n\n @idea = Idea.new(idea_hash)\n @idea.member = member\n\n respond_to do |format|\n if @idea.save\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @actionlist = Actionlist.new(actionlist_params)\n\n respond_to do |format|\n if @actionlist.save\n format.html { redirect_to @actionlist, notice: 'Actionlist was successfully created.' }\n format.json { render :show, status: :created, location: @actionlist }\n else\n format.html { render :new }\n format.json { render json: @actionlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def caste_params\n params.require(:caste).permit(:name, ability_ids: [])\n end", "def create\n @dosha_action = DoshaAction.new(dosha_action_params)\n\n respond_to do |format|\n if @dosha_action.save\n format.html { redirect_to @dosha_action, notice: 'Dosha action was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dosha_action }\n else\n format.html { render action: 'new' }\n format.json { render json: @dosha_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequestError.new('missing parameter(s)') if params[:change_alliance_auto_join_action].nil? || params[:change_alliance_auto_join_action][:alliance_id].blank? \n\n raise ForbiddenError.new('tried to do a leader action although not even in an alliance') if current_character.alliance_id.blank?\n raise ForbiddenError.new('tried to change setting on wrong alliance') unless current_character.alliance_id == params[:change_alliance_auto_join_action][:alliance_id].to_i\n raise ForbiddenError.new('only leader can change auto join setting') unless current_character.alliance_leader?\n \n alliance = current_character.alliance\n alliance.auto_join_disabled = !((params[:change_alliance_auto_join_action][:auto_join_setting] || \"0\") == \"1\")\n \n raise BadRequestError.new('saving the auto join setting did fail.') unless alliance.save\n\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def destroy\n @actionable.destroy\n respond_to do |format|\n format.html { redirect_to actionables_url, notice: 'Actionable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @miscellaneou = Miscellaneou.new(miscellaneou_params)\n\n respond_to do |format|\n if @miscellaneou.save\n format.html { redirect_to @miscellaneou, notice: 'Accessory was successfully created.' }\n format.json { render :show, status: :created, location: @miscellaneou }\n else\n format.html { render :new }\n format.json { render json: @miscellaneou.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse(json)\n actions = super(json)\n return [] if actions.nil?\n actions.collect do |raw_action|\n action = Action.new\n action.id = raw_action[\"id\"]\n action.name = raw_action[\"name\"]\n action.name_show = raw_action[\"name_show\"]\n action.done = raw_action[\"done\"] == 1\n action.done_time = raw_action[\"done_time\"]\n action.time = raw_action[\"time\"]\n action.next = raw_action[\"next\"] == \"next\"\n action.project = Nozbe::Project.new\n action.project.id = raw_action[\"project_id\"]\n action.project.name = raw_action[\"project_name\"]\n action.context = Nozbe::Context.new\n action.context.id = raw_action[\"context_id\"]\n action.context.name = raw_action[\"context_name\"]\n action.context.icon = raw_action[\"context_icon\"]\n action\n end\n end", "def create\n @my_action = MyAction.new(my_action_params)\n\n respond_to do |format|\n if @my_action.save\n format.html { redirect_to @my_action, notice: 'My action was successfully created.' }\n format.json { render :show, status: :created, location: @my_action }\n else\n format.html { render :new }\n format.json { render json: @my_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @default_ability = DefaultAbility.new(default_ability_params)\n\n respond_to do |format|\n if @default_ability.save\n format.html { redirect_to @default_ability, notice: 'Default ability was successfully created.' }\n format.json { render action: 'show', status: :created, location: @default_ability }\n else\n format.html { render action: 'new' }\n format.json { render json: @default_ability.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(action, params={}, options={})\n request(:post, action, params, options)\n end", "def create\r\n @aes_action = Action.new(aes_action_params)\r\n\r\n respond_to do |format|\r\n if @aes_action.save\r\n format.html { redirect_to @aes_action, notice: 'Aes action was successfully created.' }\r\n format.json { render :show, status: :created, location: @aes_action }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @aes_action.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create(action, force: false)\n @logger.info(\"Sending action request for #{action} with force #{force}.\")\n payload = { type: action }\n payload[:force] = force if force\n response = post(payload: payload)\n Action.new(response)\n end", "def formula_action_params\n params.require(:formula_action).permit(:formula_id, :formula_named_action_id)\n end", "def user_action_params\n Rails.logger.info(\"params: #{params}\")\n params.require(:user_action).permit([:description,:action_type,:action_subtype,:flyer_id,:user_id,:data])\n end", "def create\n @wallet_action = WalletAction.new(wallet_action_params)\n\n respond_to do |format|\n if @wallet_action.save\n format.html { redirect_to @wallet_action, notice: 'Wallet action was successfully created.' }\n format.json { render :show, status: :created, location: @wallet_action }\n else\n format.html { render :new }\n format.json { render json: @wallet_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @actiontype = Actiontype.new(actiontype_params)\n\n respond_to do |format|\n if @actiontype.save\n format.html { redirect_to @actiontype, notice: 'Actiontype was successfully created.' }\n format.json { render :show, status: :created, location: @actiontype }\n else\n format.html { render :new }\n format.json { render json: @actiontype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @modalities = Modality.create!(modality_params)\n json_response(@modalities, :created)\n end", "def create\n @adopter = Adopter.new(adopter_params)\n\n if @adopter.save\n render json: @adopter, status: :created, location: @adopter\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "def create\n @accessory = Accessory.new(accessory_params)\n\n respond_to do |format|\n if @accessory.save\n format.html { redirect_to @accessory, notice: 'Accessory was successfully created.' }\n format.json { render :show, status: :created, location: @accessory }\n else\n format.html { render :new }\n format.json { render json: @accessory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @action_object = ActionObject.new(action_object_params)\n\n respond_to do |format|\n if @action_object.save\n format.html { redirect_to action: 'index', notice: 'Objeto de Ação criado com sucesso.' }\n format.json { render :show, status: :created, location: @action_object }\n else\n format.html { render :new }\n format.json { render json: @action_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def accessory_params\n params.require(:accessory).permit(:name, :weapon, :shield)\n end", "def create\n @cable = Cable.new(params[:cable])\n authorize! :create, @cable\n\n respond_to do |format|\n if @cable.save\n format.html { redirect_to @cable, notice: 'Cable was successfully created.' }\n format.json { render json: @cable, status: :created, location: @cable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cable.errors, status: :unprocessable_entity }\n end\n end\n end", "def action_item_params\n params.require(:action_item).permit(:content, :emotion, :sentiment)\n end", "def api_post(action, data, binary_key = nil)\n api_request(action, data, 'POST', binary_key)\n end", "def create\n @kaction = Kaction.new(kaction_params)\n\n respond_to do |format|\n if @kaction.save\n format.html { redirect_to @kaction, notice: 'Action was successfully created.' }\n format.json { render :show, status: :created, location: @kaction }\n else\n format.html { render :new }\n format.json { render json: @kaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @datum = Datum.new(params[:datum])\n @datum.action_list = ActionList.new(:name => \"Empty\")\n @datum.action_list.datum = @datum\n @datum.user = current_user\n @user_state = current_user.user_state\n respond_to do |format|\n if not @datum.action_list.save\n format.html { render action: \"new\" }\n format.json { render json: @datum.action_list.errors, status: :unprocessable_entity }\n elsif not @datum.save\n format.html { render action: \"new\" }\n format.json { render json: @datum.errors, status: :unprocessable_entity }\n else\n @user_state.reset(@datum.action_list.id)\n\n if not @user_state.save\n format.html { render action: \"new\" }\n format.json { render json: @user_state.errors, status: :unprocessable_entity }\n\n else\n format.html { redirect_to @datum, notice: 'Datum was successfully created.' }\n format.json { render json: @datum, status: :created, location: @datum }\n end\n end\n end\n end", "def store_action_items\n return unless self.all_action_items\n\n self.all_action_items.delete :retrieved_file\n\n if self.class.columns_hash[item_actions_field].type == :string\n send \"#{item_actions_field}=\", self.all_action_items.to_json\n else\n send \"#{item_actions_field}=\", self.all_action_items\n end\n end", "def create\n api_response = paralleldots_api_call(params[:action_item][:content]) \n #oxford_response = oxford_api_call(\"mountain\")\n\n api_response_to_save = api_response.select do |key,value|\n [:emotion, :sentiment].include?(key)\n end \n\n api_response_to_update = api_response.select do |key,value|\n [:emotion_probabilities, :sentiment_probabilities].include?(key)\n end \n \n @action_item = ActionItem.new(action_item_params.merge(api_response_to_save)) #To save\n\n #@action_item.user_id = session[:user_id]\n user = User.find(session[:user_id].to_i)\n team = Team.find(session[:team_id].to_i)\n\n @action_item.user = user\n @action_item.team = team\n #puts @action_item\n #puts @action_item.inspect\n #update_team_score\n\n respond_to do |format|\n if @action_item.save()\n format.html { redirect_to action_items_path, notice: 'Action item was successfully created.' }\n format.json { render :show, status: :created, location: @action_item }\n else\n puts @action_item.errors.full_messages\n @error_message = \"Action Item not saved\"\n format.html { render :create}\n format.json { render json: @action_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payable_action = PayableAction.new(params[:payable_action])\n\n respond_to do |format|\n if @payable_action.save\n flash[:notice] = 'PayableAction was successfully created.'\n format.html { redirect_to([:admin, @payable_action]) }\n format.xml { render :xml => @payable_action, :status => :created, :location => @payable_action }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payable_action.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @therapy = Therapy.new(therapy_params)\n category = TherapyCategory.create(name: @therapy.name)\n category.therapies << @therapy\n\n respond_to do |format|\n if @therapy.save\n format.html { redirect_to @therapy }\n format.json { render :show, status: :created, location: @therapy }\n else\n format.html { render :new }\n format.json { render json: @therapy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @network_action = NetworkAction.new(network_action_params)\n @network_action.user = current_user\n\n respond_to do |format|\n if @network_action.save\n format.html { redirect_to @network_action, notice: 'Network action was successfully created.' }\n format.json { render :show, status: :created, location: @network_action }\n else\n format.html { render :new }\n format.json { render json: @network_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @action_names = ActionName.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @action_names }\n end\n end", "def create\n @unit_action = UnitAction.new(unit_action_params)\n\n respond_to do |format|\n if @unit_action.save\n format.html { redirect_to @unit_action, notice: 'Unit action was successfully created.' }\n format.json { render :show, status: :created, location: @unit_action }\n else\n format.html { render :new }\n format.json { render json: @unit_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accessory = Accessory.new(params[:accessory])\n\n respond_to do |format|\n if @accessory.save\n format.html { redirect_to @accessory, notice: 'Accessory was successfully created.' }\n format.json { render json: @accessory, status: :created, location: @accessory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accessory.errors, status: :unprocessable_entity }\n end\n end\n end", "def ability_params\n params.require(:ability).permit(:number, :name, :description, :shortdescription)\n end", "def create\n Filter.create! :json_contents => params[:filter]\n\n render json: {\n success: true\n }\n end", "def action_params\n params.permit(:type_of_entity, :type_of_action, :entity_id, :user_id, :content)\n end", "def set_actions\n @actions = []\n end", "def create_many\n ids = []\n promotions_errors = []\n promotionable_ids = params.require(:promotionable_ids)\n promotionable_type = promotion_params[:promotionable_type]\n promotionable_ids.each do |id|\n promotion = Promotion.where(promotionable_id: id, promotionable_type: promotionable_type).first\n if promotion.blank?\n promotion = Promotion.new(promotionable_id: id, promotionable_type: promotionable_type)\n unless promotion.save\n promotions_errors << promotion.errors\n end\n end\n ids << promotion.id\n end\n @promotions = Promotion.find(ids)\n respond_to do |format|\n unless promotions_errors.count > 0\n format.json { render :index, status: :created, location: promotions_url }\n else\n format.json { render json: promotions_errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @player_action = PlayerAction.new(player_action_params)\n\n respond_to do |format|\n if @player_action.save\n format.html { redirect_to @player_action, notice: 'Player action was successfully created.' }\n format.json { render :show, status: :created, location: @player_action }\n else\n format.html { render :new }\n format.json { render json: @player_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @actions = [] unless defined?(@actions)\n @actions << :create\n end", "def create\r\n # @user = User.find(session[:user_id])\r\n # @usertable = Usertable.new(params[:usertable])\r\n # @usertable.user = @user\r\n\r\n @user = current_user\r\n @usertable = Usertable.new(params[:usertable])\r\n @usertable.user = @user\r\n\r\n respond_to do |format|\r\n if @usertable.save\r\n format.html { redirect_to @usertable, notice: 'Your mood was successfully saved.' }\r\n format.json { render json: @usertable, status: :created, location: @usertable }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @usertable.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n if @mission.torched_by? current_user\n return respond_to do |format|\n format.html { redirect_to mission_path(@mission) }\n format.json { head :no_content }\n end\n end\n @mission.torches.create torcher: current_user\n respond_to do |format|\n # TODO: notification and activity\n format.html { redirect_to mission_path(@mission), notice: t('missions.torch_awarded_successfully') }\n format.json { render json: { count: @mission.torches.count } }\n end\n end", "def create\n @remedy_action = RemedyAction.new(remedy_action_params)\n\n respond_to do |format|\n if @remedy_action.save\n format.html { redirect_to @remedy_action, notice: 'Remedy action was successfully created.' }\n format.json { render :show, status: :created, location: @remedy_action }\n else\n format.html { render :new }\n format.json { render json: @remedy_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @traits = Trait.all\n @trait_action_object_hash = Trait.action_object_hash\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traits }\n end\n end", "def create\n @accessory_category = AccessoryCategory.new(accessory_category_params)\n\n if @accessory_category.save\n audit(@accessory_category, current_user)\n render json: @accessory_category, status: :created\n else\n render json: @accessory_category.errors, status: :unprocessable_entity\n end\n end", "def create\n @pizza = Pizza.new(pizza_params)\n if @pizza.save\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end", "def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n Ability.all.each {|a|\n CharacterAbility.create(ability: a, character: @character, value: 10)\n }\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ticket = Ticket.find(params[:ticket_action][:ticket_id])\n# logger.debug(@ticket.to_yaml)\n @ticket_action = @ticket.ticket_actions.build(params[:ticket_action])\n\n respond_to do |format|\n if @ticket_action.save\n flash[:notice] = 'TicketAction was successfully created.'\n format.html { redirect_to(@ticket_action) }\n format.xml { render :xml => @ticket_action, :status => :created, :location => @ticket_action }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ticket_action.errors, :status => :unprocessable_entity }\n end\n end\n end", "def as_nested_actions; end", "def create\n @editability = Editability.new(params[:test])\n\n respond_to do |format|\n if @editability.save\n format.html { redirect_to @editability, notice: 'Test was successfully created.' }\n format.json { render json: @editability, status: :created, location: @test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @editability.errors, status: :unprocessable_entity }\n end\n end\n end", "def bulk(actions)\n raise NotImplemented, \"You must implement this yourself\"\n # bulk([\n # '{ \"index\" : { \"_index\" : \"test\", \"_type\" : \"type1\", \"_id\" : \"1\" } }',\n # '{ \"field1\" : \"value1\" }'\n #])\n end", "def create\n @users_products_wanted_action = UsersProductsWantedAction.new(params[:users_products_wanted_action])\n\n respond_to do |format|\n if @users_products_wanted_action.save\n format.html { redirect_to @users_products_wanted_action, notice: 'Users products wanted action was successfully created.' }\n format.json { render json: @users_products_wanted_action, status: :created, location: @users_products_wanted_action }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users_products_wanted_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @action = params[:action_military_create_army_action]\n \n location = Map::Location.find(@action[:location_id])\n garrison_army = location.garrison_army\n\n raise BadRequestError.new('no garrison at location') if garrison_army.nil? \n raise BadRequestError.new('not owner of location') unless location.owner == current_character\n raise BadRequestError.new('not owner of garrison') unless garrison_army.owner == current_character\n raise ForbiddenError.new('garrison is not idle') unless garrison_army.mode == Military::Army::MODE_IDLE\n raise ForbiddenError.new('garrison is fighting') unless garrison_army.battle_id.nil?\n \n army_size = 0\n GameRules::Rules.the_rules.unit_types.each do | unit_type |\n if !@action[unit_type[:db_field]].nil? && @action[unit_type[:db_field]].to_i < 0\n raise BadRequestError.new('negative unit quantity')\n end\n if !@action[unit_type[:db_field]].nil? && @action[unit_type[:db_field]].to_i > 0\n army_size += @action[unit_type[:db_field]].to_i\n end\n end\n raise ForbiddenError.new('army would be larger than the allowed size') if army_size > location.settlement.army_size_max \n \n raise BadRequestError.new('not enough units in army') unless garrison_army.contains?(@action)\n raise BadRequestError.new('not enough command points') unless location.settlement.command_points_available?\n garrison_army.reduce_units(@action)\n Military::Army.create_with_action(@action)\n\n respond_to do |format|\n format.html { redirect_to action_path, notice: 'Move army action was successfully executed.' }\n format.json { render json: {}, status: :created }\n end\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end", "def create\n @admitting = Admitting.new(admitting_params)\n\n if @admitting.save\n render json: @admitting, status: :created, location: @admitting\n else\n render json: @admitting.errors, status: :unprocessable_entity\n end\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 create\n @recipe = Recipe.new(recipe_params)\n @recipe.uuid = SecureRandom.uuid\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe.objective}\n format.json { render :show, status: :created, location: @recipe.objective }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @through_table = ThroughTable.new(params[:through_table])\n\n respond_to do |format|\n if @through_table.save\n format.html { redirect_to @through_table, notice: 'Through table was successfully created.' }\n format.json { render json: @through_table, status: :created, location: @through_table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @through_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dosha_actions = DoshaAction.all\n end", "def create\n #When creating a new mission, current point should default to zero\n @mission = Mission.new()\n # @mission = Mission.new({\"name\" => params[:name], \"goal_points\" => params[:goal_points].to_i, \"current_points\" => 0, \"image\" => params[:image]})\n @mission.name = params[:name]\n @mission.goal_points = params[:goal_points].to_i\n @mission.current_points = 0\n @mission.image = params[:image]\n \n \n if @mission.valid? \n @mission.save!\n respond_to do |format|\n format.json { render json: @mission }\n format.xml { render xml: @mission }\n end\n else\n respond_to do |format|\n #format.json { render action: 'index' }\n format.json { render json: @mission.errors,status: :unprocessable_entity }\n \n end\n end\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def actiontype_params\n params.require(:actiontype).permit(:name, :usedby)\n end", "def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @disability = Disability.new(params[:disability])\n\n add_missing_translation_content(@disability.disability_translations)\n\n respond_to do |format|\n if @disability.save\n format.html { redirect_to admin_disability_path(@disability), notice: t('app.msgs.success_created', :obj => t('activerecord.models.disability')) }\n format.json { render json: @disability, status: :created, location: @disability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @disability.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @action_item = ActionItem.new(params[:action_item])\n @action_item.person = current_person\n\n respond_to do |format|\n if @action_item.save\n format.html { redirect_to(@action_item, :notice => 'Action item was successfully created.') }\n format.xml { render :xml => @action_item, :status => :created, :location => @action_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @action_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @my_actions = MyAction.all\n end" ]
[ "0.6378845", "0.59932905", "0.5918275", "0.5736906", "0.57261574", "0.5713055", "0.5677671", "0.5586333", "0.55838335", "0.5547208", "0.55451936", "0.55003744", "0.54988986", "0.5453329", "0.5431675", "0.53686136", "0.5320863", "0.53139377", "0.5297027", "0.5290968", "0.5283099", "0.5275274", "0.5272801", "0.5249919", "0.5239801", "0.5233249", "0.5230429", "0.52281564", "0.52188087", "0.5207178", "0.5203137", "0.5198863", "0.5191954", "0.51830673", "0.5182509", "0.51792175", "0.5171628", "0.51457304", "0.514328", "0.5140148", "0.51386446", "0.5130212", "0.51252675", "0.51049906", "0.51040614", "0.5095189", "0.5090894", "0.5090486", "0.5089326", "0.50737506", "0.507129", "0.5070437", "0.5068615", "0.50623333", "0.50573015", "0.5057008", "0.5048104", "0.5040613", "0.50372744", "0.5032748", "0.5032414", "0.5029952", "0.5027399", "0.50265133", "0.5024991", "0.5024478", "0.5022214", "0.5021932", "0.50161827", "0.5014616", "0.50117", "0.5009824", "0.50074995", "0.50073975", "0.5006457", "0.5001427", "0.5000857", "0.49972937", "0.49883944", "0.49880844", "0.49876624", "0.49829486", "0.49814644", "0.49794906", "0.49753878", "0.4960699", "0.49574405", "0.49546784", "0.49532595", "0.49508643", "0.4946732", "0.4946134", "0.4944202", "0.49422094", "0.49384567", "0.49369922", "0.49348497", "0.4934067", "0.49300826", "0.49193436" ]
0.66605294
0
PATCH/PUT /actionables/1 PATCH/PUT /actionables/1.json
def update respond_to do |format| if @actionable.update(actionable_params) format.html { redirect_to @actionable, notice: 'Actionable was successfully updated.' } format.json { render :show, status: :ok, location: @actionable } else format.html { render :edit } format.json { render json: @actionable.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end", "def patch(action, **args); end", "def update\n @editability = Editability.find(params[:id])\n\n respond_to do |format|\n if @editability.update_attributes(params[:editability])\n format.html { redirect_to @editability, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @editability.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @action_object.update(action_object_params)\n format.html { redirect_to action: 'index', notice: 'Objeto de Ação alterado com sucesso.'}\n format.json { render :show, status: :ok, location: @action_object }\n else\n format.html { render :edit }\n format.json { render json: @action_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cable = Cable.find(params[:id])\n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cable.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @usertable = Usertable.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @usertable.update_attributes(params[:usertable])\r\n format.html { redirect_to @usertable, notice: 'Your mood was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @usertable.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @accessory_act = AccessoryAct.find(params[:id])\n\n respond_to do |format|\n if @accessory_act.update_attributes(params[:accessory_act])\n format.html { redirect_to @accessory_act, :notice => 'Accessory act was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @accessory_act.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cable = Cable.find(params[:id])\n authorize! :update, @cable\n \n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { redirect_to @cable, notice: 'Cable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render status: 501, json: { errors: ['Action not implemented yet!'] }\n end", "def update\n respond_to do |format|\n if @action_item.update(action_item_params)\n format.html { redirect_to @action_item, notice: 'Action item was successfully updated.' }\n format.json { render :show, status: :ok, location: @action_item }\n else\n format.html { render :edit }\n format.json { render json: @action_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @orderable_concept = OrderableConcept.find(params[:id])\n\n respond_to do |format|\n if @orderable_concept.update_attributes(params[:orderable_concept])\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orderable_concept.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @default_ability.update(default_ability_params)\n format.html { redirect_to @default_ability, notice: 'Default ability was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @default_ability.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end", "def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end", "def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end", "def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n respond_to do |format|\n if @equipment_things_to_check.update(equipment_things_to_check_params)\n format.html { redirect_to @equipment_things_to_check, notice: 'Equipment things to check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @equipment_things_to_check.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @anything.update(anything_params)\n format.html { redirect_to @anything, notice: 'Anything was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @anything.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @accessory = Accessory.find(params[:id])\n\n if @accessory.update_attributes(params[:accessory])\n head :no_content\n else\n render json: @accessory.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @my_action.update(my_action_params)\n format.html { redirect_to @my_action, notice: 'My action was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_action }\n else\n format.html { render :edit }\n format.json { render json: @my_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @action_file = ActionFile.find(params[:id])\n\n respond_to do |format|\n if @action_file.update_attributes(params[:action_file])\n format.html { redirect_to @action_file, notice: 'Action file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @action_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payable_action = PayableAction.find(params[:id])\n\n respond_to do |format|\n if @payable_action.update_attributes(params[:payable_action])\n flash[:notice] = 'PayableAction was successfully updated.'\n format.html { redirect_to([:admin, @payable_action]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payable_action.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @itemstable = Itemstable.find(params[:id])\n\n respond_to do |format|\n if @itemstable.update_attributes(params[:itemstable])\n format.html { redirect_to @itemstable, notice: 'Itemstable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @itemstable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @action_name = ActionName.find(params[:id])\n\n respond_to do |format|\n if @action_name.update_attributes(params[:action_name])\n format.html { redirect_to @action_name, notice: 'Action name was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @action_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @action_idea.update(action_idea_params)\n format.html { redirect_to @action_idea, notice: 'Action idea was successfully updated.' }\n format.json { render :show, status: :ok, location: @action_idea }\n else\n format.html { render :edit }\n format.json { render json: @action_idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @operation = Operation.find(params[:id])\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n format.html { redirect_to user_model_path(@model.user,@model), notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @act = Act.find(params[:id])\n\n respond_to do |format|\n if @act.update_attributes(params[:act])\n format.html { redirect_to acts_path, notice: 'act was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @packing_list = PackingList.find(params[:packing_list_id])\n @context = @packing_list.context\n @packable = @packing_list.packables.find(params[:packable_id])\n\n respond_to do |format|\n if @packable.update_attributes(params[:packable])\n format.html { redirect_to @packing_list, notice: 'Packing List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @packable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @through_table = ThroughTable.find(params[:id])\n\n respond_to do |format|\n if @through_table.update_attributes(params[:through_table])\n format.html { redirect_to @through_table, notice: 'Through table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @through_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instance_action = InstanceAction.find(params[:id])\n\n respond_to do |format|\n if @instance_action.update_attributes(params[:instance_action])\n format.html { redirect_to @instance_action, notice: 'Instance action was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @actiontype.update(actiontype_params)\n format.html { redirect_to @actiontype, notice: 'Actiontype was successfully updated.' }\n format.json { render :show, status: :ok, location: @actiontype }\n else\n format.html { render :edit }\n format.json { render json: @actiontype.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n respond_to do |format|\n if @equipment_model.update(equipment_model_params)\n format.html { redirect_to @equipment_model, notice: t('.update_ok', item: @equipment_model.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @equipment_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with []\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dispatching = Dispatching.find(params[:id])\n workflow = @dispatching.workflow\n respond_to do |format|\n if params[:warranty] == \"进厂\"\n if @dispatching.update_attributes(params[:dispatching])\n workflow.update_attributes(:status => \"vehicle\")\n workflow.user_ids = params[:repairman_ids]\n workflow.users.each do |user|\n user.update_attributes(:status => \"busy\")\n end\n format.json { head :ok }\n else\n format.json { render :json => @dispatching.errors, :status => :unprocessable_entity }\n end\n elsif params[:warranty] == \"救援\"\n if @dispatching.update_attributes(params[:dispatching])\n workflow.update_attributes(:status => \"newpart\")\n format.json {head :ok}\n else\n format.json { render :json => @dispatching.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n if @faction.update_attributes(params[:faction])\n format.html { redirect_to admin_factions_url, notice: 'Faction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @faction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @actionlist.update(actionlist_params)\n format.html { redirect_to @actionlist, notice: 'Actionlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @actionlist }\n else\n format.html { render :edit }\n format.json { render json: @actionlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @objective.strategy, :update_objective?\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective}\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\n # else\n # format.html { render :edit }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @food_expenditure.update(food_expenditure_params)\n @food_expenditure.update_attributes(:edit_able=>false)\n format.html { redirect_to @food_expenditure, notice: 'FoodExpenditure was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_expenditure }\n else\n format.html { render :edit }\n format.json { render json: @food_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_asset = ClientAsset.find(params[:id])\n if params[:client_asset][:referenceable_type] == \"Asset\"\n # Fetch asset from Asset model\n elsif params[:client_asset][:referenceable_type] == \"Device\"\n @client_asset.referenceable_id = params[:device_id]\n elsif params[:client_asset][:referenceable_type] == \"Computer\"\n @client_asset.referenceable_id = params[:computer_id]\n end\n \n respond_to do |format|\n if @client_asset.update_attributes(params[:client_asset])\n format.html { redirect_to @client_asset, notice: \"#{@client_asset.client_name}'s asset was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @action_item = ActionItem.find(params[:id])\n\n respond_to do |format|\n if @action_item.update_attributes(params[:action_item])\n format.html { redirect_to(@action_item, :notice => 'Action item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @action_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thing_to_do.update(thing_to_do_params)\n format.html { redirect_to @thing_to_do, notice: 'Thing to do was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thing_to_do.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @acticle.update(acticle_params)\n format.html { redirect_to @acticle, notice: 'Acticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @acticle }\n else\n format.html { render :edit }\n format.json { render json: @acticle.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @accounting_action.update(accounting_action_params)\n format.html { redirect_to @accounting_action, notice: 'Ação foi atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @accounting_action }\n else\n format.html { render :edit }\n format.json { render json: @accounting_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @act.update(act_params)\n format.html { redirect_to @act.play, notice: 'Act was successfully updated.' }\n format.json { respond_with_bip(@act) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@act) }\n end\n end\n end", "def update\n @objective = Objective.find(params[:id])\n\n respond_to do |format|\n if @objective.update_attributes(params[:objective])\n format.html { redirect_to @objective, notice: 'Objective was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deliverable = Deliverable.find(params[:id])\n\n respond_to do |format|\n if @deliverable.update_attributes(params[:deliverable])\n format.html { redirect_to @deliverable, :notice => 'Deliverable was successfully updated.' }\n format.json { respond_with_bip(@deliverable)}\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@deliverable)}\n end\n end\n end", "def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n updated = params[:availabilities].keys.map(&:to_i)\n #existing = @person.availabilities.map(&:timeslot_id)\n #new = updated - existing\n #deleted = existing - updated\n #@person.availabilities.delete(deleted.map{|d| @person.availabilities.find_by_timeslot_id(d)})\n @person.availabilities=(updated.map{|t| @person.availabilities.find_or_create_by_timeslot_id(t)})\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to admin_operations_path, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def task_action\n action = params[:task_action]\n @task.update status: action \n respond_to do |format|\n format.html { redirect_to edit_ticket_path(@ticket), notice: \"Task #{action}.\" }\n format.json { head :no_content }\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @action = args[:action] if args.key?(:action)\n @paths = args[:paths] if args.key?(:paths)\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n respond_to_update({thing: @author})\n end", "def update\n @thing = current_user.things.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @operation_item.update(operation_item_params)\n format.html { redirect_to :action => :index, notice: 'Operation item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, :notice => 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n @clients = Client.all.collect{ |c| [c.name, c.id] }\n @aircraft_types = AircraftType.all(:order => :name).collect{|c| [c.name, c.id]}\n\n format.html { render :action => \"edit\" }\n format.json { render :json => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cta.update(cta_params)\n format.html { redirect_to @cta, notice: 'cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n @initiative.phase_id=params[:phase_id]\n\n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n format.html { render :nothing => true }\n #format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @xaction = Xaction.find(params[:id])\n\n respond_to do |format|\n if @xaction.update_attributes(params[:xaction])\n format.html { redirect_to @xaction, notice: 'Xaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @xaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(action)\n return unless action[:type] == action_type\n\n super\n end", "def update\n respond_to do |format|\n if @eatable.update(eatable_params)\n format.html { redirect_to @eatable, notice: 'Eatable was successfully updated.' }\n format.json { render :show, status: :ok, location: @eatable }\n else\n format.html { render :edit }\n format.json { render json: @eatable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @actore = Actore.find(params[:id])\n\n respond_to do |format|\n if @actore.update_attributes(params[:actore])\n format.html { redirect_to @actore, notice: 'Actore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @actore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n if @fiction.update_attributes(params[:fiction])\n format.html { redirect_to @fiction, notice: 'Fiction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n @chimpaction = Chimpaction.find(params[:id])\n\n respond_to do |format|\n if @chimpaction.update_attributes(params[:chimpaction])\n format.html { redirect_to(chimpactions_url, :notice => 'Chimpaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @chimpaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # this action is not provided for partyroles\n end" ]
[ "0.6737716", "0.6182605", "0.61328727", "0.600249", "0.59972954", "0.5982557", "0.593613", "0.59163475", "0.5911129", "0.5909275", "0.58852", "0.58827823", "0.5874014", "0.58598995", "0.58342785", "0.58342785", "0.58342785", "0.58342785", "0.5832853", "0.58304155", "0.58228785", "0.58188695", "0.581072", "0.5809106", "0.57964206", "0.5796258", "0.57881576", "0.57847816", "0.5781092", "0.5776431", "0.57748777", "0.577164", "0.57703847", "0.57664883", "0.57472914", "0.5739375", "0.57387304", "0.5737721", "0.57314545", "0.5729372", "0.5729035", "0.57227385", "0.5712727", "0.5712727", "0.57113487", "0.5710683", "0.5710608", "0.5705704", "0.5704772", "0.5702533", "0.57024413", "0.56967646", "0.56903315", "0.56867075", "0.5685128", "0.56787395", "0.56749636", "0.56748295", "0.5674518", "0.5674403", "0.5670947", "0.56695527", "0.5667795", "0.566714", "0.566395", "0.56632394", "0.56586325", "0.56582326", "0.5653833", "0.56526893", "0.5648741", "0.56487304", "0.56485695", "0.56467235", "0.5640607", "0.5639253", "0.56373274", "0.5632405", "0.56288403", "0.5626298", "0.56209415", "0.56184846", "0.56085986", "0.5608476", "0.56023794", "0.5602314", "0.5600351", "0.559562", "0.5595511", "0.5594279", "0.559389", "0.5593717", "0.559108", "0.55895126", "0.5587757", "0.55852807", "0.5584399", "0.558226", "0.5579297", "0.5578917" ]
0.68141884
0
DELETE /actionables/1 DELETE /actionables/1.json
def destroy @actionable.destroy respond_to do |format| format.html { redirect_to actionables_url, notice: 'Actionable was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end", "def delete(action, **args); end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @accessory_act = AccessoryAct.find(params[:id])\n @accessory_act.destroy\n\n respond_to do |format|\n format.html { redirect_to accessory_acts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_name = ActionName.find(params[:id])\n @action_name.destroy\n\n respond_to do |format|\n format.html { redirect_to action_names_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @action_item.destroy\n respond_to do |format|\n format.html { redirect_to action_items_url, notice: 'Action item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @actionlist.destroy\n respond_to do |format|\n format.html { redirect_to actionlists_url, notice: 'Actionlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n @dosha_action.destroy\n respond_to do |format|\n format.html { redirect_to dosha_actions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n head :forbidden\n # @action = Action.find(params[:id])\n # @action.destroy\n\n # head :no_content\n end", "def destroy\n @editability = Editability.find(params[:id])\n @editability.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @payable_action = PayableAction.find(params[:id])\n @payable_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_actions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @usertable = Usertable.find(params[:id])\r\n @usertable.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to usertables_url }\r\n format.json { head :ok }\r\n end\r\n end", "def delete!\n request! :delete\n end", "def destroy\n @medium_mission = MediumMission.find(params[:id])\n @medium_mission.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_missions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @actiontype.destroy\n respond_to do |format|\n format.html { redirect_to actiontypes_url, notice: 'Actiontype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @adhoc_deliverable = Deliverable.find(params[:id])\n #delete adhoc deliverable from database\n @adhoc_deliverable.destroy\n\n respond_to do |format|\n format.html { redirect_to adhoc_deliverables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stable = Stable.find(params[:id])\n @stable.destroy\n\n respond_to do |format|\n format.html { redirect_to stables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cable = Cable.find(params[:id])\n @cable.destroy\n authorize! :destroy, @cable\n\n respond_to do |format|\n format.html { redirect_to cables_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @xaction = Xaction.find(params[:id])\n @xaction.destroy\n\n respond_to do |format|\n format.html { redirect_to xactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_object.destroy\n respond_to do |format|\n format.html { redirect_to action_objects_url, notice: 'Objeto de Ação apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end", "def delete_resource_action(type, id = nil, data = nil)\n api_resource(type, id, \"Detaching\") do |resource|\n delete_resource_main_action(type, resource, data)\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @instance_action = InstanceAction.find(params[:id])\n @instance_action.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_actions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n head :no_content\n end", "def destroy\n @deliverable = Deliverable.find(params[:id])\n @deliverable.destroy\n\n respond_to do |format|\n format.html { redirect_to deliverables_url }\n format.json { head :ok }\n end\n end", "def destroy\n @disability = Disability.find(params[:id])\n @disability.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_disabilities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @through_table = ThroughTable.find(params[:id])\n @through_table.destroy\n\n respond_to do |format|\n format.html { redirect_to through_tables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accessory.destroy\n respond_to do |format|\n format.html { redirect_to accessories_url, notice: 'Accessory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_item = ActionItem.find(params[:id])\n @action_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @actum.destroy\n respond_to do |format|\n format.html { redirect_to acta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_action.destroy\n respond_to do |format|\n format.html { redirect_to my_actions_url, notice: 'My action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ab_reltionship.destroy\n respond_to do |format|\n format.html { redirect_to ab_reltionships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n render json: @objective \n end", "def destroy\n @shareable = Shareable.find(params[:id])\n @shareable.destroy\n\n respond_to do |format|\n format.html { redirect_to shareables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admission_type = AdmissionType.find(params[:id])\n @admission_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admission_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_accessory.destroy\n respond_to do |format|\n format.html { redirect_to client_accessories_url, notice: 'Client accessory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @equipment_things_to_check.destroy\n respond_to do |format|\n format.html { redirect_to equipment_things_to_checks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @actionitem = Actionitem.find(params[:id])\n @actionitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(actionitems_url) }\n format.xml { head :ok }\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 authorize @objective.strategy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sa_action_type.destroy\n respond_to do |format|\n format.html { redirect_to sa_action_types_url, notice: 'Sa action type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n respond_to do |format|\n format.html { redirect_to(accessories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n if options = Option.find_all_by_accessory_id(params[:id])\n options.each do |option|\n option.destroy\n end\n end\n respond_to do |format|\n format.html { redirect_to(accessories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_action.destroy\n respond_to do |format|\n format.html { redirect_to admin_actions_url, notice: 'Admin action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wallet_action.destroy\n respond_to do |format|\n format.html { redirect_to wallet_actions_url, notice: 'Wallet action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @through_reference = ThroughReference.find(params[:id])\n @through_reference.destroy\n\n respond_to do |format|\n format.html { redirect_to through_references_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deliverable.destroy\n respond_to do |format|\n format.html { redirect_to deliverables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_adicional.destroy\n respond_to do |format|\n format.html { redirect_to item_adicionals_url, notice: 'Item adicional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @action_type = ActionType.find(params[:id])\n @action_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_action_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_animal = StatusAnimal.find(params[:id])\n @status_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to status_animais_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to admin_missions_url, notice: 'Mission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @consumable.destroy\n respond_to do |format|\n format.html { redirect_to consumables_url, notice: 'Consumable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @consumable.destroy\n respond_to do |format|\n format.html { redirect_to consumables_url, notice: \"Consumable was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_mission_strategy = MediumMissionStrategy.find(params[:id])\n @medium_mission_strategy.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_mission_strategies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_list = ActionList.find(params[:id])\n @action_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n @ways_of_admission.destroy\n\n respond_to do |format|\n format.html { redirect_to ways_of_admissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @distraction = Distraction.find(params[:id])\n @distraction.destroy\n\n respond_to do |format|\n format.html { redirect_to distractions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auctionable.destroy\n respond_to do |format|\n format.html { redirect_to auctionables_url, notice: 'Auctionable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_file = ActionFile.find(params[:id])\n @action_file.destroy\n\n respond_to do |format|\n format.html { redirect_to action_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ambit.destroy\n respond_to do |format|\n format.html { redirect_to ambits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @deliverable = Deliverable.find(params[:id])\n #delete deliverable from database\n @deliverable.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/deliverables/project_id/#{@deliverable.project_id}\" }\n format.json { head :no_content }\n end\n end", "def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end", "def destroy\n @faction = Faction.find(params[:id])\n @faction.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_factions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = option_model.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy\n @abuse.destroy\n respond_to do |format|\n format.html { redirect_to abuses_url, notice: t('views.flash_delete_message') }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_org_orderable = ClientOrgOrderable.find(params[:id])\n @client_org_orderable.destroy\n\n respond_to do |format|\n format.html { redirect_to client_org_orderables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @representante_athlete = Representante::Athlete.find(params[:id])\n @representante_athlete.destroy\n\n respond_to do |format|\n format.html { redirect_to representante_athletes_url, notice: 'Atleta apagado com sucesso' }\n format.json { head :no_content }\n end\n end", "def destroy\n @allocation = Allocation.find(params[:id])\n @episode = @allocation.episode\n @allocation.destroy\n\n respond_to do |format|\n format.html { redirect_to client_path(@episode.client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @investable.destroy\n respond_to do |format|\n format.html { redirect_to investables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hability.destroy\n respond_to do |format|\n format.html { redirect_to habilities_url, notice: 'Hability was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch.destroy\n render json: @batch, status: :ok\n end", "def destroy\n @loanable.destroy\n respond_to do |format|\n format.html { redirect_to users_loanables_url, notice: 'Loanable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accessory_type.destroy\n respond_to do |format|\n format.html { redirect_to accessory_types_url, notice: 'Accessory type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n\n end", "def destroy\n @coleccionable.destroy\n respond_to do |format|\n format.html { redirect_to coleccionables_url, notice: 'Coleccionable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @candy.destroy\n respond_to do |format|\n format.html { redirect_to candies_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7239529", "0.685737", "0.6722556", "0.6682913", "0.6567606", "0.6560132", "0.655953", "0.655689", "0.6553568", "0.6549024", "0.653393", "0.65276504", "0.65073866", "0.6505469", "0.6480941", "0.64697516", "0.64576954", "0.64461267", "0.6445829", "0.6438733", "0.64309037", "0.64295256", "0.6414886", "0.6413744", "0.6394826", "0.63804084", "0.6372066", "0.6371681", "0.6368974", "0.636574", "0.6362688", "0.63614476", "0.6351202", "0.6349281", "0.6345737", "0.63433653", "0.6343265", "0.6340686", "0.6332334", "0.63264984", "0.63213885", "0.6319248", "0.63183326", "0.63155144", "0.6315474", "0.63126194", "0.6311628", "0.6309381", "0.63091004", "0.63077646", "0.6305818", "0.62985533", "0.6290537", "0.6289961", "0.6280748", "0.6274152", "0.6272479", "0.62711316", "0.62671334", "0.62666315", "0.6266466", "0.6265365", "0.62642896", "0.62628084", "0.6258563", "0.62551665", "0.625497", "0.6250084", "0.6248332", "0.62479275", "0.62472504", "0.6235056", "0.6232284", "0.6231098", "0.6229731", "0.62269366", "0.6226018", "0.62250656", "0.6224517", "0.62238705", "0.6221472", "0.621999", "0.6219863", "0.621599", "0.62158185", "0.6215156", "0.621453", "0.62130004", "0.62123084", "0.6209189", "0.62053746", "0.6200552", "0.61975163", "0.6197363", "0.6192416", "0.6191401", "0.61891735", "0.6189148", "0.61851335", "0.61810946" ]
0.7415544
0
Use callbacks to share common setup or constraints between actions.
def set_actionable @actionable = Actionable.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def actionable_params params.require(:actionable).permit(:student_requested_job, :employeer_requested_student_for_job, :student_approved_for_job, :appeared_at_job, :student_did_job_well, :job_id, :student_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
generates playes and sets default first player to player in array position 0
def initialize(p1, p2) @players = [p1, p2] @current_player = @players[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_starting_player\n @current_player_index = rand(0..num_players - 1)\n puts \"Looks like #{@players[@current_player_index].name} will be going first!\"\n @players[@current_player_index]\n end", "def first_player_plays \n\t@choice_player1 = first_player.ask_play \n\tunless first_player.verification_coordonnees == true \n\t first_player.error \n\t \t @choice_player1 = first_player.ask_play\n\tend\n\n #pour chacun des elements du array stockant les cases\n #si le nom de la case = au choix du joueur et si la case et vide\n #changer la valeur de la case avec une petite croix\n #lance un message de succes (voir classe Player) qui dit que la case est bonne\n #si le nom de la case = au choix du joueur mais la case n'est pas vide\n #on lance la fonction error qui affiche un message d'erreur\n #on relance ask_play pour demander au joueur une autre coordonnee\n\t@array.map do |x| \n\t if x.value == @choice_player1 && x.check_if_empty\n\t x.fill_up_case(\"x\")\n\t first_player.success_case\n\t elsif x.value == @choice_player1 && !x.check_if_empty\n\t\t first_player.error\n\t\t @choice_player1 = first_player.ask_play\n\t end\n end\n\n #on lance la fonction ci-dessous pour modifier le board selon le choix du joueur\t\n\tupdate_board\n #on verifie si le joueur a gagne avec la fonction ci-dessous\n\tcheck_if_victory\n\n #si le joueur a gagne\n #on appelle la fonction winner (classer Player) qui affiche un message de victoire !\n #on lance la fonction ci-dessous qui demande a lancer un nouveau jeu\n\t if @victory == true\n\t first_player.winner \n\t another_game \n\t end\n end", "def play\n @play_array = [\"rock\", \"paper\", \"scissors\"]\n @play_array.sample\n end", "def switch_players\n @current_player_index += 1\n @current_player_index = 0 if @current_player_index >= @num_players\n @players[@current_player_index]\n end", "def init_players\r\n markers = MARKERS.dup\r\n (1..NUM_PLAYERS).each do |player_num|\r\n player_type = multiple_choice(\"Choose player #{player_num} type\",\r\n 'h' => Human, 'c' => Computer)\r\n @players << player_type.new(markers.pop)\r\n end\r\n end", "def player_array(player_a, player_b)\n players = []\n players[rand(2)] = player_a\n if players[0].nil?\n players[0] = player_b\n else\n players[1] = player_b\n end\n players\n end", "def initialize\n @players = []\n @p1 = Player.new('player')\n @players << @p1\n @p2 = ComputerPlayer.new('com')\n @players << @p2\n play\n end", "def start(players)\n puts \"#{players[0].name} goes first, sign - x\"\n players[0].sign = \"x \"\n puts \"#{players[1].name} goes second, sign - o\"\n players[1].sign = \"o \"\n puts \"Start game\"\n end", "def initialize\n @players = []\n @p1 = Player.new('p1')\n @players << @p1\n @p2 = ComputerPlayer.new('com')\n @players << @p2\n play\n end", "def select_player\n Player.new( [PLAYER_NAMES.try(:shuffle).try(:first), ('A'..'Z').try(:to_a).try(:sample).concat('.')].join(' ') )\n end", "def choose_first\n num = 1 + rand(2)\n puts \"Player #{num} will start the game.\"\n if num == 1\n @current_player = @player1\n else\n @current_player = @player2\n end\n end", "def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end", "def one_player\n\n if go_first? == true\n game = Game.new(Players::Human.new(\"X\"), Players::Computer.new(\"O\"))\n game.play\n\n else\n game = Game.new(Players::Computer.new(\"X\"), Players::Human.new(\"O\"))\n game.play\n end # inner if\n end", "def init_play\n # self.started_at = Time.now\n logger.info 'game.started_at: ' + started_at.to_s\n seq = 0\n gamers.order(:sequence_nbr).each do |g|\n turn = Turn.find_by(game_id: id, user_id: g.user_id)\n if g.accepted?\n seq += 1\n g.sequence_nbr = seq\n g.game_started # state --> waiting\n g.save\n turn.sequence_nbr = seq\n if seq == 1 #first player\n logger.info 'game.first player: ' + g.user_id.to_s\n turn.started = started_at\n turn.get_turn \n end\n turn.save!\n # delete turn of not accepting gamer\n else\n g.sequence_nbr = 0\n g.save\n turn.delete if turn\n end\n end\n save\n end", "def choose_first(player1, player2)\n players = [player1, player2]\n play_first = players[rand(2)]\n play_second = players.find { |elem| elem != play_first }\n puts \"#{play_first.name} has been randomly chosen to play first\"\n [play_first, play_second]\nend", "def next_player!\n end", "def set_players(num)\n @num_players=num\n for i in 0...@num_players\n @players[i] = Player.new(@ui.get_player_name(i+1))\n end\n end", "def second_player_plays\n\t@choice_player2 = second_player.ask_play\n\tunless second_player.verification_coordonnees == true \n\t \t second_player.error\n\t \t @choice_player2 = second_player.ask_play\n\tend\n\n\t@array.map do |x|\n\t if x.value == @choice_player2 && x.check_if_empty\n\t\t x.fill_up_case(\"o\")\n\t\t second_player.success_case\n\t elsif x.value == @choice_player2 && !x.check_if_empty\n\t\t\tsecond_player.error\n\t\t\t@choice_player2 = second_player.ask_play\n\t end\t\n\tend\n\n\tupdate_board\n\tcheck_if_victory\n\n\t if @victory == true \n\t\t second_player.winner\n\t\t another_game \n\t end\n end", "def set_starting_player\n starting_player = [Player.human, Player.computer].sample\n self.started_by = starting_player\n self.goes = starting_player\n self.first_player_type = starting_player\n self.second_player_type = self.versus\n end", "def go_play\n puts \"Let's start a new game\"\n @grid.print_board # prints the initial blank layout of the board\n puts @player1.name + \" \" + \"your turn first!\" # player 1 always goes first\n end", "def make_player\n\t\tputs \"\\nIf I may, master, what is your government name?\"\n\t\tname_input = gets.chomp\n#\t\t@name_1 = name_input.split.map {|i| i.capitalize}.join(\" \")\n#\t\t@user_name_1= new_name[0][(0..3)]+new_name[2][(0..3)]\n\t\tsign = @signs_array[0]\n\t\tPlayer.new(name_input,sign)\n\t\t$current_players[0] << @order[1]\n\t\t$current_players[0] << @signs_array[0]\n\t\t@signs_array = @signs_array.delete_at(0)\n\t\tputs \"\\nThank you!\\tNow I just need the next person.\"\n\t\t\n\t\tputs \"Other master, when ready, please type your government name.\"\n\t\tname_input = gets.chomp\n\t\tsign = @signs_array[-1]\n\t\tPlayer.new(name_input,sign)\n\t\t$current_players[1] << @order[0]\n\t\t$current_players[1] << @signs_array[-1]\n\t\tend", "def create #players are in an array\n @players = [\n Player.new('Contestant 1')\n Player.new('Contestant 2')\n ]\n end", "def create_players\n\t\t\t\tnum_players.times do |i|\n\t\t\t\t\tplayer_class = Merlion::Player\n\t\t\t\t\tself.players[i] = create_player({ seat: i, class: player_class })\n\t\t\t\tend\n\t\t\tend", "def initialize\n\t\t@players = []\n\t\t@players << @p1 = Player.new(\"p1\")\n\t\t@players << @p2 = ComputerPlayer.new(\"p2\")\n\t\t\n\t\t#@p1 = Player.new\n\t\t#@p2 = ComputerPlayer.new\n\t\tplay\n\tend", "def active_player\n @active_player ||= players.start\n end", "def switch_player\n if @current_player == @players[0]\n @current_player = @players[1]\n else\n @current_player = @players[0]\n end\n end", "def initialize_players\n\n end", "def start\n \t\tself.board.display_instruction\n \t\tcurrent_player = select_first_player\n \t\t(self.board.size).times do \n \t\t\tplay(current_player)\n \t\t\tcurrent_player = next_of current_player \n end\n display_winner(nil, true)\n \tend", "def initialize\n @status = \"on going\"\n @players = []\n 2.times do |index|\n if index == 0 \n symbol = \"X\"\n else\n symbol = \"O\"\n end\n @players << get_new_player(symbol, index)\n puts \"\\nLe joueur \\\"#{@players[index].name}\\\" a pour symbole : #{symbol}.\\n\"\n end\n @current_player = @players[0]\n end", "def create_players\n players = []\n players << create_player('player_1')\n players << create_player('player_2')\n players\n end", "def play players,snakes,ladders,dice,board_size\n p \"Game started --------\"\n players_name = players\n players_starting_positions = players.map{0} #empty array basedon user \n starting_player = rand(players.length) # 0,1,2\n snakes_ladders = random_board(snakes,ladders, board_size)#get snake and ladder in hash format and based on movement will happen\n mdice = dice\n winner = move(players_starting_positions, starting_player,mdice,snakes_ladders,board_size=100,players_name)\n puts \"Game started between these #{players} players ----and---- #{players[winner]} is winner!\"\n # return players[winner] \n end", "def set_player\n\n end", "def initialize(num_players)\n @num_players = num_players\n @players = []\n @current_player_index = nil\n (0..num_players - 1).each { |i| @players[i] = Player.new }\n end", "def initialize\n @currentPlayerIndex = -1;\n\n\n end", "def display_players_defaults\n players.each do |player|\n display_template_bind(\"ttt_players\", player.template_binding)\n end\n display_template_bind(\"ttt_first_player\", first_player.template_binding)\n end", "def play\n outcome = ''\n [1, 2].each {|ix| _select_players(ix)}\n c_player, o_player = _init_players\n o_player.set_other!(c_player) if o_player.is_IA_S?\n c_player.set_other!(o_player) if c_player.is_IA_S?\n #\n move_already_played = []\n #\n loop do\n STDOUT.print(\"#{@board.to_s}\\n#==> #{c_player.name}/#{c_player.type}'s TURN:\\n\")\n loop do\n m, sym = _get_move_from(c_player, move_already_played) # current player do his move\n v = @board.set_cell(m, sym.to_s)\n if m == -1 || v == sym # if sym not valid symbol, set_cell(m, sym != sym\n move_already_played << m.to_i\n break\n end\n STDERR.print \"! cell[#{m}] already set, try something else - v was: #{v.inspect} // #{v.class}\\n\"\n end\n move_already_played.sort!\n outcome = @board.game_over?\n break if outcome == :draw || outcome == :winner\n c_player, o_player = _switch_players(c_player, o_player)\n end\n _conclusion(outcome, c_player)\n end", "def first_turn\n @turn = 1\n @this_players_turn = @players.sample\n puts \"#{@this_players_turn.name} starts\"\n take_turn(@this_players_turn)\n end", "def players\n @players ||= []\n end", "def players\n @players ||= []\n end", "def play\r\n display_welcome_message\r\n init_players\r\n\r\n loop do\r\n play_match\r\n break unless play_again?\r\n end\r\n\r\n display_goodbye_message\r\n end", "def initPlayers(names)\n names.each do |n|\n @players << Player.new(n)\n end\n end", "def reset\n @num_1 = rand(1..20)\n @num_2 = rand(1..20)\n if @current_player == 1\n @current_player = 2\n else\n @current_player = 1\n end\n end", "def initialize\n @current_player = 1\n @player_1 = Player.new\n @player_2 = Player.new\n @num_1 = rand(1..20)\n @num_2 = rand(1..20)\n end", "def set_players_for_first\n Game::FIRST_MARKETS.each do |market|\n team_id = @game[\"first_#{market}_team_id\".to_sym]\n\n if team_id\n set_players_instance_variable(market, Team.find(team_id).players)\n else \n set_players_instance_variable(market, @game.teams.first.players)\n end\n end\n end", "def round_1\n i = 0\n round1_array = []\n @teams = @teams.shuffle\n\n while i < @teams.length\n match = Match.new( { 'team1_id' => @teams[i].id , 'team2_id' => @teams[i+1].id } )\n round1_array << match\n i += 2\n end\n\n for match in round1_array\n match.play\n match.save\n end\n\n end", "def start(x_player, o_player, board)\n puts \"\\n >> PLEASE SEE THE POSITIONS OF THE BOARD << \\n\\n\"\n player = which_player\n puts \"\\nYour player is 'X' and computer plays with 'O'\\n\\n\"\n if %w[N n].include?(player)\n current_player = o_player\n else\n current_player = x_player\n end\n\n (1..9).each do\n if current_player == x_player\n play(current_player, board)\n current_player = o_player\n else\n play(current_player, board)\n current_player = x_player\n end\n end\n end", "def choose_turn_order\r\n @players.shuffle!\r\n end", "def next_player\n @current_player_index += 1\n @current_player_index %= 2\n end", "def change_player \n if @current_player == 0\n @current_player = 1\n elsif @current_player == 1\n @current_player = 0\n end\n end", "def init_player_hands\n\n @player1_hand = []\n @player2_hand = []\n @player3_hand = []\n @player4_hand = []\n\n end", "def play\n init_player()\n init_board()\n puts \"Test game play\"\n end", "def switch_player\nif @player == PIECE[:x]\n@player = PIECE[:o]\nelse\n@player = PIECE[:x]\nend\nend", "def initialize\n @player1 = get_player_name('1')\n @player2 = get_player_name('2')\n @current_player = @player1\n end", "def play(iterations)\n last_score = 0\n current_player = 0\n iterations.times do\n current_player += 1\n current_player = 1 if current_player > num_players\n scoreboard[current_player] += emitter.next\n end\n scoreboard\n end", "def name_all_players\n (0..num_players - 1).each { |i| @players[i].name_player('Player' + i.to_s)}\n end", "def play\n idx = rand(audio_file_count)\n audio_file = audio_file_from_list(idx)\n run_player_loop_for(audio_file)\n end", "def first_player\n singles_player_of_team first_team\n end", "def first_player=(player)\n self.first_team = singles_player_team(player)\n end", "def assign_play_value(play)\n move = @potential_plays.index(play)\n end", "def next_turn\n @play == 0 ? @play +=1 : @play -=1 #change la valeur de play, donc change de joueur\n tu_vas_jouer_oui?(player[play])\n end", "def load_players\n\t\tif self.new_record? && self.players.empty?\n\t\t\tself.user_ids.shuffle!.each_with_index do |user_id, index|\n\t\t\t\tself.players.build(position: index, user_id: user_id)\n\t \tend\n\t end\n \tend", "def next_player\n current_player == 1 ? 2 : 1\n end", "def player_creation\n @players = []\n @available_roles_to_pick = ROLES.keys.shuffle\n @number_players = 0\n\n prompt_number_of_players\n\n @epidemic_cards_number = 0\n determine_epidemic_cards_number\n\n determine_deal_player_card_number\n create_players\n prompt_player_info\n end", "def play\n puts \"#{current_player.name} has randomly been selected as the first player\"\n while true\n board.display\n puts \"\"\n array = to_coordinate(select_case)\n x, y = array[0], array[1]\n board.set_cell(x, y, current_player.color)\n result = board.game_over\n if result == :winner\n board.display\n puts \"Congratulation #{current_player.name} you won!\"\n return\n elsif result == :draw\n puts \"No winners. Draw.\"\n return\n else\n switch_players\n end\n end\n end", "def gameplay; @gameplay ||= match.gameplays[current_player_side]; end", "def initialize(current_player)\n\n\t@current_player = current_player\n\n\t@board = Array.new(BOARD_MAX_INDEX + 1) {Array.new(BOARD_MAX_INDEX + 1) {EMPTY_POS} }\n\n#puts \"You are playing as #{HUMAN_PLAYER}, and the computer is playing as #{COMPUTER_PLAYER}.\"\n\nend", "def setup_players\n @players = []\n @players << add(Spaceship, 400, 320)\n @players << add(Tank, width/2, height-100)\n end", "def player\n player1 = Player.new('luke')\n player2 = Player.new('sam')\n game = Game.new(player1,player2)\n end", "def generate_player\n ret_val = nil\n msg = \"no changes made\"\n if (!ranking_player.nil?) and !has_base_player\n ret_val = PlayersHelper.generate_player_from_url(ranking_player)\n if !ret_val.nil?\n self.player = ret_val\n if base_player_country_id != base_country_id \\\n and !base_player_country.nil?\n self.country = base_player_country\n end\n self.resolved = true\n self.save!\n msg = \"Created new player \" + base_player_name + \"/\" + \\\n base_player_code + \"/id=\" + ret_val.id.to_s\n else\n msg = \"Player creation failed from url: \" + rp_url\n end\n end\n\n SystemLog.log(msg)\n ret_val\n end", "def initialize(player_1, player_2)\n @board = Board.new\n @status = \"ongoing\"\n @players_board = []\n @players_board << player_1\n @players_board << player_2\n @current_player = @players_board[rand(0..1)]\n end", "def initialize(needed_players=2)\n @players = []\n @needed_players = needed_players\n end", "def get_curr_player \n current_player = @player_arr.first()\n return current_player\n end", "def initial_particle_assignment\r\n array = 0.upto(@length - 1).to_a\r\n array = array.shuffle\r\n (0..@length - 1).each do |x|\r\n student = array[x]\r\n @position[student][x % @teams] = 1\r\n end\r\n end", "def setplayer1\r\n\t\t\t@player1 = \"O\"\r\n\t\tend", "def add_random_players\n\tplayer_number_array = [1,2,3,4,5,6,7,8,9,10,11].shuffle\n\tp player_number_array\n\tplayer_number_array.each do |each_number|\n\t\t\tfill_team_with_players(@team_name, Faker::Name.name, each_number)\n\t\tend\nend", "def start\n puts \"Welcome to Tic Tac Toe!\"\n puts \"\"\n define_players\n play\n end", "def zero_players\n game = Game.new(Players::Computer.new(\"X\"), Players::Computer.new(\"O\"))\n\n puts \"To have the computer play itself 100 times, type 'wargames'.\"\n puts \"Type anything else to have it play itself only once\"\n user_input = gets.strip\n\n if user_input.downcase == \"wargames\"\n 100.times{game.play}\n else\n until game.over?\n game.play\n end # until over?\n end # if wargames\n end", "def select_first_player\n \t\t\tprint \"Do you want to play first? <y/n>: \"\n \t\t\tans = gets.chomp\n \t\t\tif %w[Y y].include?(ans)\n \t @robot = Player.new(\"X\")\n \t @player = Player.new(\"O\")\n \t else\n \t \t@player = Player.new(\"X\")\n \t @robot = Player.new(\"O\")\n \t end\n \t\tend", "def play\n\t @players.each { |player| player.score = 0 }\n\t \n\t loop do\n\t @board.clear\n\t\t@cur_player = @players[0]\n\t\t@rounds += 1\n\t\t\n\t\tprint \"\\n******************* Tic-Tac-Toe ********************\"\n\t puts \"\\n#{@players[0].name} will play with #{@players[0].mark}; #{@players[1].name} will play with #{@players[1].mark}\\n\\n\"\n\t\t@board.print_board \n\t \n\t\tloop do\n position = prompt_movement\n\t @board.set_mark(position, @cur_player.mark)\n\t\t @board.print_board \n\t\t \n\t\t result = \n\t\t if @board.is_winner?(@cur_player.mark)\n\t\t @cur_player.score += 1\n\t\t puts \"\\n#{@cur_player.name} wins!!\"\n\t\t\t true\n\t\t elsif @board.is_full?\n\t\t puts \"\\nThe game ended in a tie!\"\n\t\t\t true\n\t\t\tend\n\t\t \n\t\t break if result\n\t\t swap_players\n\t\tend\n\t\t\n\t\tbreak if prompt_quit\n\t end\n\t \n\t print_final_score\n\tend", "def players\n @a = Array.new\n @a << east \n @a << south\n @a << west\n @a\n end", "def setup_player\n self.points = 0\n Match.all.each do |m|\n self.bets.build(match: m, result: Match::TIE)\n end\n end", "def player_setup(array)\n i = 0\n until array.length == 2\n print \"\\nPlayer #{i+1}, what is your name?\\n> \"\n player_name = gets.chomp\n array.push(Disc.new(player_name))\n puts \"You are #{array[i].color}!\".colorize(array[i].color.to_sym)\n i += 1\n # sleep(1)\n end\nend", "def run_game\n\n #creating the players\n\n player1 = Player.new(\"Player 1\")\n player2 = Player.new(\"Player 2\")\n @players << player1\n @players << player2\n\n @active_player = @players[1]\n\n while (@active_player.life > 0)\n run_round\n end\n\n game_over\n\n end", "def switch_player\n @act_p = @act_p.id == 0 ? self[1] : self[0]\n end", "def human_player_and_ai(size)\n\tif first?()\n @player1 = \"player\"\n @player2 = difficulty(size,\"o\")\n else\n @player1 = difficulty(size,\"x\")\n @player2 = \"player\"\n end\nend", "def play\n# \tThere are 3 players in Knuckleheads: \n\t\tputs \"There are #{to_s} players in #{@title}\"\n# \tI'm Moe with a health of 100 and a score of 103.\n# \tI'm Larry with a health of 60 and a score of 65.\n# \tI'm Curly with a health of 125 and a score of 130.\n\t\t@Player.each do |spieler|\n\t\t\tputs \"I'm #{spieler} with a health of #{@health} and a score of #{score}\"\n\t\t\tend\n# \tMoe got blammed!\n# \tMoe got w00ted!\n# \tMoe got w00ted!\n# \tI'm Moe with a health of 120 and a score of 123.\n# \tLarry got blammed!\n# \tLarry got w00ted!\n# \tLarry got w00ted!\n# \tI'm Larry with a health of 80 and a score of 85.\n# \tCurly got blammed!\n# \tCurly got w00ted!\n# \tCurly got w00ted!\n# \tI'm Curly with a health of 145 and a score of 150.\n\t\tend", "def resetBoard (player)\n\t\tif(player.side == 1)\n\t\t\t@p1Board.each do |c|\n\t\t\t\tc.played = false\n\t\t\tend\n\t\telsif(player.side == 2)\n\t\t\t@p2Board.each do |c|\n\t\t\t\tc.played = false\n\t\t\tend\n\t\tend\n\tend", "def start\n setPlayers\n question\nend", "def player1\n @players.first\n end", "def initialize(name_player1, name_player2)\n @current_player = :player1\n @player1 = Player.new(name_player1, PLAYER_MARKS[:player1], 1)\n @player2 = Player.new(name_player2, PLAYER_MARKS[:player2], 2)\n\n @game_array = [[nil, nil, nil],\n [nil, nil, nil],\n [nil, nil, nil]]\n end", "def play\n p_arr = randomize_players(@player_1, @player_2)\n current_player = p_arr[0]\n next_player = p_arr[1]\n current_player.piece = 'X'\n next_player.piece = 'O'\n puts \"Player #{current_player.id.to_s} goes first!\"\n\n end_message = \"\"\n loop do\n set_cell(current_player.move(self))\n if check_win?\n end_message = current_player.win_message\n break\n elsif check_draw?\n end_message = \"It's a draw.\"\n break\n end\n current_player, next_player = next_player, current_player\n end\n\n display_board\n end_message\n end", "def current_player\n\tif $turn == 0\n\t\tplayerone\n\telse\n\t\tplayertwo\n\tend\nend", "def initialize \n\t@first_player = Player.new(\"joueur 1\")\n\t@second_player = Player.new(\"joueur 2\")\n\t self.create_board\n\t self.play_until_victory\n end", "def players_factory(player1, player2, player1_marker_x=true)\n players = []\n\n\t# Cases of initializing the players\n\tif player1_marker_x\n\n\t\t# Case 1\n\t\tif player1 == \"human\"\n\t\t\tplayers << Player.new(\"X\", \"Player1\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"X\", \"Player1\", true)\n\t\tend\n\n\t\tif player2 == \"human\"\n\t\t\tplayers << Player.new(\"O\", \"Player2\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"O\", \"Player2\", true)\n\t\tend\n\n\telse\n\t\t# Case2\n\t\tif player1 == \"human\"\n\t\t\tplayers << Player.new(\"O\", \"Player1\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"O\", \"Player1\", true)\n\t\tend\n\n\t\tif player2 == \"human\"\n\t\t\tplayers << Player.new(\"X\", \"Player2\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"X\", \"Player2\", true)\n\t\tend\n\tend\n\n\tplayers\nend", "def init_game\n @io.welcome_msg\n @num_decks = @io.get_num_decks \n @player_cnt = @io.get_player_cnt(@max_players)\n players_names = @io.get_players_names\n\n # Initialize player objects\n 0.upto(players_names.length - 1) do |x|\n @players[x] = Player.new(players_names[x], @bankroll)\n end\n\n # Create the dealer and add as a player\n @dealer = Dealer.new\n @dealer.hit_soft_17 = @hit_soft_17\n @players[@players.length] = @dealer\n end", "def switch_players!\n if current_player==player1\n @current_player=player2\n else\n @current_player=player1\n end\n end", "def initPlayers(names) # (names : string[]) : void\n names.each do |k|\n @players << Player.new(k)\n end\n end", "def play\n @@plays += 1\n end", "def init_players(names)\n \n \n @dealer = CardDealer.instance\n \n #Inicializamos el array de jugadores\n @players = Array.new\n \n #Recorremos los nombres pasados y creamos tantos jugadores como nombres\n names.each do |s|\n\n players << Player.new(s)\n\n end\n end", "def next_player!\n players.rotate!\n players.rotate! until losses[current_player] < MAX_LOSS_COUNT\n end" ]
[ "0.71329635", "0.67810935", "0.6665624", "0.65446174", "0.65112907", "0.6508821", "0.64856106", "0.6457072", "0.6442371", "0.6433342", "0.64264965", "0.64178556", "0.6414918", "0.63896406", "0.6382427", "0.63591194", "0.63272417", "0.63211435", "0.62899673", "0.6274553", "0.6254322", "0.6251286", "0.62468064", "0.6222449", "0.62184566", "0.6215902", "0.62026936", "0.6197057", "0.6192951", "0.6192568", "0.61653644", "0.61609715", "0.6157115", "0.6156534", "0.61528665", "0.6116297", "0.6104563", "0.6101585", "0.6101585", "0.6089404", "0.6087827", "0.6078095", "0.6074561", "0.6073593", "0.60704035", "0.6069422", "0.60620695", "0.6058686", "0.6052063", "0.6033356", "0.60315675", "0.60201555", "0.6018996", "0.6018602", "0.60128534", "0.6008223", "0.59821826", "0.5982159", "0.59782267", "0.59662247", "0.596409", "0.59495777", "0.59444463", "0.59438246", "0.59362394", "0.5933214", "0.5930201", "0.59272283", "0.5921721", "0.5918947", "0.591602", "0.59099823", "0.5907944", "0.5907781", "0.59036374", "0.58940226", "0.58901185", "0.5886624", "0.58857995", "0.58806235", "0.5873993", "0.58569914", "0.5851227", "0.58481926", "0.584532", "0.58440006", "0.5843775", "0.58437294", "0.5839594", "0.5830092", "0.58287996", "0.5828378", "0.5820454", "0.5818255", "0.58166087", "0.5814802", "0.5814689", "0.58057916", "0.58028674", "0.5795206" ]
0.58241224
92
manages method for removing one life on wrong answer
def lose_life puts "Sorry, that is the wrong answer!" @current_player.life -= 1 if @current_player.life == 0 puts "#{current_player.name} loses! Game Over!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrong_answer\n @score -= 1\n end", "def remove_item\n if !@question.many_answers && @item.ok && @question.items.count > 1\n # No more good answer\n # We put one in random to true\n @item.destroy\n @item2 = @question.items.last\n @item2.ok = true\n @item2.save\n flash[:info] = \"Vous avez supprimé une réponse correcte : une autre a été mise correcte à la place par défaut.\"\n else\n @item.destroy\n end\n redirect_to question_manage_items_path(params[:question_id])\n end", "def remove_old\n count = WrongAnswer.count(:all, :conditions => { :user_id => user.id })\n if count > APP_SETTINGS['wrong_answers_to_store']\n WrongAnswer.find(:first, :conditions => { :user_id => user.id }).destroy\n end\n end", "def clear_answer\n \t\tself.answer = nil\n \tend", "def wrong \n @lives -= 1\n end", "def wrong\n self.lives -= 1\n end", "def remove_answers_to_wrong_activity\n [:multiple_choice_answers, :open_response_answers, :image_question_answers].each do |answer_type|\n answers = self.send answer_type\n answers.each do |answer|\n if answer.question && answer.question.activity\n activity_id = answer.question.activity.id\n unless activity_id == self.activity_id\n answer.delete\n puts \"deleted an answer to question: #{answer.question.id}\"\n end\n end\n end\n end\n end", "def use_guess\n @guesses -= 1\n end", "def unsubmit(_ = nil)\n # Skip the state validation in answers.\n @unsubmitting = true\n\n unsubmit_latest_answers\n self.points_awarded = nil\n end", "def decline_suggestion suggestion \n\t\tsuggestion.status = 4\t\n\t\tsuggestion.save\n\t\t#user_reward(suggestion, -5)\n end", "def set_incorrect_answer\r\n set_question_and_answer\r\n @answer.correct = 0\r\n save_answer_and_render\r\n end", "def update_possible!()\r\n\r\n #falls es keine Hits gibt, werden ale Tipps geloescht, die eine der Ziffern enthalten\r\n if (@last_hits == [0,0])\r\n @digits.times do |i|\r\n\r\n @left.delete_if{ |x|\r\n x.include?(@last_guess[i])\r\n }\r\n\r\n end\r\n\r\n end\r\n\r\n #falls es keine Black Hits gibt, werden alle Tipps mit einer identischen Stelle geloescht\r\n if @last_hits[0]==0\r\n\r\n @digits.times do |i|\r\n\r\n @left.delete_if { |x|\r\n x[i]==@last_guess[i]\r\n }\r\n end\r\n\r\n end\r\n\r\n #loescht alle, deren Uebereinstimmung mit dem letzten Tipp nicht den Black Hits entspricht\r\n @left.delete_if { |x|\r\n @last_hits[0] != @mastermind.hits(@last_guess,x)[0]\r\n }\r\n\r\n #loescht alle, deren Uebereinstimmung mit dem letzten Tipp nicht den Total Hits entspricht\r\n @left.delete_if { |x|\r\n (@last_hits[0] + @last_hits[1]) != (@mastermind.hits(@last_guess,x)[0]+@mastermind.hits(@last_guess,x)[1])\r\n }\r\n\r\n end", "def uncorrect\n @submission.mark_incorrect\n flash[:success] = \"Soumission marquée comme erronée.\"\n redirect_to problem_path(@problem, :sub => @submission)\n end", "def destroy\n\n @question=@answer.question\n @question.update(cant_answers: @question.cant_answers - 1)\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to @question, notice: 'La respuesta fue borrada con exito' }\n format.json { head :no_content }\n end\n end", "def incorrect_answer(button_index)\n @label_quess.text = \"Guess once more!\"\n @label_quess.textColor = UIColor.alloc.initWithRed(0.8,green: 0.6,blue: 0.73, alpha:1.0) \n @buttons[button_index].removeFromSuperview\n # return @scores = 0 if @scores < -10000\n # @scores -= 1\n return @incorrect = 0 if @incorrect > 10000\n @incorrect +=1\n @label_incorect.text = \" ✗: \" + @incorrect.to_s+\" \" \n @label_incorect.textAlignment = NSTextAlignmentRight\n end", "def reset\n @lives = 3\n @score = 0\n @answer = \"\"\n end", "def guess_count\n\t\t @number_of_guesses -= 1\n\tend", "def incorrect_answer(text)\n answer = Answer.new(text, false)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def remove_answer\n elem = \"entry_answer\" << params[:id]\n entry = JournalEntry.find(params[:id])\n # remove any score report created\n if entry.survey_answer\n sc = ScoreRapport.find_by_survey_answer_id(entry.survey_answer.id)\n sc.destroy if sc\n end\n\n # delete all answers and answer cells, delete login for journal_entry\n if entry.destroy\n render :update do |page|\n page.visual_effect :slide_up, elem\n page.remove elem\n end\n end\n end", "def first_answer( )\n @first_answer\n ensure\n @first_answer = nil\n end", "def deduct_available_guesses\n @available_guesses -= 1\n end", "def unheart!(question)\n heart = self.hearts.find_by(question_id: question.id)\n heart.destroy!\n end", "def cleardownvote\n @post = Post.find(params[:id])\n @post_count = Post.count\n @vote = Vote.where(user_id: session[:id], post_id: @post.id, score: -1)\n if @vote.exists?\n Vote.destroy(@vote.pluck(:id)[0])\n @post.update_attribute(:respect, @post.respect + 1) # Update post respect\n flash[:notice] = 'Vote cleared successfully'\n end\n redirect_to(action: 'index', topic_id: @topic.id)\n end", "def remove_one_and_score(single_die)\n @current_score += 100 if single_die == 1\n @current_score += 50 if single_die == 5\n @number_of_dice -= 1\n end", "def no_responses\n #below is code to fix a bizarre bug. When triggered by the \"cut\" function, for some reason survey_id is erased. Have not found reason yet. Temporary fix.\n if !survey_section && self.id\n self.reload\n end\n if self.id && self.survey_section && self.survey_section.survey\n #this will be a problem if two people are editing the survey at the same time and do a survey preview - highly unlikely though.\n self.survey_section.survey.response_sets.where('test_data = ?',true).each {|r| r.destroy}\n end\n if self.id && !survey_section.survey.template && survey_section.survey.response_sets.count>0\n errors.add(:base,\"Reponses have already been collected for this survey, therefore it cannot be modified. Please create a new survey instead.\")\n return false\n end\n end", "def lose_life()\r\n @life -= 1\r\n end", "def guess_badly(guess)\n @remaining_guesses -= 1\n @current_index += 1\n @bad_guesses << guess\n end", "def move_used_question_to_answered(q)\n @answered_questions[q] = @questions[q]\n @questions.delete(q)\n end", "def remove_old_answers\n if self.valid?\n self.choice_questions.includes(:choice_answers).each {|x| x.choice_answers.each(&:destroy)}\n end\n end", "def lose_a_point\n\n self.score -= 1\n\n end", "def lose_life\n @life -= 1\n end", "def unsubmit(_ = nil)\n # Skip the state validation in answers.\n @unsubmitting = true\n\n unsubmit_current_answers\n self.points_awarded = nil\n self.draft_points_awarded = nil\n self.awarded_at = nil\n self.awarder = nil\n self.submitted_at = nil\n self.publisher = nil\n self.published_at = nil\n end", "def check_answer(player)\n if @answer == @correct\n puts \"YES! You are correct!\"\n else\n puts \"Seriously? No!\"\n player.lives -= 1\n puts \"#{player.name} lives remainining: #{player.lives}\"\n end\n end", "def get_mad_at(reindeer)\n\t\t@reindeer_ranking << @reindeer_ranking.delete(reindeer)\t\t\n\tend", "def solved(solution)\n @entry.text = \"\"\n captcha = @captchas.delete_at(0)\n captcha[:callback].call(solution)\n self.refresh()\n end", "def undo_vote\n vote(0)\n end", "def increment(resp)\n return if game_data.randomly_picked_word.include?(resp)\n\n game_data.guesses_remaining -= 1\n end", "def ask_question_and_update_lives(player)\n result = ask_question_and_check_answer\n if !result\n player.lives -= 1\n end\n end", "def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end", "def deduct_life\n @lives -= 1\n end", "def remove_life \r\n @lives -= 1 # this is part of class and objects above\r\n end", "def forget(m, thing)\n thing.downcase!\n if @@learning_db.has_key? thing\n @@learning_db.delete thing\n m.reply \"I forgot #{thing}.\"\n else\n m.reply \"I don't know anything about #{thing}.\"\n end\n end", "def lives_lost\n @lives -= 1\n pp \"INCORRECT -- YOU HAVE #{@lives} LIVES LEFT\"\n end", "def register_last_answer\n unless self.for_test || self.team_id.nil?\n la = LastAnswer.find_or_create_by(:user_id => self.user_id.to_s, :question_id => self.question_id.to_s)\n\n unless la.answer_id.nil? || la.answer.nil?\n self.try_number = la.answer.try_number + 1\n end\n\n\n\n self.last_answer = la\n la.answer_id = self.id\n\n\t if la.answer.nil?\n\t answers = Answer.where(user_id:la.user_id.to_s, question_id: la.question_id.to_S).desc(:created_at)\n if answers.count > 0\n la.answer_id = answers.first.id\n la.save!\n else\n\t la.delete\n end\n else\n la.save!\n end\n\n self.save\n\n true\n end\n\n #unless self.for_test\n # la = LastAnswer.find_or_create_by(:user_id => self.user.id, :question_id => self.question.id)\n # la.answer = self\n # la.question_id = self.question_id\n # la.user_id = self.user_id\n # la.save!\n #end\n end", "def unanswered\n request('unanswered')\n end", "def remove_last_item_from_items_collected_at_desk\n $items_collected.delete($items_collected.last)\n# returns user to previous task of choosing item from desk\n desk_options\nend", "def refuse\n @presentation.refuse!\n redirect_to admin_submissions_path((@presentation.poster ? :poster : :contributed) => 1), notice: 'The presentation has been unaccepted.'\n end", "def unauthorize_corrections\n if @contestproblem.in_recorrection?\n @contestproblem.corrected!\n flash[:success] = \"Les organisateurs ne peuvent plus modifier leurs corrections.\"\n end \n redirect_to @contestproblem\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def destroy\n @question = @attempt_choice.question\n @student = @attempt_choice.user\n if @attempt_choice.team_id.present?\n @team_id = Team.find(@attempt_choice.team_id).id\n else\n @team_id = nil\n end\n\n @attempt = @attempt_choice.attempt\n @attempt.points = 0\n @questions = @attempt.quiz.questions\n if @team_id.present?\n @questions.each do |q|\n p = q.choices.count.to_f - q.attempt_choices.where(team_id: @team_id).count.to_f + 1\n if p < 1\n p = 1\n end\n @attempt.points = @attempt.points + p.to_i\n puts \"points: #{@attempt.points}\"\n @attempt.save\n end\n else\n @questions.each do |q|\n if q.attempt_choices.where(user_id: @student.id, team_id: nil).first.choice.correct?\n p = 1\n else\n p = 0\n end\n @attempt.points = @attempt.points + p.to_i\n puts \"points: #{@attempt.points}\"\n @attempt.save\n end\n end\n\n @attempt_choice.destroy\n respond_to do |format|\n if @team_id.present?\n format.html { redirect_to view_team_attempt_choices_path(@question.id, @team_id), notice: 'Attempt choice was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to view_attempt_choices_path(@question.id, @student.id), notice: 'Attempt choice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def reset\n correct = course.responses.correct.interval(self.index_no).since(self.updated_at).size\n incorrect = course.responses.incorrect.interval(self.index_no).since(self.updated_at).size\n \n return false if self.index_no < 2\n \n actual = 100.0 * (incorrect) / (correct + incorrect)\n target = 100.0 - course.accuracy_target\n \n case\n when actual > target\n update_attribute :minutes, ( self.minutes * (target+actual)/(2*actual) ).to_i\n when actual < target\n update_attribute :minutes, ( self.minutes * (3*target-actual)/(2*target) ).to_i\n else\n return false\n end\n end", "def remove!; end", "def update_w_ans!(answer)\n\t\t# answer.points = points_for(answer.correct)\n\t\t\n\t\tanswer.points = points_for(answer, self.quiz_instance.quiz.quiz_type)\n\t\tanswer.save\n\n\t\tself.problem_stat = stat.update_w_ans!(answer)\n\t\t\n\t\tself.remaining = remaining - 1\n\t\tchange_problem\n\t\tsave\n\tend", "def reset\r\n@candidates = ['Mika', 'Reggie', 'Kenneth', 'Trevor']\r\n@votes = [m=0, r=0, k=0, t=0]\r\n@canname = ''\r\n@vote =''\r\n@v=0\r\n@tie = []\r\nend", "def update(time_passed)\n @invincibility -= time_passed\n end", "def reset_task\n\n removed_task_id = completed_task_ids.delete(current_task_id)\n\n if !removed_task_id.blank?\n\n # deduct the points and mark the last lesson\n self.points = points - lesson.tasks.find(removed_task_id).points\n\n self.save!\n logger.info( \"RESET task: #{current_task_id} \\tLesson: #{lesson.id} \\tUser: #{self.user.name}\" )\n\n true\n end\n\n false\n end", "def correct_answer\n @correct_answer ||= question.correct\n end", "def supprimerQuestion(id_question)\n question = QuestionOuverte.find_by(id_question: id_question, etat: false)\n supprimer = (question != nil && question.update_attributes(:etat => true))\n end", "def santa_mad_at(reindeer_name)\r\n @reindeer_ranking.each do |rank|\r\n #find the reindeer in the reindeer_ranking array\r\n if rank == reindeer_name\r\n #store the reindeer that santa is mad at\r\n temp = rank\r\n #remove reindeer that santa is mad at\r\n @reindeer_ranking.delete(reindeer_name)\r\n #put the temp stored reindeer tot he end of the line\r\n @reindeer_ranking << temp\r\n end\r\n end\r\n p @reindeer_ranking\r\n end", "def looses_life\n @lives -= 1\n end", "def before_destroy\n if self.yes?\n Question.decrement_counter(:yes_count, question.id)\n else\n Question.decrement_counter(:no_count, question.id)\n end\n \n Stat.decrement_counter(:reply_count, self.user.stat.id)\n end", "def destroy\n @possible_answer.destroy\n respond_to do |format|\n format.html { redirect_to possible_answers_url, notice: 'Possible answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def ask_again\n\n end", "def corrector; end", "def corrector; end", "def corrector; end", "def corrector; end", "def ungraded_answers(submission)\n submission.reload.current_answers.select { |a| a.attempting? || a.submitted? }\n end", "def finalise(_ = nil)\n answers.select(&:attempting?).each(&:finalise!)\n end", "def unreserve\n f = @submission.followings.first\n if !@submission.waiting? || f.nil? || (f.user != current_user.sk && !current_user.sk.root?) || f.kind != 0 # Not supposed to happen\n @what = 0\n else\n Following.delete(f.id)\n @what = 1\n end\n end", "def take_life\n @lives -= 1\n end", "def remove_answer(question_id)\n answers.each do |a|\n if a.survey_question.id == question_id\n self.answers.delete(a)\n a.destroy \n return\n end\n end\n end", "def finalise(_ = nil)\n self.submitted_at = Time.zone.now\n current_answers.select(&:attempting?).each(&:finalise!)\n\n assign_zero_experience_points if assessment.questions.empty?\n end", "def clearupvote\n @post = Post.find(params[:id])\n @post_count = Post.count\n @vote = Vote.where(user_id: session[:id], post_id: @post.id, score: 1)\n if @vote.exists?\n Vote.destroy(@vote.pluck(:id)[0])\n @post.update_attribute(:respect, @post.respect - 1) # Update post respect\n flash[:notice] = 'Vote cleared successfully'\n end\n redirect_to(action: 'index', topic_id: @topic.id)\n end", "def manually_complete_quest(quest_id)\n quest(quest_id).prime_objectives.clear\n quest(quest_id).manual_status = :complete\n end", "def delete_useless!\n @eng_sentence = @eng_sentence - @useless_eng_words\n @rus_sentence = @rus_sentence - @useless_rus_words\n end", "def lose_pts\n self.score -= 1\n end", "def validate_answer(answer)\n end", "def retornar_disponibilidad_y_eliminar_venta ticket\n @jugadalots = Jugadalot.where(:ticket_id => ticket.id) \n result = 0 \n\n @jugadalots.each do |jugadalot|\n\n if jugadalot.qpt == 'Q' # && jugadalot.sorteot.sigla == '01' # Verificar Disponibilidad de Quiniela de la Nacional Noche\n \n @modelocontrolq = Aliasmodelosiglasorteot.where(:siglasorteo => jugadalot.sorteot.sigla).first.modelocontrolq \n @modelocontrolq = @modelocontrolq.capitalize.classify.constantize # Esto para convertir string en constante y poder acceder al modelos de Active Record. Scado de este link: https://stackoverflow.com/questions/34757582/using-variables-for-model-names-in-active-record \n \n @modeloventaq = Aliasmodelosiglasorteot.where(:siglasorteo => jugadalot.sorteot.sigla).first.modeloventaq \n @modeloventaq = @modeloventaq.capitalize.classify.constantize # Esto para convertir string en constante y poder acceder al modelos de Active Record. Scado de este link: https://stackoverflow.com/questions/34757582/using-variables-for-model-names-in-active-record \n \n\n #Actualizar disponibilidad y registrar venta\n @act_disp = @modelocontrolq.where(:numero => jugadalot.n1.to_i).first\n @act_disp.vendida -= jugadalot.monto.to_i # devuelto valor de disponibilidad usado.\n \n @eliminar_ventas = @modeloventaq.where(:ticket_id => ticket.id) # => arreglo con todas las jugadas quiunielas de ese ticket anulado, hay que borrarlas todas. \n \n @eliminar_ventas.each do |jugada|\n jugada.destroy\n end\n\n if (@act_disp.save && @eliminar_ventas) == false\n result +=1\n end\n\n end\n\n\n if jugadalot.qpt == 'P' # && jugadalot.sorteot.sigla == '01' # Verificar Disponibilidad de Quiniela de la Nacional Noche\n \n @modelocontrolp = Aliasmodelosiglasorteot.where(:siglasorteo => jugadalot.sorteot.sigla).first.modelocontrolp \n @modelocontrolp = @modelocontrolp.capitalize.classify.constantize # Esto para convertir string en constante y poder acceder al modelos de Active Record. Scado de este link: https://stackoverflow.com/questions/34757582/using-variables-for-model-names-in-active-record \n \n @modeloventap = Aliasmodelosiglasorteot.where(:siglasorteo => jugadalot.sorteot.sigla).first.modeloventap \n @modeloventap = @modeloventap.capitalize.classify.constantize # Esto para convertir string en constante y poder acceder al modelos de Active Record. Scado de este link: https://stackoverflow.com/questions/34757582/using-variables-for-model-names-in-active-record \n\n\n #Actualizar disponibilidad y registrar venta\n @act_disp = @modelocontrolp.where(:n1 => jugadalot.n1.to_i , :n2 => jugadalot.n2.to_i).first\n @act_disp.vendida -= jugadalot.monto.to_i # devuelto valor de disponibilidad usado.\n \n @eliminar_ventas = @modeloventap.where(:ticket_id => ticket.id) # => arreglo con todas las jugadas quiunielas de ese ticket anulado, hay que borrarlas todas. \n \n @eliminar_ventas.each do |jugada|\n jugada.destroy\n end\n\n if (@act_disp.save && @eliminar_ventas) == false\n result +=1\n end\n\n end\n\n if jugadalot.qpt == 'T' # && jugadalot.sorteot.sigla == '01' # Verificar Disponibilidad de Quiniela de la Nacional Noche\n \n\n @modelocontrolt = Aliasmodelosiglasorteot.where(:siglasorteo => jugadalot.sorteot.sigla).first.modelocontrolt \n @modelocontrolt = @modelocontrolt.capitalize.classify.constantize # Esto para convertir string en constante y poder acceder al modelos de Active Record. Scado de este link: https://stackoverflow.com/questions/34757582/using-variables-for-model-names-in-active-record \n \n @modeloventat = Aliasmodelosiglasorteot.where(:siglasorteo => jugadalot.sorteot.sigla).first.modeloventat \n @modeloventat = @modeloventat.capitalize.classify.constantize # Esto para convertir string en constante y poder acceder al modelos de Active Record. Scado de este link: https://stackoverflow.com/questions/34757582/using-variables-for-model-names-in-active-record \n\n #Actualizar disponibilidad y registrar venta\n @act_disp = @modelocontrolt.where(:n1 => jugadalot.n1.to_i , :n2 => jugadalot.n2.to_i , :n3 => jugadalot.n3.to_i).first\n @act_disp.vendida -= jugadalot.monto.to_i # devuelto valor de disponibilidad usado.\n \n @eliminar_ventas = @modeloventat.where(:ticket_id => ticket.id) # => arreglo con todas las jugadas quiunielas de ese ticket anulado, hay que borrarlas todas. \n \n @eliminar_ventas.each do |jugada|\n jugada.destroy\n end\n\n if (@act_disp.save && @eliminar_ventas) == false\n result +=1\n end\n\n end\n\n end # end del each loop\n\n if result > 0\n return false\n else\n return true # todo ok. Disponibilidad descontada y venta registrada en tabla.\n end\n\n end", "def reset_answers\n\tputs \"Would you like to clear all user input answers? Type 'yes' or 'no'.\"\n\twhile true\n\t\treset = gets.strip.downcase\n\t\tif reset == \"yes\"\n\t\t\t@questions[:misc].delete_if { |item| item.include?(\"USERANSWER\")}\n\t\t\tputs \"Success! All answers are factory fresh!\"\n\t\t\tputs \"Let's get back to asking questions!\"\n\t\t\tinput_eval\n\t\telsif reset == \"no\"\n\t\t\tputs \"Your answers are still there!\"\n\t\t\tinput_eval\n\t\telse\n\t\t\tputs \"I didn't quite catch that. Type 'yes' or 'no'.\"\n\t\tend\n\tend\nend", "def defeat\n @current_player = @players[\"plyr2\"]\n if @it == 12\n puts \" \"\n puts \" Code-breaker #{@current_player} loses!!\"\n puts \" \"\n puts \"Solution is #{@result}\"\n puts \" \"\n end\n end", "def correct!\n correct\n save if changed?\n reset\n end", "def remove_song\n if self.yes?\n Song.decrement_counter(:yes_count, song.id)\n else\n Song.decrement_counter(:no_count, song.id)\n end\n end", "def reveal_quest(quest_id); quest(quest_id).concealed = false; end", "def guess_incorrectly\n correct_guess = Game.first.next_question.person.name\n\n tag = all(\"form label\").detect do |tag|\n ! tag.text.include?(correct_guess)\n end\n\n guess(tag.text)\n end", "def downvote\n @question.downvote_from current_user\n #si votas negativo automaticamente el usuario logueaado tiene un punto negativo -1\n @question.user.puntaje-=2\n @question.user.save\n\n current_user.puntaje-=1\n current_user.save\n redirect_to @question, notice: 'Gracias por puntuar'\n end", "def correct_answer(text)\n answer = Answer.new(text, true)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def undo\n if current_ident == @undo.last\n # reset\n self.current_db_value = current_question[\"question\"].value\n @undo.pop\n update_toolbar\n else\n old = @all_failed_questions.assoc(@undo.last)\n return unless old\n self.current_question = old[1]\n end\n end", "def check_correct_answer\n puts 'Answer was correct!!!!'\n @purses[@current_player] += 1\n current_purses = @purses[@current_player]\n puts \"#{@players[@current_player]} now has #{@purses[@current_player]} Gold Coins.\"\n check_current_player\n current_purses\n end", "def unanswered_questions; questions_not_matching_query(answered_questions_query); end", "def gameover\n op_hand.clear\n end", "def delete_game_question\n Graphics.transition\n # Message break prevention\n Graphics.update while Input.press?(:B)\n scene = $scene\n $scene = self\n message = text_get(25, 18)\n oui = text_get(25, 20)\n non = text_get(25, 21)\n # Delete the game ?\n c = display_message(message, 1, non, oui)\n if c == 1\n message = text_get(25, 19)\n # Really ?\n c = display_message(message, 1, non, oui)\n if c == 1\n # Ok deleted!\n File.delete(@filename)\n message = text_get(25, 17)\n display_message(message)\n end\n end\n $scene = scene\n return @running = false\n end", "def remove\n\t @pieces[chosen] -= 1\n\t update_buttons chosen\n\tend", "def set_correct_answer\r\n set_question_and_answer\r\n @answer.correct = 1\r\n save_answer_and_render\r\n end", "def verify_and_update(params, kase, answer_set=\"case_answers\", user=nil)\n if params[:answer]\n if self.questions.with_answers.length >= params[:answer].length\n case answer_set\n when \"case_answers\"\n kase.send(answer_set).collect{|ca| ca.destroy!}\n end\n end\n end\n end", "def delete_option\n puts \"PROCEED WITH CAUTION\".center(80).red\n puts \"Delete (P)olitician or (V)oter record?\".center(80)\n delete_type = verified_answer(gets.chomp.downcase, [\"p\", \"v\"])\n if delete_type == \"p\"\n delete_politician\n list_politicians\n else\n delete_voter\n list_voters\n end\n puts\n end", "def unendorse\n if current_user.is_staff\n answer = Answer.find_by_id(params[:answer_id])\n answer.is_staff_endorsed = false\n answer.save!\n end\n render :nothing => true\n end" ]
[ "0.6724293", "0.6559344", "0.65317655", "0.65178406", "0.64450353", "0.6414005", "0.6358155", "0.6325719", "0.6311025", "0.61898583", "0.61567426", "0.6032602", "0.60241467", "0.60200757", "0.60190964", "0.60117006", "0.5905089", "0.5888338", "0.58614767", "0.5844508", "0.5836531", "0.5827684", "0.58114046", "0.58024997", "0.5767713", "0.57523626", "0.57432765", "0.5726926", "0.57173586", "0.57059026", "0.570531", "0.5703833", "0.5703227", "0.5701104", "0.5697059", "0.5694047", "0.567705", "0.56531584", "0.56373584", "0.56298614", "0.56266236", "0.5623539", "0.5611607", "0.56110847", "0.55944544", "0.5593664", "0.558365", "0.557634", "0.55704516", "0.55704516", "0.55704516", "0.55704516", "0.55579156", "0.5557677", "0.5552809", "0.5552741", "0.5528791", "0.552815", "0.5524582", "0.552018", "0.5519147", "0.55111027", "0.55059177", "0.54968244", "0.5495605", "0.5493909", "0.549118", "0.549118", "0.549118", "0.549118", "0.54829365", "0.5481141", "0.5477577", "0.54649055", "0.5462144", "0.5458112", "0.54544896", "0.5453879", "0.5448602", "0.5447272", "0.54400444", "0.5434298", "0.5429918", "0.54269195", "0.54253227", "0.5423816", "0.54232615", "0.54222924", "0.54144675", "0.54143876", "0.5412618", "0.5412435", "0.5402972", "0.54012376", "0.539262", "0.5392511", "0.5389287", "0.53859913", "0.5378782", "0.5378629" ]
0.5376419
100
method showing lives remaining
def show_lives puts "Lives remaining: #{@players[0].name}: #{@players[0].life}/3 - #{@players[1].name}: #{@players[1].life}/3" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_lives(lives)\n puts \"#{lives} Lives left\"\n end", "def take_life\n @lives -= 1\n end", "def looses_life\n @lives -= 1\n end", "def show_state\n if @life_points <= 0\n puts \"#{@name} is dead... \\n...Monde de merde...\"\n else\n puts \"#{@name} has #{@life_points} life points left.\"\n end\n end", "def lives_lost\n @lives -= 1\n pp \"INCORRECT -- YOU HAVE #{@lives} LIVES LEFT\"\n end", "def reduce_life\n if @lives > 0\n @lives -= 1\n end\n end", "def deduct_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def lose_life\n @lives -= 1\n end", "def life_count\n puts \"#{@player1.name}'s lives: #{@player1.lives}\\n#{@player2.name}'s lives: #{@player2.lives}\"\n end", "def time_remaining\n\n end", "def time_remaining\n end", "def lose_life()\r\n @life -= 1\r\n end", "def life\n return @life\n end", "def player_lives_status(player, num_lives)\n \"\\n#{player_name(player)} has #{num_lives} lives/life left.\\n\"\nend", "def remove_life \r\n @lives -= 1 # this is part of class and objects above\r\n end", "def get_time_remaining\n\n end", "def subtract_point \n\t\t@lives -= 1\n\tend", "def get_away()\n @health -= 10\n puts @health\n end", "def lives_decriment\n\t\tlives_will_change!\n\t\tself.lives -= 1 \n\t\tself.hp = self.level+5\n\t\tself.save!\n\t\tif self.lives <=0 \n\t\t\t# restarts NPC's renders user-wizards unusable\n\t\t\tif self.user_id == 1\n\t\t\t\tself.default_values()\n\t\t\telse\n\t\t\t\tputs \"Game Over for #{self.name}!\"\n\t\t\t\tself.level = 0\n\t\t\tend\n\t\tend\n\tend", "def status\n \"#{@name}: #{@lives}/3 \"\n end", "def remaining\n [0, @duration - elapsed].max\n end", "def current_stat\n \"#{@lives}/#{@total_lives}\"\n end", "def show_state\n if @life_points < 0\n @life_points = 0\n end\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def wrong \n @lives -= 1\n end", "def remaining_hours\n \n end", "def lose_life\n @life -= 1\n end", "def show_state\n if @life_points <= 0\n puts \">>> #{@name} a 0 points de vie\"\n else\n puts \">>> #{@name} a #{@life_points} points de vie\"\n end\n end", "def remaining_time\n # calculate how old is the feedback\n created_at = self.created_at.to_time\n diff_seconds = (Time.now - created_at).round\n remaining = TEN_MINUTES - diff_seconds\n\n remaining.to_s\n end", "def current_life\n 0.01 * total_life * current_life_percent\n end", "def remaining\n (Time.now - @last_scrape).to_i \n end", "def remaining; end", "def done\n @lives <= 0\n end", "def show_lives\n puts \"Lives: #{@lives} ♥\"\n end", "def reduce_life\n if @life > 0 \n @life = @life - (1 * @starvation_rate)\n else\n @status = :dead\n end\n end", "def wrong\n self.lives -= 1\n end", "def show_state\n puts \"#{@name} has #{@life_points} life points\"\n end", "def show_state \n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def show_state \n puts \"#{@name} à #{@life_points} points de vie\"\n end", "def time_left\n @lifetime - @elapsed_time\n end", "def show_state\n\t\tputs \"#{@name} n'a plus qu'un point de vie !\" if @life_points == 1\n\n\t\tputs \"#{@name} est mort\" if @life_points == 0\n\n\t\tputs \"#{@name} a #{life_points} points de vie\" if @life_points.between?(2,10)\n\tend", "def show_state\r\n puts \"#{@name} à #{@life_points} points de vie\"\r\n end", "def life_lost\n # if we are attacking ourselves, don't give our life back (otherwise it will never end)\n unless current_user == current_user.previous.player\n # Render the status message and push it to all clients\n message = render_to_string :partial => 'messages/gained_a_life', \n :locals => {:user_1 => current_user.previous.player, :user_2 => current_user}\n send_status_message(message) \n \n # Attacker gains the life that their victim lost\n attacker = current_user.previous.player\n life_gained(attacker)\n end\n ensure\n render :nothing => true\n end", "def show_state\n puts \"#{@name} à #{@life_points} points de vie\"\n end", "def lose_life\n puts \"Sorry, that is the wrong answer!\"\n @current_player.life -= 1\n if @current_player.life == 0\n puts \"#{current_player.name} loses! Game Over!\"\n end\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie\"\n end", "def show_state\n puts \"#{self.name} a #{self.life_points} points de vie.\"\n end", "def show_state\n if @life_points <= 0\n puts \">>> #{@name} a 0 points de vie\"\n else\n puts \">>> #{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end\n end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def show_state\n\t\treturn \"#{self.name} a #{self.life_points} points de vie.\"\n\tend", "def remaining\n max - used\n end", "def amount_remaining\n @desired_amount - @bought_amount\n end", "def show_state\n \tputs \"#{@name} a #{life_points} points de vie\"\n end", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def show_state\n puts \"#{name} a #{life_points} points de vie!\"\n end", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def get_Remaining()\n \t return @outputs[\"Remaining\"]\n \tend", "def show_state\n puts \"#{name} a #{life_points} points de vie !!\"\n end", "def remaining_total\n total\n end", "def show_state\n puts \"#{@name} a #{@life_points} de vie\"\n end", "def show_state\n\t\tputs \"#{@name} a #{@life_points} points de vie.\"\n\tend", "def game_over\n @lives == 0\n end", "def show_state\n puts \"#{name} à #{life_points} points de vie\"\n end", "def show_state\n puts \"#{names} a #{life_points} points de vie\"\n end", "def remaining_time\n t = date.to_time - Time.now\n \"%2d Tage %2d h %2d Min.\" % [t/86400, t/3600%24 , t/60%60]\nend", "def show_state\n return \"#{@name} a #{@life_points} points de vie\"\n end", "def lost?\n @life <=0\n end" ]
[ "0.75132436", "0.7385032", "0.73500735", "0.730432", "0.7229958", "0.72146595", "0.7208545", "0.708957", "0.708957", "0.708957", "0.708957", "0.68156254", "0.67217946", "0.67131567", "0.66743046", "0.66627496", "0.6622638", "0.66155505", "0.66103446", "0.65931404", "0.65896255", "0.6567224", "0.6548389", "0.654286", "0.65224594", "0.65143013", "0.6502064", "0.64995897", "0.64788413", "0.64753884", "0.6458438", "0.64420635", "0.6433514", "0.6381374", "0.63638043", "0.6322611", "0.63222975", "0.6315327", "0.63046247", "0.6282415", "0.6272208", "0.62698925", "0.62550014", "0.62492883", "0.62316644", "0.62246776", "0.6220336", "0.621725", "0.62172306", "0.6211904", "0.6210616", "0.6210469", "0.61981744", "0.6194755", "0.61618876", "0.61615825", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424476", "0.61424434", "0.614212", "0.614212", "0.614212", "0.614212", "0.614212", "0.614212", "0.614212", "0.6141193", "0.6141193", "0.6141193", "0.6141193", "0.6141193", "0.6141193", "0.6141193", "0.6141193", "0.6141193", "0.6141193", "0.6141193", "0.6141018", "0.6122998", "0.6115466", "0.6114037", "0.6105549", "0.61046565", "0.6094202", "0.6090692", "0.60826147", "0.6071746" ]
0.7464693
1
method which switches between players each round
def switch_player if @current_player == @players[0] @current_player = @players[1] else @current_player = @players[0] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_players\n temp = @current_player\n @current_player = @opposing_player\n @opposing_player = temp\n end", "def switch_players\n @player1_turn = !@player1_turn\n end", "def switch_players!\n if current_player==player1\n @current_player=player2\n else\n @current_player=player1\n end\n end", "def change_turns\n (@current_player == @p1) ? @current_player = @p2 : @current_player = @p1\n end", "def switch_players\n @current_player_index += 1\n @current_player_index = 0 if @current_player_index >= @num_players\n @players[@current_player_index]\n end", "def switch_players(player) \n if player == 0\n player = 1\n else\n player = 0\n end\nend", "def switch_players\n \n if @current_asker == @player1\n @current_asker = @player2\n @current_responder = @player1\n else\n @current_asker = @player1\n @current_responder = @player2\n end\n\n end", "def switch_player\n @current_player = if @current_player == @player_o\n @player_x\n else\n @player_o\n end\n\n @number_of_turns += 1\n end", "def switch_players \n @active_player, @inactive_player = @inactive_player, @active_player\n end", "def switch_player()\n\t\tif $current_player == @player1\n\t\t\t$current_player = @player2\n\t\telse \n\t\t\t$current_player = @player1\n\t\tend \n\tend", "def switch_player\n if @active_player == @player1\n @active_player = @player2\n else\n @active_player = @player1\n end\n end", "def switch_players(player_one, player_two)\n self.current_player = current_player == player_one ? player_two : player_one\n\n end", "def switch_player\nif @player == PIECE[:x]\n@player = PIECE[:o]\nelse\n@player = PIECE[:x]\nend\nend", "def switch_players\n if @current_player.name == @player1.name\n @current_player = @player2\n @other_player = @player1\n else \n @current_player = @player1\n @other_player = @player2\n end\n return\n end", "def next_round\n sleep(1)\n puts \"\\n----- NEW TURN -----\"\n self.players.rotate!\n round_gameplay\n end", "def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end", "def switch_players\n @current_player, @other_player = @other_player, @current_player\n end", "def switch_players\n @current_player, @other_player = @other_player, @current_player\n end", "def round\n @player = @players.first\n puts \"---- NEW TURN -----\"\n ask_question(@player)\n @players.rotate!\n\nend", "def switch_player(player)\n if player == @player1\n player = @player2\n else \n player = @player1\n end\n end", "def play_turn\n @players.each do |p|\n dice = @dice.roll\n move_player p, dice\n @board.landed_by p\n end\n end", "def play_round\n loop do\n self.board.display_board\n self.player1.turn_action\n if self.player1.winner? || self.board.board_full?\n break\n end\n self.player2.turn_action\n if self.player2.winner? || self.board.board_full?\n break\n end\n end\n self.board.display_board\n end", "def change_turn\n @turn += 1\n @this_players_turn = @players.reject{|x| x == @this_players_turn}[0]\n take_turn(@this_players_turn)\n end", "def switch_player(player_turn)\n\t\tplayer_turn == @player1 ? @player2 : @player1\n\tend", "def next_round\n if @round > 1\n puts \"----- NEW TURN -----\"\n end\n # next round\n @round += 1\n @players.rotate!\n end", "def set_turns\n if @game_count % 2 == 1\n @player_turn = 1\n @player_1.symbol = :X\n @player_2.symbol = :O\n else\n @player_turn = 2\n @player_1.symbol = :O\n @player_2.symbol = :X\n end\n end", "def change_player\n @curr_player == @player1 ? @curr_player = @player2 : @curr_player = @player1\n end", "def change_player \n if @current_player == 0\n @current_player = 1\n elsif @current_player == 1\n @current_player = 0\n end\n end", "def playerTurn\n if @current_player == @player1\n @current_player = @player2\n else \n @current_player = @player1\n end\n return @current_player\n end", "def change_player\n\t\tif @current_player == @player1\n\t\t\t@current_player = @player2\n\t\t\t@opponent_player = @player1\n\t\telse\n\t\t\t@current_player = @player1\n\t\t\t@opponent_player = @player2\n\t\tend\n\tend", "def current_player_switch()\n if @current_player == 0 \n @current_player = 1\n elsif @current_player == 1 \n @current_player = 0\n end\n end", "def player_in_turn\n \tif self.turns.where(round: self.round).exists?\n \t\t\tself.next_player\n \t\telse\n \t\t\tself.loser_of_round(self.round-1)\n \t\tend\n end", "def play\n #self.set_players # Only uncomment one of these two lines.\n self.set_computer_players # Uncomment this line to have two computer players\n until @board.winner?\n self.turn\n self.change_current_player\n end\n winner = (@current_player == @player1) ? @player2 : @player1\n puts \" #{winner.color.to_s.upcase} is the winner!!!!\"\n puts \"Thanks for playing.\"\n end", "def play_turn\n @board.place_mark(@current_player.get_move, @current_player.mark)\n switch_players!\n end", "def switch_current_player\n @current_player = @current_player == @player1 ? @player2 : @player1\n end", "def change_turn\n if @player_to_move == \"w\"\n @player_to_move = \"b\"\n else\n @player_to_move = \"w\"\n end\n end", "def new_game\n @players = [@p1, @p2]\n\n round_gameplay\n until self.winner?\n next_round\n end\n\n end", "def change_player\n\n end", "def switch_player(current_player)\n current_player == player1 ? @next_player = player2 : @next_player = player1\n end", "def start_new_match\n @player1.points = 0\n @player1.deuce = false\n @player1.advantage = false\n @player1.win = false\n @player1.games_won = 0\n @player1.sets_won = 0\n\n @player2.points = 0\n @player2.deuce = false\n @player2.advantage = false\n @player2.win = false\n @player2.games_won = 0\n @player2.sets_won = 0\n end", "def play\n until @board.winner?(@player_1.token) || @board.winner?(@player_2.token)\n @board.print\n self.play_turn\n p \"--------------------\"\n end\n\n self.switch_players!\n @board.print\n p @current_player.token + \" has won!\"\n end", "def play\n until @board.winner?(@player_1.token) || @board.winner?(@player_2.token)\n @board.print\n self.play_turn\n p \"--------------------\"\n end\n\n self.switch_players!\n @board.print\n p @current_player.token + \" has won!\"\n end", "def switch_player!\n return @player = 'X' unless @player == 'X'\n @player = 'O'\n end", "def start_round!\n @players.each { |player| player.empty_hand! }\n @players_in_round.replace(@players)\n @round_winner = nil\n ante_up!\n deal_initial_hands\n end", "def perform\n @turn += 1\n if @turn%2 != 0\n slot = players[0].play(@board)\n else\n slot = players[1].play(@board)\n end\n @board.update_board(slot, @turn.even? ? 2 : 1)\n end", "def play_round\n @fragment = \"\"\n welcome\n\n until round_over?\n take_turn\n next_player!\n end\n\n update_standings\n end", "def play_round \n @events.handle(:round) do\n reset_players\n\n take_bets\n deal\n play\n determine_winners\n \n @deck.reset!\n end\n end", "def game_with_two_players\n\t\t@current_turn = @player_one if @current_turn == false\n\t\tuntil check_or_checkmate(@current_turn) == \"CHECKMATE\"\n\t\t\tmove\n\t\t\tif @current_turn == @player_one\n\t\t\t\t@current_turn = @player_two\n\t\t\telsif @current_turn == @player_two\n\t\t\t\t@current_turn = @player_one\n\t\t\tend\n\t\t\tclear_screen\n\t\tend\n\tend", "def switch_player\n @current_player = (@current_player == 'x' ? 'o' : 'x')\n end", "def turn\n victory = false\n while victory == false do\n player_place\n @board.show_board\n end\n end", "def swap_players\n\t @cur_player = @players.find { |player| player != @cur_player }\n\tend", "def change_current_player\n current_player == player_1 ? @current_player = @player_2 : @current_player = @player_1\n end", "def player_turn\n hit_loop(@player)\n end", "def switch_player\n @act_p = @act_p.id == 0 ? self[1] : self[0]\n end", "def play\n outcome = ''\n [1, 2].each {|ix| _select_players(ix)}\n c_player, o_player = _init_players\n o_player.set_other!(c_player) if o_player.is_IA_S?\n c_player.set_other!(o_player) if c_player.is_IA_S?\n #\n move_already_played = []\n #\n loop do\n STDOUT.print(\"#{@board.to_s}\\n#==> #{c_player.name}/#{c_player.type}'s TURN:\\n\")\n loop do\n m, sym = _get_move_from(c_player, move_already_played) # current player do his move\n v = @board.set_cell(m, sym.to_s)\n if m == -1 || v == sym # if sym not valid symbol, set_cell(m, sym != sym\n move_already_played << m.to_i\n break\n end\n STDERR.print \"! cell[#{m}] already set, try something else - v was: #{v.inspect} // #{v.class}\\n\"\n end\n move_already_played.sort!\n outcome = @board.game_over?\n break if outcome == :draw || outcome == :winner\n c_player, o_player = _switch_players(c_player, o_player)\n end\n _conclusion(outcome, c_player)\n end", "def turn\n @player_1.new_question\n check_score\n @player_2.new_question\n check_score\n match_stats\n puts \"-----NEW-TURN-----\"\n turn\n end", "def switch_player(player_sym)\n check_full_board\n player_sym == PLAYER1_SYM ? player_sym = PLAYER2_SYM : player_sym = PLAYER1_SYM\n make_move(player_sym)\n end", "def run_a_round\n # Sets player one's choice\n player_one_selection = select_player_choice(@player_one)\n # Sets player two's choice\n player_two_selection = select_player_choice(@player_two)\n # Determines winner with correct output string\n puts determine_winner(player_one_selection, player_two_selection)\n end", "def rotate_players\n if @current_player == @player1\n @current_player = @player2\n else\n @current_player = @player1\n end\n end", "def pass_player_turn\n @active_player_idx += 1\n if @active_player_idx == @players.length\n @active_player_idx = 0\n end\n end", "def swap_players\n @cur_player = @players.find { |player| player != @cur_player }\n end", "def play_round\r\n reset_board\r\n\r\n loop do\r\n display_board\r\n current_player_moves\r\n break if someone_won_round? || board_full?\r\n rotate_players!\r\n end\r\n\r\n the_winner = winner\r\n display_board\r\n display_round_result(the_winner)\r\n update_scores!(the_winner)\r\n end", "def play\n\t\tboard = Board.new # cree une instance de la class board\n\t\tfor i in 1..9 # fait une boucle qui vas de 1 a 9, quand on arrive a 9 ca veut dire que toutes les cases du tableau on ete remplis. \n\t\t\tboard.display_stat(@player_one.return_name, @player_two.return_name, @player_one.return_number_of_win, @player_two.return_number_of_win, @player_two.return_number_of_egality) # on appel la methode display stats qui vas servire a affichier les statistiques, nombre de parties, nom des joueurs, leur nombre de victoires...\n\t\t\tif @who_play == 1 # on cree une condition qui vas servire a afficher le nom du joueur qui doit jouer ce tours.\n\t\t\t\tputs \"A toi de jouer #{@player_one.return_name.colorize(:green)} !\\n\\n\\n\"\n\t\t\telse\n\t\t\t\tputs \"A toi de jouer #{@player_two.return_name.colorize(:green)} !\\n\\n\\n\"\n\t\t\tend\n\t\t\tboard.display_board(@board_case) # on affiche le plateau du jeux\n\t\t\tselect_board_case # on appel la methode qui demande a l'utilisateur de choisire la case sur laquel il vas jouer\n\t\t\tif is_win == true # on fait une condition qui appel la methode is_win, cette methode verifi si il y a un cas de victoire\n\t\t\t\tboard.display_board(@board_case) # on affiche le plateau une derniere fois pour montrer la derniere modification\n\t\t\t\tif @who_play == 1 # on fait une condition qui verifie qui a gagner\n\t\t\t\t\tputs \"le joueur #{@player_one.return_name} a gagner cette partie!\" # si c'est le joueur 1 qui a gagner on dit qu'il a gagner, on affiche son nom\n\t\t\t\t\t@player_one.increments_number_of_win\t# on incremente du nombre de victoire \n\t\t\t\telse\n\t\t\t\t\tputs \"le joueur #{@player_two.return_name} a gagner cette partie!\"\n\t\t\t\t\t@player_two.increments_number_of_win\n\t\t\t\tend\n\t\t\t\tbreak # On quitte la boucle car il y a eu une victoire\n\t\t\tend\n\t\t\t@who_play == 1 ? @who_play = 2 : @who_play = 1 # cette ligne sert a faire que c'est a l'autre joueur de jouer (c'est une condition de type ternaire)\n\t\tend\n\t\tif is_win == false # si on sort de la boucle et qu'il n'y a aucune victoire alor c'est un match nul\n\t\t\t@player_one.increments_number_of_egality # on incremente la variable qui compte le nombres de matchs nuls\n\t\t\t@player_two.increments_number_of_egality\n\t\t\tputs \"MATCH NULLLLLLL\".colorize(:red) # on affiche que c'est un match nul\n\t\tend\n\tend", "def play_round(heaps)\n winning_move_from_state(heaps: heaps)\n end", "def turn\n puts \"#{@player_1.name}'s turn.\"\n puts \"Choose your case:\"\n print \">\"\n check_if_empty(@player_1)\n if win\n @board.print_board\n return true\n end\n @board.print_board\n puts \"#{@player_2.name}'s turn.\"\n puts \"Choose your case:\"\n print \">\"\n check_if_empty(@player_2)\n if win\n @board.print_board\n return true\n end\n @board.print_board\n end", "def scoreboard(round_winner)\n if round_winner != 0\n round_winner == 1 ? round_winner = @player1 : round_winner = @player2 \n puts \"#{round_winner.name} won the round.\"\n round_winner.win\n else puts \"tie\"\n end\n puts \"#{player1.name}: #{player1.score}\", \"#{player2.name}: #{player2.score}\"\n end", "def turn_game\n\t\t@player_1.new_question\n\t\tcheck_score\n\t\t@player_2.new_question\n\t\tcheck_score\n\t\tcheck_status\n\t\tputs '------------NEW-TURN-------------'\n\t\tturn_game\n\tend", "def increment_turn\n @players.rotate!\n end", "def play_rounds(player1,player2,rules)\n rnd = 0\n \n until rnd > @rounds-1 do\n \n play1 = player1.get_move\n play2 = player2.get_move\n \n game_val = rules.determine_round_winner(play1, play2)\n \n declare_round_winner(game_val,player1,player2)\n \n rnd += 1\n end\n end", "def reset\n @num_1 = rand(1..20)\n @num_2 = rand(1..20)\n if @current_player == 1\n @current_player = 2\n else\n @current_player = 1\n end\n end", "def startGame(player1, player2)\n\n puts \" Do you want heads(h) or tails(t)?\"\n answer = gets\n answer = answer.chomp\n first = false\n\n # flips the coin\n @coin.flip\n\n # player1 calls what face they want\n if answer == 't'\n if @coin.display == 'Heads'\n first = false\n else\n first = true\n end\n elsif answer == 'h'\n if @coin.display == 'Heads'\n first = true\n else\n first = false\n end\n else\n puts \" fix later\"\n end\n\n # assigns colours baised on who goes first\n if first\n player1.givePieces(\"#FF0000\")\n player1.colour = \"#FF0000\"\n player2.givePieces(\"#0000FF\")\n player2.colour = \"#0000FF\"\n else\n player1.givePieces(\"#0000FF\")\n player1.colour = \"#0000FF\"\n player2.givePieces(\"#FF0000\")\n player2.colour = \"#FF0000\"\n \n end\n\n if first\n puts player1.name + \", You are going first\"\n @view.refreshBoard(@board, [])\n player1.turnStart()\n else\n puts player2.name + \", You are going first\"\n @view.refreshBoard(@board, [])\n player2.turnStart()\n end\n \n while !checkWin() do\n\n if player1.isActive\n # player 1 is active\n @player1.turnEnd()\n @view.refreshUnplayedPieces(@player1)\n @view.refreshUnplayedPieces(@player2)\n @view.refreshBoard(@board, [])\n @view.refreshTurnIndicator(@player2)\n\n player2.turnStart()\n player1.updatePlayedPieces()\n else\n # player 2 is active\n @player2.turnEnd()\n @view.refreshUnplayedPieces(@player1)\n @view.refreshUnplayedPieces(@player2)\n @view.refreshBoard(@board, [])\n @view.refreshTurnIndicator(@player1)\n\n player1.turnStart()\n player2.updatePlayedPieces()\n end\n end\n\n # ask if user's want to reset.\n puts \" Do you want to reset and play another game? Please enter Y or N.\"\n answer = gets\n answer = answer.chomp\n\n # handle input\n if answer == 'Y' || answer == 'y'\n reset()\n elsif answer == 'N' || answer == 'n'\n puts \"Goodbye I hope you had fun playing the game!\"\n else\n puts \" Invalid input detected. The game will be reset\"\n reset() \n end \n end", "def play_single_round\n loop do\n clear\n deal_initial_cards\n show_cards\n turn_cycle\n update_score\n show_result\n break if someone_won_tournament?\n quit_early unless play_again?\n reset\n end\n end", "def choose_turn_order\r\n @players.shuffle!\r\n end", "def play_round\n for player in @players\n for hand in player.hands\n # Check for split from previous hand\n if hand.cards.length == 1 and hand.is_split\n hit_split_hand(player, hand)\n end\n\n if player.is_dealer and not @play_god\n hand.play(@shoe)\n else\n while hand.can_hit and not hand.is_done\n move = @io.get_players_move(@dealer, player, hand)\n case move\n when \"h\" # Hit\n hit_hand(player, hand)\n when \"d\" # Double down\n hit_hand(player, hand)\n player.double_bet(hand)\n hand.stand\n when \"t\" # Stand\n hand.stand\n when \"p\" # Split\n player.split_hand(hand)\n @io.show_hands(player)\n hit_split_hand(player, hand)\n when \"g\" # play_god mode, let god.super decide\n if player.is_dealer and @play_god\n hand.play(@shoe)\n else\n @io.try_again\n end\n else\n # Invalid result\n @io.try_again\n end\n end\n end\n @io.show_hand(player, hand)\n end\n end\n end", "def war\n \n until winner?(self.player1,self.player2)\n 4.times do \n player1.play\n player2.play\n end\n end\n\n handle_winner(self.player1,self.player2)\n\n end", "def next_round\n unless current_round == num_rounds\n update_attributes(current_round: current_round + 1)\n round.start_response_timer\n else\n max_points = game_players_by_points.first.points\n if max_points == 0\n game_players.each{|game_player| game_player.set_lose}\n else\n has_winner = game_players.select{|game_player| game_player.points == max_points}.count == 1\n if has_winner\n game_players_by_points.first.set_win\n else\n game_players.select{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_tie}\n end\n game_players.reject{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_lose}\n end\n update_attributes(current_state: 3)\n end\n end", "def play\n @players.each { |player| player.score = 0 }\n\t \n\tloop do\n\t @board.clear\n @cur_player = @players[0]\n\t @rounds += 1\n\t\t\n\t print \"\\n******************* Connect Four ********************\"\n\t puts \"\\n#{@players[0].name} will play with #{@players[0].color}; #{@players[1].name} will play with #{@players[1].color}\\n\\n\"\n\t @board.print_board \n\t \n\t loop do\n position = prompt_movement\n\t @board.set_disk(position, @cur_player.color)\n\t\t@board.print_board \n\t\t \n\t\tresult = \n\t\t if @board.is_winner?(@cur_player.color)\n\t\t @cur_player.score += 1\n\t\t puts \"\\n#{@cur_player.name} wins!!\"\n\t\t\ttrue\n\t\t elsif @board.is_full?\n\t\t puts \"\\nThe game ended in a tie!\"\n\t\t\ttrue\n\t end\n\t\t \n\t\tbreak if result\n\t\tswap_players\n end\n\t\t\n\t break if prompt_quit\n\tend\n\t \n\tprint_final_score\n end", "def update\n player = Player.find_by!(uuid: session[:uuid])\n game = player.game\n\n if game.creator == player\n game.max_rounds.times do\n CreateRound.new(game: game).perform\n end\n NextRound.new(game: game).perform\n game.playing!\n end\n\n redirect_to player_path\n end", "def turns\n while @board.game_check == false\n player_process(@player1_name,@player1_symbol,@turn)\n break if @board.game_check == true\n\n player_process(@player2_name,@player2_symbol,@turn)\n end\n @board.display\n print \"\\nDone \\n\"\n end", "def play_match()\n\t\t#start a loop \n\t\tgame_end = false\n\t\twhile not game_end\n\t\t\tchar = get_player()\n\t\t\t#play a round\n\t\t\tself.play_round(char)\n\t\t\tself.player_turn += 1\n\t\t\t#check for win condition\n\t\t\tif self.board.line_complete?(char)\n\t\t\t\tif char == \"X\"\n\t\t\t\t\tputs \"Player 1 won!\"\n\t\t\t\t\tself.p1_rounds += 1\n\t\t\t\telse\n\t\t\t\t\tputs \"Player 2 won!\"\n\t\t\t\t\tself.p2_rounds += 1\n\t\t\t\tend\n\t\t\t\tputs self.to_s()\n\t\t\t\tgame_end = true\n\t\t\t\tbreak\n\t\t\tend\n\t\t\t# check for stalemate\n\t\t\tgame_end = true if board.stalemate?()\n\t\tend\t\n\tend", "def choose_move\n choose_move_when_in_check\n #update to be player specific\n choose_piece_to_move\n which_piece_selected\n choose_where_to_move\n end", "def round_1\n i = 0\n round1_array = []\n @teams = @teams.shuffle\n\n while i < @teams.length\n match = Match.new( { 'team1_id' => @teams[i].id , 'team2_id' => @teams[i+1].id } )\n round1_array << match\n i += 2\n end\n\n for match in round1_array\n match.play\n match.save\n end\n\n end", "def turn\n puts \"Turn #{@board.count_turn + 1}, player #{get_current_player.name} choose:\"\n @board.play_turn\n end", "def current_player\n if turn_count.even?\n player_1\n else\n player_2\n end\n end", "def move_player1 (choice_case)\n symbole_player1 = @player1.symbole\n @board.move_player1(choice_case, symbole_player1)\n @@game_count+=1\n end", "def play_match\r\n reset_scores\r\n\r\n loop do\r\n display_scores\r\n choose_turn_order\r\n play_round\r\n break if someone_won_match?\r\n end\r\n\r\n display_match_result\r\n end", "def play\n\t @players.each { |player| player.score = 0 }\n\t \n\t loop do\n\t @board.clear\n\t\t@cur_player = @players[0]\n\t\t@rounds += 1\n\t\t\n\t\tprint \"\\n******************* Tic-Tac-Toe ********************\"\n\t puts \"\\n#{@players[0].name} will play with #{@players[0].mark}; #{@players[1].name} will play with #{@players[1].mark}\\n\\n\"\n\t\t@board.print_board \n\t \n\t\tloop do\n position = prompt_movement\n\t @board.set_mark(position, @cur_player.mark)\n\t\t @board.print_board \n\t\t \n\t\t result = \n\t\t if @board.is_winner?(@cur_player.mark)\n\t\t @cur_player.score += 1\n\t\t puts \"\\n#{@cur_player.name} wins!!\"\n\t\t\t true\n\t\t elsif @board.is_full?\n\t\t puts \"\\nThe game ended in a tie!\"\n\t\t\t true\n\t\t\tend\n\t\t \n\t\t break if result\n\t\t swap_players\n\t\tend\n\t\t\n\t\tbreak if prompt_quit\n\t end\n\t \n\t print_final_score\n\tend", "def player_win\n @player_win += 1\n end", "def game_on\n # Declare variable for player_1 and player_2 -> using .new\n player_1 = Player.new(\"Player 1\")\n player_2 = Player.new(\"Player 2\")\n\n # Declare a counter variable\n count = 0\n\n # Use a while loop to play game until one of the player has no live left\n while player_1.lives > 0 && player_2.lives > 0\n puts \"***** NEW TURN *****\"\n\n # Check if the counter is even?\n count.even? ? play_turn(player_1) : play_turn(player_2)\n\n # Display the results of player 1 and 2 \n display_player_1_result = \"P1: #{player_1.lives}/3 vs \"\n display_player_2_result = \"P2: #{player_2.lives}/3\"\n # Print out the output string\n puts display_player_1_result + display_player_2_result\n \n count += 1\n end\n\n # Find the winner\n winner = player_1.game_over? ? player_2 : player_1\n puts \"*********************\"\n # Print out the winner and his score\n puts \"#{winner.name} wins with a score of #{winner.lives}/3\"\n puts \"***** GAME OVER *****\"\n puts \"***** GOOD BYE *****\"\nend", "def turn(player)\n puts \" C'est le tour de #{player.nom}\"\n\n#affichage du plateau\n @plateau.visuel\n\n#demande au joueur ce qu'il joue\n puts \"Ou veux tu placer ton pion?\"\n puts \"Info : Tapes de 1 à 9\"\n @choix = gets.chomp.to_i\n puts \"Tu as choisi la case #{@choix}\"\n\n#appel de la methode de modification de la valeur de la case\n @plateau.play(@choix, player, player.token)\n\n#affichage du tableau avec les modifications\n @plateau.visuel\n\n#verification de la victoire ou non \n @plateau.victory(player.win, player.token)\n puts player.win\n if player.win == false\n go\n elsif\n puts \"Le jeu est fini ! #{player.nom} à gagner\"\n end\n\n end", "def play_some_moves(game)\n first_player = game.active_player\n second_player = game.inactive_player\n size = game.board_size\n moves = [size + 1, 2*size - 2, 3*size + 1, 4*size - 2]\n\n i = 0\n 2.times do\n [first_player, second_player].each do |player|\n game.new_move(moves[i], player)\n i += 1\n end\n end\nend", "def play\n #turns = 0\n until over?\n turn\n end\nend", "def opponent_turn\n #set variables\n game = Game.find(self.game_id)\n player = Player.find(game.players.last)\n draw_card = Card.where(player_id: -2).first\n opponent_cards = Card.where(player_id: self.id)\n possible_plays = []\n colors = [\"blue\", \"green\", \"red\", \"yellow\"]\n\n #determine eligible cards in hand.\n opponent_cards.each do |card|\n if card.color == draw_card.color || card.number == draw_card.number || (card.card_action != nil && card.card_action == draw_card.card_action)\n possible_plays.push(card)\n end\n end\n #starts decision logic for card to play, otherwise draws a card and looks for possible plays\n if possible_plays.any?\n #discard current draw pile card\n draw_card.player_id = -1\n draw_card.save\n\n #determines card to be played, sets card to be the new draw pile card\n selected_card = possible_plays.sample\n selected_card.player_id = -2\n selected_card.save\n\n #determines if card has special action, and executes action if it does.\n if selected_card.card_action != nil\n\n if selected_card.card_action === \"skip\" || selected_card.card_action === \"reverse\"\n self.opponent_turn\n elsif selected_card.card_action === \"draw\"\n draw_two = Card.where(player_id: 0).sample(2)\n draw_two.each do |card|\n card.player_id = game.players.first.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"draw_four\"\n draw_four = Card.where(player_id: 0).sample(4)\n draw_four.each do |card|\n card.player_id = player.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"wild_color\"\n selected_card.color = colors.sample\n selected_card.save\n end\n\n else\n #switches current turn once card has been selected and played\n if game.current_turn = self.id\n game.current_turn = player.id\n game.save\n else\n game.current_turn = self.id\n game.save\n end\n\n end\n\n else\n #draws a card from the draw pile and repeats opponent_turn process.\n drawn_card = Card.where(player_id: 0).sample\n drawn_card.player_id = self.id\n drawn_card.save\n self.opponent_turn\n end\n end", "def switch_sides(player)\n\t\tputs \"---------------\"\n\t\tshow_board\n\t\tputs \"Switching sides... #{player}'s turn.\"\n\t\trotate_board\n\t\tputs \"---------------\"\n\tend", "def fight (player1, player2)\n\n round = 0\n\n while player1.life_points > 0 && player2.life_points > 0\n round += 1\n puts \"This is the current state of each player:\"\n player1.show_state\n player2.show_state\n\n puts \"\\n\"\n puts \"ROUND #{round}...FIGHT!\"\n player1.attacks (player2)\n\n \n if player2.life_points <= 0\n break\n end\n round += 1\n puts \"\\n\"\n puts \"ROUND #{round}...FIGHT!\"\n player2.attacks (player1)\n\n \n if player2.life_points <= 0\n break\n end\n puts \"\\n\"\n puts \"------------------------\"\n puts \"------------------------\"\n puts \"\\n\"\n end\nend", "def play_game\n\t\t\n\t\t2.times do \n\t\t\t\n\t\t\tputs to_s\n\t\t\t@players.each do |player|\n\n\t\t\t\tif player.is_fold\n\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tputs player.to_s\n\t\t\t\todds = @pokeroddsproxy.get_odds(player.get_cards, get_cards, @playernumber)\n\t\t\t\t#puts player.get_cards\n\t\t\t\tif player.get_user\n\t\t\t\t\tinput = get_input\n\t\t\t\t\tamount = 0\n\t\t\t\t\tif input == 1\n\t\t\t\t\t\tamount = 100 + @bet\n\t\t\t\t\telsif input == 2\n\t\t\t\t\t\tamount = @bet\n\t\t\t\t\telse\n\t\t\t\t\t\tamount = 0\n\t\t\t\t\t\tplayer.fold\n\t\t\t\t\tend\n\t\t\t\t\tplayer.removemoney(amount)\n\t\t\t\t\t@pot = @pot + amount \n\t\t\t\telse\n\t\t\t\t\tamount = player.set_move(odds, 200, 200)\n\t\t\t\t\tplayer.removemoney(amount)\n\t\t\t\t\t@pot = @pot + amount \n\t\t\t\tend\n\t\t\t\t#puts get_cards\n\t\t\t\tputs odds\n\t\t\t\tputs\n\t\t\tend\n\t\t\t\n\t\t\tputs \"pot: #{@pot}\"\n\n\t\t\t@board << @deck.deal\n\t\tend\n\n\t\tfind_winner\n\tend", "def next_round!\n @round =\n case @round\n when Round::Stock\n @operating_rounds = @phase.operating_rounds\n reorder_players\n new_operating_round\n when Round::Operating\n if @round.round_num < @operating_rounds\n or_round_finished\n new_operating_round(@round.round_num + 1)\n else\n @turn += 1\n or_round_finished\n or_set_finished\n if @minor_exchange == :triggered\n new_minor_exchange_round\n else\n new_stock_round\n end\n end\n when init_round.class\n init_round_finished\n reorder_players\n new_operating_round(@round.round_num)\n end\n end", "def switch_player\n\t\tputs \"\\n\"\n\t\tif @player == @player1\n\t\t\t@player = @player2\n\t\t\t@other_player = @player1\n\t\telse\n\t\t\t@player = @player1\n\t\t\t@other_player = @player2\n\t\tend\n\t\t\n\t\t#Matt easter egg\n\t\tif @player.name.downcase == 'matt'\n\t\t\tdescriptors = [' the Amazing', ' the Hero', ' the Incroyable', \n\t\t\t\t\t\t ' the Handsome', ' the Clever', ' the Wonderful', ' the Indominable']\n\t\t\t@player.name = @player.name + descriptors.sample\n\t\tend\n\n\t\t@player.stench -= 1\n\t\t@player.stench = 4 if @player.location == :Rubbisher\n\t\t@player.beans -= 1\n\t\t@player.pills += 1 if @player.pills > 0\n\t\tif @player.location == :free && @other_player.location == :free\n\t\t\t@escape_artists = @escape_artists.upcase\n\t\t\tif @player.stench > 0 || @player.beans > 0 || @other_player.stench > 0 || @other_player.beans > 0\n\t\t\t\t@stinky = @stinky.upcase\n\t\t\tend\n\t\t\tif (@player.stench > 0 && @other_player.beans > 0) || (@player.beans > 0 && @other_player.stench > 0)\n\t\t\t\t@double_stink = @double_stink.upcase\n\t\t\tend\n\t\t\tputs \"\\nYou've both escaped! Congratulations!\"\n\t\t\tif @player.dead\n\t\t\t\tputs @player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0 && @player.location != :Rubbisher\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\t\tif @other_player.dead\n\t\t\t\tputs @other_player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @other_player.beans > 0\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @other_player.stench > 0\n\t\t\tshow_achievements\n\t\t\t@game = false\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\tputs \"\\nYou've escaped, but you've left your friend behind to rot.\\n\"\\\n\t\t\t\t \"Way to go, hero.\"\n\t\t\t@game = false\n\t\tend\n\t\tif @player.location == :free\n\t\t\tputs \"\\n\" + @player.name + \" is free!\"\n\t\tend\n\t\tif @player.dead\n\t\t\tputs \"\\n\" + @player.name + \" is dead.\"\n\t\tend\n\t\tshow_current_description unless @player.location == :free\n\t\tputs \"\\nThe world swims before your eyes.\" if @player.pills == 2\n\t\tputs \"\\nIn the corners of your vision, colorful phantasms\\nflicker in and out of being.\" if @player.pills == 3\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour stomach hurts.\" if @player.pills == 4\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour entire body is starting to hurt.\" if @player.pills == 5\n\t\tif [4, 5].include?(@player.pills) && @player.location == :Lair && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature's image in the spirit world is far stronger than\\n\"\\\n\t\t\t\t \"in the real. In the spirit world, you can see the ideas holding\\n\"\\\n\t\t\t\t \"the creature together... you reach out your hand and you can\\n\"\\\n\t\t\t\t \"feel them, too. You twist your fingers and those ideas shift.\\n\"\\\n\t\t\t\t \"The creature blurs and disappears. In it's place, a mouse falls\\n\"\\\n\t\t\t\t \"to the floor and scampers away. Without the creature there, you\\n\"\\\n\t\t\t\t \"can see an exit to the north.\" \n\t\t\twin_door(:Lair, :north)\n\t\tend\t\n\t\tif @player.pills == 6\n\t\t\tputs \"\\nYour entire body feels like tiny rats are eating you from inside your veins,\\n\"\\\n\t\t\t\"and the rats are on fire. You can't do anything but lie on the floor and moan.\"\n\t\t\t@player.dead = true\n\t\t\t@overdose = @overdose.upcase\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0\n\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\tif @player.location == :Lair && (@player.stench > 0 || @player.beans > 0) && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature takes a step back, and wrinkles its already wrinkly nose. As it\\n\"\\\n\t\t\t\"glides to the side and disappears through the wall, you think you hear it\\n\"\\\n\t\t\t\"mutter something about the disadvantages of an enhanced sense of smell.\\n\"\\\n\t\t\t\"Without the creature there, you can see an exit to the north.\"\n\t\t\twin_door(:Lair, :north)\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tif @player.dead\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\n\t\t#Matt easter egg\n\t\tif ['matt the amazing', 'matt the hero', 'matt the incroyable', \n\t\t\t'matt the handsome', 'matt the clever', 'matt the wonderful', \n\t\t\t'matt the indominable'].include?(@player.name.downcase)\n\t\t\t@player.name = @player.name.slice(0, 4)\n\t\tend\n\t\n\tend", "def play()\n \twinner = false\n \twhile not winner\n\t # player 1 moves\n\t @board.show()\n\t location = @player1.play()\n\t @board.changeLocation(location, @player1.marker)\n\n\t # did he win?\n\t winner = @board.checkWinner(@player1.marker)\n\t break if winner\n\n\t # player 2 plays\n\t @board.show()\n\t location = @player2.play()\n\t @board.changeLocation(location, @player2.marker)\n\n\t # did he win?\n\t winner = @board.checkWinner(@player2.marker)\n\n\tend\n @board.show()\n puts \"Player #{winner} won the game!\"\n end", "def play_a_round(view, board_instance)\n round_number = 0\n while board_instance.end? == 0\n puts \"\"\n # Alternates the current players with the number of round done\n cur_player = round_number % 2\n cur_player_name = (cur_player == 0 ? @player_1 : @player_2)\n # First display the board at each turn\n view.show_the_board(board_instance.return_board)\n view.tell_the_player_to_play(cur_player_name)\n # Infinite loop to ask where the player actualy wanna play\n while true\n pawn_pos = view.ask_where\n board_instance.valid_pos?(pawn_pos) ? break : view.wrong_entry\n end\n board_instance.board_update(pawn_pos, cur_player)\n round_number += 1\n end\n # Display the final board before calling for the round's end message\n view.show_the_board(board_instance.return_board)\n # Calling round's end message with winner name or both for a ties\n board_instance.end? == 1 ? view.done([cur_player_name]) : view.done([@player_1, @player_2])\n end" ]
[ "0.79595894", "0.79312795", "0.7870784", "0.7730949", "0.77302736", "0.7607129", "0.76000977", "0.75590426", "0.7522271", "0.7512322", "0.74809647", "0.745435", "0.74015576", "0.7390399", "0.7384308", "0.73823", "0.7358186", "0.7358186", "0.7332286", "0.73045486", "0.72800547", "0.72503996", "0.72327715", "0.7230095", "0.7215144", "0.70929414", "0.70892215", "0.70450294", "0.70435023", "0.7025465", "0.70159703", "0.70150185", "0.69914824", "0.6984907", "0.6964929", "0.69314426", "0.6919386", "0.69122", "0.6909775", "0.6907363", "0.68902725", "0.68902725", "0.68764925", "0.6871313", "0.686501", "0.6857895", "0.6822919", "0.682247", "0.68010175", "0.6796612", "0.6795134", "0.67945933", "0.675933", "0.6748075", "0.67459637", "0.67385304", "0.6734299", "0.6724664", "0.67222136", "0.6715653", "0.6714407", "0.6711316", "0.6704775", "0.6697141", "0.66718906", "0.667146", "0.6668457", "0.6667283", "0.666377", "0.6648152", "0.66435665", "0.6641259", "0.6636937", "0.66314703", "0.6621521", "0.6609", "0.66007125", "0.65986484", "0.6574686", "0.6567793", "0.6565362", "0.65646917", "0.6557588", "0.6549764", "0.654355", "0.6540564", "0.6538278", "0.6526664", "0.65240544", "0.65238637", "0.65232986", "0.65215385", "0.65193063", "0.65169835", "0.6505183", "0.65026796", "0.6499746", "0.6498672", "0.6492715", "0.648447" ]
0.74996066
10
Parse the uploaded file. Resulting data will be in data
def parse(uploaded_file) parser_class = case uploaded_file.content_type when "application/vnd.ms-excel" ExcelParser when "text/csv", "application/octet-stream", "text/plain" CSVParser else self.errors << "Do not know how to parse #{uploaded_file.original_filename}. " + "Expects .csv or .xls (Excel) files." nil end if parser_class @data = parser_class.new(self).parse(uploaded_file) end self.valid? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(file)\n if file && !file.instance_of?(String)\n parse_contents(file)\n elsif file.instance_of?(String)\n data = File.read(file)\n parse_contents(data)\n else\n self.load_errors = \"No file was selected to upload.\"\n end\n end", "def uploaded_data=(file)\n self.data = []\n if !file.kind_of?(String)\n self.name = file.original_filename\n self.content_type = file.content_type.chomp\n self.data = file.read\n end\n end", "def parse\n parse_file\n self\n end", "def parse\n uploader = FileUpload.new(params[:contacts])\n uploader.parse\n \n unless uploader.errors.empty?\n @uploader = uploader\n render :action=>:new\n return\n end\n \n @columns = uploader.columns.map{|col| [(col+\" (column #{uploader.columns.index(col)+1})\").downcase,col.downcase]}\n @columns.unshift([\"Select\",nil])\n\n # Security reason this has been saved in Session. \n session[:filename] = uploader.new_filename\n\n end", "def parse_image_data(image_data)\n @tempfile = Tempfile.new('item_image')\n @tempfile.binmode\n @tempfile.write Base64.decode64(image_data[:content])\n @tempfile.rewind\n\n uploaded_file = ActionDispatch::Http::UploadedFile.new(\n tempfile: @tempfile,\n filename: image_data[:filename]\n )\n\n uploaded_file.content_type = image_data[:content_type]\n uploaded_file\n end", "def parse_file\n @filecontent ||= File.read(@filepath)\n end", "def parse\n file = File.read(@file)\n @data = JSON.parse(file)\n end", "def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end", "def parse_image_data(image_data)\n @tempfile = Tempfile.new('item_image')\n @tempfile.binmode\n @tempfile.write Base64.decode64(image_data[:content])\n @tempfile.rewind\n\n uploaded_file = ActionDispatch::Http::UploadedFile.new(\n tempfile: @tempfile,\n filename: image_data[:filename]\n )\n\n uploaded_file.content_type = image_data[:content_type]\n uploaded_file\n end", "def read\n File.read(uploaded.path)\n end", "def parse_file(filename); end", "def parse\n @chunks = parse_chunks extract_chunks decode_blob @blob\n end", "def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end", "def parse(rawdata)\n end", "def parse_upload\n\t@worksheet = (params[:uploaded_doc][:workbook])\n \t@file_path = [Rails.root, 'public', 'upload', @worksheet.original_filename].join('/')\n\t@worksheet_class = (params[:uploaded_doc][:workbook]).class\n\t@worksheet_type = (params[:uploaded_doc][:workbook]).content_type\n\t@worksheet_name = (params[:uploaded_doc][:workbook]).original_filename \n\tFile.open(Rails.root.join('public', 'uploads', @worksheet.original_filename), 'r') do |file|\n\t\t@worksheet_array << file.gets \n\tend\n=begin\t@worksheet_array = RubyXL::Parser.parse(params[:uploaded_doc][:workbook]).worksheets[0].extract_data\n \t@worksheet = RubyXL::Parser.parse(Rails.root.join('public', 'uploads', (params[:uploaded_doc][:workbook]).original_filename , 'w'))#.worksheets[0].extract_data\n\tFile.open(Rails.root.join('public', 'uploads', @worksheet.original_filename), 'r') do |file|\n\t\t@worksheet_array << file.gets \n\tend\n\n=end\n end", "def uploaded_file\n instance_read(:uploaded_file)\n end", "def contents\n file_upload.read\n end", "def parse(data); end", "def process\n validate_file_type(@file_name, 'csv')\n convert_csv_file_to_object\n end", "def parse_files\n options.each do |type, filename|\n begin\n content[type] = FCSV.read(filename)\n rescue CSV::MalformedCSVError\n $stderr.puts \"Error parsing #{filename}: #{$!.message}\"\n exit 1\n rescue Errno::ENOENT, Errno::EACCES\n $stderr.puts \"Error reading #{filename}: #{$!.message}\"\n exit 1\n end\n end\n end", "def parsed_file\n data.split(\"\\n\").map do |line|\n line.split(' ')\n end\n end", "def file=(data)\n self.file.assign(data)\n # uploaded photos need metadata immediately in order to\n # \"Sync obs. w/ photo metadata\"\n if data.is_a?(ActionDispatch::Http::UploadedFile)\n extract_metadata(data.path)\n end\n end", "def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end", "def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end", "def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end", "def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end", "def parse path\n\t\theaders, body = path.read.split(\"\\n\\n\", 2) # Two newlines marks end of headers\n\t\t@headers = parse_headers(headers)\n\t\t@body = parse_body(self.content_type, body)\n\tend", "def parse_upload\n expected_params[:upload] ||= ParameterDeclaration.new(:upload, :upload, {})\n params[:upload]\n end", "def parsed_file_name\n data_file_name.split('.')[0]\n end", "def extract_data!(options)\n if options.has_key?(:data)\n data = options.delete :data\n \n if Array === data\n data.each.with_index do |filepath, idx|\n if filepath.is_a?(Faraday::UploadIO)\n options[\"data[#{idx}]\"] = filepath\n else\n mime_type = extract_mimetype(filepath)\n options[\"data[#{idx}]\"] = Faraday::UploadIO.new(filepath, mime_type)\n end\n end\n elsif data.is_a?(Faraday::UploadIO)\n options[\"data\"] = data\n else\n mime_type = extract_mimetype(data)\n options[\"data\"] = Faraday::UploadIO.new(data, mime_type)\n end\n end\n end", "def parse_input(input_file); end", "def parse_input(input_file); end", "def map_type_import_body(uploaded_file)\n { 'fileUpload' => UploadIO.new(uploaded_file, uploaded_file.content_type, uploaded_file.original_filename) }\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end", "def parse path\n headers, body = path.read.split(\"\\n\\n\", 2)\n @headers = parse_headers(headers)\n @body = parse_body(self.content_type, body)\n end", "def parse_input (input_file)\nend", "def parse(subdata)\n \t\tif subdata.has_key?(:file)\n handle_files(subdata[:file])\n end\n if subdata.has_key?(:directory)\n \t\t handle_folders(subdata[:directory])\n end\n \tend", "def parse! filename\n parse_! filename\n end", "def parse\n logger.debug \"Reading stoage file from: #{self.file.path}\"\n if self.status != 'finished'\n last_parsed_line = self.last_parsed_line\n # make_options\n begin\n # Match the proper parser and build options\n case self.file_type\n when \"1\"\n @parser = Wms::Input::Filetype1\n else\n raise \"Undefined storage type #{file_type}\"\n end\n # when \"wifilocation\"\n # @parser = Wms::Input::AndroidWifiLocation\n # when \"sensor\"\n # @parser = Wms::Input::AndroidSensor\n # when \"audio\"\n # raise \"Not Supported yet storage type #{file_type}\"\n # else\n # raise \"Undefined storage type #{file_type}\"\n # end\n\n @processor = @parser.new\n options = make_options\n @processor.register(options=options)\n\n @processor.run do |data|\n begin\n create_event data\n \n rescue Exception => e\n logger.error \"ERROR #{self.class.name}: #{e} for #{data}\"\n end\n last_parsed_line += 1\n end\n\n \n self.last_parsed_line = last_parsed_line\n self.status = \"finished\"\n self.save\n \n rescue Exception => e\n logger.error \"ERROR: [#{e}]\"\n self.last_parsed_line = last_parsed_line\n self.status = \"error\"\n self.save\n end # end begin\n \n end #end if self.status != 'finished'\n\n\n \n \n end", "def file_upload_data(item = nil)\n fd = get_file_data(item)\n fd = fd[:uploader] if fd[:uploader].is_a?(Hash)\n fd.deep_symbolize_keys if fd[:storage].present?\n end", "def extract_metadata!(data = {})\n data.tap do |d|\n file = File.open(@file)\n d[:filesize] = file.size\n file.close\n\n d[:content_type] = MIME::Types.type_for(@file).first.to_s\n end\n end", "def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end", "def parse_file\n @file ||= File.open(@file_name) unless @file_name.nil?\n @text = @file.readlines\n @file.close unless @file.nil?\n parse_text\n end", "def request_data\n {\n file: File.new(@upload_path, \"rb\"),\n data: @data.to_json\n }\n end", "def parse\n @parsed\n end", "def uploaded_data=(data)\n return if data.nil? #&& data.size > 0\n #set new values\n self.filename = data.original_filename.strip.gsub(/[^\\w\\d\\.\\-]+/, '_')\n self.disk_filename = Attachment.disk_filename(filename)\n #check for small files indicated by beeing a StringIO\n @uploaded_file = data\n end", "def file_upload\n return if request.get?\n\n file = params[:file]\n @results = []\n @error = nil\n\n if (file.nil?)\n @error = \"Looks like there's no file for us to process :(\"\n return\n end\n\n begin\n @results = handle_csv_data(file)\n rescue CSV::MalformedCSVError => e\n @error = e\n end\n end", "def parse(data)\n @data = data\n end", "def parse_file\n #needs begin rescue exception handling \n \tbegin \n \t\traise FileNotFoundException.new(\"File not Found\") unless File.exists?(@file_path)\n\t\n \t\tFile.open(@file_path).slice_before(@delimiter).each do |chunk|\n \t\t\tchunk.reject! {|item| item =~ @delimiter }\n \t\ttitle = chunk.shift\n \t\tif @title_hash.has_key?(title)\n \t\t\t@title_hash[title] = @title_hash[title] << chunk \n \t\telse\n \t\t p chunk\n \t\t\t@title_hash[title] = chunk\n \t\tend \t\t\n \t\tend\n \t\t\n \trescue FileNotFoundException => e\n \t\tp e.message\n \tend\n\t\n end", "def finish_data\n @data.chop!\n name = nil\n \n disp = @headers[\"content-disposition\"]\n raise \"No 'content-disposition' was given.\" if !disp\n \n \n #Figure out value-name in post-hash.\n match_name = disp.match(/name=\\\"(.+?)\\\"/)\n raise \"Could not match name.\" if !match_name\n name = match_name[1]\n \n \n #Fix count with name if given as increamental [].\n if match = name.match(/^(.+)\\[\\]$/)\n if !@counts.key?(match[1])\n @counts[match[1]] = 0\n else\n @counts[match[1]] += 1\n end\n \n name = \"#{match[1]}[#{@counts[match[1]]}]\"\n end\n \n \n #Figure out actual filename.\n match_fname = disp.match(/filename=\\\"(.+?)\\\"/)\n \n if match_fname\n obj = Knjappserver::Httpsession::Post_multipart::File_upload.new(\n \"fname\" => match_fname[1],\n \"headers\" => @headers,\n \"data\" => @data\n )\n @return[name] = obj\n @data = nil\n @headers = {}\n @mode = nil\n else\n @return[name] = @data\n @data = nil\n @headers = {}\n @mode = nil\n end\n end", "def create\n \n\n @foto = Foto.new(params[:foto])\n uploaded_file = params[:foto][:foto]\n \n\n\n photo = Parse::File.new({\n :body => File.read(uploaded_file.tempfile) ,\n :local_filename => uploaded_file.original_filename,\n :content_type => uploaded_file.content_type\n })\n \n photo.save\n foto = Parse::Object.new(\"Foto\").tap do |p|\n p[\"foto\"] = photo\n p[\"descripcion\"] = params[:foto][:descripcion]\n p[\"categoryId\"] = params[:foto][:categoryId]\n end\n \n\n foto.save\n \n\n redirect_to @foto\n end", "def perform\n accept(parse_file)\n end", "def convert()\n @helper.post(@fields, @files, @raw_data)\n end", "def parse_from_file filename\n parse File.open(filename)\n end", "def read\n @fileobj.seek @data_offset\n @data = @fileobj.read @data_size\n end", "def uploaded_data\n return \"\"\n end", "def data\n File.read(path)\n end", "def swf_uploaded_data=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).first.to_s\n self.file = data\n end", "def swf_uploaded_data=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).first.to_s\n self.file = data\n end", "def parse_data\n puts \"now parsing\"\n parsed_file = @downloads[0].split(' ', -1) \n # BigFile.create(file: @downloads[2])\n if parsed_file[7] == MissouriDatum.order(created_at: :desc).limit(2).last.parsed_timestamp\n MissouriDatum.last.update(parsed_timestamp: parsed_file[7], new_file: false)\n else \n MissouriDatum.last.update(parsed_timestamp: parsed_file[7], new_file: true)\n end \n end", "def process_upload\n return if @upload_processed\n @file.file.process!\n @upload_processed = true\n end", "def parse_file(attrs)\n return attrs unless attrs[:asset]\n attrs[:asset_attrs] = {}\n if attrs[:asset].kind_of?(::File) or attrs[:asset].kind_of?(::Tempfile) then\n attrs[:asset_attrs][:name] = attrs[:asset].respond_to?(:original_filename) ? attrs[:asset].original_filename : ::File.basename(attrs[:asset].path)\n attrs[:asset_attrs][:local_path] = attrs[:asset].path\n elsif attrs[:asset].kind_of?(String) then\n attrs[:asset_attrs][:local_path] = attrs[:asset]\n attrs[:asset] = ::File.new(attrs[:file])\n attrs[:asset_attrs][:name] = ::File.basename(attrs[:asset_attrs][:local_path])\n elsif attrs[:asset].kind_of?(StringIO) then\n raise(ArgumentError, \"Must specify the :as option when uploading from StringIO\") unless attrs[:as]\n attrs[:asset_attrs][:local_path] = attrs[:as]\n\n # hack for bug in UploadIO\n class << file\n attr_accessor :path\n end\n file.path = attrs[:asset]\n else\n raise ArgumentError, \"local_file must be a File, StringIO, or file path\"\n end\n\n attrs[:asset_attrs][:name] = ::File.basename(attrs.delete(:as)) if attrs[:as]\n\n attrs\n end", "def parse_file(file)\n if file.instance_of?(IcalLinkUploader)\n cal_file = File.open(file.file.file)\n elsif file.instance_of?(File)\n cal_file = file\n else\n cal_file = File.open(file)\n end\n events = Icalendar::Event.parse(cal_file)\n end", "def update_upload_attributes\n if document.present? && document_changed?\n self.content_type = document.file.content_type\n self.file_size = document.file.size\n self.file_name = File.basename(document.url)\n end\n end", "def read\n return unless ::File.exist?(@file)\n\n @data = Bencode.decode(::File.read(@file))\n end", "def content\n fields = self.get_fields\n fields.empty? ? self.data.merge(self.file_data).to_json : fields.to_json\n end", "def parse f\n raise \"called parse with type not set\" unless self.type\n #return if self.data\n\n self.data = []\n return nil unless file_offset\n\n case type\n when 'BITMAP','ICON'\n f.seek file_offset\n if f.read(4) == \"\\x89PNG\"\n data << 'PNG'\n else\n f.seek file_offset\n data << BITMAPINFOHEADER.read(f)\n end\n when 'CURSOR'\n f.seek file_offset\n data << CURSOR_HOTSPOT.read(f)\n data << BITMAPINFOHEADER.read(f)\n when 'GROUP_CURSOR'\n f.seek file_offset\n data << CUR_ICO_HEADER.read(f)\n nRead = CUR_ICO_HEADER::SIZE\n data.last.wNumImages.to_i.times do\n if nRead >= self.size\n PEdump.logger.error \"[!] refusing to read CURDIRENTRY beyond resource size\"\n break\n end\n data << CURDIRENTRY.read(f)\n nRead += CURDIRENTRY::SIZE\n end\n when 'GROUP_ICON'\n f.seek file_offset\n data << CUR_ICO_HEADER.read(f)\n nRead = CUR_ICO_HEADER::SIZE\n data.last.wNumImages.to_i.times do\n if nRead >= self.size\n PEdump.logger.error \"[!] refusing to read ICODIRENTRY beyond resource size\"\n break\n end\n data << ICODIRENTRY.read(f)\n nRead += ICODIRENTRY::SIZE\n end\n when 'STRING'\n f.seek file_offset\n 16.times do\n break if f.tell >= file_offset+self.size\n nChars = f.read(2).to_s.unpack('v').first.to_i\n t =\n if nChars*2 + 1 > self.size\n # TODO: if it's not 1st string in table then truncated size must be less\n PEdump.logger.error \"[!] string size(#{nChars*2}) > stringtable size(#{self.size}). truncated to #{self.size-2}\"\n f.read(self.size-2)\n else\n f.read(nChars*2)\n end\n data <<\n begin\n t.force_encoding('UTF-16LE').encode!('UTF-8')\n rescue\n t.force_encoding('ASCII')\n tt = t.size > 0x10 ? t[0,0x10].inspect+'...' : t.inspect\n PEdump.logger.error \"[!] cannot convert #{tt} to UTF-16\"\n [nChars,t].pack('va*')\n end\n end\n # XXX: check if readed strings summary length is less than resource data length\n when 'VERSION'\n f.seek file_offset\n data << PEdump::VS_VERSIONINFO.read(f)\n end\n\n data.delete_if do |x|\n valid = !x.respond_to?(:valid?) || x.valid?\n PEdump.logger.warn \"[?] ignoring invalid #{x.class}\" unless valid\n !valid\n end\n ensure\n validate\n end", "def set_file_from_raw_data\n self.status = 'archived'\n self.file = ActionDispatch::Http::UploadedFile.new(filename: filename, tempfile: tempfile_for_filedata)\n end", "def parse\n # Flac file maybe contain ID3 header on the start, so skip it if exists\n id3_header = ID3::V2Header.new(@file_io)\n id3_header.valid? ? @file_io.seek(id3_header.size) : @file_io.rewind\n\n return if @file_io.read(4) != TAG_ID\n\n loop do\n block = Flac::Block.new(@file_io)\n parse_block(block)\n\n break if block.is_last? || @file_io.eof?\n end\n end", "def parse\n # we need one of them at least\n return nil if !@id.present? && !@filepath.present? \n # get key from filepath if needs\n @id.nil? ? filepath_to_id : id_to_filepath\n # set default locale if null\n @locale ||= I18n.locale.to_s\n # cleanup blanks\n @handler = nil if @handler.blank?\n # set default format\n @format ||= FORMATS[@dir]\n # rebuild key\n @id = [\"\",@dir,@path].compact.join(\"/\")\n # rebuild filepath\n dir = (is_asset? ? \"assets/#{@dir}\" : (is_content? ? \"content/#{@dir}\" : @dir))\n\n @filepath = Grass.app_root + [\"\",dir,@path].compact.join(\"/\") + [\"\",@locale,@format,@handler].compact.join(\".\") \n\n end", "def parse_file\n File.read(file_with_ext).to_s\n end", "def uploaded_file=(uploaded_file)\n run_callbacks :upload do\n @uploaded_file = uploaded_file\n self.filename = uploaded_file.original_filename\n self.content_type = uploaded_file.content_type.strip\n end\n end", "def parse\n end", "def data; file_log.read(file_node); end", "def create\n Rails.logger.debug \"File type is: #{params[:upload].content_type}\"\n @parser = Import::Parser.new\n @parser.parse(params[:upload])\n\n if @parser.valid?\n @processor = Import::VehicleImporter.new(current_account, current_user)\n @processor.store(params[:upload].original_filename, @parser.data)\n else\n flash.now[:error] = @parser.errors[0]\n render :action => \"index\"\n end\n end", "def perform(filepath)\n Postcard.parse_postcard_data(filepath)\n end", "def encoded_file_data(item = nil)\n get_file_data(item)[:data].presence\n end", "def metadata\n metadata = {}\n @file.data.each { |key, value| metadata[key.to_sym] = value }\n\n metadata[:type] = @file.class.name.split('::')[1].downcase\n metadata[:url] = @file.url\n\n metadata[:slug] = slug\n\n metadata[:posted_at] = @file.date.to_time.to_i if @file.respond_to? :date\n metadata[:tags] = tags\n\n metadata\n end", "def file_upload(params_userfile)\n content_upload(params_userfile.read)\n end", "def uploaded_file=(file_field)\n self.filename = base_part_of(file_field.original_filename)\n\n f_str = Iconv.conv('utf-8', self.encoding, file_field.read)\n\n f = StringIO.new(f_str)\n\n if self.format == 'OBT'\n it = OBNOTextIterator.new(f, self.sentence_delimiter == 'delimiter')\n elsif self.format == 'VRT'\n it = VRTReader.new(f)\n else\n raise RuntimeError\n end\n\n it.each_sentence {|s| sentences << s}\n f.close()\n\n # add postamble stored in iterator after parsing last sentence\n # TODO add support for arbitrary data for OBT format\n if self.format = 'VRT'\n self.postamble = it.postamble\n end\n end", "def parse(data)\n new.parse(data)\n end", "def parse_params\n params.require(:parse).permit(:name,:file)\n end", "def file_field; end", "def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end", "def parse_files(*files); end", "def get\n uploaded_file(read) if read\n end", "def parse(data, pos = 0)\n return nil if @eject\n\n # Check to see if we need to apply some heuristics\n if @buff.length < MAGIC_BYTES\n rem = MAGIC_BYTES - @buff.length\n @buff << data[0, rem]\n pos += rem\n data[0, rem] = ''\n\n # Apply heuristics if we have enough data\n if @buff.length == MAGIC_BYTES\n FILE_MAGIC.each do |exp, parser|\n if @buff =~ exp\n begin\n @magic = parser\n @parser = method(\"fparse_#{parser}\")\n @conclude = method(\"conclude_#{parser}\") rescue nil\n @parser.call(@buff)\n rescue NameError\n @parser = nil\n @event_collector.send(:file_parser_dne) do\n { :format => @magic, :parser => \"fparse_#{parser}\",\n :client_ip => str_ip(@state.app_state[:src]),\n :server_ip => str_ip(@state.app_state[:dst]),\n :client_port => @state.app_state[:sport],\n :server_port => @state.app_state[:dport],\n :dir => @dir, :protocol => @proto\n }\n end\n end\n end # of if buff =~ exp\n end # of each file_magic\n end # of if sufficient buffer for heuristics\n\n return nil if data.empty?\n end # of if-need-heuristics-data\n\n # Just buffer the data and hand off to the file parser\n if @parser\n @parser = nil unless @parser.call(data)\n end\n @buff << data unless @buff.length > @maxlen\n @pos += data.length\n end", "def process_data_file!\n filename = self.attachment.file.file\n data = CSV.read(filename, col_sep: \"\\t\")\n data.delete_at(0)\n\n sales_attrs = data.map do |row|\n row.each_with_index.map do |value, index|\n Hash[ CSV_HEADERS[index], value ]\n end.reduce(&:merge)\n end\n\n sales_attrs.each do |sale_attr|\n self.sales.create(sale_attr)\n end\n\n total_revenue = self.sales.map{|sale| sale.amount * sale.unit_price }.reduce(:+)\n self.update_attributes({\n processed: true,\n revenue: total_revenue,\n batch_code: SecureRandom.uuid\n })\n end", "def parse_raw_data\n data_slices.to_a\n end", "def process_file(item_file, index)\n if item_file.upload_file_path\n @logger.info(\"[Child #{index}] Copying file in bag to path: #{item_file.upload_full_path}\")\n item_file.copy_to_upload_full_path\n file = item_file.upload_file_url\n else\n item_file.copy_to_metadata_full_path\n @logger.info(\"[Child #{index}] Uploading filename from metadata to server: #{item_file.metadata_full_path}\")\n file = upload_file(item_file)\n item_file.delete_metadata_full_path\n end\n file\n end", "def initialize( filename )\n @data = Hash.new\n parse( filename )\n end", "def fields\n return @fields if @fields\n @file.rewind\n @fields = @file.gets.split(@separator).map &:strip\n end", "def parse_control_file\n @control_file_contents.scan(/^([\\w-]+?): (.*?)\\n(?! )/m).each do |entry|\n field, value = entry\n @fields[field.gsub(\"-\", \"_\").downcase] = value\n end\n @fields[\"installed_size\"] = @fields[\"installed_size\"].to_i * 1024 unless @fields[\"installed_size\"].nil?\n end", "def initiate_study_file_parse(filename, study_id)\n study_file_params = {file: filename}\n post \"/single_cell/studies/#{study_id}/parse\", params: study_file_params, headers: {'Content-Type' => 'multipart/form-data'}, xhr: true\nend", "def upload\n\t@uploaded_doc = { :workbook => RubyXL::Parser.new } \t\n#\t@uploaded_io = params[:file]\n end" ]
[ "0.7450316", "0.68234205", "0.6747816", "0.6613368", "0.6561181", "0.6537654", "0.65263605", "0.64798194", "0.64629877", "0.63639116", "0.6350962", "0.63383764", "0.6289999", "0.6227038", "0.6218328", "0.62134504", "0.62112314", "0.6200922", "0.61911684", "0.6182405", "0.6147711", "0.6136117", "0.60943276", "0.60943276", "0.60943276", "0.60943276", "0.60940593", "0.60712755", "0.60299313", "0.60220176", "0.5990335", "0.5990335", "0.5983276", "0.5972328", "0.5972328", "0.5972328", "0.5972328", "0.5972328", "0.5972328", "0.5966379", "0.596219", "0.59491986", "0.592733", "0.5914455", "0.5893126", "0.5887067", "0.588564", "0.5875074", "0.5874738", "0.586539", "0.58633006", "0.5846865", "0.5844895", "0.5843666", "0.5830272", "0.58173275", "0.57912177", "0.57901824", "0.57707846", "0.5729809", "0.5714417", "0.56946564", "0.56883305", "0.56883305", "0.5687858", "0.56864536", "0.56856316", "0.56666523", "0.56507796", "0.5647091", "0.5639309", "0.563512", "0.5617389", "0.5609532", "0.56079376", "0.5604857", "0.56017077", "0.5600137", "0.5599609", "0.5595444", "0.5587284", "0.5586797", "0.55840236", "0.5583547", "0.5577146", "0.5574703", "0.5554692", "0.55531275", "0.5546705", "0.55448616", "0.5539447", "0.5526614", "0.55083025", "0.5505158", "0.5492242", "0.548955", "0.5486914", "0.548222", "0.5481433", "0.54795223" ]
0.718122
1
Was the parse successful?
def valid? @data && @errors.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parsing_succeeded\n return @parsing_succeeded\n end", "def parsed?\n self.parsed == 1\n end", "def success?\n unparser.success? && missing.empty? && unexpected.empty?\n end", "def parsed?\n @parsed\n end", "def parse_error?\n @parse_error ? true : false\n end", "def parsed_successfully()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.ParseRunResult_parsed_successfully(@handle.ptr)\n result\n end", "def parsing_succeeded=(value)\n @parsing_succeeded = value\n end", "def done\n # Parse not successful and no reason identified\n # Assuming that parse failed because of a premature end\n premature_end unless success? || failure_reason\n end", "def check_status\n @status = parser.parse\n end", "def parsed; end", "def parsed; end", "def parse(m)\n false\n end", "def success?() end", "def parse_response?\n parse_response\n end", "def parse_response?\n parse_response\n end", "def success?\n response.message == 'OK'\n end", "def parse_ok?\n return false if @severity.nil? || @severity.length != 1\n return false if @fields.nil? || @fields.length < ChainLog::Formatter::NUM_FIELDS\n true\n end", "def success?\n type == :ok\n end", "def parsed?\n @raw.nil?\n end", "def successful?\n @successful\n end", "def ok?\n return @data[\"stat\"] == \"ok\" ? true : false\n end", "def silverpop_successful?(doc)\n %w[true success].include?(result_dom(doc)['SUCCESS'].downcase) rescue false\n end", "def parse\n @parsed\n end", "def successful?\n @success\n end", "def success?\n return true\n end", "def success?\n stat = false\n if @data and @data['message'] == 'success'\n stat = true\n end\n return stat\n end", "def success?\n true\n end", "def succeeded?\n result == \"SUCCESS\"\n end", "def success?\n result.success\n end", "def success?\n status == \"ok\"\n end", "def parse; end", "def parse; end", "def parse; end", "def success\n is_successful?\n end", "def ok?\n @ok\n end", "def success?\n @succeeded\n end", "def success?\n false\n end", "def success?\n false\n end", "def success?\n [missing, unexpected, no_diffs, invalid_syntax].all?(&:empty?)\n end", "def success?\n valid? && ack != 'Failure'\n end", "def parse\n fail StandardError.new('parse has not been implemented.')\n end", "def parse_bool() true end", "def success?\n @error == false\n end", "def success?\n end", "def success_from(response)\n response == 'SUCCESSFUL' || response =~ /^\\d+$/ || response == 'true'\n end", "def succeeded?; state == 'succeeded'; end", "def succeeded?; state == 'succeeded'; end", "def parse(parse_info)\r\n result = false\r\n result = true while @children[0].parse(parse_info)\r\n result\r\n end", "def success?\n state == :success\n end", "def success?\n\t\t\t@success\n\t\tend", "def successful?\n @code == 0\n end", "def parse\n case @state\n when :root\n return false unless parse_root_state\n when :command\n parse_command_state\n else\n raise_parser_error 'Unknown parser state'\n end\n\n true\n end", "def ok?\n @result.retval == 0\n end", "def success?(*) end", "def success?\n @success\n end", "def success?\n @success\n end", "def success?\n @success\n end", "def success?\n @success\n end", "def success?\n @success\n end", "def success?\n @success\n end", "def success?\n @success\n end", "def parse\n end", "def successful?\n status == \"successful\"\n end", "def parse_failure_cause; end", "def successful?\n error.nil?\n end", "def success?\n hash[:smarter_u][:result] == 'Success'\n rescue\n false\n end", "def successful?\n status == :successful\n end", "def successful?\n status == :successful\n end", "def successful?\n if @successful.nil?\n true\n else\n @successful\n end\n end", "def success?\n return false unless @result['status'] == 'OK'\n return false unless @result['results'][0]['address_components'].length > 1\n true\n end", "def success?\n reply_code == 0\n end", "def parse\n return parse_text unless @text.nil?\n return parse_file unless @file.nil? && @file_name.nil?\n return false\n end", "def success?\n @success == true\n end", "def liberal_parsing?() @liberal_parsing end", "def successful\n count(&:ok?)\n end", "def success?\n got.equal?(true)\n end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def successful?\n return true if !acknowledged?\n if first_document.has_key?(OK)\n ok? && parser.message.empty?\n else\n !query_failure? && parser.message.empty?\n end\n end", "def is_successful?\n status_code == '0'\n end", "def successful?\n complete? && all_nodes_succeeded?\n end", "def successful?\n complete? && all_nodes_succeeded?\n end", "def successful?\n returned_parameters['status'] == 'success'\n end", "def success?\n response.success?\n end", "def successful?\n @success && errors.empty?\n end", "def success?\n terminal_flag == :success\n end", "def success?\n @status == SUCCESS_FLAG\n end", "def success?\n got.equal?(true)\n end", "def parse(json)\n res = super(json)\n res[\"response\"] == \"ok\"\n end", "def ok?\n @status == OK\n end", "def parse;\n \"Parsing method\";\n end", "def parse_in_progress\n if @input.match?(/(.*?) folyamatban \\/ Registration in progress\\n/)\n p(\"whois.nic.hu: parse_in_progress\") if 1 == 2 || $DEBUG\n @input.scan(/(.*?) folyamatban \\/ Registration in progress\\n/)\n return @ast['InProgress'] = true\n end\n @ast['InProgress'] = false\n end", "def parse()\n merge(rvparse: 'true')\n end", "def parse response\n if response #and response.code >= 200 and response.code < 300\n return !response.empty? ? JSON.parse(response) : true\n else\n false\n end\n rescue => e\n $logger.trace \"Failed to parse response: #{response} -> #{e}\"\n false\n end", "def parse(args)\n true\n end", "def ok?\n @ok\n end", "def ok?\n return @ok\n end" ]
[ "0.7961036", "0.7335571", "0.7261637", "0.713443", "0.70891905", "0.6956753", "0.6836915", "0.6764742", "0.6585268", "0.65151787", "0.65151787", "0.6443959", "0.643199", "0.63956785", "0.63935846", "0.63513523", "0.6335524", "0.63048214", "0.62647265", "0.6260507", "0.62578344", "0.62480074", "0.62273484", "0.62238276", "0.6223744", "0.621623", "0.6183609", "0.6176921", "0.6172833", "0.6162778", "0.61553454", "0.61553454", "0.61553454", "0.6151306", "0.6150404", "0.6144718", "0.6144084", "0.6144084", "0.6143726", "0.61206746", "0.61177653", "0.6086604", "0.60749406", "0.60702896", "0.6058728", "0.6057492", "0.6057492", "0.6053365", "0.6043335", "0.6043254", "0.6042385", "0.6035549", "0.60342634", "0.6025437", "0.60152787", "0.60152787", "0.60152787", "0.60152787", "0.60152787", "0.60152787", "0.60152787", "0.6009277", "0.5997146", "0.5989158", "0.5988144", "0.5979904", "0.59795505", "0.59795505", "0.59779626", "0.59724534", "0.59615207", "0.59596825", "0.5952834", "0.5951388", "0.59495634", "0.5947351", "0.5938486", "0.5938486", "0.5938486", "0.5938486", "0.5938486", "0.5938486", "0.59147245", "0.59076273", "0.59038013", "0.59038013", "0.58986926", "0.58965987", "0.589349", "0.58815515", "0.5875616", "0.5863449", "0.5848071", "0.58403134", "0.583852", "0.5837299", "0.5828338", "0.5825312", "0.5824565", "0.5818956", "0.579638" ]
0.0
-1
Returns array of keys that do not have value in the hash Given +required_keys+ should be an array of +string+
def missing_keys_from(required_keys) required_keys.select{ |k| self.get(k).to_s.empty? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject_keys *keys\n reject{|k, _| keys.include? k}\n end", "def reject_keys!(hash, keys)\n hash.reject { |k, _| keys.include?(k) }\n end", "def arg_hash_keys_required(required_keys, *args)\n args.each do |h|\n missing = required_keys - h.keys\n raise ArgumentError, \"Hash is missing required keys (#{missing.join(', ')}). Got:\\n#{h.inspect}\" if missing.length > 0\n end\n end", "def require_keys(*p_valid_keys)\n l_missing_keys = []\n p_valid_keys.flatten!\n p_valid_keys.each do |k|\n l_missing_keys << k unless self.has_key?(k)\n end\n\n unless l_missing_keys.empty?\n raise ArgumentError.new(\"Missing required key(s): #{l_missing_keys.map(&:inspect).join(', ')}\")\n end\n\n end", "def without(*keys)\n keys = keys.flatten\n pairs = each_pair.filter { |k, _| !k.in?(keys) }\n pairs.to_h\n end", "def exclude(*keys)\n reject { |key, _| keys.include?(key) }\n end", "def not_matched_keys\n @not_matched.keys\n end", "def omit(hash, *keys)\n hash.select { |k| not keys.include?(k) }\n end", "def konly(*x)\n reject{ |k,v| !x.include?(k) }\n end", "def incorrect_keys(the_input, invalid_hash = Array.new, the_array)\n the_input.each_key do |key|\n unless the_array.include?(key.to_s)\n invalid_hash << key\n end\n end\n raise K2IncorrectParams.new(invalid_hash) if invalid_hash.present?\n end", "def checked_keys(params_hash)\n params_hash.reject{ |key, value| value.blank? || value == '0' }.keys\n end", "def filter_keys(data, *expected_keys)\n excess_keys = data.keys - expected_keys\n excess_keys.each do |key|\n data.delete(key)\n end\n return data\nend", "def without(*keys)\n keys = keys.to_sargs\n self.reject { |k| keys.include?(k) } || self\n end", "def unmatched_keys; end", "def missing_keys; end", "def deny_keys(*keys)\r\n tmp = self.clone\r\n tmp.delete_if {|k,v| keys.include?(k) }\r\n tmp\r\n end", "def filter_search_keys(search_keys)\n search_keys.delete_if { |_key, value| value.empty? }\n end", "def accept_keys!(hash, keys)\n reject_keys!(hash, hash.keys - keys)\n end", "def unused_keys\n keys - fetched_keys\n end", "def delete_all_keys_except(hash_record, except_array = [])\n hash_record.select do |key|\n except_array.include?(key)\n end\n end", "def arg_hash_keys_limit(required_keys, optional_keys, *args)\n args.each do |h|\n missing = required_keys - h.keys\n extra = h.keys - required_keys - optional_keys\n \n unless missing.empty? && extra.empty?\n msg = \"\"\n msg << \"Hash is missing required keys (#{missing.join(', ')}).\\n\" unless missing.empty?\n msg << \"Hash has extra keys which aren't allowed (#{extra.join(', ')}).\\n\" unless extra.empty?\n msg << \" Got: #{h.inspect}\"\n raise ArgumentError, msg\n end\n end\n end", "def validate_keys(*valid_keys)\n valid_keys.flatten!\n @hash.each_key do |k|\n unless valid_keys.include?(k)\n raise ArgumentError.new(\"Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}\")\n end\n end\n end", "def unrecognized_keys(expected, given)\n given.keys - expected\n end", "def fast_assert_valid_keys(valid_keys)\n unknown_keys = keys - valid_keys\n raise(ArgumentError, \"Unknown key(s): #{unknown_keys.join(\", \")}\") unless unknown_keys.empty?\n end", "def removed_keys\n @removed_keys ||= []\n end", "def filter_keys(issue_keys)\n issue_keys.reject { |k| k =~ /^#{key}-0+$/ }\n end", "def assert_required_keys(*keys)\n keys.flatten.each do |key|\n raise ArgumentError, \"Required key: #{key.inspect}\" unless key?(key)\n end\n end", "def remove_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] -= keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end", "def arg_hash_keys_exact(exact_keys, *args)\n args.each do |h|\n missing = exact_keys - h.keys\n extra = h.keys - exact_keys\n raise ArgumentError, \"Hash keys don't match required set (#{exact_keys.join(', ')}). \" +\n \"Missing required keys (#{missing.join(', ')}); extra keys not allowed (#{extra.join(', ')}).\\n\" +\n \"Got:\\n#{h.inspect}\" if (missing.length > 0) || (extra.length >0)\n end\n end", "def clever_validate_keys(ssh_keys)\n ssh_keys.is_a? Array and\n # check each entry\n ssh_keys.map { |entry|\n not entry.nil? and\n entry['key'].is_a? String and entry['key'].length > 0 and\n entry['type'].is_a? String and entry['type'].length > 0 and\n (entry['comment'].nil? or\n (entry['comment'].is_a? String and entry['comment'].length > 0))\n # any false results invalidates the whole set\n }.reduce(:&)\n end", "def excluded_keys\n @excluded_keys ||= begin\n ret = self.options[:except] || []\n ret.map(&:to_sym)\n end\n end", "def keys\n map(&:key).uniq\n end", "def nil_values(the_input, nil_keys_array = Array.new)\n the_input.select { |_, v| v.blank? }.each_key do |key|\n nil_keys_array << key.to_s\n end\n raise K2EmptyParams.new(nil_keys_array) unless nil_keys_array.blank?\n end", "def kexcept(*x)\n reject{ |k,v| x.include?(k) }\n end", "def keys\n [Array(hash_keys) + Array(range_keys)].flatten.uniq\n end", "def keys\n [Array(hash_keys) + Array(range_keys)].flatten.uniq\n end", "def except!(hash, *rejected_keys)\n hash.delete_if do |key, _value|\n rejected_keys.any? { |rejected| rejected === key }\n end\n end", "def validate_input_keys\n input_keys = Input.all.map(&:key)\n preset_keys = user_values.keys\n\n if (intersection = preset_keys - input_keys).any?\n errors.add(:user_values,\n \"contains input keys which don't exist: \" \\\n \"#{ intersection.sort.inspect }\")\n end\n end", "def only(*keys)\n h = {}\n keys.each{|key|h[key] = self[key]}\n h\n end", "def ignore(ignore_keys)\n return @collection if ignore_keys.blank?\n @collection.select { |kv_item| !ignore_keys.include?(kv_item.keys.first) }\n end", "def only(*keys)\n keys = keys.to_sargs\n self.select { |k| keys.include?(k) } || self\n end", "def required_attributes!(keys)\n keys.each do |key|\n bad_request!(key) unless params[key].present?\n end\n end", "def required_attributes!(keys)\n keys.each do |key|\n bad_request!(key) unless params[key].present?\n end\n end", "def type_note_keys_without_blanks\n @args[:type_note_keys].reject(&:empty?)\n end", "def only!(*keys)\n ret = only(*keys)\n replace(except(*keys))\n return ret\n end", "def except!(*keys)\r\n replace(except(*keys))\r\n end", "def except!(*keys)\r\n replace(except(*keys))\r\n end", "def required_keys_string\n @required_keys.map { |key| %('#{key}') }.join(', ')\n end", "def should_not_contain!(*keys, **options, &block)\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n keys += self.keys.select(&block) if block_given?\n invalid_keys = self.keys.map(&:to_sym) & keys.map(&:to_sym)\n if invalid_keys.present?\n invalid_keys.each do |key|\n warnings.add(key, 'is not permitted')\n end\n end\n end\n end\n end", "def check_keys object, path, allowed = [], required = []\n allowed += required if allowed && required\n required.each { |k| report_error(\"Missing required key: #{\"#{path ? path + \"/\" : \"\"}#{k}\".inspect}\") unless !object[k].nil? }\n object.each_key { |k| report_error(\"Unknown key: #{\"#{path ? path + \"/\" : \"\"}#{k}\".inspect}\") unless allowed.index(k) }\n end", "def except(*keys)\n common = keys & self.class.required_attributes\n\n if common.empty?\n self.class.new(@hash.except(*keys))\n else\n to_hash.except(*keys)\n end\n end", "def only_allowed_keys?(value)\n val = value.symbolize_keys\n val.slice(*ALLOWED_KEYS).present? && val.except(*ALLOWED_KEYS).blank?\n end", "def hstore_has_all_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?& ARRAY[:keys]\", :keys => keys.flatten)\n end", "def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end", "def getKeys(data_keys)\r\n data_keys[0].keys\r\n end", "def filter(*keys)\n if self.respond_to?(:to_hash_proxy) then\n to_hash_proxy.filter(*keys)\n else\n raise NotImplementedError.new('not implemented for plain hash')\n end\n end", "def slice(some_hash, *keys)\n allowed = Set.new(keys)\n hash = {}\n allowed.each { |k| hash[k] = some_hash[k] if some_hash.has_key?(k) }\n hash\n end", "def keys\n return [], []\n end", "def array_of_keys(key)\n n = query(@connection, key)\n if n.nil?\n []\n else\n a = []\n n.each do |value|\n a.push(value.key.gsub(key, ''))\n end\n a\n end\n end", "def hstore_has_any_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?| ARRAY[:keys]\", :keys => keys.flatten)\n end", "def find_keys(key, redis=nil)\n redis ||= DulyNoted.redis\n keys = []\n keys += redis.keys(\"#{key}:*\")\n keys += redis.keys(\"#{key}\")\n keys -= redis.keys(\"#{key}:*:meta\")\n keys -= redis.keys(\"#{key}:ref:*\")\n keys -= redis.keys(\"#{key}:*fields\")\n end", "def custom_hash_keys(hash)\n keys_array = []\n hash.each { |k,v| keys_array << k }\n keys_array\nend", "def strict_keys?(input)\n (input.keys - rules.keys).empty?\n end", "def strip_hash_of_keys(array_of_keys_to_strip)\n self.keys.each do |k|\n strip = false\n array_of_keys_to_strip.each do |i|\n if i.class == Regexp\n strip = true if k =~ i\n else\n strip = true if k == i\n end\n end\n\n if strip\n self.delete(k)\n else\n if self[k].class == Hash\n self[k] = self[k].strip_hash_of_keys(array_of_keys_to_strip)\n elsif self[k].class == Array\n self[k].each do |h|\n h = h.strip_hash_of_keys(array_of_keys_to_strip) if h.class == Hash\n end\n end\n end\n end\n self\n end", "def key_values_without_defaults(tf = true)\n keys(tf).reject{|k| @this.default?(k) }.map{ |k, a| [k, @this.send(k)]}\n end", "def hash_keys(hash)\n\thash.map { |k, v| k }\nend", "def symbolize_keys_of_hashs!(array_of_hashs)\n array_of_hashs.collect!{|hash| symbolize_keys(hash)}\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def except!(*keys)\n replace(except(*keys))\n end", "def missing\n (@_cells.values.reduce(:|) - @_cells.keys).to_a\n end", "def keys\n list = []\n each_key{|key| list << key}\n list\n end", "def requireds\n\t\tHash[ select {|i,f| f.required? } ]\n\tend", "def keys\n @values.values.uniq.sort_by(&:value).map { |e| e.keys.sort }.flatten\n end", "def except!(*keys)\r\n keys.each { |key| delete(key.to_s); delete(key.to_sym) }\r\n self\r\n end", "def keys?(*items)\n items.flatten.each { |item| return false unless key?(item) }\n true\n end", "def possible_keys(key); end", "def missing_keys(route, parts); end", "def missing_params\n required_params = manifest.keys.select { |name| manifest.required?(name) }\n required_params - @params.keys\n end", "def check_schema_keys(resource)\n rejected = []\n resource.reject { |key| rejected << key if key != :title && attributes.key?(key) == false }\n rejected\n end", "def uniq_keys\n all.to_a.collect {|n| n.key }.uniq\n end", "def all_keys\n map(&:all_keys).flatten.uniq.sort\n end", "def report_non_nil_and_missing_keys(data)\n data.each{ |h|\n %w[key ref _owner].each{ |k| check_key(h, k) }\n }\n end", "def required(loose:)\n clone.tap do |cloned|\n optional_keys.each do |key|\n cloned.delete(key)\n end\n if loose\n strict_keys.each do |key|\n cloned.delete(key)\n end\n end\n end\n end", "def validate_redis_key\n valid_fields = redis_fields_config.select{|k,v| v != :array && v != :hash }.keys\n bad_fields = redis_key_config - valid_fields\n raise ArgumentError, \"Sorry, but you cannot use as redis key [nonexisting | array | hash] fields: [#{bad_fields.join(\",\")}], availible are: #{valid_fields.join(\", \")}\" unless bad_fields.size == 0\n end", "def must_not_contain!(*keys, deep: false, **options, &block)\n return must_not_contain_deep!(*keys, **options) if deep === true\n before_validation do\n JSONAPIonify::Continuation.new(**options).check(self) do\n keys += self.keys.select(&block) if block_given?\n invalid_keys = self.keys.map(&:to_sym) & keys.map(&:to_sym)\n if invalid_keys.present?\n invalid_keys.each do |key|\n errors.add(key, 'is not permitted')\n end\n end\n end\n end\n end", "def none_of(*field_names)\n [].tap do |list|\n lack_num = any_of_number(*field_names)\n self.each_value { |num| list << num if (num & lack_num) == 0 }\n end\n end", "def clean_unwanted_keys(hash)\r\n ignored_keys = [:only_path, :use_route]\r\n hash.dup.delete_if{|key,value| ignored_keys.include?(key)}\r\n end", "def key_ids\n @keys.keys\n end", "def user_keys\n @user_keys ||= begin\n _keys = keys || {}\n ret = Hash[_keys.map { |k, v| [clean_identifier(k), v] }]\n if ret.keys.count != _keys.keys.count\n Logger.warn \\\n \"Duplicate public key identifiers were detected in #keys.\"\n end\n ret\n end\n end", "def get_all_keys(required_data)\n response = []\n\n if !required_data.empty? && !(required_data.include? 'address') &&\n !(required_data.include? 'pubkey') && !(required_data.include? 'privkey')\n required_data = []\n end\n\n if !required_data.empty?\n CSV.foreach(FILE_NAME) do |row|\n key = {}\n\n if required_data.include? 'address'\n key['address'] = row[0]\n end\n\n if required_data.include? 'pubkey'\n key['pubkey'] = row[1]\n end\n\n if required_data.include? 'privkey'\n key['privkey'] = row[2]\n end\n\n response << key unless key.empty?\n end\n else\n CSV.foreach(FILE_NAME) do |row|\n key = {\n 'address' => row[0],\n 'pubkey' => row[1],\n 'privkey' => row[2]\n }\n response << key\n end\n end\n\n response\nend", "def missing\n\t\t@missing_fields.uniq.sort_by {|f| f.to_s}\n\tend", "def contains_expected_keys?(data, *expected_keys)\n expected_keys.each do |expected_key|\n return false until data.keys.include? expected_key\n end\n return true\nend", "def deleted_keys\n @deleted_keys ||= []\n end", "def deleted_keys\n @deleted_keys ||= []\n end", "def list_keys\n @keydict.keys\n end", "def get_assigned_keys(endusers)\n keys = Array.new\n endusers.each do |enduser|\n relationships = Relationship.where(\"endusers like?\", \"%#{enduser[:id]}\")\n relationships.each do |relationship|\n unless relationship[:keys].blank?\n key = Key.find(relationship[:keys])\n key = key.as_json\n key[\"enduser\"] = enduser[:id]\n keys.push(key)\n end\n end\n end\n\n return keys\n end", "def keys\n @hash.keys\n end" ]
[ "0.7145525", "0.71454954", "0.70673525", "0.6754895", "0.6680012", "0.6556928", "0.6548558", "0.6508701", "0.6506007", "0.64663833", "0.6448933", "0.6435034", "0.6412506", "0.6409251", "0.6377574", "0.6377338", "0.6374554", "0.6373801", "0.6331329", "0.6328221", "0.63118696", "0.629837", "0.6209566", "0.6171858", "0.61715263", "0.6164006", "0.6151336", "0.61363775", "0.6112455", "0.6093221", "0.5992961", "0.59618646", "0.59516567", "0.5951048", "0.5919366", "0.5919366", "0.58921665", "0.58824134", "0.58574414", "0.58558786", "0.58530647", "0.58220947", "0.58220947", "0.575528", "0.5733706", "0.5724087", "0.5724087", "0.57080925", "0.5706883", "0.5694806", "0.56844836", "0.56716216", "0.56613904", "0.56069607", "0.55944693", "0.5579574", "0.55695504", "0.5561102", "0.5559543", "0.555083", "0.55507374", "0.5547488", "0.5546085", "0.5542859", "0.5532127", "0.55210394", "0.5517865", "0.55155504", "0.55155504", "0.55155504", "0.55155504", "0.55155504", "0.5495918", "0.5491679", "0.5485644", "0.5470315", "0.5469158", "0.54653895", "0.5458737", "0.5458478", "0.5435874", "0.5397872", "0.5385908", "0.53836906", "0.5380906", "0.53802836", "0.5361445", "0.5359607", "0.53572804", "0.53532624", "0.53283334", "0.5324971", "0.5310829", "0.5308927", "0.5300083", "0.5298753", "0.5298753", "0.52922904", "0.52700543", "0.52684164" ]
0.81626594
0
Returns Hash of Hash attr_values["attr_name"][":"] = attr_value
def make_expression_attribute_values(event) attr_values = make_hoh event.each do |k,v| if k == "start_time" puts "Found start time: methods: #{v.methods}, methods contain strftime? #{v.methods.include?(:strftime)}" end attr_values[k][make_expression_key(k,)] = v end return attr_values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end", "def convert_attr_hash(attrs = [])\n h = {}\n attrs.each do |v|\n # v is Nokogiri::XML::SAX::Parser::Attribute\n # see http://nokogiri.org/Nokogiri/XML/SAX/Parser/Attribute.html\n key = v.prefix ? v.prefix + ':' : ''\n key += v.localname\n\n h[key.to_sym] = v.value\n end\n h\n end", "def transform_attr(key, value); end", "def process_attribute(key, value)\n return super unless key == :value\n\n @built[:value] = value\n nil\n end", "def []=(attr_name, attr_value)\n value[attr_name.to_s] = attr_value\n end", "def []=(attr_name, attr_value)\n value[attr_name.to_s] = attr_value\n end", "def to_hash\n fattrs.inject({}){|h,a| h.update a => send(a)}\n end", "def coerce_attributes_to_hash(attrs)\n if ::Hash === attrs\n ::Hash[attrs.map {|key, val|\n if val\n [key.end_with?('!') ? '!' + key.chop : key, val]\n else\n key = key.chop if key.end_with?('!')\n key = '!' + key unless key.start_with?('!')\n [key, '']\n end\n }]\n else\n Array(attrs || []).inject({}) do |accum, entry|\n key, val = entry.split('=', 2)\n accum[key.end_with?('!') ? '!' + key.chop : key] = val || ''\n accum\n end\n end\n end", "def attributes\n @ldap_entry.attribute_names.each_with_object({}) do |key, hsh|\n hsh[key] = get_value(key)\n end\n end", "def to_h\n attrl = self\n hash = {}\n until attrl.to_ptr.null?\n n = attrl[:name].read_string\n v = attrl[:value].read_string\n r = attrl[:resource].null? ? nil : attrl[:resource].read_string\n r ? (hash[n.to_sym] ||= {} and hash[n.to_sym][r.to_sym] = v) : hash[n.to_sym] = v\n attrl = attrl[:next]\n end\n hash\n end", "def to_hash\n {\n :name => @name,\n :value => @value\n }\n end", "def to_hash\n { @name => @value }\n end", "def set_attr(name, value)\n each_value {|x| x[name] = value }\n end", "def extra_attributes_attributes=(attributes)\n map = Hash[extra_attributes.map { |k| [k.spec_id, k] }]\n method = attributes.respond_to?(:each_value) ? :each_value : :each\n attributes.send(method) do |attribute|\n if attribute['spec_id'] && map[attribute['spec_id'].to_i]\n map[attribute['spec_id'].to_i].value = attribute['value']\n end\n end\n end", "def attr_values\n values = self.instance_variables.collect do |key|\n [key, self.instance_variable_get(key)]\n end\n return Hash[values]\n end", "def to_hash\n {@tag => @value}\n end", "def dynamo_attribute_from_value(attr_val)\n # { dynamo_attribute_key => { dynamo_attribute_value_type_key => convert_to_dynamo_value(attr_val) }} unless attr_val.nil?\n { dynamo_attribute_key => convert_to_dynamo_value(attr_val)} unless attr_val.nil?\n end", "def attr_hash(attrs)\n h = {}\n attrs.each {|k,v| h[k] = v}\n h\n end", "def attribute_values\n @attribute_values ||= {}\n end", "def attr h_or_name\n h_or_name = h_or_name.map { |k,v| \"#{k}=\\\"#{v}\\\"\" }.join \" \" if\n Hash === h_or_name\n\n \"{:#{h_or_name}}\"\n end", "def attr\n @attr.map{|k,v| \"#{k}=\\\"#{h v}\\\"\"}.sort.join(' ')\n end", "def extract_attr_value(xml)\n raw = {}\n default_when_xpath_err {\n @path.each(xml) do |node|\n raw[node.name] = node.text\n end\n }\n raw\n end", "def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end", "def attribute_values \n @attribute_values = Hash.new\n @attribute_values[:influencers] = \"Influencers: \" + self.influencers.to_s\n @attribute_values[:specialties] = \"Specialities: \" + self.specialties.to_s\n @attribute_values[:compensation] = \"Compensation: \" + self.compensation.to_s\n @attribute_values[:experience] = \"Experience: \" + self.experience.to_s\n \n @attribute_values[:genre] = \"Genre(s): \"\n if self.genre != nil\n self.genre.split(\",\").each do |genre|\n @attribute_values[:genre] += genre + \", \"\n end\n @attribute_values[:genre] = @attribute_values[:genre][0, @attribute_values[:genre].length-2]\n end\n \n @attribute_values\n end", "def attribute_values \n @attribute_values = Hash.new\n @attribute_values[:influencers] = \"Influencers: \" + self.influencers.to_s\n @attribute_values[:specialties] = \"Specialities: \" + self.specialties.to_s\n @attribute_values[:compensation] = \"Compensation: \" + self.compensation.to_s\n @attribute_values[:experience] = \"Experience: \" + self.experience.to_s\n \n @attribute_values[:genre] = \"Genre(s): \"\n if self.genre != nil\n self.genre.split(\",\").each do |genre|\n @attribute_values[:genre] += genre + \", \"\n end\n @attribute_values[:genre] = @attribute_values[:genre][0, @attribute_values[:genre].length-2]\n end\n \n @attribute_values\n end", "def attribute_values \n @attribute_values = Hash.new\n @attribute_values[:influencers] = \"Influencers: \" + self.influencers.to_s\n @attribute_values[:specialties] = \"Specialities: \" + self.specialties.to_s\n @attribute_values[:compensation] = \"Compensation: \" + self.compensation.to_s\n @attribute_values[:experience] = \"Experience: \" + self.experience.to_s\n \n @attribute_values[:genre] = \"Genre(s): \"\n if self.genre != nil\n self.genre.split(\",\").each do |genre|\n @attribute_values[:genre] += genre + \", \"\n end\n @attribute_values[:genre] = @attribute_values[:genre][0, @attribute_values[:genre].length-2]\n end\n \n @attribute_values\n end", "def attributes\n @attributes = Hash[attrs.map { |a| [a.to_sym, send(\"#{a}\")] }]\n end", "def attributes_hash\n attributes_hash = section.attributes.to_hash\n attributes_hash.each { |k, attr| attributes_hash[k] = attr.value }\n end", "def each(&block)\n\t\t\tvalues = {}\n\t\t\teach_attribute do |attr|\n\t\t\t\tvalue = self.fetch(attr)\n\t\t\t\tif not value.nil?\n\t\t\t\t\tvalues[attr] = value\n\t\t\t\tend\n\t\t\tend\n\t\t values.each &block\n\t\tend", "def build_attributes_for_element element\n return nil unless element[\"attrs\"] and element[\"attrs\"][\"phemaObject\"] and element[\"attrs\"][\"phemaObject\"][\"attributes\"]\n attr_hash = Hash.new\n attributes = element[\"attrs\"][\"phemaObject\"][\"attributes\"]\n attributes.each do |key, value|\n # We need to handle result as a special entry, and so it's excluded from general attribute processing.\n # Result will be used when we define the value of the data element.\n if value and key != 'Result'\n attribute_symbol = key.underscore.to_sym\n if value.is_a?(Array)\n if value.length > 0\n attr_hash[attribute_symbol] = {:type => \"CD\", :code => value[0][\"id\"], :title => value[0][\"name\"]} if value[0][\"type\"] == \"ValueSet\"\n end\n elsif value[\"type\"]\n if value[\"type\"] == \"present\"\n attr_hash[attribute_symbol] = {:type => \"ANYNonNull\" }\n elsif value[\"type\"] == \"value\"\n attr_hash[attribute_symbol] = build_range_hash(false, value[\"operator\"], value[\"units\"][\"id\"], value[\"valueLow\"], value[\"valueHigh\"])\n end\n end\n end\n end\n attr_hash\n end", "def to_hash\n hash = {}\n\n instance_variables.each do |var|\n key = var.to_s.delete(\"@\").to_sym\n val = instance_variable_get(var)\n\n if authlete_model_simple_attribute?(key) or val.nil?\n hash[key] = val\n elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)\n hash[key] = val.map { |element| element.to_hash }\n elsif key == :extension\n # For attributes such as :extension\n hash[key] = val.to_hash\n end\n end\n\n hash\n end", "def to_hash\n _attributes_.inject({}) { |h, (k,v)| h[k] = eval_as_proc(v); h }\n end", "def attr(name, value)\n self[name] = value\n return self\n end", "def values(attrs, changed_attributes = false)\n if changed_attributes\n hash = {}\n attrs.changes.each {|k, v| hash[k.to_sym] = v.first}\n attrs = attrs.attributes.merge hash\n elsif attrs.respond_to? :attributes\n attrs = attrs.attributes\n end\n\n {}.tap do |hash|\n if hash_keys.any? { |key| attrs[key] }\n hash[:hash_value] = hash_keys.collect{|key| attrs[key]}.join('.')\n end\n hash[:range_value] = range_keys.inject(0.0) {|sum, key| sum + attrs[key].to_f} if self.range_key?\n end\n end", "def attrs=(hash)\n super(hash.is_a?(Hash) ? hash.to_json.to_s : '{}')\n end", "def project_attribute_hash\n to_a.inject({}) { |hash,(k,v)| hash[k] = v }\n end", "def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = self.instance_variable_get(attr)\n key = attr.to_s.sub(%r{^\\@}, '').sub(%r{\\@}, '')\n if @attr_list.include?(key)\n data[key] = value\n end\n end\n\n data\n end", "def split_attributes(attributes)\n attributes.reduce([{}, {}]) do |memo, attr_val|\n attribute, value = attr_val\n if attribute.to_s.start_with?('+')\n memo[1][attribute[1..-1].to_sym] = value\n else\n memo[0][attribute] = value\n end\n memo\n end\n end", "def set_attribute_value(attrib_name, attrib_value=nil)\n return set_attribute_values(attrib_name) if attrib_name.is_a? Hash \n touch(attrib_name)\n @attribute_values_flat[attrib_name.to_sym] = attrib_value\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def values(attrs, changed_attributes = false)\n if changed_attributes\n hash = {}\n attrs.changes.each {|k, v| hash[k.to_sym] = (v.first || v.last)}\n attrs = hash\n end\n attrs = attrs.send(:attributes) if attrs.respond_to?(:attributes)\n {}.tap do |hash|\n hash[:hash_value] = hash_keys.collect{|key| attrs[key]}.join('.')\n hash[:range_value] = range_keys.inject(0.0) {|sum, key| sum + attrs[key].to_f} if self.range_key?\n end\n end", "def attr_to_hash(obj, hash)\n obj.attribute_names.each do |attr|\n hash[attr.to_sym] = obj.read_attribute(attr)\n end\n end", "def attribute=(name, value)\n @attributes ||= {}\n @attributes[name] = value\n end", "def attributes_to_hash(element)\n hash = {}\n element.attributes.each do |a, v|\n hash.store a.to_s, v.to_s\n end\n hash\n end", "def haml_attribute_pair(name, value, options)\n value = dynamic_attribute?(name, options) ? dynamic_attributes[name] : value.inspect\n if options[:html_style_attributes]\n \"#{name}=#{value}\"\n else\n name = name.index(/\\W/) ? name.inspect : \":#{name}\"\n \"#{name} => #{value}\"\n end\n end", "def []=(attr, value)\n raise \"argument to [] must be a Symbol or a String.\" unless attr.is_a?(Symbol) or attr.is_a?(String)\n @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?\n @attributes[attr] = value.to_s\n end", "def to_h\n attributes.each_with_object({}) { |(key, _value), h|\n h[key] = self.send key\n }\n end", "def extract_attribute_options(value)\n options = ''\n ret_val = value\n if value.class == Hash\n options = ';' + value.keys[0]\n ret_val = value[value.keys[0]]\n if ret_val.class == Hash\n sub_options, ret_val = extract_attribute_options(ret_val)\n options += sub_options\n end\n end\n ret_val = [ret_val] unless ret_val.class == Array\n [options, ret_val]\n end", "def parse_attributes!\n self.attributes = (attributes || []).map do |key_value|\n name, type, index, default = key_value.split(/:/)\n opts = {}\n if default\n opts[:default] = default\n end\n if index\n index_type, constraint = index.split(/,/)\n if constraint == 'not_null'\n opts[:null] = false\n end\n end\n create_attribute(name, type, index_type, opts)\n end\n end", "def attributes(hash)\n hash.keys.inject(\"\") { |attrs, key| attrs + %{#{key}=\"#{hash[key]}\" } }\n end", "def _assign_attribute(k, v)\n attributes[k] = v\n super\n end", "def valuesToStrings(attrs)\n Hash[attrs.map { |k,v| [k, v.to_s] }]\n end", "def attr_h(string)\n h(string).gsub('\"', '&quot;')\n end", "def to_h\n each_with_object({}) { |attr, h| h[attr.name] = attr }\n end", "def to_hash\n {}.tap do |hash|\n @original_attrs.keys.each do |at|\n hash[at] = send(at)\n end\n end\n end", "def []=(key, value)\n attributes[key] = value\n end", "def to_hash\n split(\"|\").map_hash{|e|e2 = e.split(\"=\") ; [e2[0].to_sym, e2[1]]}\n end", "def _attr_value(value)\n case value\n when ::BuilderSymbol\n value.to_s\n else\n _escape_attribute(value.to_s)\n end\n end", "def set_attribute(dict_name, key, value)\n end", "def appendAttr(k,v)\n\t\told = @attributes[k]\n\t\tif old && @multiple.include?(k)\n\t\t\tv = \"#{old} #{v}\"\n\t\tend\n\t\t@attributes[k] = v\n\t\tself\n\tend", "def formatted_attributes\n Hash[display_key.downcase.to_sym, values.collect { |el| el[:displayValue] }]\n end", "def kwattr_values(attribute_name); end", "def []=(key, value)\n attributes[key] = value\n end", "def []=(key, value)\n attributes[key] = value\n end", "def []=(key,value)\n @attributes[key] = value\n end", "def set_attribute(dict_name, key, value)\n end", "def set_attribute(dict_name, key, value)\n end", "def parse_attributes! #:nodoc:\n self.attributes = (attributes || []).map do |key_value|\n name, type = key_value.split(':')\n Rails::Generators::GeneratedAttribute.new(name, type)\n end\n end", "def []=(key, value)\n copy_on_write if @attrs.shared\n key = key.intern \n a = @attrs_hash[key]\n if a\n if value\n a.value = value\n else\n delete_attr!(key)\n end\n else\n put_attr(Attr.new(key,value)) if value\n end\n value\n end", "def hash\n @attrs\n end", "def attributes\n @attributes ||= begin\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n self.class.other_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n attrs\n end\n end", "def extra_input_attributes\n { :value => binding.html_value }\n end", "def add_attr(name, value)\n attr_name = ActiveSupport::Inflector.underscore(name).to_sym\n\n if @attrs.key?(attr_name)\n if @attrs[attr_name].is_a?(Array)\n # An existing array value means just push the new value onto\n # the array.\n @attrs[attr_name].push(value)\n else\n # An existing, non-array value means we must convert the existing\n # value into an array and then push the new value onto it.\n existing_scalar_value = @attrs[attr_name]\n @attrs[attr_name] = [existing_scalar_value, value]\n end\n else\n # If no existing value, then just set the value.\n @attrs[attr_name] = value\n end\n end", "def write_attribute(attr_name, value)\n attr_name = attr_name.to_s\n @attributes_cache.delete(attr_name)\n @attributes[attr_name] = convert_to_json(value, type_for_property(attr_name.to_sym))\n end", "def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end", "def attributes\n @attributes ||= attribute_names.inject({}) do |hash, name|\n attribute_values = saml.xpath(\"//saml:Attribute[@Name='#{name}']/saml:AttributeValue/text()\")\n hash[name] = attribute_values.length > 1 ? attribute_values.collect(&:to_s) : attribute_values.to_s\n hash\n end\n end", "def observation_field_values_attributes=(attributes)\n if attributes.is_a?( ActionController::Parameters )\n attr_array = attributes.to_hash.values\n else\n attr_array = attributes.is_a?(Hash) ? attributes.values : attributes\n end\n return unless attr_array\n attr_array.each_with_index do |v,i|\n if v[\"id\"].blank?\n existing = observation_field_values.where(:observation_field_id => v[\"observation_field_id\"]).first unless v[\"observation_field_id\"].blank?\n existing ||= observation_field_values.joins(:observation_fields).where(\"lower(observation_fields.name) = ?\", v[\"name\"]).first unless v[\"name\"].blank?\n attr_array[i][\"id\"] = existing.id if existing\n elsif !ObservationFieldValue.where(\"id = ?\", v[\"id\"]).exists?\n attr_array[i].delete(\"id\")\n end\n end\n assign_nested_attributes_for_collection_association(:observation_field_values, attr_array)\n end", "def update_attributes(attr = {})\n attr.each_pair do |k, v|\n if v.is_a?(Array) || v.is_a?(Hash)\n send(\"#{k}=\", v.dup)\n else\n send(\"#{k}=\", v)\n end\n end\n end", "def to_hash\n r = ATTR_NAMES.inject({}) { |m,e|\n m[e] = self.send(e)\n m\n }\n r[:product_identity_id] = product_identity_id\n r[:langcode] = lang_code_3_chars\n r[:mappings] = mappings\n r\n end", "def create_attrib_item_values \n @base_attribs = []\n @attribs = params[:attrib]\n @attribs.keys.each do | key |\n @base_attribs << AttribItemValue.new(attrib_id: key, value: @attribs[key])\n #puts \"AttribItemValue: #{@base_attribs.last.attrib.id}, #{@base_attribs.last.value}\"\n end if @attribs\n #puts \"Attribs: #{@attribs}, @base_attribs: #{@base_attribs.size}\"\n modified_item_parms = item_params\n modified_item_parms[:attrib_values] = @base_attribs\n modified_item_parms\n end", "def attr_hash\n hash = create_hash\n hash.delete(\"id\")\n hash.delete(\"errors\")\n return hash\n end", "def attribute(option_key, default_value=:__UNDEFINED__, opts={}, &block)\n ret = _pair(option_key, default_value, opts, &block)\n return if ret[2] # ignore\n @attributes[ret[0]] = ret[1]\n end", "def dynamic_attributes_hash\n @dynamic_attributes.inject({}) { |h, da| h[da.name] = da; h}\n end", "def json_value=(value)\n value = value.values if value.is_a?(Hash)\n value = value.map do |item|\n item = item.values if item.is_a?(Hash)\n item.join('/').delete(':').delete('-')\n end\n super(value)\n end", "def nested_values(attribute, hash)\n hash.inject('') do |all,(key,value)|\n attribute_with_name = \"#{attribute}-#{key.to_s.tr('_', '-')}\"\n all << if value.is_a?(Hash)\n nested_values(attribute_with_name, value)\n else\n %(#{attribute_with_name}=\"#{escape_value(value)}\" )\n end\n end\n end", "def attributes\n attrs = Hash.new\n attribute_list.each do |attribute|\n value = self.send(attribute)\n attrs[attribute] = value unless value.nil?\n end\n attrs\n end", "def set_attr_value( m_name, args )\n \n dup_m_name = m_name.gsub(/=$/, '')\n if( extended_attribute = find_in_extended_attr( dup_m_name ) )\n extended_attribute.update_attributes( :values => args )\n elsif( schema = find_attr_in_schema( dup_m_name ) )\n self.extended_attributes.build( :extended_attributes_schema => schema, :values => args )\n end\n \n end", "def to_hash\n r = ATTR_NAMES.inject({}) { |m,e|\n m[e] = self.send(e)\n m\n }\n r[:files] = mappings_for_files.map { |e| e.to_hash }\n r\n end", "def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\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 attributes\n list.values.map { |field| [field.name, field.value] }.to_h\n end", "def to_hash\n {}.tap do |hash|\n _attributes.each do |key, value|\n if key == :data\n hash.merge!(value)\n else\n hash[key] = value.respond_to?(:to_hash) ? value.to_hash : value\n end\n end\n end\n end", "def serialize\n hash = {}\n self.class::ATTRIBUTES.keys.each do |attr|\n spec = self.class::ATTRIBUTES[attr].to_h\n type = spec[:type]\n value = send(attr)\n\n if value.nil?\n hash[attr] = nil\n elsif type == TYPE_OBJECT\n hash[attr] = value.serialize\n elsif type == TYPE_OBJECT_ARRAY\n hash[attr] = value.map{ |e| e.serialize }\n else\n hash[attr] = value\n end\n end\n\n return hash\n end", "def map_attributes_to_hash(attributes)\n attr_hash = Hash.new\n float_pattern = /([0-9]\\.)+/\n word_pattern = /([A-Za-z]|:)/\n attributes.each do |k, v|\n value_string = v.to_s\n if float_pattern.match(value_string)\n attr_hash[k.to_sym] = value_string.to_f\n elsif word_pattern.match(value_string)\n attr_hash[k.to_sym] = value_string\n else\n attr_hash[k.to_sym] = value_string.to_i\n end\n end\n attr_hash\n end", "def parseAttributes(alarmAttribute)\n key = @spectrum_access_code[alarmAttribute['@id'].to_s].to_s\n value = ((to_utf8(alarmAttribute['$'].to_s)).strip).gsub(/\\r?\\n/, \" \")\n return key,value\n end", "def attributes=(hash)\n return unless hash\n\n hash.transform_keys { |key| \"#{key}=\".to_sym }\n .each { |attr, val| assign attr, val }\n end", "def set_attribute_value(node_id:, name:, value:)\n {\n method: \"DOM.setAttributeValue\",\n params: { nodeId: node_id, name: name, value: value }.compact\n }\n end", "def values_hash\n hashify(:value)\n end", "def attr_hash\n\t\t\thash = {:sourcetype => @type}\n\t\t\tcase @type\n\t\t\twhen 'random_string'\n\t\t\t\thash[:length] = @length\n\t\t\twhen 'random_number'\n\t\t\t\thash[:start] = @start\n\t\t\t\thash[:end] = @end\n\t\t\twhen 'eval'\n\t\t\t\thash[:code] = @code.chomp.to_sym\t\t\t# symbolize it in order to prevent it from being escaped\n\t\t\twhen 'file'\n\t\t\t\thash[:fileid] = @fileid\n\t\t\t\thash[:delimiter] = @delimiter\n\t\t\t\thash[:order] = @order\n\t\t\tend\n\t\t\thash\n\t\tend", "def write_attribute(key, value)\n @hash[key.to_s] = value\n end", "def xml_node_to_hash(nokogiri_node)\n\t\t\tattributes = Hash.new\n\n\t\t\tnokogiri_node.each do |k,v|\n\t\t\t\tattributes[k.to_sym] = v.value\n\t\t\tend\n\n\t\t\treturn attributes\n\t\tend" ]
[ "0.66263604", "0.6540327", "0.63845205", "0.6137079", "0.6099234", "0.6099234", "0.6070037", "0.60513324", "0.60105413", "0.597682", "0.5966348", "0.5957069", "0.592394", "0.58955926", "0.5883498", "0.58814657", "0.588119", "0.5866515", "0.5864777", "0.58646214", "0.5859974", "0.5853771", "0.5852722", "0.58158576", "0.58158576", "0.58158576", "0.57788646", "0.57756484", "0.57704353", "0.57643104", "0.5760163", "0.57557", "0.575503", "0.5748196", "0.57322985", "0.57203305", "0.5715158", "0.5702641", "0.5701442", "0.5695693", "0.5694056", "0.5688347", "0.56743604", "0.5663476", "0.56627584", "0.5656592", "0.5654055", "0.5646335", "0.56371355", "0.563027", "0.56249696", "0.5617604", "0.5605502", "0.56030804", "0.5597134", "0.5580426", "0.55622554", "0.555828", "0.5549608", "0.5543724", "0.5534749", "0.55344766", "0.55333537", "0.55333537", "0.55324954", "0.5532447", "0.5532447", "0.5529861", "0.5517764", "0.55081344", "0.55068713", "0.5506005", "0.550308", "0.55018413", "0.5492382", "0.5482091", "0.54818714", "0.5477382", "0.54735786", "0.5469509", "0.54687047", "0.54598695", "0.5452226", "0.5445974", "0.54456455", "0.5440882", "0.5439852", "0.5431909", "0.54311365", "0.54297787", "0.5407191", "0.53986305", "0.5389866", "0.5377244", "0.53718066", "0.53661656", "0.53616893", "0.53531957", "0.5350171", "0.5349757", "0.53457844" ]
0.0
-1
Remove the first hash ["attr_name"] from make_expression_attribute_values
def clean_up(attr_values_hash_of_hash) attr_values = Hash.new attr_values_hash_of_hash.each do |bad_key,good_hash| attr_values.merge!(good_hash) end return attr_values end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_attributes(attributes)\n attributes.reduce([{}, {}]) do |memo, attr_val|\n attribute, value = attr_val\n if attribute.to_s.start_with?('+')\n memo[1][attribute[1..-1].to_sym] = value\n else\n memo[0][attribute] = value\n end\n memo\n end\n end", "def make_expression_attribute_values(event)\n\t\tattr_values = make_hoh\n\n\t\tevent.each do |k,v| \n\t\t\tif k == \"start_time\"\n\t\t\t\tputs \"Found start time: methods: #{v.methods}, methods contain strftime? #{v.methods.include?(:strftime)}\"\n\t\t\tend\n\t\t\tattr_values[k][make_expression_key(k,)] = v \n\t\tend\n\t\treturn attr_values\n\tend", "def make_update_expression_values(event,attr_values)\n\t\tupdate_string = 'SET '\n\t\tevent.each do |k,v|\n\t\t\tupdate_string += \"#{make_expression_key(k,\"names\")} = #{attr_values[k].key(v)}, \"\n\t\tend\n\t\treturn update_string[0...-2]\n\tend", "def strip_attributes\n attribute_names().each do |name|\n if self.send(name.to_sym).respond_to?(:strip)\n self.send(\"#{name}=\".to_sym, self.send(name).strip)\n end\n end\n end", "def transform_attr(key, value); end", "def attr\n @attr.map{|k,v| \"#{k}=\\\"#{h v}\\\"\"}.sort.join(' ')\n end", "def removed_attributes\n operand.header - header\n end", "def factorygirl_attributes\n symbolize_attributes!\n @attributes.each do |key, value|\n next unless respond_to?(method = method_name(key))\n if (result = send method, value) || value.nil?\n @attributes[key] = result if @attributes.key? key\n else\n @attributes.delete key\n end\n end\n end", "def clean_attribute(value)\n if value.kind_of?(Hash)\n value.delete_if { |key, value| clean_attribute(value) }.empty?\n elsif value.kind_of?(Array)\n value.delete_if { |value| clean_attribute(value) }.empty?\n else\n value.to_s.strip.empty?\n end\n end", "def clean_attrs\n data = node.to_hash\n %w(run_list recipes roles).each { |k| data.delete(k) }\n data\n end", "def kwattr_values(attribute_name); end", "def attr_clean!(key)\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys.delete_if {|k| k == key.to_sym }\n end", "def query_attributes(query_expression) # :nodoc:\n attrs = []\n array = query_expression.scan(/['\"](.*?[^\\\\])['\"]/).flatten\n until array.empty? do\n attrs << array.shift # skip it's value\n array.shift #\n end\n attrs\n end", "def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end", "def extract_attributes!(attributes)\n active_source_attributes = attributes.inject({}) do |active_source_attributes, column_values|\n active_source_attributes[column_values.first] = attributes.delete(column_values.first) if self.class.column_names.include? column_values.first\n active_source_attributes\n end\n\n [ active_source_attributes, attributes ]\n end", "def attr h_or_name\n h_or_name = h_or_name.map { |k,v| \"#{k}=\\\"#{v}\\\"\" }.join \" \" if\n Hash === h_or_name\n\n \"{:#{h_or_name}}\"\n end", "def attr_hash\n hash = create_hash\n hash.delete(\"id\")\n hash.delete(\"errors\")\n return hash\n end", "def simplify_key_value_list(elements)\n # remove everything form right to left till the double unerline\n elements.each do |element|\n element.keyValueList.transform_keys! do |key|\n index = key.index('__')\n if !index.nil?\n key.slice(index + 2, key.length)\n else\n key\n end\n end\n end\n end", "def remove_attr(name); end", "def remove_attr(name); end", "def remove_whitespace\n attribute_names.each do |name|\n if send(name).respond_to?(:strip)\n send(\"#{name}=\", send(name).strip)\n end\n end\n end", "def remove_extra_whitespace\n attributes.each do |key, val|\n next unless val.present? && val.is_a?(String)\n\n self[key] = val.strip.squeeze(' ')\n end\n end", "def coerce_attributes_to_hash(attrs)\n if ::Hash === attrs\n ::Hash[attrs.map {|key, val|\n if val\n [key.end_with?('!') ? '!' + key.chop : key, val]\n else\n key = key.chop if key.end_with?('!')\n key = '!' + key unless key.start_with?('!')\n [key, '']\n end\n }]\n else\n Array(attrs || []).inject({}) do |accum, entry|\n key, val = entry.split('=', 2)\n accum[key.end_with?('!') ? '!' + key.chop : key] = val || ''\n accum\n end\n end\n end", "def attribute_values \n @attribute_values = Hash.new\n @attribute_values[:influencers] = \"Influencers: \" + self.influencers.to_s\n @attribute_values[:specialties] = \"Specialities: \" + self.specialties.to_s\n @attribute_values[:compensation] = \"Compensation: \" + self.compensation.to_s\n @attribute_values[:experience] = \"Experience: \" + self.experience.to_s\n \n @attribute_values[:genre] = \"Genre(s): \"\n if self.genre != nil\n self.genre.split(\",\").each do |genre|\n @attribute_values[:genre] += genre + \", \"\n end\n @attribute_values[:genre] = @attribute_values[:genre][0, @attribute_values[:genre].length-2]\n end\n \n @attribute_values\n end", "def attribute_values \n @attribute_values = Hash.new\n @attribute_values[:influencers] = \"Influencers: \" + self.influencers.to_s\n @attribute_values[:specialties] = \"Specialities: \" + self.specialties.to_s\n @attribute_values[:compensation] = \"Compensation: \" + self.compensation.to_s\n @attribute_values[:experience] = \"Experience: \" + self.experience.to_s\n \n @attribute_values[:genre] = \"Genre(s): \"\n if self.genre != nil\n self.genre.split(\",\").each do |genre|\n @attribute_values[:genre] += genre + \", \"\n end\n @attribute_values[:genre] = @attribute_values[:genre][0, @attribute_values[:genre].length-2]\n end\n \n @attribute_values\n end", "def attribute_values \n @attribute_values = Hash.new\n @attribute_values[:influencers] = \"Influencers: \" + self.influencers.to_s\n @attribute_values[:specialties] = \"Specialities: \" + self.specialties.to_s\n @attribute_values[:compensation] = \"Compensation: \" + self.compensation.to_s\n @attribute_values[:experience] = \"Experience: \" + self.experience.to_s\n \n @attribute_values[:genre] = \"Genre(s): \"\n if self.genre != nil\n self.genre.split(\",\").each do |genre|\n @attribute_values[:genre] += genre + \", \"\n end\n @attribute_values[:genre] = @attribute_values[:genre][0, @attribute_values[:genre].length-2]\n end\n \n @attribute_values\n end", "def attributes\n @attributes = Hash[attrs.map { |a| [a.to_sym, send(\"#{a}\")] }]\n end", "def attributor(attributes)\n inject_s(attributes) {|key, value| \" #{key.to_s}=\\\"#{value.to_s}\\\"\"}\n end", "def attribute_hash\n build_literals(strip_tsim(solr_document.select do |k, _v|\n k.end_with?(\"tsim\")\n end))\n end", "def attribute_name\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n hash = nil\n comp_first = nil\n comp_next = nil\n # - - - - @init action - - - -\n hash = Hashie::Mash.new\n\n begin\n # at line 148:27: comp_first= attribute_component ( '.' comp_next= attribute_component )*\n @state.following.push(TOKENS_FOLLOWING_attribute_component_IN_attribute_name_1077)\n comp_first = attribute_component\n @state.following.pop\n # --> action\n cur_hash = hash; comp = (comp_first && @input.to_s(comp_first.start, comp_first.stop))\n # <-- action\n # at line 149:6: ( '.' comp_next= attribute_component )*\n while true # decision 36\n alt_36 = 2\n look_36_0 = @input.peek(1)\n\n if (look_36_0 == T__33)\n alt_36 = 1\n\n end\n case alt_36\n when 1\n # at line 149:8: '.' comp_next= attribute_component\n match(T__33, TOKENS_FOLLOWING_T__33_IN_attribute_name_1088)\n @state.following.push(TOKENS_FOLLOWING_attribute_component_IN_attribute_name_1092)\n comp_next = attribute_component\n @state.following.pop\n # --> action\n cur_hash[comp.to_sym] = Hashie::Mash.new; cur_hash = cur_hash[comp.to_sym]; comp = (comp_next && @input.to_s(comp_next.start, comp_next.stop))\n # <-- action\n\n else\n break # out of loop for decision 36\n end\n end # loop for decision 36\n # --> action\n cur_hash[comp.to_sym] = ATTRIBUTE\n # <-- action\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__, 28 )\n\n end\n\n return hash\n end", "def sanitize_attributes\n self.name = \"#{self.name}\".strip\n end", "def values\n @attributes.reject { |k, _| tag_names.include?(k.to_s) }\n end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def remove_attribute(name); end", "def strip_params_before_orm(hash)\n new_hash = hash.dup\n new_hash.delete(\"route_properties\")\n new_hash.delete(\"data_object\")\n\n return new_hash\n end", "def delete_attr!(key)\n copy_on_write if @attrs.shared\n key = key.intern \n old_attrs = @attrs\n @attrs = AttrArray.new\n @attrs_hash = {}\n old_attrs.each do |a|\n put_attr(a) if a.key_symbol != key\n end\n end", "def name_attribute_multi\n %(name=\"#{name_base}[]\")\n end", "def raw_attributes\n @ldap_entry.attribute_names.each_with_object({}) do |key, hsh|\n hsh[key] = @ldap_entry[key]\n end\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 parse_attributes!\n self.attributes = (attributes || []).map do |key_value|\n name, type, index, default = key_value.split(/:/)\n opts = {}\n if default\n opts[:default] = default\n end\n if index\n index_type, constraint = index.split(/,/)\n if constraint == 'not_null'\n opts[:null] = false\n end\n end\n create_attribute(name, type, index_type, opts)\n end\n end", "def attr_split\n expr.attr_split.each_pair.each_with_object({}) do |(k,v),h|\n h[k] = Predicate.new(v)\n end\n end", "def nested_values(attribute, hash)\n hash.inject('') do |all,(key,value)|\n attribute_with_name = \"#{attribute}-#{key.to_s.tr('_', '-')}\"\n all << if value.is_a?(Hash)\n nested_values(attribute_with_name, value)\n else\n %(#{attribute_with_name}=\"#{escape_value(value)}\" )\n end\n end\n end", "def name!(attributes)\n hash = attributes.clone\n\n [:role, :order].each do |k|\n hash.delete(k)\n end\n\n if hash[:first].length == 1\n hash[:first] = \"#{hash[:first]}.\"\n end\n\n if hash[:middle]\n hash[:middle] = \"#{hash[:middle][0,1].upcase}.\"\n end\n\n if @order == :last || hash[:suffix]\n hash[:last] = \"#{hash[:last]},\"\n end\n\n if @order == :last && hash[:middle]\n hash[:middle] = \"#{hash[:middle]},\"\n end\n\n hash.values.compact.reject(&:empty?).join(' ').squish\n end", "def attributes\n @attributes ||= attribute_names.inject({}) do |hash, name|\n attribute_values = saml.xpath(\"//saml:Attribute[@Name='#{name}']/saml:AttributeValue/text()\")\n hash[name] = attribute_values.length > 1 ? attribute_values.collect(&:to_s) : attribute_values.to_s\n hash\n end\n end", "def - (name) remove_attribute name end", "def sanitize_model_attrs(model)\n model.column_names.map(&:intern).reject { |k| k == :prospect_id }\n end", "def sanitize_model_attrs(model)\n model.column_names.map(&:intern).reject { |k| k == :prospect_id }\n end", "def make_attribute_readers \n readers = @specification[:attributes].map do |regexp_or_name|\n expr1 = regexp_or_name.kind_of?(Regexp) ? regexp_or_name.source : regexp_or_name.to_s\n expr = remove_trailing_equals_and_or_dollar(remove_leading_colon_or_at_sign(expr1))\n if regexp_or_name.kind_of? Regexp\n Regexp.new(remove_leading_colon_or_at_sign(expr))\n else\n expr\n end\n end\n Set.new(readers.sort_by {|exp| exp.to_s})\n end", "def ext_attrs(values, attrs_skip = [])\n result = values.except *attrs_always_skip\n return result\n end", "def process_attrasgn exp\n exp = exp.dup\n exp.target = process exp.target\n exp.arglist = process exp.arglist\n exp\n end", "def mk_attr_str **attr_map\n attr_map.map{|k,v|\" #{k}='#{v}'\"}.join\n end", "def parse_attributes! #:nodoc:\n self.attributes = (attributes || []).map do |key_value|\n name, type = key_value.split(':')\n Rails::Generators::GeneratedAttribute.new(name, type)\n end\n end", "def transform_attr(key, value)\n if value.is_a? Array\n sub_attrs = value.map do |sub_prop|\n sub_prop.map { |k, v| transform_attr(k, v) }\n end\n \"<w:#{key}>#{sub_attrs.join}</w:#{key}>\"\n elsif value.is_a? Hash\n props = value.map { |k, v| format('w:%s=\"%s\"', k, v) if v }\n \"<w:#{key} #{props.compact.join(' ')} />\"\n else\n value = format('w:val=\"%s\" ', value) if value\n \"<w:#{key} #{value}/>\"\n end\n end", "def transform_attr(key, value)\n if value.is_a? Array\n sub_attrs = value.map do |sub_prop|\n sub_prop.map { |k, v| transform_attr(k, v) }\n end\n \"<w:#{key}>#{sub_attrs.join}</w:#{key}>\"\n elsif value.is_a? Hash\n props = value.map { |k, v| format('w:%s=\"%s\"', k, v) if v }\n \"<w:#{key} #{props.compact.join(' ')} />\"\n else\n value = format('w:val=\"%s\" ', value) if value\n \"<w:#{key} #{value}/>\"\n end\n end", "def extract_attribute_options(value)\n options = ''\n ret_val = value\n if value.class == Hash\n options = ';' + value.keys[0]\n ret_val = value[value.keys[0]]\n if ret_val.class == Hash\n sub_options, ret_val = extract_attribute_options(ret_val)\n options += sub_options\n end\n end\n ret_val = [ret_val] unless ret_val.class == Array\n [options, ret_val]\n end", "def kwattr_remove(attribute_name, keywords); end", "def process_attributes(rest_of_line)\n @tag_attributes = []\n while rest_of_line != \"\" do\n # If '=' doesn't exist, empty attribute string and break from loop\n if rest_of_line.index('=') == nil\n break\n elsif rest_of_line.index('=') != nil and rest_of_line.index('<') != nil and rest_of_line.index('<') < rest_of_line.index('=')\n break\n end\n \n first_equals_index = rest_of_line.index '='\n embedded_attribute = false\n \n if rest_of_line[first_equals_index+1..first_equals_index+2] == '{{'\n embedded_attribute = true\n close_index = rest_of_line.index '}}'\n if close_index == nil\n raise CompilerException, \"Unmatched '{{' found in line #{@line_number}\"\n end\n elsif rest_of_line[first_equals_index+1..first_equals_index+2] == '<%'\n embedded_attribute = true\n close_index = rest_of_line.index '%>'\n if close_index == nil\n raise CompilerException, \"Unmatched '<%' found in line #{@line_number}\"\n end\n end\n \n if embedded_attribute\n current_attribute = rest_of_line[0..close_index+1]\n if rest_of_line.length == close_index + 2\n rest_of_line = \"\"\n else\n rest_of_line = rest_of_line[close_index+2..-1]\n end\n \n elsif rest_of_line.length == first_equals_index\n current_attribute = rest_of_line.strip\n rest_of_line = \"\"\n \n elsif rest_of_line[first_equals_index + 1..-1].index('=') == nil\n open_inner_text_index = rest_of_line.index('<')\n if open_inner_text_index != nil\n current_attribute = rest_of_line[0..open_inner_text_index-1].strip\n rest_of_line = rest_of_line[open_inner_text_index..-1]\n else\n current_attribute = rest_of_line * 1\n rest_of_line = \"\"\n end\n \n else\n second_equals_index = rest_of_line[first_equals_index + 1..-1].index '='\n reversed_letters_between_equals = rest_of_line[first_equals_index+1..first_equals_index + 1 + second_equals_index - 1].split(\"\").reverse\n \n whitespace_index = nil\n i = 0\n for char in reversed_letters_between_equals do\n if \" \\t\".index(char) != nil\n whitespace_index = first_equals_index + 1 + second_equals_index - i\n break\n end\n i += 1\n end\n \n if whitespace_index == nil\n # TODO: Do some error reporting here\n break\n end\n \n current_attribute = rest_of_line[0..whitespace_index-1].strip\n rest_of_line = rest_of_line[whitespace_index..-1]\n end\n \n if current_attribute != nil\n equals_index = current_attribute.index '='\n @tag_attributes << ' ' + current_attribute[0..equals_index-1] + '=\"' + current_attribute[equals_index+1..-1] + '\"'\n end\n end\n \n rest_of_line.strip\n end", "def attributes(hash)\n hash.keys.inject(\"\") { |attrs, key| attrs + %{#{key}=\"#{hash[key]}\" } }\n end", "def attributes_with_quotes\n columns_hash = self.class.columns_hash\n @attributes.inject({}) do |attrs_quoted, pair| \n attrs_quoted[pair.first] = quote(pair.last, columns_hash[pair.first])\n attrs_quoted\n end\n end", "def redact( *attributes )\n hash =\n if attributes.first.is_a?( Symbol )\n Hash[ attributes.zip( [ nil ] * attributes.length ) ]\n else\n attributes.first\n end\n\n self.class.new( to_attributes.merge( hash ) )\n end", "def form_attributes\n sanitized_attributes = {}.with_indifferent_access\n attributes.reject { |attr| attr =~ /_at|version/ }.each do |key, value|\n sanitized_key = key == '_id' ? 'id' : key\n sanitized_attributes[sanitized_key] = value.to_s\n end\n sanitized_attributes\n end", "def to_s\n each_with_object([]) do |(name, value), array|\n if value.is_a?(Component::Attr)\n # Flatten nested hashs and inject them unless empty\n value = value.to_s\n array << value unless value.empty?\n else\n name = [@prefix, name].compact.join(\"-\").gsub(/[\\W_]+/, \"-\")\n array << %(#{name}=\"#{value}\") unless value.nil?\n end\n end.sort.join(\" \")\n end", "def kwattr_values(attribute_name)\n keywordify(get_attribute(attribute_name) || [])\n end", "def project_attribute_hash\n to_a.inject({}) { |hash,(k,v)| hash[k] = v }\n end", "def remove_unique_attrs( char )\n ResourcePool.unique_attrs.each do |attr|\n if (self.is_storing_picked?(attr[0]))\n atr = attr[0]\n attr.slice(1, (attr.length - 1)).each do |attr|\n if (attr.is_a?(Array))\n self.add_to_picked(atr, char.send(attr[1]))\n self.delete_from_pool(attr[0], char.send(attr[1]))\n else\n self.add_to_picked(atr, char.send(attr))\n self.delete_from_pool(atr, char.send(attr))\n end\n end\n end\n end\n end", "def remove_expression(expression)\n \n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attr_without_feed_prefix (attr_sym)\n self[attr_sym].slice feed.prefix if self.gtfs_cols_with_prefix.include? (attr_sym)\n end", "def simplify\n if @type == 'pair'\n [@attr['first'].simplify, @attr['second'].simplify]\n elsif @type == 'map' && @value.is_a?(Array)\n @value.map {|e| [e['first'].simplify, e['second'].simplify]}.to_h\n elsif is_struct\n @attr.transform_values(&:simplify)\n elsif @value.is_a?(Array)\n @value.map {|e| e.is_a?(ObjectValue) ? e.simplify : e}\n elsif @value.is_a?(ObjectValue)\n @value.simplify\n else\n @value\n end\n end", "def attributes_string\n\t\t\t#note that underscores are converted to hyphens. Quotes are entity encoded\n\t\t\tattrs = @attributes.reject{|k,v| v.nil?}.map do |k,v|\n\t\t\t\tvv = escape_quote v.to_s\n\t\t\t\tkk = k.to_s.gsub('_', '-')\n\t\t\t\t%Q[#{kk}=\"#{vv}\"]\n\t\t\tend\n\t\t\t\n\t\t\treturn attrs.join(' ')\n\t\tend", "def delete_attribute(key); end", "def clean_attributes(attributes)\n attributes[:license] = Array(attributes[:license]) if attributes.key? :license\n attributes[:rights_statement] = Array(attributes[:rights_statement]) if attributes.key? :rights_statement\n remove_blank_attributes!(attributes)\n end", "def strip_attributes(attrs_to_check)\n attrs_to_check = model.attribute_names if @attrs_to_manage[:strip] == :all\n\n attrs_to_check.each do |attribute|\n value = strip_attribute(attribute)\n model[attribute] = value if value\n end\n end", "def cleanup_characters(attrs, new_monograph)\n attrs_out = {}\n attrs.each do |key, value|\n # At this point the cardinality is as required by ActiveFedora, ready to be set. Store it for later.\n is_array = value.kind_of?(Array)\n # Array wrap for uniform processing.\n cleaned_value = clean_values(Array(value), new_monograph)\n # back to expected AF cardinality\n attrs_out[key] = is_array ? cleaned_value : cleaned_value.first\n end\n attrs_out\n end", "def comparison_attributes\n except_list = ['id', 'updated_at', 'created_at', 'verified_at']\n except_list << 'alternative_phone' unless Spree::Config[:alternative_shipping_phone]\n except_list << 'company' unless Spree::Config[:company]\n\n a = attributes.except(*except_list)\n a.each{|k, v|\n if v.is_a?(String)\n v = v.downcase.strip.gsub(/\\s+/, ' ')\n a[k] = v.present? ? v : nil\n end\n }\n a['state_name'] = nil if a['state_name'].blank?\n a\n end", "def parse_query_api_pattern_remove_blank_key( key, value, result)\n # 'KeyName{!remove-if-blank}'\n blank_key_sign = key[FIND_BLANK_KEYS_TO_REMOVE]\n if blank_key_sign\n # Delete the original key from the resulting hash.\n result.delete(key)\n # But if its value is not blank then fix the key name (get rid of {!remove-if-blank}) and\n # put it back.\n unless value.respond_to?(:_blank?) && value._blank?\n key = key.sub(blank_key_sign, '')\n result[key] = value\n end\n end\n [key, value]\n end", "def attribute(name, options={:strip => true, :null_if_blank => true})\n\t\t\treturn @attributes[name.to_sym] if @attributes && @attributes[name.to_sym]\n\t\t\treturn nil unless @node.attribute(name)\n\t\t\t@attributes = {} unless @attributes\n\t\t\t@attributes[name] = @node.attribute(name).evaluate(@node, :attrs => true).to_s\n\t\t\t@attributes[name].strip! if options[:strip]\n\t\t\t@attributes[name] = nil if @attributes[name].blank? && options[:null_if_blank]\n\t\t\t@attributes[name]\n\t\tend", "def attributes(options={:strip => true, :null_if_blank => true})\n\t\t\treturn @attributes if @attributes\n\t\t\t@attributes = {}\n\t\t\t@node.attributes.each do |value|\n\t\t\t\t@attributes[value[:name]] = value.evaluate(@node, :attrs => true)\n\t\t\t\t@attributes[value[:name]].strip! if options[:strip]\n\t\t\t\t@attributes[value[:name]] = nil if @attributes[value[:name]].blank? && options[:null_if_blank]\n\t\t\tend\n\t\t\t@attributes\n\t\tend", "def clean_data\n clean_attributes = {}\n attributes.each do |key, value|\n # clean user inputted strings\n value = value.downcase.strip if value.is_a?(String)\n\n clean_attributes[key.to_sym] = value\n end\n clean_attributes\n end", "def clean_attributes(attributes)\n # attributes[:rights_license] = Array(attributes[:rights_license]) if attributes.key? :rights_license\n super( attributes )\n end", "def map_attribute_names(data, attribute_map)\n data\n .transform_keys { |k| attribute_map.fetch(k, nil) }\n .reject { |key, _| key.nil? }\n end", "def attribute_values\n @attribute_values ||= {}\n end", "def map_attribute_names(data, attribute_map)\n data.transform_keys { |k| attribute_map.fetch(k, nil) }.reject { |key,_| key.nil? }\n end", "def existing_formula_attributes=(formula_attributes)\n formulas.reject(&:new_record?).each do |formula|\n attributes = formula_attributes[formula.id.to_s]\n if attributes\n formula.attributes = attributes\n else\n formulas.delete(formula)\n end\n end\n end", "def existing_formula_attributes=(formula_attributes)\n formulas.reject(&:new_record?).each do |formula|\n attributes = formula_attributes[formula.id.to_s]\n if attributes\n formula.attributes = attributes\n else\n formulas.delete(formula)\n end\n end\n end", "def convert_attribute_name name\n ATTRIBUTE_NAME_MAPPING[name] || name\n end", "def prune_extra_attributes(request_body, existing_attributes) \n request_body.each do |request_attribute, request_value|\n request_body.delete request_attribute unless existing_attributes.include?(request_attribute)\n end\n return request_body\n end", "def process\n @properties.map { |k, v| transform_attr(k, v) }.join\n end", "def process\n @properties.map { |k, v| transform_attr(k, v) }.join\n end", "def line_clean_up(x)\n\t\tx=x.lstrip\n\t\tx=x.gsub(/[a-zA-Z\\]\\'\\\"{\\d]+=[a-zA-Z\\[\\'\\\"{\\d]+/){|x| x.split(\"=\").join(\" = \")}\n\t\t#or equal is failing to work in the same way\n\t\t#x=x.gsub(/[a-zA-Z\\]\\'\\\"{\\d]+=[a-zA-Z\\[\\'\\\"{\\d]+/){|x| x.split(\"||=\").join(\" ||= \")}\n\t\treturn x\n\tend", "def merge_attributes\n %w( price area paragraph bullet file ).map(&:to_sym)\n end", "def clean_attributes\n return attributes if group.nil? || !group.empty?\n\n filtered_attributes = attributes.dup\n filtered_attributes.delete(:group)\n end", "def trim_params(params)\n Hash[*(params.select { |k,v| new.attributes.keys.include? k.to_s}.flatten)] \n end", "def attr_dirty!(key)\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys << key.to_sym\n @dirty_attribute_keys.uniq!\n end", "def field_attribute(attribute)\n attribute.to_s.sub(/\\?$/,\"\")\n end", "def attributes= hsh\n conv_hsh = {}\n hsh.each do |k,v|\n k = k.to_s.gsub(/:/,'_') if k =~ /:/\n conv_hsh[k] = v\n end\n super hsh\n end" ]
[ "0.63046414", "0.62480664", "0.60744774", "0.6049843", "0.5967913", "0.59644175", "0.5959419", "0.59232926", "0.59214556", "0.58586043", "0.5847415", "0.5822893", "0.5767844", "0.5746209", "0.5661682", "0.5636758", "0.56321937", "0.55865186", "0.55667365", "0.55667365", "0.55555326", "0.5544415", "0.55425847", "0.55423915", "0.55423915", "0.55423915", "0.5525108", "0.5514278", "0.5506733", "0.5505737", "0.5480386", "0.5476259", "0.5470827", "0.5470827", "0.5470827", "0.5470827", "0.5462225", "0.5447711", "0.54300535", "0.5428915", "0.5424221", "0.54232216", "0.540645", "0.5404182", "0.5401443", "0.53876567", "0.5387578", "0.53829426", "0.53829426", "0.5377209", "0.5372853", "0.5365298", "0.5362859", "0.5361287", "0.53585976", "0.53585976", "0.5356123", "0.53500307", "0.5349234", "0.5337524", "0.5330546", "0.53171813", "0.5307008", "0.5294857", "0.52914584", "0.529051", "0.5284827", "0.52816844", "0.52815145", "0.52815145", "0.52815145", "0.5279138", "0.5276266", "0.52729636", "0.52724546", "0.52723384", "0.5268598", "0.52644366", "0.52607507", "0.5260581", "0.5257206", "0.52502865", "0.52500564", "0.52494776", "0.52409357", "0.5239136", "0.5225724", "0.5219183", "0.5219183", "0.52171934", "0.5216367", "0.52033836", "0.52033836", "0.5198448", "0.519697", "0.5196344", "0.51925796", "0.51883495", "0.5187864", "0.518258" ]
0.5786511
12
Make Update expression 'SET = :' : points to a value from the expression_attribute_value
def make_update_expression_values(event,attr_values) update_string = 'SET ' event.each do |k,v| update_string += "#{make_expression_key(k,"names")} = #{attr_values[k].key(v)}, " end return update_string[0...-2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_expression_value\n @expression_value = ExpressionValue.find(params[:id])\n end", "def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end", "def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end", "def expr=(p1)\n #This is a stub, used for indexing\n end", "def update\n set_line = self.class.columns.map { |attr| \"#{attr} = ?\" }.join(\", \")\n\n DBConnection.execute(<<-SQL, *attribute_values, self.id)\n UPDATE\n #{self.class.table_name} \n SET\n #{set_line}\n WHERE\n id = ?\n SQL\n end", "def update\n eqs = self.class.columns.map { |column| \"#{column} = ?\"}.join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values, id)\n UPDATE\n #{self.class.table_name}\n SET\n #{eqs}\n WHERE\n id = ?\n SQL\n end", "def set_expression\n @expression = Expression.find params[:id]\n end", "def edit_symptom(db, id, category, value)\n $db.execute( <<-SQL\n UPDATE symptoms\n SET \"#{category}\"=\"#{value}\"\n WHERE id=\"#{id}\";\n SQL\n )\nend", "def update\n\n DBConnection.execute2(<<-SQL, attribute_values)\n UPDATE\n #{class_obj.table_name}\n SET\n #{sql_update_set}\n WHERE\n id = #{self.id}\n SQL\n\n end", "def setq(sym, expr)\n\t\tif expr.is_a?(String)\n\t\t\tif expr.match(/\\(list/)\t\n\t\t\t\tstr = \"(setq #{sym.to_s} #{expr.to_s})\" \n\t\t\telse\t\n\t\t\t\tstr = \"(setq #{sym.to_s} \\\"#{expr.to_s}\\\")\" \n\t\t\tend\t\n\t\t\tputs str\n\t\telse\n\t\t\tstr = \"(setq #{sym.to_s} #{expr.to_s})\" \n\t\t\tputs str\n\n\t\tend\t\n\t\tlisp_eval str\n\tend", "def expression(expression_string)\n state_depth_must_be(States::ATTRIBUTE)\n raise 'expression already defined' if @current_attribute.expression\n @current_attribute.expression = expression_string\n end", "def test_assignment_binds_are_substituted\n table = Table.new(:users)\n um = Arel::UpdateManager.new Table.engine\n bp = Nodes::BindParam.new '?'\n um.set [[table[:name], bp]]\n visitor = Class.new(Arel::Visitors::ToSql) {\n include Arel::Visitors::BindVisitor\n }.new Table.engine.connection\n\n assignment = um.ast.values[0]\n actual = visitor.accept(assignment, collector) {\n \"replace\"\n }\n assert actual\n value = actual.value\n assert_like \"\\\"name\\\" = replace\", value\n end", "def set_attr_value( m_name, args )\n \n dup_m_name = m_name.gsub(/=$/, '')\n if( extended_attribute = find_in_extended_attr( dup_m_name ) )\n extended_attribute.update_attributes( :values => args )\n elsif( schema = find_attr_in_schema( dup_m_name ) )\n self.extended_attributes.build( :extended_attributes_schema => schema, :values => args )\n end\n \n end", "def ^ (name, value = nil, &block) update_attribute name, value, &block end", "def parsed_expression=(value)\n @parsed_expression = value\n end", "def update!(**args)\n @dimension = args[:dimension] if args.key?(:dimension)\n @expression = args[:expression] if args.key?(:expression)\n @operator = args[:operator] if args.key?(:operator)\n end", "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @operator = args[:operator] if args.key?(:operator)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @equivalent_attribute_id = args[:equivalent_attribute_id] if args.key?(:equivalent_attribute_id)\n end", "def update!(**args)\n @case_sensitive = args[:case_sensitive] if args.key?(:case_sensitive)\n @expression_value = args[:expression_value] if args.key?(:expression_value)\n @field = args[:field] if args.key?(:field)\n @field_index = args[:field_index] if args.key?(:field_index)\n @kind = args[:kind] if args.key?(:kind)\n @match_type = args[:match_type] if args.key?(:match_type)\n end", "def update_attribute key, value\n setter = :\"#{key}=\"\n send(setter, value) if respond_to?(setter)\n save(:changes => true, :validate => false)\n end", "def update\n column_sets = self.class.columns.map { |attr_name| \"#{attr_name} = ?\" }.join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values, self.id)\n UPDATE\n #{self.class.table_name}\n SET\n #{column_sets}\n WHERE\n #{self.class.table_name}.id = ?\n SQL\n # ...\n end", "def update!(**args)\n @comparison_type = args[:comparison_type] if args.key?(:comparison_type)\n @comparison_value = args[:comparison_value] if args.key?(:comparison_value)\n @expression = args[:expression] if args.key?(:expression)\n @match_type = args[:match_type] if args.key?(:match_type)\n @type = args[:type] if args.key?(:type)\n end", "def sql_update_set\n attributes.keys.map { |attr_name| \"#{attr_name} = ?\" }\n .join(\", \")\n end", "def expression=(_arg0); end", "def update_column name, value\n name = name.to_s\n self.dynamic_record.send \"#{name}=\", value\n self.raw_write_attribute name, value\n end", "def set_fauxsql_attribute(attribute_name, value)\n options = fauxsql_options[attribute_name]\n value = value.send(options[:type]) if options and options[:type]\n \n attribute = Fauxsql.dereference_fauxsql_attribute(value)\n Fauxsql.dirty!(self){ fauxsql_attributes[attribute_name] = attribute } \n end", "def store_expression expression, variable_name\r\n command 'storeExpression', expression, variable_name\r\n end", "def set_variable(expr, value)\n @variables[expr] = value.to_s.force_encoding(Encoding::UTF_8)\n end", "def set_attribute params\n sequel_db = get_db params[:database]\n sequel_db.transaction do\n attribute_record = sequel_db[:attributes].where( :object_id => params[:persistence_id], :name => params[:name].to_s ) # convert name to String as Symbol breaks sqlite\n\n if attribute_record.empty?\n # If the attribute doesn't exist, we must INSERT and not UPDATE\n attribute_record.insert :object_id => params[:persistence_id], :name => params[:name].to_s, :value => params[:value] # convert name to String as Symbol breaks sqlite\n else\n attribute_record.update :value => params[:value]\n end\n end\n nil\n end", "def update_statement(properties, query)\n conditions_statement, bind_values = conditions_statement(query.conditions)\n\n statement = \"UPDATE #{quote_name(query.model.storage_name(name))}\"\n statement << \" SET #{properties.map { |property| \"#{quote_name(property.field)} = ?\" }.join(', ')}\"\n statement << \" WHERE #{conditions_statement}\" unless conditions_statement.blank?\n\n return statement, bind_values\n end", "def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @operator_name = args[:operator_name] if args.key?(:operator_name)\n @value = args[:value] if args.key?(:value)\n end", "def set_test(field, operator,value, &block)\n set_value = translate_value(field, value)\n raise ScopedSearch::QueryNotSupported, \"Operator '#{operator}' not supported for '#{field.field}'\" unless [:eq,:ne].include?(operator)\n negate = ''\n if [true,false].include?(set_value)\n negate = 'NOT ' if operator == :ne\n if field.numerical?\n operator = (set_value == true) ? :gt : :eq\n set_value = 0\n else\n operator = (set_value == true) ? :ne : :eq\n set_value = false\n end\n end\n [\"#{negate}(#{field.to_sql(operator, &block)} #{self.sql_operator(operator, field)} ?)\", set_value]\n end", "def rhs= exp\n expect :attrasgn, :safe_attrasgn, *ASSIGNMENT_BOOL\n @my_hash_value = nil\n\n if self.node_type == :attrasgn or self.node_type == :safe_attrasgn\n self[3] = exp\n else\n self[2] = exp\n end\n end", "def method_missing *args\n # if the first entry of the parameter-array is a known attribute\n # proceed with the assignment\n if args.size == 1\n attributes[args.first.to_sym] # return the attribute-value\n elsif args[0][-1] == \"=\" \n if args.size == 2\n#\tif rid.rid? \n#\t update set:{ args[0][0..-2] => args.last }\n#\telse\n\t self.attributes[ args[0][0..-2] ] = args.last\n#\tend\n else\n\t self.attributes[ args[0][0..-2] ] = args[1 .. -1]\n#\tupdate set: {args[0][0..-2] => args[1 .. -1] } if rid.rid?\n end\n else\n raise NameError, \"Unknown method call #{args.first.to_s}\", caller\n end\n end", "def updateAppFlag(org_id, type, env, value)\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n response = dynamodb.update_item(\n {\n table_name: \"Organizations\",\n key: {\n \"id\" => org_id\n },\n expression_attribute_names: {\n \"#SETTINGS\" => \"settings\",\n \"#APPS\" => \"apps\",\n \"#TYPE\" => type,\n \"#ENV\" => env\n },\n expression_attribute_values: {\n \":value\" => value\n },\n update_expression: \"SET #SETTINGS.#APPS.#TYPE.#ENV = :value\"\n }\n )\n\n return true\nrescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return false\nend", "def default_value_expression= default_value_expression\n @gapi.update! default_value_expression: default_value_expression\n end", "def _expression\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_assignment)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_value)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_expression unless _tmp\n return _tmp\n end", "def update!(**args)\n @expression = args[:expression] if args.key?(:expression)\n @name = args[:name] if args.key?(:name)\n @tag_color = args[:tag_color] if args.key?(:tag_color)\n end", "def update_field(change_field, change_value)\n if valid?\n run_sql(\"UPDATE #{table} SET #{change_field} = #{self.class.add_quotes_if_string(change_value)} WHERE id = #{@id};\")\n else\n false\n end\n end", "def set_attribute_value(attribute, value)\n\n # This product needs to have an id in order to set\n # attribute values on it.\n save! if new_record?\n\n if attribute.atype == ProductAttribute::Atype_String\n str_val = value\n int_val = nil\n elsif attribute.atype == ProductAttribute::Atype_Currency\n str_val = nil\n int_val = MoneyUtils.parse(value)\n else\n # It is possible that the admin did not fill in a value for\n # a text field, so we get an empty string for \"value\". We\n # could implement a default value for the attribute (probably\n # stored in the attribute itself, but for now just store 0.)\n str_val = nil\n if value.blank?\n int_val = 0\n else\n int_val = Integer(value)\n end\n end\n write_attr_val(attribute.id, str_val, int_val)\n\n end", "def set(field, value)\n if @data.set_fields.include?(field)\n raise SqlStmtError, \"trying to set field #{field} again\"\n end\n\n if field\n @data.set_fields << field\n end\n value = value.is_a?(String) ? value : value.to_sql\n @data.set_values << value\n return self\n end", "def update_value(aim,value)\n self.update(\"#{aim}\": value)\n end", "def update_attribute(key, value)\n instance_variable_set \"@#{key}\", value\n save_if_match\n end", "def update (flow_expression)\n\n flow_expression.updated_at = Time.now\n\n #ldebug { \"update() for #{flow_expression.fei.to_debug_s}\" }\n\n onotify(:update, flow_expression.fei, flow_expression)\n\n flow_expression\n end", "def update!(**args)\n @argument = args[:argument] if args.key?(:argument)\n @operand = args[:operand] if args.key?(:operand)\n @operator = args[:operator] if args.key?(:operator)\n end", "def set_attribute(key_, value_)\n attribute(key_, value_, :set)\n end", "def set!(variable, new_value)\n check_argument_type(variable, Variable)\n check_argument_type(new_value, BasicModel)\n @table[variable] = new_value\n end", "def test_set_eval\n set = SetVariableEval.new(@int_var, @int_lit)\n set.eval\n assert_equal \"SET [Y+9], 10\\n\", MPPCompiler.last\n end", "def update_where(table, what, where, *bindvars)\n sql = \"update #{table.name}\\nset #{what} where #{where}\"\n#$stderr.puts sql\n db.do(sql, *bindvars)\n end", "def replace_placeholder_string(expression, variable_old, variable_new)\n if expression.is_a? Yarpler::Models::Expression\n expression.left = replace_placeholder_string(expression.left, variable_old, variable_new)\n expression.right = replace_placeholder_string(expression.right, variable_old, variable_new)\n elsif expression.is_a? Yarpler::Models::Field\n expression.variable = variable_new if expression.variable == variable_old\n end\n expression\n end", "def set _index, _value\n <<-SQF\n MEMBER(\"__dataset\", nil) set [_index, _value];\n SQF\n end", "def update_attribute!(attribute, value)\n send(\"#{attribute}=\", value)\n self.save!\n end", "def update()\ndb = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\nsql = \"UPDATE bounty_hunters\nSET (name,\n species,\n homeworld,\n favourite_weapon\n )=(\n $1, $2, $3, $4\n )\n WHERE id = $5\n \"\n\nvalues = [@name, @species, @homeworld, @favourite_weapon]\ndb.prepare('update',sql)\n db.exec_prepared('update', values)\n db.close\nend", "def update!(**args)\n @attribute_key = args[:attribute_key] if args.key?(:attribute_key)\n @attribute_value = args[:attribute_value] if args.key?(:attribute_value)\n end", "def build_update_set_cols(key)\n \"#{quote_column_name(key)} = updated_values.#{quote_column_name(key)}\"\n end", "def update!(**args)\n @attr_value = args[:attr_value] if args.key?(:attr_value)\n end", "def update_attribute\n end", "def update_user_rateing(db,id,new_value)\n db.execute(\"UPDATE users SET user_rating=#{new_value} WHERE users.id =#{id}\")\nend", "def dbupdate(table, variables, condition, names)\n if variables.kind_of?(Array) == false\n v = variables.to_s + \"=?\"\n else\n v = \"\"\n i = 0\n while i < variables.length\n v += variables[i].to_s + \"=?\"\n i += 1\n if i < variables.length\n v += \", \"\n end\n end\n end\n\n if condition.kind_of?(Array) == false\n c = condition.to_s + \"=?\"\n else\n c = \"\"\n i = 0\n while i < condition.length\n c += condition[i].to_s + \"=?\"\n i += 1\n if i < condition.length\n c += \" AND \"\n end\n end\n end\n\n return db.execute(\"UPDATE #{table} SET #{v} WHERE #{c}\", names)\nend", "def set(value)\n execute(:set, value)\n end", "def set_expected_income(db, user_name, dolla_dolla_bills_yall)\r\n\texpected_income = '\r\n\r\n\tUPDATE users SET expected_income = ?\r\n\r\n\tWHERE name = ?' \r\n\tdb.execute(expected_income, [dolla_dolla_bills_yall, user_name]) \r\nend", "def set(field,value)\n set_method = (field.to_s + \"=\").to_sym\n m = self.method((field.to_s + \"=\").to_sym)\n m.call value\n end", "def update_attribute!(key, value)\n instance_variable_set \"@#{key}\", value\n save!\n end", "def set(assignments)\n assignments.map do |attr, value|\n next unless attr.present?\n\n name = attr.is_a?(Arel::Attributes::Attribute) ? attr.name : attr.to_s\n\n quoted = record.class.connection.quote_column_name(name)\n \"#{quoted} = (#{value.to_sql})\"\n end.join(', ')\n end", "def setattribute_raw(path, name, value)\n Puppet.debug \"#{name.inspect} setting to #{value.inspect} for path: #{path}\"\n cmd = if value.nil?\n \"#{path}:undefine-attribute(name=\\\"#{name}\\\")\"\n else\n \"#{path}:write-attribute(name=\\\"#{name}\\\", value=#{value})\"\n end\n cmd = \"/profile=#{@resource[:profile]}#{cmd}\" if runasdomain?\n state = execute cmd\n Puppet.debug(\"Setting attribute response: #{state.output}\")\n raise \"Cannot set #{name} for #{path}: #{state.output}\" unless state.success?\n @property_hash[name] = value\n end", "def neo_attribute_set_clauses\n attribute_keys_to_copy_to_neo4j.collect do |key|\n \"set self.#{key} = '#{self.send(key)}'\"\n end.join(\"\\n\")\n end", "def eval_after\n self.after_value = eval_expression\n end", "def update_cell(column, value)\n table_name = self.class.to_s.pluralize.underscore\n return CONNECTION.execute(\"UPDATE #{table_name} SET #{column} = '#{value}' WHERE id = #{@id}\")\n end", "def set_attribute(name, value); end", "def []=(attribute_name, value = nil)\n raise \"Please set the source data set before attempting to set values.\" unless @current_source_data_set\n \n attribute_name = attribute_name.to_sym\n value.strip! if value.kind_of? String\n \n # Are we updating an existing value?\n existing = @attributes[@current_language][attribute_name] || \n @attributes[@current_language][attribute_name.to_s.singularize.to_sym]\n \n if existing\n\n # An attribute that allows multiple values?\n if existing.kind_of? ManyValues\n # Always clear attribute values before re-adding them\n # That way we add new but remove values.\n existing.clear\n unless value.blank?\n value.split(',').each {|v| existing.add(v)}\n end\n # Single value attribute\n elsif existing.value != value\n existing.source_data_set_id = @current_source_data_set.id\n\n unless value.blank?\n existing.value = value\n existing.changed = true\n else\n existing.value = nil\n existing.deleted = true\n end\n end\n\n elsif !value.blank?\n \n # Look up the attribute to get its details: required, allow_many, data_type.\n attribute_definition = PublicEarth::Db::Attribute.find_by_name(attribute_name.to_s) ||\n PublicEarth::Db::Attribute.find_by_name!(attribute_name.to_s.singularize)\n \n # If the attribute allows many values, we need an array.\n if attribute_definition.allow_many?\n @attributes[@current_language][attribute_name] ||= ManyValues.new(self, \n PublicEarth::Db::Details::Attribute.new(self, nil, \n attribute_name, value.split(','), nil, @current_language, @current_source_data_set.id, attribute_definition.readonly, 9999, false, \n false, attribute_definition.allow_many, attribute_definition.data_type))\n return @attributes[@current_language][attribute_name].add(value)\n \n # Otherwise just set the attribute equal to the new value\n else\n @attributes[@current_language][attribute_name] = PublicEarth::Db::Details::Attribute.new(self, nil, \n attribute_name, value, nil, @current_language, @current_source_data_set.id, attribute_definition.readonly, 9999, false, \n false, attribute_definition.allow_many, attribute_definition.data_type)\n @attributes[@current_language][attribute_name].changed = true\n end\n end\n end", "def attribute_setter(attribute_name)\n \"set#{attribute_name.to_s.camelcase(:upper)}\"\n end", "def update!(**args)\n @attribute_id = args[:attribute_id] if args.key?(:attribute_id)\n @value_type = args[:value_type] if args.key?(:value_type)\n @values = args[:values] if args.key?(:values)\n end", "def update!(**args)\n @predicate_encoded_mid = args[:predicate_encoded_mid] if args.key?(:predicate_encoded_mid)\n @property_name = args[:property_name] if args.key?(:property_name)\n @value = args[:value] if args.key?(:value)\n end", "def update_request(request, parms)\n parms.each {|dot_ref, value|\n set_cmd = \"request.#{dot_ref}.value='#{value}'\"\n eval(set_cmd)\n }\n end", "def update(attribute, value)\n instance_variable_set(\"@#{attribute}\", value)\n end", "def update_attribute(name, value)\n send(\"#{name}=\", value)\n save\n end", "def update_attribute(name, value)\n send(\"#{name}=\", value)\n save\n end", "def set_variable(key, value)\n\n @db.execute(\"INSERT OR REPLACE INTO variables VALUES(?,?)\",key.downcase,value)\n\n puts \"I added #{key} to variable table database\"\n return key\n end", "def write_set_attribute(attribute_name, value)\n column_type = ((column_definition = self.class.columns_hash[attribute_name.to_s]) and column_definition.type)\n value = value.to_s(10) if column_type == :string\n write_attribute(attribute_name, value)\n end", "def evalAssign(instr)\n\tvalues = instr.get_values\n\tidentif = values[0].get_value\n\t# Si al buscar en la tabla, la variable no ha sido declarada, \n\t# devuelve un mensaje\n\tsymbol_expr = evalExpression(values[1])\n\tif !$error\n\t\tif symbol_expr[0] == :INTEGER\n\t\t\t$tables.update(symbol_expr[0],identif,symbol_expr[1])\n\t\telsif symbol_expr[0] == :CANVAS\n\t\t\t$tables.update(symbol_expr[0],identif,symbol_expr[1])\n\t\telse\n\t\t\t$tables.update(symbol_expr[0],identif,symbol_expr[1])\n\t\tend\n\tend\nend", "def transform_inc_val_to_set(inc_expr)\n _tag, expr, val = inc_expr\n ['set', expr, ['+', expr, val]]\n end", "def update attributes\n attributes.each do |name, value|\n send \"#{name}=\", value if respond_to? \"#{name}=\"\n end\n save\n end", "def value_update(_value, type)\n if _value.blank? or _value == 'null'\n destroy\n else\n case type\n when AttributeClass::TYPE_NUMBER\n create_or_update_value SitescanCommon::AttributeNumber, {value: _value}\n when AttributeClass::TYPE_RANGE\n create_or_update_value SitescanCommon::AttributeRange,\n {from: _value[:from], to: _value[:to]}\n when AttributeClass::TYPE_OPTION\n create_or_update_value SitescanCommon::AttributeOption,\n {attribute_class_option_id: _value}\n when AttributeClass::TYPE_BOOLEAN\n create_or_update_value SitescanCommon::AttributeBoolean, {value: _value}\n when AttributeClass::TYPE_STRING\n create_or_update_value SitescanCommon::AttributeString, {value: _value}\n end\n end\n end", "def set_value(attribute_id, value)\n get_custom_value_hash\n if @custom_value_hash[attribute_id].nil?\n create_value(attribute_id, value)\n else\n if value && @custom_value_hash[attribute_id] != value\n sql = \"UPDATE #{CustomValue.table_name} SET #{Person::_(:value, :custom_value)} = '#{quote_string(value)}' \n WHERE #{Person::_(:person_id, :custom_value)} = #{id} \n AND #{Person::_(:custom_attribute_id, :custom_value)} = #{attribute_id}\"\n CustomValue.connection.execute(sql)\n @custom_value_hash[attribute_id] = value\n end\n end\n value\n end", "def update(attribute_names = @attributes.keys)\r\n quoted_attributes = attributes_with_quotes(false, false, attribute_names)\r\n return 0 if quoted_attributes.empty?\r\n connection.update(\r\n \"UPDATE #{self.class.quoted_table_name} \" +\r\n \"SET #{quoted_comma_pair_list(connection, quoted_attributes)} \" +\r\n \"WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)}\",\r\n \"#{self.class.name} Update\"\r\n )\r\n end", "def update!(**args)\n @attribute = args[:attribute] if args.key?(:attribute)\n end", "def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n @value = args[:value] if args.key?(:value)\n end", "def do_expression(expr, vars)\n parse_expression(expr).each do |k|\n expr = expr.gsub(\"$(#{k})\", vars[k])\n end\n expr\nend", "def store expression, variable_name\r\n command 'store', expression, variable_name\r\n end", "def update!(**args)\n @attribute_id = args[:attribute_id] if args.key?(:attribute_id)\n end", "def update() #UPDATE film1.price = 10 then film1\n sql = \"UPDATE films SET (title,price) = ($1, $2) RETURNING id = $3\"\n values = [@title, @price, @id]\n result = SqlRunner.run(sql, values)\n\n end", "def update_attribute(attribute, attribute_type, value)\n\t\tresults = submit_cmd('update app attribute',:db, \"-env #{self.belongs_to.env} \\\n -app_instance #{self.name} -attribute #{attribute} -attribute_type #{attribute_type} \\\n -new_value #{value}\")\n\t \n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \traise \"update attribute failed\" \n\t else\n\t \tself.attributes[attribute.intern] = value\n\t end\n\tend", "def update!(**args)\n @max_comparison_value = args[:max_comparison_value] if args.key?(:max_comparison_value)\n @dimension_name = args[:dimension_name] if args.key?(:dimension_name)\n @operator = args[:operator] if args.key?(:operator)\n @expressions = args[:expressions] if args.key?(:expressions)\n @case_sensitive = args[:case_sensitive] if args.key?(:case_sensitive)\n @min_comparison_value = args[:min_comparison_value] if args.key?(:min_comparison_value)\n end", "def set(value)\n execute_only(:set, value)\n end", "def set_attribute_property(id, attribute, property, value)\n\t\to = getObject(id)\n\t\tif (o != nil && o.respond_to?(:[]))\n\t\t\tif (o[attribute] != nil)\n\t\t\t\tif (o[attribute].include?(property))\n\t\t\t\t\to[attribute] = o[attribute].gsub(/#{property}\\:.*(\\;|$)/, setting(property, value))\n\t\t\t\telse\n\t\t\t\t\ts = o[attribute]\n\t\t\t\t\tif (s[-1, 1] != ';') \n\t\t\t\t\t\ts += ';'\n\t\t\t\t\tend\n\t\t\t\t\to[attribute] = s + setting(property, value)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\to[attribute] = setting(property, value)\n\t\t\tend\n\t\telse\n\t\t\tputs \"Could not find object with id = #{id}\"\n\t\tend\n\tend", "def emit_expr value\n statement :expr, value\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def set_value(value)\n unless value.kind_of?(String) or value == nil\n raise \"Illegal value passed to set_value!\"\n end\n\n @value = nil\n @value_string = value\n if value and value != \"\"\n @value = SimpleExpression.new(value)\n end\n\n @vartype = nil\n @depends_on = nil\n @diffeq_deps = nil\n end", "def assignment\n @name = get_name\n match '='\n expression\n emit_ln \"LEA #{@name} (PC),A0\"\n emit_ln 'MOVE D0,(A0)'\nend" ]
[ "0.6285116", "0.62565255", "0.62565255", "0.6079802", "0.6028029", "0.6019261", "0.6008429", "0.5959494", "0.5922933", "0.5892387", "0.587297", "0.5806208", "0.5790991", "0.57007587", "0.5645627", "0.5605947", "0.55957127", "0.5564535", "0.5555585", "0.5554237", "0.555319", "0.55468494", "0.5500502", "0.5495155", "0.5481827", "0.54792076", "0.5466882", "0.54596305", "0.5443371", "0.5426862", "0.54192513", "0.54192513", "0.54020905", "0.5389639", "0.5376612", "0.5373662", "0.53687", "0.53640354", "0.5363004", "0.53566194", "0.5328598", "0.53025806", "0.5298645", "0.5283507", "0.5261394", "0.5258569", "0.52497536", "0.5247467", "0.52462095", "0.524181", "0.5232255", "0.52308", "0.52296895", "0.5227546", "0.5224354", "0.52185297", "0.52175057", "0.52157545", "0.52105236", "0.52040815", "0.51978815", "0.51954025", "0.5187793", "0.51763433", "0.51762885", "0.51759326", "0.51721513", "0.5167852", "0.51627815", "0.51588565", "0.51520324", "0.5148307", "0.5140409", "0.51374865", "0.5135178", "0.5133645", "0.51235604", "0.51235604", "0.51167756", "0.5107395", "0.5099973", "0.5080071", "0.50711805", "0.50711256", "0.5070775", "0.50702417", "0.50661904", "0.505676", "0.50504905", "0.50481147", "0.5038071", "0.5037399", "0.50371623", "0.5022993", "0.50216025", "0.5020257", "0.5013055", "0.50067997", "0.5005356", "0.5001555" ]
0.723983
0
create a new archive by merging this and another archive
def merge(other) assert_archive other data = deep_clone(@data) merge_data data, other.as_json, other.uri self.class.new data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge!(other)\n assert_archive other\n clear_caches\n\n merge_data @data, other.as_json, other.uri\n nil\n end", "def merge(other); end", "def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end", "def merge(source); end", "def merge_with other\n m_next = @metadata.merge_with other.metadata\n files_res = {}\n\n # my files\n @files.each { |f| files_res[f.src] = f }\n\n # overrides\n other.files.each { |f| files_res[f.src] = f }\n\n # result\n f_next = files_res.collect { |k, v| v }\n\n Package.new m_next, f_next\n end", "def archive!\n archive\n save!(validate: false)\n end", "def merge(other)\n self.class.new(*structures, other)\n end", "def merge(other, sibling_compression_counter = nil)\n self.merge_actors(other)\n self.remove_duplicates()\n self.compress_history(sibling_compression_counter)\n end", "def merge; end", "def create_archive\n created = false\n empty = true\n Dir.mktmpdir do |tmpdir|\n # create manifest\n tmpmf = File.join(tmpdir, DulHydra.export_set_manifest_file_name)\n # create the zip archive\n zip_name = \"export_set_#{Time.now.strftime('%Y%m%d%H%M%S')}.zip\"\n zip_path = File.join(tmpdir, zip_name)\n Zip::ZipFile.open(zip_path, Zip::ZipFile::CREATE) do |zip_file|\n CSV.open(tmpmf, 'wb') do |manifest|\n manifest << archive_manifest_header\n pids.each do |pid|\n # get Fedora object\n begin\n object = ActiveFedora::Base.find(pid, :cast => true) \n # skip if object is not content-bearing or user lacks :read permission\n next unless object.has_content? and user.can?(:read, object)\n content_ds = object.datastreams[DulHydra::Datastreams::CONTENT]\n # use guaranteed unique file name based on PID and dsID \n temp_file_path = File.join(tmpdir, content_ds.default_file_name)\n # write content to file\n File.open(temp_file_path, 'wb', :encoding => 'ascii-8bit') do |f|\n content_ds.write_content(f)\n end\n # Use original source file name, if available; otherwise the generated file name\n # Note that we keep the path of the source file in order to reduce likelihood\n # name conflicts, and since it is easy to flatten zip contents on extraction.\n # However, we don't want the path of the generated temp file, just the basename.\n file_name = object.source.first || File.basename(temp_file_path)\n # discard leading slash, if present\n file_name = file_name[1..-1] if file_name.start_with? '/'\n # add file to archive\n zip_file.add(file_name, temp_file_path)\n # add row to manifest\n manifest << archive_manifest_row(file_name, object)\n rescue ActiveFedora::ObjectNotFoundError => e\n logger.error e\n next\n end\n end # document_list\n end # manifest\n # check if the zip file is emtpy\n empty = (zip_file.size == 0)\n # write manifest \n zip_file.add(DulHydra.export_set_manifest_file_name, tmpmf) unless empty\n end # zip_file\n # update_attributes seems to be the way to get paperclip to work \n # when not using file upload form submission to create the attachment\n created = !empty && update_attributes({:archive => File.new(zip_path, \"rb\")})\n end # tmpdir is removed\n created\n end", "def merge_zip merged_build\n debug_msg \"Merging zip for #{merged_build}\"\n \n tmp = temp_dir\n \n title = merged_build.builds.map do |build| \n automation_by_name(build.name).name + \" v#{build.version}\"\n end.join(', ')\n names = merged_build.builds.map do |build| \n automation_by_name(build.name).short_name\n end.join(',')\n options = []\n options << \"-o\" << tmp\n options << '--title' << title\n options << '--names' << names\n merged_build.builds.each do |build|\n options << File.join(@public_dir, build.to_s)\n end\n SDoc::Merge.new.merge(options)\n \n prepare tmp\n \n tmp\n end", "def archive!\n DocumentArchive.create!(:consumer_id => self.consumer_id, :suggested_standard_document_id => self.suggested_standard_document_id, :rejected_at => Time.now, :suggested_at => self.suggested_at, :source => self.source, :file_content_type => self.file_content_type, :cloud_service_full_path => self.cloud_service_full_path, :original_file_name => self.original_file_name)\n end", "def merge!(other)\n other.read_present.each do |k, v|\n write(k, v)\n end\n\n self\n end", "def merge!; end", "def join(other)\n new(entries.merge(other.entries) { |_name, old, new| old + new })\n end", "def archive\n @repo.archive(sha, nil, :format => 'tgz', :prefix => \"#{safe_name}/\")\n end", "def merge!(other)\n case other\n when Hash\n data = other\n when FileStore\n data = other.to_h\n end\n data.each do |name, value|\n @data[name.to_s] = value \n end\n end", "def merge!(other); end", "def archive_incremental(source_directory, destination_dir, file_prefix, file_suffix, tag_prefix)\n @project.from_directory do\n latest_tag_count = @project.latest_tag_count(tag_prefix)\n\n if latest_tag_count == 0\n archive_single(source_directory, File.join(destination_dir, file_prefix + file_suffix))\n else\n destination_file = File.join(destination_dir,\n \"#{file_prefix}_#{format(\"%04d\", latest_tag_count)}#{file_suffix}\")\n tag = @project.latest_tag(tag_prefix)\n log.debug \"creating #{destination_file} with files newer than #{tag}\"\n\n log.debug \"files that changed since then: #{@project.git.changed_files_since(tag)}\"\n list = @project.git.changed_files_since(tag).select do |file|\n File.expand_path(file) =~ /^#{File.expand_path(source_directory)}\\//\n end.map do |file|\n Pathname.new(file).relative_path_from Pathname.new(source_directory)\n end\n @project.from_directory source_directory do\n `tar -cJf #{destination_file} #{list.join(\" \")}`\n end\n\n destination_file\n end\n end\n end", "def merge(other_image)\n raise 'an image class must be supplied' unless other_image.is_a? Image\n raise 'cannot merge if the user is different' unless other_image.user == user\n raise 'cannot merge if the account_id is different' unless other_image.account_id == account_id\n raise 'cannot merge if the state is different' unless other_image.state == state\n\n new_image = Image.new\n new_image.user = @user\n new_image.entries = entries + other_image.entries\n new_image\n end", "def merge(with); end", "def archive_single(source_directory, destination_file)\n log.debug \"creating #{destination_file}\"\n @project.from_directory source_directory do\n `tar -cJf #{destination_file} *`\n end\n\n destination_file\n end", "def merge(other)\n result = super\n\n result.sources = other.sources + self.sources\n result\n end", "def merge( other )\n clone.merge!( other )\n end", "def merge other\n if empty? then\n @parts = other.parts\n return self\n end\n\n other.parts.each do |other_part|\n self.parts.delete_if do |self_part|\n self_part.file and self_part.file == other_part.file\n end\n\n self.parts << other_part\n end\n\n self\n end", "def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end", "def merge!( other )\n my_keys = @ini.keys\n other_keys =\n case other\n when IniFile; other.instance_variable_get(:@ini).keys\n when Hash; other.keys\n else raise \"cannot merge contents from '#{other.class.name}'\" end\n\n (my_keys & other_keys).each do |key|\n @ini[key].merge!(other[key])\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = other[key]\n end\n\n self\n end", "def merge(other)\n attributes = @attributes.merge(other.attributes)\n excluded = @excluded.dup.concat(other.excluded)\n self.class.new(prefix, attributes, excluded)\n end", "def merge(other)\n other.each { |entry| self << entry }\n self\n end", "def wonkofile_merge(old, new)\n res = old.merge new\n # changing versions is not allowed by adding another version index (we might end up with a version in the index that\n # we don't have an actual version file for)\n res['versions'] = old['versions']\n res\nend", "def create\r\n @archive = Archive.new(params[:archive])\r\n #Obtenemos el ip y el id del usuario de la session\r\n userid = session[:user_id]\r\n userip = request.remote_ip\r\n #Revisamos que el usuario pueda subir el archivo para esta tarea\r\n\r\n #Agregamos el resto de las cosas manualmente\r\n @archive.ip = userip\r\n #Obtenemos la versión actual: si obtenemos un archivo anterior, obtenemos la versión, sino, version 1\r\n homeworkuser = HomeworkUser.find_by_homework_id_and_user_id(params[:homework_id], userid)\r\n if(homeworkuser.archives.nil?)\r\n #Get versión\r\n @archive.version = homeworkuser.archives.last.version+1\r\n else\r\n @archive.version = 1\r\n end\r\n @archive.homework_user_id = homeworkuser.id\r\n respond_to do |format|\r\n if @archive.save\r\n format.html { redirect_to @archive, notice: 'El archivo fue subido exitosamente.' }\r\n format.json { render json: @archive, status: :created, location: @archive }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @archive.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def merge(other)\n append(*other)\n end", "def merge!(src)\n raise ArgumentError.new('Mismatched object') \\\n unless src.objs == @objs\n @deps.push(src.deps).uniq!\n @rules.push(src.rules).flatten!\n @dirs_to_create.push(src.dirs_to_create).flatten!.uniq!\n src.files_to_copy.each do |k,v|\n @files_to_copy[k] ||= []\n @files_to_copy[k].concat(v).uniq!\n end\n end", "def merge(other)\n self.class.new.tap do |result|\n result.merge!(self)\n result.merge!(other)\n end\n end", "def archive(timestamp,cam_home=CAM_HOME)\n folder = File.join(cam_home,'archive',timestamp.strftime('%Y'),timestamp.strftime('%m'),timestamp.strftime('%d'))\n FileUtils::mkdir_p(folder)\n fname = WebcamImage.half_filename(timestamp)\n dest = File.join(folder,fname)\n FileUtils::cp(File.join(cam_home,'halfsize.jpg'),dest)\n link_name = next_link_name(folder,\"half\")\n FileUtils::symlink(dest,File.join(folder,link_name))\n WebcamImage.create! timestamp: timestamp, fname: fname, sequence_fname: link_name, size: WEBCAM_THUMB\n fname = WebcamImage.full_filename(timestamp)\n dest = File.join(folder,fname)\n FileUtils::cp(File.join(cam_home,'fullsize.jpg'),dest)\n link_name = next_link_name(folder,\"full\")\n FileUtils::symlink(dest,File.join(folder,link_name))\n WebcamImage.create! timestamp: timestamp, fname: fname, sequence_fname: link_name, size: WEBCAM_FULL\nend", "def create data, options = {}\n\n data = convert_to_io(data)\n\n hash, tree_hash = compute_checksums(data)\n\n upload_options = {}\n upload_options[:vault_name] = vault.name\n upload_options[:account_id] = account_id\n upload_options[:body] = data\n upload_options[:checksum] = tree_hash\n upload_options[:content_sha256] = hash\n upload_options[:archive_description] = options[:description] if\n options[:description]\n\n resp = client.upload_archive(upload_options)\n\n self[resp[:archive_id]]\n\n end", "def merge( other )\n self.dup.merge!(other)\n end", "def zip\n end", "def zip\n end", "def archive\n @archive ||= RestClient.get info['link'] + '/zip'\n end", "def merge(other)\n dup << other\n end", "def merge( other )\n\t\t\tself.dup.merge!( other )\n\t\tend", "def merge(...)\n self.clone.merge!(...)\n end", "def make_tarball(destination, conf,curDir)\n\tDir.chdir(curDir)\n\n gzip = Zlib::GzipWriter.new(File.open(destination, 'wb'))\n tar = Minitar::Output.new(gzip)\n\t conf[:zipFiles].each { |f|\tMinitar.pack_file(f, tar) }\n tar.close\n\n conf[:backupSize]=File.size(destination) #remember archive size\nend", "def prepare_archive\n raise NotImplementedError\n end", "def archive(name, &block)\n @archives << Backup::Archive.new(name, &block)\n end", "def archive\n if @archive.nil?\n @archive = StateModule::Archive::new(self.data[:archive])\n end\n \n return @archive\n end", "def merge!(other)\n @products+=other.products\n @products=@products.uniq{|p| p.ean}\n init_vault\n self\n end", "def concatinate(f1, f2)\n\t\tDir.foreach(\"#{f1}\") do |x0|\n\t\t\tnext if x0 == '.' or x0 == '..' or x0.start_with?('.')\n\t\t\tDir.foreach(\"#{f2}\") do |x1|\n\t\t\t\tnext if x1 == '.' or x1 == '..' or x1.start_with?('.')\n\t\t\t\t\n\t\t\t\t# concatenate x and y \t\t\n \t\t\t\tsystem(\"cat #{f1}/#{x0} #{f2}/#{x1} > t1/#{x0}#{x1}\")\n\t\t\t\t# compress concatenated files\n \t\t\t\tsystem(\"7za a -t7z t2/#{x0}#{x1}.7z t1/#{x0}#{x1}\")\n \t \t\t#system(\"7za a -t7z -mx9 -mmt2 -ms4g -m0=lzma:d128m:fb256 t2/#{x0}#{x1}.7z t1/#{x0}#{x1}kd\")\n \t \t\t\n \t \tend \n \t end\t\t\n\tend", "def archive\n \tself.archived = true\n \tself.save\n \tend", "def create_zipped_moab_versions!\n storage_location = moab_replication_storage_location\n return nil unless storage_location\n\n params = (1..current_version).map do |v|\n ZipEndpoint.which_need_archive_copy(druid, v).map { |zep| { version: v, zip_endpoint: zep } }\n end.flatten.compact.uniq\n\n zipped_moab_versions.create!(params).tap do |zmvs|\n zmvs.pluck(:version).uniq.each { |version| Replication::ZipmakerJob.perform_later(druid, version, storage_location) }\n end\n end", "def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n $el.append_to_file timestamp, nil, filename\n $el.append_to_file content, nil, filename\n end", "def merge(*sources); end", "def initialize_copy(other)\n @jar = Marshal.load(Marshal.dump(other.instance_variable_get(:@jar)))\n end", "def merge(other_hash); end", "def merge_into(r)\n if !self.metadata[:add].nil?\n if !r.metadata[:add].nil?\n r.metadata[:add] |= self.metadata[:add]\n else\n r.metadata[:add] = self.metadata[:add]\n end\n end\n\n if !self.metadata[:remove].nil?\n if !r.metadata[:remove].nil?\n r.metadata[:remove] |= self.metadata[:remove]\n else\n r.metadata[:remove] = self.metadata[:remove]\n end\n end\n\n if !r.metadata[:todos].nil?\n r.metadata[:todos] |= r.metadata[:add] - r.metadata[:remove]\n else\n r.metadata[:todos] = r.metadata[:add] - r.metadata[:remove]\n end\n\n if !r.metadata[:tags].nil?\n r.metadata[:tags] |= self.metadata[:tags] if !self.metadata[:tags].nil?\n else\n r.metadata[:tags] = self.metadata[:tags]\n end\n\n if !self.metadata[:tags]\n self.metadata[:tags].each do |tag|\n r.add_tags(tag)\n end\n end\n\n r.sector_tag_list |= self.sector_tag_list\n r.type_tag_list |= self.type_tag_list\n r.input_method_list |= self.input_method_list\n r.PFO_statu_list |= self.PFO_statu_list\n r.organizer_list |= self.organizer_list\n\n r.email << (\", \" + self.email) if r.email.blank? && !self.email.blank?\n r.phone = self.phone if r.phone.blank? && !self.phone.blank?\n r.organization = self.organization if r.organization.blank? && !self.organization.blank?\n r.position = self.position if r.position.blank? && !self.position.blank?\n r.address = self.address if r.address.blank? && !self.address.blank?\n\n r.street_address = self.street_address if r.street_address.nil? && !self.street_address.nil?\n r.user = self.user if r.user.nil? && !self.user.nil?\n\n if !self.notes.nil? && !self.notes.empty?\n if r.notes.nil?\n r.notes = self.notes\n else\n new_notes = r.notes << \", \" << self.notes\n r.notes = nil\n r.save\n r.notes = new_notes\n end\n end\n\n r.manually_added ||= self.manually_added\n r.save\n end", "def archive\n PastStanding.create!({:standing_id => self.id, :channel_id => self.channel_id, :rank => self.rank,\n :share => self.share, :count0 => self.count0, :count1 => self.count1, :tallied_at => self.tallied_at})\n end", "def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n append_to_file timestamp, nil, filename\n append_to_file content, nil, filename\n end", "def concat(another)\n case another\n when Array, ExternalArchive\n self[length, another.length] = another\n else \n raise TypeError.new(\"can't convert #{another.class} into ExternalArchive or Array\")\n end\n self\n end", "def archive(branch_or_tag = nil)\n working_dir do\n git 'archive', branch_or_tag || 'HEAD', :binmode => true\n end\n end", "def create\n comment_file = tmp_comment_file!\n tmp_zipfile = tmp_zipfile!\n\n derivative_files = []\n\n Zip::File.open(tmp_zipfile.path, Zip::File::CREATE) do |zipfile|\n # Add attribution as file and zip comment text\n zipfile.comment = comment_text\n zipfile.add(\"about.txt\", comment_file)\n\n members_to_include.each_with_index do |member, index|\n filename = \"#{format '%03d', index+1}-#{DownloadFilenameHelper.filename_base_from_parent(member)}.jpg\"\n\n uploaded_file = file_to_include(member.leaf_representative)\n\n # While it would be nice to stream directly from remote storage into the zip, we couldn't\n # get this to work with the combo of ruby-zip and shrine api's without downloading it\n # to local disk first. There may be a way we haven't figured out. May be able\n # to pass derivative.file.open to it instead for slightly better perf\n # once https://github.com/janko/down/issues/26\n file_obj = uploaded_file.download\n derivative_files << file_obj\n\n\n # We want to add to zip as \"STORED\", not \"DEFLATE\", since our JPGs\n # won't compress under DEFLATE anyway, save the CPU. Ruby zip does not\n # give us a GREAT api to do that, but it gives us a way.\n #\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/file.rb#L271\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/entry.rb#L53\n entry = ::Zip::Entry.new(zipfile.name, filename, nil, nil, nil, nil, ::Zip::Entry::STORED)\n zipfile.add(entry, file_obj)\n\n # We don't really need to update on every page, the front-end is only polling every two seconds anyway\n if callback && (index % 3 == 0 || index >= members_to_include.count - 1)\n callback.call(progress_total: members_to_include.count, progress_i: index + 1)\n end\n end\n end\n\n # tell the Tempfile to (re)open so it has a file handle open that can see what ruby-zip wrote\n tmp_zipfile.open\n\n return tmp_zipfile\n ensure\n (derivative_files || []).each do |tmp_file|\n tmp_file.close\n tmp_file.unlink\n end\n\n if comment_file\n comment_file.close\n comment_file.unlink\n end\n end", "def merge_from(other)\n @title = other.title unless other.title.to_s.empty?\n @descriptions[:default] = other.descriptions[:default] unless other.descriptions[:default].to_s.empty?\n @impact = other.impact unless other.impact.nil?\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n tag ? tag.value = ot.value : @tags.push(ot)\n end\n self\n end", "def create_zip\n require 'zip'\n zip_files = [self.ground_truth, self.image_sequence, self.config_file]\n if self.acceptable_segmentation_region.present?\n zip_files.push(self.acceptable_segmentation_region)\n end\n zip_filename = Rails.root.join(dir_path, \"#{self.name}.zip\")\n Zip::File.open(zip_filename, Zip::File::CREATE) do |zipfile|\n zip_files.each do |file|\n zipfile.add(file, \"#{dir_path}/#{file}\")\n end\n end\n end", "def archive(name, &block)\n @archives << Archive.new(self, name, &block)\n end", "def merge(*args)\n options = Hash === args.last ? args.pop : {}\n files = to_artifacts(args)\n rake_check_options options, :path\n raise ArgumentError, \"Expected at least one file to merge\" if files.empty?\n path = options[:path] || @path\n expanders = files.collect do |file|\n @sources << proc { file.to_s }\n expander = ZipExpander.new(file)\n @actions << proc do |file_map, transform_map|\n file.invoke() if file.is_a?(Rake::Task)\n expander.expand(file_map, transform_map, path)\n end\n expander\n end\n Merge.new(expanders)\n end", "def merge(other)\n dup.merge!(other)\n end", "def duplicate merge_options = {}\n # start to clone\n duplicated_obj = self.clone :except => [:zip_file], :include => [:template_partials, :mail_template_files]\n duplicated_obj.zip_file = File.open(self.zip_file.path) if self.zip_file.path # it will make a copy version of zipfile\n duplicated_obj.attributes = merge_options if merge_options.is_a? Hash # merge custom options\n # without saving can't not create files. so save it first.\n duplicated_obj.save\n\n ### below code is used to clone mail_template_files and replace the new url for cloned template body.\n # pair the mail_template_files and insert into substitution_array.\n substitution_pair_array = []\n self.mail_template_files.each_with_index do |origin_file, index|\n substitution_pair_array << [origin_file, duplicated_obj.mail_template_files[index]]\n end\n\n # replace image or file url with new url.\n original_body = self.body\n\n substitution_pair_array.each do |origin_file, new_file|\n original_body = MailEngine::HtmlDocumentAssetsReplacer.replace_resource_in_html(\n original_body,\n origin_file.file.url,\n new_file.file.url,\n :url\n )\n end\n\n # write back the new body with cloned resource urls.\n duplicated_obj.update_attributes :body => original_body\n duplicated_obj\n end", "def merge!(with); end", "def merge(hash); end", "def merge(hash); end", "def merge(hash); end", "def merge\n @mergeit.merge_data(@input_files)\n end", "def merge\n a_hash = without_empty_values @a.to_h\n b_hash = without_empty_values @b.to_h\n\n @a.class.new a_hash.merge b_hash\n end", "def merge!( other )\n\t\t\tcase other\n\t\t\twhen Hash\n\t\t\t\t@hash = self.to_h.merge( other,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen ConfigStruct\n\t\t\t\t@hash = self.to_h.merge( other.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen Arrow::Config\n\t\t\t\t@hash = self.to_h.merge( other.struct.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\telse\n\t\t\t\traise TypeError,\n\t\t\t\t\t\"Don't know how to merge with a %p\" % other.class\n\t\t\tend\n\n\t\t\t# :TODO: Actually check to see if anything has changed?\n\t\t\t@dirty = true\n\n\t\t\treturn self\n\t\tend", "def merge(other)\n self.class[Utils.merge(to_h, other)]\n end", "def merge!(other)\n raise NotImplementedError.new(\"Method 'merge!' not implemented by '#{self.class.name}'\")\n end", "def zip_archive_zip_create(input_file1, opts = {})\n data, _status_code, _headers = zip_archive_zip_create_with_http_info(input_file1, opts)\n data\n end", "def merge!(other)\n return self if other.nil?\n\n my_keys = @ini.keys\n other_keys = case other\n when IniFile\n other.instance_variable_get(:@ini).keys\n when Hash\n other.keys\n else\n raise Error, \"cannot merge contents from '#{other.class.name}'\"\n end\n\n (my_keys & other_keys).each do |key|\n case other[key]\n when Hash\n @ini[key].merge!(other[key])\n when nil\n nil\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = case other[key]\n when Hash\n other[key].dup\n when nil\n {}\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n self\n end", "def archive\n self.archived_at = Time.current\n end", "def restore_archive\n end", "def archive_kit(whole)\n destination_dir = File.join(@project.full_path, \"output\", \"#{@project.name}-kit\")\n FileUtils.mkdir_p(destination_dir)\n file_prefix = \"#{@project.name}-kit\"\n file_suffix = \".tar.xz\"\n\n @project.take_snapshot \"Kit archival started\"\n\n destination_file = (\n if whole\n remove_stale_incremental(destination_dir, file_prefix, file_suffix)\n archive_single(\"kit\", File.join(destination_dir, file_prefix + file_suffix))\n else\n log.debug \"doing incremental archive\"\n archive_incremental(\"kit\", destination_dir, file_prefix, file_suffix, :archive_kit)\n end\n )\n\n @project.take_snapshot \"Kit archive generated\", :archive_kit\n\n destination_file\n end", "def create_archive(opts = {})\n archive = normalize_archive_name( find_option( opts, 'name' ) || archive_name )\n app_dir = find_option( opts, 'app_dir' ) || Dir.pwd\n dest_dir = find_option( opts, 'dest_dir' ) || Dir.pwd\n excludes = find_option( opts, 'exclude' ) || \"\"\n should_precompile_assets = find_option( opts, 'precompile_assets' ) == true\n should_package_gems = find_option( opts, 'package_gems' ) == true\n package_without = find_option( opts, 'package_without' ) || Array.new\n\n if should_precompile_assets\n precompile_assets( app_dir )\n raise 'Error precompiling assets' unless $? == 0\n end\n\n archive_path = File.join( dest_dir, archive )\n archive_proc = lambda { create_knob_archive( app_dir, archive_path, excludes ) }\n\n if should_package_gems\n package_gems( app_dir, package_without ) {\n raise 'Error packaging gems' unless $? == 0\n archive_proc.call\n }\n else\n archive_proc.call\n end\n\n archive_path\n end", "def merge!(other)\n update_attributes items: items + other.items\n other.destroy! and self\n end", "def merge_data!(other, source: \"YAML front matter\")\n merge_categories!(other)\n Utils.deep_merge_hashes!(data, other)\n merge_date!(source)\n data\n end", "def archive!\n self.update_attribute(:archived, true)\n end", "def archive!\n self.update_attribute(:archived, true)\n end", "def archive!\n self.update_attribute(:archived, true)\n end", "def copy_from_archive(game)\n return false unless game.is_archived\n\n new_game = game.dup\n new_game.number *= 10000\n new_game.name += \" (копия)\"\n new_game.is_active = false\n new_game.is_archived = false\n new_game.save\n # Copy game config\n new_game.config = game.config.dup\n\n game.transaction do\n new_game.config.save\n\n # Zones with ALL stuff\n game.archive_zones.each do |archive_zone|\n copy_zone(archive_zone, new_game)\n end\n end\n\n new_game\n end", "def merge(other)\n dup.merge!(other)\n end", "def merge!(other)\n @hash.merge!(other.hash)\n end", "def archive(treeish, file = nil, opts = {})\n self.object(treeish).archive(file, opts)\n end", "def merge(other)\n @scheme = other.scheme unless other.scheme.nil?\n @workspace = other.workspace unless other.workspace.nil?\n @target = other.target unless other.target.nil?\n @suffix = other.suffix unless other.suffix.nil?\n @reporter = other.reporter unless other.reporter.nil?\n @xctool_path = other.xctool_path unless other.xctool_path.nil?\n @project = other.project unless other.project.nil?\n \n return self\n end", "def merge!(other)\n o = dup\n other.each do |k,v|\n o.store!(k,v)\n end\n o\n end", "def sync_archive_resource(resource, version)\n fetch_resource(resource, version) do |archive|\n dest_dir = %W(#{@datadir} #{resource} #{version}).join('/')\n log.debug \"exploding fetched archive #{archive} into data dir: #{dest_dir}\"\n # process the tar.gz\n Gem::Package::TarReader.new(Zlib::GzipReader.open(archive)) do |targz|\n dest = nil\n targz.each do |entry|\n dest = File.join dest_dir, entry.full_name\n # check if any old data exists, could happen if same resource name reused with different format\n if File.directory? dest\n log.debug \"removing existing directory (#{dest} before extracting archive there\"\n FileUtils.rm_rf dest\n elsif File.file? dest.chomp('/')\n log.debug \"removing existing file (#{dest.chomp}) before extracting archive there\"\n File.delete dest.chomp('/')\n end\n # extract\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n # ensure extraction directory exists\n d_dir = File.dirname(dest)\n FileUtils.mkdir_p d_dir unless File.exist? d_dir\n\n File.open dest, 'wb' do |f|\n f.print entry.read\n end\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n dest = nil\n end\n end\n end\n end", "def merge(other)\n self.dup.tap do |v|\n v.merge!(other)\n end\n end", "def build_archive # @location == LOCATION(group, user, mtime, experiment_id)\n restore_dir = Dir.pwd\n @mount_dir ||= ::ArchiveRoot\n FileUtils.mkdir_p(File.join(@mount_dir, @location))\n Dir.chdir(File.join(@mount_dir, @location))\n # cp the config file from the higher level down\n @@build_directories.each do |dir|\n FileUtils.mkdir dir unless Dir.exist?(dir)\n end\n Dir.chdir(restore_dir)\n # Find a config file and move it down to this directory... right?\n end", "def bundle!(export_dir= Rails.configuration.gtdinbox_export_dir)\n @bundle_filename = \"#{export_dir}/#{@bundle_id}-translation-export.zip\"\n\n\n Zip::ZipFile.open(@bundle_filename, Zip::ZipFile::CREATE) do |zipfile|\n pp @dir_names\n @dir_names.each {|dirname|zipfile.mkdir(dirname)}\n @dir_files.each do |dir_file|\n dirname, file = dir_file\n zip_filepath = File.basename(file.path).gsub(\"#{dirname}-#{@bundle_id}-\",'')\n zipfile.add([dirname, zip_filepath].join('/'), file.path)\n end\n end\n\n File.chmod(0644, @bundle_filename)\n clean_up\n\n @bundle_filename\n end", "def merge!(other)\n raise Exception::OptionShouldBeRecursive.new(other) unless Utils.recursive?(other)\n\n if other.is_a?(self.class)\n structures.concat(other.structures)\n else\n structures << other\n end\n\n dirty!\n end", "def archive(branch_or_tag = nil)\n git 'archive', branch_or_tag || 'HEAD', binmode: true\n end", "def archive\n perform_action(:post, 'archive')\n end" ]
[ "0.7187005", "0.61873007", "0.6131283", "0.6020542", "0.59257907", "0.59120613", "0.5880315", "0.5879201", "0.5868103", "0.5865944", "0.5838", "0.57779586", "0.57763475", "0.577431", "0.5706385", "0.56874985", "0.5685824", "0.56599903", "0.5657604", "0.56480783", "0.5635691", "0.56303924", "0.5623839", "0.5604704", "0.56028706", "0.55871016", "0.55771583", "0.55674255", "0.55532753", "0.55513316", "0.5532401", "0.55297095", "0.551657", "0.55161023", "0.55013025", "0.54944575", "0.5469449", "0.5468186", "0.54589665", "0.5456508", "0.5439636", "0.5397977", "0.53975475", "0.5383446", "0.53794473", "0.5378942", "0.53748775", "0.5373997", "0.5372665", "0.53722566", "0.53663445", "0.53466505", "0.53437686", "0.5340524", "0.5339033", "0.5338459", "0.53235346", "0.531753", "0.52984583", "0.5296521", "0.5296107", "0.52903", "0.52798146", "0.5277861", "0.5276622", "0.5262171", "0.5256047", "0.52485746", "0.5247661", "0.5247661", "0.5247661", "0.5236801", "0.523551", "0.52282906", "0.5220713", "0.52185374", "0.5216883", "0.5216515", "0.5215295", "0.52085197", "0.52009076", "0.5200181", "0.519838", "0.5193756", "0.51897204", "0.51897204", "0.51897204", "0.5178426", "0.517496", "0.51749265", "0.51740056", "0.51594555", "0.51584953", "0.5145647", "0.5143496", "0.513825", "0.51353496", "0.5131816", "0.512933", "0.512707" ]
0.7257923
0
destructively merge this with the given archive
def merge!(other) assert_archive other clear_caches merge_data @data, other.as_json, other.uri nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(other)\n assert_archive other\n\n data = deep_clone(@data)\n merge_data data, other.as_json, other.uri\n\n self.class.new data\n end", "def merge!; end", "def merge!(with); end", "def restore_archive\n end", "def archive!\n archive\n save!(validate: false)\n end", "def merge!(other); end", "def merge(other, sibling_compression_counter = nil)\n self.merge_actors(other)\n self.remove_duplicates()\n self.compress_history(sibling_compression_counter)\n end", "def merge(source); end", "def archive!\n self.update_attribute(:archived, true)\n end", "def archive!\n self.update_attribute(:archived, true)\n end", "def archive!\n self.update_attribute(:archived, true)\n end", "def merge(other); end", "def merge; end", "def merge other\n if empty? then\n @parts = other.parts\n return self\n end\n\n other.parts.each do |other_part|\n self.parts.delete_if do |self_part|\n self_part.file and self_part.file == other_part.file\n end\n\n self.parts << other_part\n end\n\n self\n end", "def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end", "def merge(with); end", "def merge!(other)\n other.read_present.each do |k, v|\n write(k, v)\n end\n\n self\n end", "def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n $el.append_to_file timestamp, nil, filename\n $el.append_to_file content, nil, filename\n end", "def unarchive\n unless in_zip?\n zips, gzs = selected_items.partition(&:zip?).tap {|z, others| break [z, *others.partition(&:gz?)]}\n zips.each do |item|\n FileUtils.mkdir_p current_dir.join(item.basename)\n Zip::File.open(item) do |zip|\n zip.each do |entry|\n FileUtils.mkdir_p File.join(item.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(item.basename, entry.to_s)) { true }\n end\n end\n end\n gzs.each do |item|\n Zlib::GzipReader.open(item) do |gz|\n Gem::Package::TarReader.new(gz) do |tar|\n dest_dir = current_dir.join (gz.orig_name || item.basename).sub(/\\.tar$/, '')\n tar.each do |entry|\n dest = nil\n if entry.full_name == '././@LongLink'\n dest = File.join dest_dir, entry.read.strip\n next\n end\n dest ||= File.join dest_dir, entry.full_name\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n FileUtils.mkdir_p dest_dir\n File.open(dest, 'wb') {|f| f.print entry.read}\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n unless Dir.exist? dest_dir\n FileUtils.mkdir_p dest_dir\n File.open(File.join(dest_dir, gz.orig_name || item.basename), 'wb') {|f| f.print gz.read}\n end\n end\n end\n end\n end\n else\n Zip::File.open(current_zip) do |zip|\n zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|\n FileUtils.mkdir_p File.join(current_zip.dir, current_zip.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(current_zip.dir, current_zip.basename, entry.to_s)) { true }\n end\n end\n end\n ls\n end", "def merge_zip merged_build\n debug_msg \"Merging zip for #{merged_build}\"\n \n tmp = temp_dir\n \n title = merged_build.builds.map do |build| \n automation_by_name(build.name).name + \" v#{build.version}\"\n end.join(', ')\n names = merged_build.builds.map do |build| \n automation_by_name(build.name).short_name\n end.join(',')\n options = []\n options << \"-o\" << tmp\n options << '--title' << title\n options << '--names' << names\n merged_build.builds.each do |build|\n options << File.join(@public_dir, build.to_s)\n end\n SDoc::Merge.new.merge(options)\n \n prepare tmp\n \n tmp\n end", "def merge!(hash); end", "def set_unarchive_flag\n self.just_unarchived = true\n end", "def archive(branch_or_tag = nil)\n git 'archive', branch_or_tag || 'HEAD', binmode: true\n end", "def merge!( other )\n my_keys = @ini.keys\n other_keys =\n case other\n when IniFile; other.instance_variable_get(:@ini).keys\n when Hash; other.keys\n else raise \"cannot merge contents from '#{other.class.name}'\" end\n\n (my_keys & other_keys).each do |key|\n @ini[key].merge!(other[key])\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = other[key]\n end\n\n self\n end", "def archive(branch_or_tag = nil)\n working_dir do\n git 'archive', branch_or_tag || 'HEAD', :binmode => true\n end\n end", "def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n append_to_file timestamp, nil, filename\n append_to_file content, nil, filename\n end", "def merge!(other)\n return self if other.nil?\n\n my_keys = @ini.keys\n other_keys = case other\n when IniFile\n other.instance_variable_get(:@ini).keys\n when Hash\n other.keys\n else\n raise Error, \"cannot merge contents from '#{other.class.name}'\"\n end\n\n (my_keys & other_keys).each do |key|\n case other[key]\n when Hash\n @ini[key].merge!(other[key])\n when nil\n nil\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = case other[key]\n when Hash\n other[key].dup\n when nil\n {}\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n self\n end", "def archive\n self.snapshot_action = \"archive\"\n self.discard\n end", "def merge(...)\n self.clone.merge!(...)\n end", "def archive\n self.archived_at = Time.current\n end", "def sync_archive_resource(resource, version)\n fetch_resource(resource, version) do |archive|\n dest_dir = %W(#{@datadir} #{resource} #{version}).join('/')\n log.debug \"exploding fetched archive #{archive} into data dir: #{dest_dir}\"\n # process the tar.gz\n Gem::Package::TarReader.new(Zlib::GzipReader.open(archive)) do |targz|\n dest = nil\n targz.each do |entry|\n dest = File.join dest_dir, entry.full_name\n # check if any old data exists, could happen if same resource name reused with different format\n if File.directory? dest\n log.debug \"removing existing directory (#{dest} before extracting archive there\"\n FileUtils.rm_rf dest\n elsif File.file? dest.chomp('/')\n log.debug \"removing existing file (#{dest.chomp}) before extracting archive there\"\n File.delete dest.chomp('/')\n end\n # extract\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n # ensure extraction directory exists\n d_dir = File.dirname(dest)\n FileUtils.mkdir_p d_dir unless File.exist? d_dir\n\n File.open dest, 'wb' do |f|\n f.print entry.read\n end\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n dest = nil\n end\n end\n end\n end", "def archive\n @repo.archive(sha, nil, :format => 'tgz', :prefix => \"#{safe_name}/\")\n end", "def archive\n \tself.archived = true\n \tself.save\n \tend", "def merge!(source)\n self.class.merge!(source, self)\n end", "def merge!(source)\n self.class.merge!(source, self)\n end", "def set_archive\n @archive = Archive.first\n end", "def merge!(other)\n raise Exception::OptionShouldBeRecursive.new(other) unless Utils.recursive?(other)\n\n if other.is_a?(self.class)\n structures.concat(other.structures)\n else\n structures << other\n end\n\n dirty!\n end", "def archive\n if @archive.nil?\n @archive = StateModule::Archive::new(self.data[:archive])\n end\n \n return @archive\n end", "def archive\n @archive ||= RestClient.get info['link'] + '/zip'\n end", "def merge!(other)\n @hash.merge!(other.hash)\n end", "def merge(hash); end", "def merge(hash); end", "def merge(hash); end", "def merge!(other)\n update!(other.value)\n end", "def merge!(other)\n case other\n when Hash\n data = other\n when FileStore\n data = other.to_h\n end\n data.each do |name, value|\n @data[name.to_s] = value \n end\n end", "def merge( other )\n self.dup.merge!(other)\n end", "def purge_archive\n @repos.cleanup_archive\n end", "def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end", "def merge!(other_hash); end", "def archive_now\n self.update_attributes(:archived => true)\n end", "def merge(*args)\n options = Hash === args.last ? args.pop : {}\n files = to_artifacts(args)\n rake_check_options options, :path\n raise ArgumentError, \"Expected at least one file to merge\" if files.empty?\n path = options[:path] || @path\n expanders = files.collect do |file|\n @sources << proc { file.to_s }\n expander = ZipExpander.new(file)\n @actions << proc do |file_map, transform_map|\n file.invoke() if file.is_a?(Rake::Task)\n expander.expand(file_map, transform_map, path)\n end\n expander\n end\n Merge.new(expanders)\n end", "def merge!(other)\n\t\tALL.each do |key|\n\t\t\tincrement(key, other.get(key))\n\t\tend\n\t\tself\n\tend", "def merge!(other)\n raise NotImplementedError.new(\"Method 'merge!' not implemented by '#{self.class.name}'\")\n end", "def merge!(b)\n b.items.each do |i|\n self.items << i\n self.save!\n end\n AttributesForMerging.each do |k|\n if (self[k].nil? || self[k].empty?) && !(b[k].nil? || b[k].empty?)\n self[k]=b[k]\n end\n end\n self.save!\n b.destroy\n true\n end", "def handle_whole_archive(building_block, res, linker, flag)\n if is_whole_archive(building_block)\n res.push(flag) if flag and !flag.empty?\n end\n end", "def merge(other)\n dup.merge!(other)\n end", "def rh_merge!(data)\n _rh_merge(self, data)\n end", "def merge\n @mergeit.merge_data(@input_files)\n end", "def unarchival_for(object)\n object.archived = false\n end", "def merge!\n duplicate_category.each_with_children {|subcategory| swap_businesses_and_taggings(subcategory) }\n duplicate_category.destroy\n end", "def update_archive\n if crypted_password_was.blank? || salt_was.blank?\n return\n end\n total_archivable = SorceryWand.config.password_archivable_count.to_i\n\n if total_archivable > 0\n new_archived = PasswordArchive.create(\n crypted_password: crypted_password_was,\n salt: salt_was,\n user: self,\n created_at: Time.zone.now\n )\n\n self.password_archives.order('created_at desc').\n offset(total_archivable).\n destroy_all\n else\n ## if total_archivable is 0, no need to create unnecessary record\n self.password_archives.destroy_all\n end\n end", "def merge!\n other_tag = Tag.find_by_name(self.name)\n if other_tag.nil? or other_tag.id == self.id\n return self\n else\n taggings.map(&:clone).each { |t| (t.tag = other_tag) && t.save! }\n self.destroy\n return other_tag\n end\n end", "def archive!\n DocumentArchive.create!(:consumer_id => self.consumer_id, :suggested_standard_document_id => self.suggested_standard_document_id, :rejected_at => Time.now, :suggested_at => self.suggested_at, :source => self.source, :file_content_type => self.file_content_type, :cloud_service_full_path => self.cloud_service_full_path, :original_file_name => self.original_file_name)\n end", "def merge( other )\n\t\t\tself.dup.merge!( other )\n\t\tend", "def perform_additional_merge_operations!(other)\n end", "def unarchive\n perform_action(:post, 'unarchive')\n end", "def merge!(other)\n @products+=other.products\n @products=@products.uniq{|p| p.ean}\n init_vault\n self\n end", "def merge_into(r)\n if !self.metadata[:add].nil?\n if !r.metadata[:add].nil?\n r.metadata[:add] |= self.metadata[:add]\n else\n r.metadata[:add] = self.metadata[:add]\n end\n end\n\n if !self.metadata[:remove].nil?\n if !r.metadata[:remove].nil?\n r.metadata[:remove] |= self.metadata[:remove]\n else\n r.metadata[:remove] = self.metadata[:remove]\n end\n end\n\n if !r.metadata[:todos].nil?\n r.metadata[:todos] |= r.metadata[:add] - r.metadata[:remove]\n else\n r.metadata[:todos] = r.metadata[:add] - r.metadata[:remove]\n end\n\n if !r.metadata[:tags].nil?\n r.metadata[:tags] |= self.metadata[:tags] if !self.metadata[:tags].nil?\n else\n r.metadata[:tags] = self.metadata[:tags]\n end\n\n if !self.metadata[:tags]\n self.metadata[:tags].each do |tag|\n r.add_tags(tag)\n end\n end\n\n r.sector_tag_list |= self.sector_tag_list\n r.type_tag_list |= self.type_tag_list\n r.input_method_list |= self.input_method_list\n r.PFO_statu_list |= self.PFO_statu_list\n r.organizer_list |= self.organizer_list\n\n r.email << (\", \" + self.email) if r.email.blank? && !self.email.blank?\n r.phone = self.phone if r.phone.blank? && !self.phone.blank?\n r.organization = self.organization if r.organization.blank? && !self.organization.blank?\n r.position = self.position if r.position.blank? && !self.position.blank?\n r.address = self.address if r.address.blank? && !self.address.blank?\n\n r.street_address = self.street_address if r.street_address.nil? && !self.street_address.nil?\n r.user = self.user if r.user.nil? && !self.user.nil?\n\n if !self.notes.nil? && !self.notes.empty?\n if r.notes.nil?\n r.notes = self.notes\n else\n new_notes = r.notes << \", \" << self.notes\n r.notes = nil\n r.save\n r.notes = new_notes\n end\n end\n\n r.manually_added ||= self.manually_added\n r.save\n end", "def archival_for(object)\n object.archived = true\n end", "def merge!( other )\n if other.is_a?( UniMap )\n put_all( other )\n else\n other.each do |k,v|\n set( k, v ) unless v.nil?\n end\n end\n self\n end", "def merge( other )\n clone.merge!( other )\n end", "def archive(treeish, file = nil, opts = {})\n self.object(treeish).archive(file, opts)\n end", "def merge!(new_args); end", "def merge(other)\n dup.merge!(other)\n end", "def try_merge!(pin); end", "def merge(other, &block)\n dup.merge!(other, &block)\n end", "def merge!( other )\n\t\t\tcase other\n\t\t\twhen Hash\n\t\t\t\t@hash = self.to_h.merge( other,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen ConfigStruct\n\t\t\t\t@hash = self.to_h.merge( other.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen Arrow::Config\n\t\t\t\t@hash = self.to_h.merge( other.struct.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\telse\n\t\t\t\traise TypeError,\n\t\t\t\t\t\"Don't know how to merge with a %p\" % other.class\n\t\t\tend\n\n\t\t\t# :TODO: Actually check to see if anything has changed?\n\t\t\t@dirty = true\n\n\t\t\treturn self\n\t\tend", "def unpack_zip archive, destination, clobber=nil\n validate archive, destination\n\n ##\n # As it turns out, the Rubyzip library corrupts\n # binary files (like the Flash Player) on OSX and is also\n # horribly slow for large archives (like the ~120MB Flex SDK)\n # on all platforms.\n if is_darwin?\n unpack_zip_on_darwin archive, destination, clobber\n else\n Zip::ZipFile.open archive do |zipfile|\n zipfile.each do |entry|\n next if entry.name =~ /__MACOSX/ or entry.name =~ /\\.DS_Store/\n unpack_zip_entry entry, destination, clobber\n end\n end\n end\n end", "def update!(**args)\n @compression = args[:compression] if args.key?(:compression)\n end", "def process_kaizen_archive(archive)\n\n verbose(\"Processing Kaizen archive: #{archive.path}\")\n\n Zip::File.open(archive.path) do |zip_file|\n manifest = zip_file.glob('Kaizen-master/*.yml').first\n\n if manifest.nil?\n Kaizen::CLI.pout(:error, \"Manifest file 'cli.yml' not found\")\n next\n end\n\n allowed = YAML.load(manifest.get_input_stream.read)\n\n zip_file.each do |f|\n sanitized = f.name.gsub('Kaizen-master', '')\n\n next if sanitized == '/'\n\n path = File.join(@directory, sanitized)\n\n if !allowed.include?(sanitized)\n Kaizen::CLI.pout(:warn, \"Excluded: #{path}\")\n next\n end\n\n if !File.exist?(path)\n zip_file.extract(f, path)\n else\n if @overwrite\n zip_file.extract(f, path) { true }\n else\n Kaizen::CLI.pout(:error, \"File already exists: #{path}\")\n end\n end\n end\n end\n end", "def merge!(other)\n update_attributes items: items + other.items\n other.destroy! and self\n end", "def merge(other)\n result = super\n\n result.sources = other.sources + self.sources\n result\n end", "def merge(other)\n self.dup.tap do |v|\n v.merge!(other)\n end\n end", "def commit\n # TODO\n # Update ./docProps\n # app.xml slides, notes, counts, etc\n # core.xml Times\n entries.each do |path, buffer|\n path = path.to_s\n if @original_files.include? path\n @zip.replace_buffer path, buffer\n else\n @zip.add_buffer path, buffer\n end\n end\n @zip.commit\n end", "def merge(opts); end", "def merge(b)\n return false unless self.same_book?(b)\n self.merge!(b)\n end", "def merge(other)\n other.each { |entry| self << entry }\n self\n end", "def archive(section = Doing.setting('current_section'), options)\n options ||= {}\n count = options[:keep] || 0\n destination = options[:destination] || 'Archive'\n tags = options[:tags] || []\n bool = options[:bool] || :and\n\n section = section[0] if section.is_a?(Array) && section.count == 1\n section = choose_section if section.nil? || section.empty? || section.is_a?(String) && section =~ /choose/i\n archive_all = section =~ /^all$/i # && !(tags.nil? || tags.empty?)\n section = guess_section(section) unless archive_all\n\n @content.add_section(destination, log: true)\n # add_section(Section.new('Archive')) if destination =~ /^archive$/i && !@content.section?('Archive')\n\n destination = guess_section(destination)\n\n if @content.section?(destination) && (@content.section?(section) || archive_all)\n do_archive(section, destination, { count: count, tags: tags, bool: bool, search: options[:search], label: options[:label], before: options[:before], after: options[:after], from: options[:from] })\n write(doing_file)\n else\n raise InvalidArgument, 'Either source or destination does not exist'\n end\n end", "def merge( attributes )\n\t\tself.directory.modify( self, attributes )\n\t\tself.clear_caches\n\n\t\treturn true\n\tend", "def merge_if_exists!\n t = merge_if_exists || self\n t.save!\n end", "def merge(other)\n dup.update(other)\n end", "def merge_with other\n m_next = @metadata.merge_with other.metadata\n files_res = {}\n\n # my files\n @files.each { |f| files_res[f.src] = f }\n\n # overrides\n other.files.each { |f| files_res[f.src] = f }\n\n # result\n f_next = files_res.collect { |k, v| v }\n\n Package.new m_next, f_next\n end", "def merge(*sources); end", "def merge(srcfs)\n @fs.merge!( srcfs.fs )\n @fs = Cleanfs.killdupl(@@loader.source,@fs,srcfs.fs)\n end", "def archive_incremental(source_directory, destination_dir, file_prefix, file_suffix, tag_prefix)\n @project.from_directory do\n latest_tag_count = @project.latest_tag_count(tag_prefix)\n\n if latest_tag_count == 0\n archive_single(source_directory, File.join(destination_dir, file_prefix + file_suffix))\n else\n destination_file = File.join(destination_dir,\n \"#{file_prefix}_#{format(\"%04d\", latest_tag_count)}#{file_suffix}\")\n tag = @project.latest_tag(tag_prefix)\n log.debug \"creating #{destination_file} with files newer than #{tag}\"\n\n log.debug \"files that changed since then: #{@project.git.changed_files_since(tag)}\"\n list = @project.git.changed_files_since(tag).select do |file|\n File.expand_path(file) =~ /^#{File.expand_path(source_directory)}\\//\n end.map do |file|\n Pathname.new(file).relative_path_from Pathname.new(source_directory)\n end\n @project.from_directory source_directory do\n `tar -cJf #{destination_file} #{list.join(\" \")}`\n end\n\n destination_file\n end\n end\n end", "def wonkofile_merge(old, new)\n res = old.merge new\n # changing versions is not allowed by adding another version index (we might end up with a version in the index that\n # we don't have an actual version file for)\n res['versions'] = old['versions']\n res\nend", "def archive!\n self.update(archived: true)\n NotificationMailer.new(self).document_toggle_archive\n end", "def merge(other_hash); end", "def union(b)\n @pages.update b.pages\n self\n end", "def move_to_bottom_on_unarchive\n if self.just_unarchived\n self.just_unarchived = false\n self.move_to_bottom if self.respond_to?(:move_to_bottom)\n end\n return true\n end" ]
[ "0.66228884", "0.62758654", "0.6235372", "0.62330544", "0.6205354", "0.62046945", "0.6178792", "0.6118874", "0.60017157", "0.60017157", "0.60017157", "0.59287244", "0.5926497", "0.5888809", "0.5877875", "0.5868271", "0.58376217", "0.5812669", "0.58084846", "0.5777846", "0.57665724", "0.57324725", "0.5720049", "0.57123375", "0.57097906", "0.57057613", "0.5687374", "0.56760156", "0.56728506", "0.56430584", "0.56280226", "0.5622248", "0.5617694", "0.55906796", "0.55906796", "0.55742097", "0.5536444", "0.5526002", "0.55018854", "0.54994744", "0.54806346", "0.54806346", "0.54806346", "0.5473992", "0.54712754", "0.54695666", "0.5458986", "0.5453562", "0.5452694", "0.5447707", "0.5444851", "0.5442984", "0.54266226", "0.54223055", "0.54091096", "0.5395331", "0.53845286", "0.5382453", "0.5373695", "0.5354595", "0.5346746", "0.5343781", "0.5338522", "0.5330108", "0.5323247", "0.531295", "0.5294039", "0.5293056", "0.52863157", "0.52842224", "0.5270957", "0.5266628", "0.5257665", "0.5252527", "0.5245946", "0.52454925", "0.5234214", "0.5230928", "0.52308303", "0.52254194", "0.5224043", "0.52192754", "0.521089", "0.5206137", "0.52008414", "0.5198156", "0.5194526", "0.51936203", "0.51917815", "0.51899433", "0.51855594", "0.5182994", "0.51761603", "0.51626444", "0.5161336", "0.51593804", "0.5158051", "0.5154276", "0.51519006", "0.51493603" ]
0.7215412
0
TODO Code to be reviewed
def get_streams partial_path = "streams/unread_items" if params[:scope] == "brands" || params[:scope] == "companies" partial_path = "streams/brands/unread_items" @brand = Brand.find(params[:brand_id]) brand = @brand if params[:scope] == "companies" brand = @brand.company end get_company_feeds_from_services(brand) @stream_count = brand.streams.not_displayed_for_brands.count #if @no_post_panel.blank? @unread_items = brand.streams.unread_items.count else get_feeds_from_services @stream_count = current_user.streams.not_displayed.count if @no_post_panel.blank? @unread_items = current_user.streams.unread_items.count end if params[:is_in_play_mode] == "true" redirect_to :controller => :streams, :action => :get_stream_from_db else render :update do |page| page.replace_html "socialInboxIco", "Social Inbox (#{@stream_count})" if @stream_count > 0 && params[:stream_type] != 'social_inbox' # page.replace_html "unread_items_count", :partial => partial_path, :locals => {:current_user => current_user} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def operations; end", "def operations; end", "def weber; 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 implementation; end", "def implementation; end", "def suivre; end", "def identify; end", "def formation; end", "def sitemaps; end", "def who_we_are\r\n end", "def processor; end", "def strategy; end", "def custom; end", "def custom; end", "def stderrs; end", "def villian; end", "def verdi; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def handle; end", "def internal; end", "def terpene; end", "def trd; end", "def post_process; end", "def run() end", "def berlioz; end", "def executor; end", "def executor; end", "def executor; end", "def relatorios\n end", "def intensifier; end", "def r; end", "def r; end", "def init; end", "def init; end", "def init; end", "def init; end", "def rossini; end", "def operation; end", "def hd\n \n end", "def zuruecksetzen()\n end", "def retire\n\n end", "def wrapper; end", "def isolated; end", "def isolated; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def eplore\n end", "def run\n end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def initialize\n\t\t\n\tend", "def used?; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end" ]
[ "0.7630427", "0.6686791", "0.65778285", "0.64986455", "0.6235747", "0.6235747", "0.6235747", "0.6235747", "0.6113018", "0.6113018", "0.6104528", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.60800743", "0.6053381", "0.6053381", "0.6048882", "0.60269356", "0.6019327", "0.596342", "0.59298486", "0.58871675", "0.58850163", "0.5879066", "0.5879066", "0.58692724", "0.5842258", "0.5814229", "0.5801925", "0.5801925", "0.579602", "0.57568675", "0.57405645", "0.57199115", "0.57111263", "0.5703036", "0.5700902", "0.5696075", "0.5696075", "0.5696075", "0.5672888", "0.5666849", "0.5666143", "0.5666143", "0.5661959", "0.5661959", "0.5661959", "0.5661959", "0.56477183", "0.56449157", "0.56153816", "0.56118727", "0.5596596", "0.5589042", "0.5587692", "0.5587692", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.5571049", "0.55600244", "0.5554841", "0.55425155", "0.55425155", "0.55425155", "0.55425155", "0.55425155", "0.55425155", "0.55425155", "0.55425155", "0.5533653", "0.5532529", "0.5516567", "0.5516567", "0.5516567", "0.5516567", "0.5516567" ]
0.0
-1
TODO Code to be reviewed
def get_company_feeds_from_services(brand) @messages_hash, errors = UserSession.get_twitter_messages(brand) if brand.has_twitter_service #TODO: Move all the queries to model UserSession.get_flickr_messages(brand) if brand.has_flickr_service UserSession.get_facebook_messages(brand) if brand.has_facebook_service UserSession.get_vimeo_videos(brand) if brand.has_vimeo_service UserSession.get_youtube_videos(brand) if brand.has_youtube_service UserSession.get_tumblr_messages(brand) if brand.has_tumblr_service UserSession.get_delicious_messages(brand) if brand.has_delicious_service UserSession.get_stumbleupon_messages(brand) if brand.has_stumbleupon_service return errors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def operations; end", "def operations; end", "def weber; 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 implementation; end", "def implementation; end", "def suivre; end", "def identify; end", "def formation; end", "def sitemaps; end", "def who_we_are\r\n end", "def processor; end", "def strategy; end", "def custom; end", "def custom; end", "def stderrs; end", "def villian; end", "def verdi; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def handle; end", "def internal; end", "def terpene; end", "def trd; end", "def post_process; end", "def run() end", "def berlioz; end", "def executor; end", "def executor; end", "def executor; end", "def relatorios\n end", "def intensifier; end", "def r; end", "def r; end", "def init; end", "def init; end", "def init; end", "def init; end", "def rossini; end", "def operation; end", "def hd\n \n end", "def zuruecksetzen()\n end", "def retire\n\n end", "def wrapper; end", "def isolated; end", "def isolated; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def eplore\n end", "def run\n end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def initialize\n\t\t\n\tend", "def used?; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end" ]
[ "0.7630302", "0.6685449", "0.65777683", "0.6498087", "0.62351793", "0.62351793", "0.62351793", "0.62351793", "0.61114025", "0.61114025", "0.61041707", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.60799235", "0.6053542", "0.6053542", "0.60480374", "0.6026777", "0.60179883", "0.5962857", "0.59280753", "0.58867264", "0.5885287", "0.58782625", "0.58782625", "0.5868436", "0.58411926", "0.58131903", "0.5800967", "0.5800967", "0.57960826", "0.57571393", "0.5739555", "0.57190794", "0.57105595", "0.57030267", "0.57003325", "0.56961155", "0.56961155", "0.56961155", "0.56718284", "0.566617", "0.5664389", "0.5664389", "0.56630665", "0.56630665", "0.56630665", "0.56630665", "0.56474555", "0.5643304", "0.56142807", "0.5611544", "0.55961984", "0.55898154", "0.5586565", "0.5586565", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.55703443", "0.5558202", "0.5554324", "0.55416113", "0.55416113", "0.55416113", "0.55416113", "0.55416113", "0.55416113", "0.55416113", "0.55416113", "0.55346066", "0.5531258", "0.5515153", "0.5515153", "0.5515153", "0.5515153", "0.5515153" ]
0.0
-1
Metodos Composite Pattern, debe implementarse en la clase Composite
def add(menu_component) raise UnssoportedOperationError, "this operation must be implemented in subclasses" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def composite?; self[:composite]; end", "def composite?; @composite; end", "def composite!; self[:composite] = true; self; end", "def composite(*components)\n [:composite, components, Reader::Position.caller(2)]\n end", "def composite_class\n Command::Composite\n end", "def compose\n raise NotImplementedError.new\n end", "def get_composite()\n return nil\n end", "def compose(other)\n Composite.new(self, other)\n end", "def initialize(composite, examples)\n @composite = composite\n @examples = examples\n end", "def compose(other)\n Composite.new(self, right: other)\n end", "def composite_clone\n if composite? \n attrs = self.attributes_before_type_cast\n self.class.new do |record|\n record.send :instance_variable_set, '@attributes', attrs\n end \n else\n clone\n end \n end", "def test_with_multiple_compositions\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n pipeline.use @append_c\n result = pipeline.process([])\n assert_equal(['a', 'b', 'c'], result)\n end", "def test_with_one_composite\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a\n result = pipeline.process([])\n assert_equal(['a'], result)\n end", "def inject_surrogate composite, name_pattern = @option_id\n super\n end", "def isComposite\n ! ! @submachine\n end", "def upc_a_with_composite_symbology; end", "def construct\n end", "def compose( &block )\n cc = Class.new(Component) do\n define_method( :install, &block)\n end\n @composed += 1\n self.class.const_set( \"Composed#{@composed}\", cc )\n cc.new\n end", "def composite_initialize(*children)\n @children = children\n end", "def initialize(args)\n\t\t\tsuper(args)\n\t\t\t\n\t\t\t@apply_to = args.fetch(:apply_to, [])\n\t\t\t@is_a = args.fetch(:is_a, nil)\n\t\t\t@mixins = args.fetch(:mixins, [])\n\t\t\t@class_uri = args.fetch(:class_uri, nil)\n\t\t\t@defining_slots = args.fetch(:defining_slots, [])\n\t\t\t@slot_usage = args.fetch(:slot_usage, [])\n\t\t\t@slots = args.fetch(:slots, [])\n\t\t\t@subclass_of = args.fetch(:subclass_of, nil)\n\t\t\t@union_of = args.fetch(:union_of, [])\n\n\t\t\t@apply_to = [@apply_to] unless @apply_to.is_a?(Array)\n\t\t\t@mixins = [@mixins] unless @mixins.is_a?(Array)\n\t\t\t@defining_slots = [@defining_slots] unless @defining_slots.is_a?(Array)\n\t\t\t@slot_usage = [@slot_usage] unless @slot_usage.is_a?(Array)\n\t\t\t@slots = [@slots] unless @slots.is_a?(Array)\n\t\t\t@union_of = [@union_of] unless @union_of.is_a?(Array)\n\t\t\t\n\t\t\t@apply_to = nil unless @apply_to.is_a?(Biolinkml::ClassDefinition)\n\t\t\t@is_a = nil unless @is_a.is_a?(Biolinkml::Definition)\n\t\t\t\n\t\t\t@apply_to.each do |a|\n\t\t\t\t@apply_to.delete(a) unless a.is_a?(Biolinkml::ClassDefinition)\n\t\t\tend\n\t\t\t@mixins.each do |a|\n\t\t\t\t@mixins.delete(a) unless a.is_a?(Biolinkml::ClassDefinition)\n\t\t\tend\n\t\t\t@defining_slots.each do |a|\n\t\t\t\t@defining_slots.delete(a) unless a.is_a?(Biolinkml::SlotDefinition)\n\t\t\tend\n\t\t\t@slot_usage.each do |a|\n\t\t\t\t@slot_usage.delete(a) unless a.is_a?(Biolinkml::SlotDefinition)\n\t\t\tend\n\t\t\t@slots.each do |a|\n\t\t\t\t@slots.delete(a) unless a.is_a?(Biolinkml::SlotDefinition)\n\t\t\tend\n\t\t\t@union_of.each do |a|\n\t\t\t\t@union_of.delete(a) unless a.is_a?(Biolinkml::ClassDefinition)\n\t\t\tend\n\t\t\t\n\t\t \t\t \n\t\tend", "def component c, klass = ''\n name = c.name\n title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : ''))\n desc = ''\n type = ''\n\n case c\n when MM::Indicator\n ft = c.role.fact_type\n desc = div(div(expand_reading(ft.preferred_reading, false), 'glossary-reading'), 'tt-desc')\n type = div(div('boolean', 'term'), 'tt-type')\n\n when MM::Discriminator,\n MM::Injection,\n MM::ComputedValue,\n MM::HashValue,\n MM::SurrogateKey,\n # MM::Scoping,\n MM::ValidFrom # This should be an Injection\n p c\n debugger\n print ''\n # REVISIT\n\n when MM::Absorption\n ft = c.parent_role.fact_type\n preferred_reading = ft.reading_preferably_starting_with_role(c.parent_role)\n desc = div(div(expand_reading(preferred_reading, false), 'glossary-reading'), 'tt-desc')\n if MM::ValueType === c.object_type\n name = c.column_name*''\n title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : ''))\n type = div(div(c.child_role.object_type.name, 'term'), 'tt-type')\n #elsif c.all_member.size == 0\n # title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : ''))\n #else\n title = span(name, 'term'+(c.is_mandatory ? ' mandatory' : ''))\n end\n if MM::TypeInheritance === ft\n title = \"as a \"+title\n elsif c.full_absorption\n title = \"fully absorbing \"+title\n end\n if to = (c.foreign_key && c.foreign_key.composite) or\n (\n composite_mappings = c.object_type.all_mapping.select{|m| m.composite} and\n composite_mappings.size == 1 and # In a binary mapping, there aren't any ForeignKeys\n to = composite_mappings[0].composite\n )\n title = element(title, {href: '#'+composite_anchor(to)}, 'a')\n end\n klass = klass+' tt-list' unless c.parent_role.is_unique\n\n # when MM::ValueField ... Mapping works here\n when MM::Mapping # A mapping that's not an absorption; usually a Composite\n if MM::EntityType === (o = c.object_type)\n if o.fact_type\n objectified_reading = o.fact_type.preferred_reading\n desc = div(\n span('is where ', :keyword) + expand_reading(objectified_reading, false),\n 'tt-desc'\n )\n else\n desc = div(\n span('is identified by ', :keyword) +\n o.preferred_identifier_roles.map{|r| span(r.role_name || r.name, 'term') }*', ',\n 'tt-desc'\n )\n end\n else\n desc = div('', 'tt-desc')\n end\n\n when MM::Indicator\n desc = div(\n expand_reading(c.role.fact_type.preferred_reading, false),\n 'tt-desc'\n )\n else\n # Add other special cases here\n desc = div('', 'tt-desc')\n end\n\n groups = c.exclusive_groups\n non_exclusive_members = c.all_member.select do |m|\n !groups.detect{|sx, (mandatory, members)| members.include?(m)}\n end\n seen = {}\n members = non_exclusive_members.\n sort_by{|m| m.ordinal}.\n map do |member|\n component(member)\n end*'' +\n groups.map do |sx, (mandatory, excl_members)|\n # REVISIT: When a member is in multiple exclusive groups, it's emitted more than once\n # REVISIT: Subtype Indicators are covered under the same exclusive constraint as the subtype.\n div(\n excl_members.map do |m|\n k = klass + (mandatory ? ' tt-one' : ' tt-any')\n if seen[m]\n div(span(m.name, 'term'+(m.is_mandatory ? ' mandatory' : ''))+' (as above)', 'tt-node'+k)+\"\\n\"\n else\n seen[m] = true\n component(m, k)\n end\n end*''\n )\n end*''\n\n div(title + type + desc + members, 'tt-node'+klass)+\"\\n\"\n end", "def upc_e_with_composite_symbology; end", "def composite?\n false\n end", "def composite?\n false\n end", "def child_factories; end", "def initialize\n super()\n Compo::Composites::Parentless.for(self)\n end", "def create_pit name, composite\n mapping = @constellation.Mapping(:new, name: name, object_type: composite.mapping.object_type)\n @constellation.Composite(mapping, composition: @composition, composite_group: 'bdv')\n end", "def component( name, options = {}, &initializer )\n @components ||= {}\n options = options.dup\n if !block_given?\n initializer = lambda{|value, old| value}\n end\n options[:initializer] = initializer\n options.freeze\n @components[name.to_sym] = options\n attr_accessor name\n public name.to_sym\n protected \"#{name.to_s}=\".to_sym\n if options[:delegate]\n if options[:delegate].kind_of? Hash\n options[:delegate].each do | from, to |\n module_eval <<RB\n def #{from.to_s}(*args, &block)\n #{name.to_s}.#{to.to_s}(*args,&block)\n end\nRB\n end\n elsif options[:delegate].respond_to? :each\n options[:delegate].each do | from |\n module_eval <<RB\n def #{from.to_s}(*args, &block)\n #{name.to_s}.#{from.to_s}(*args,&block)\n end\nRB\n end\n end\n \n end\n # TODO: iterater superclass combinations\n if @component_combinations\n cc = @component_combinations\n @component_combinations = []\n cc.each do | rest, block |\n when_combining_components(rest, block)\n end\n end\n end", "def meta_eval &blk; metaclass.instance_eval &blk; end", "def meta_eval &blk; metaclass.instance_eval &blk; end", "def components; end", "def inherited(base); end", "def build(**)\n raise NotImplementedError\n end", "def composite(*args, &block)\n subelements = SegmentBodyDSL.new(&block).elements\n add_element(Builder::Element(*(args + subelements)))\n end", "def coerce(other)\n if Complex.generic?(other)\n return Complex.new!(other), self\n else\n super\n end\n end", "def initialize(*children)\n composite_initialize(*children)\n end", "def meta_def_other cl, name, &blk\n (class << cl; self; end).instance_eval { define_method name, &blk }\n end", "def test_with_multiple_composites\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n result = pipeline.process([])\n assert_equal(['a', 'b'], result)\n end", "def +(list)\n\t\t\t\tComposite.new([self, list])\n\t\t\tend", "def make(*args)\n raise NotImplementedError.new('Must override')\n end", "def client_code2(component1, component2)\n component1.add(component2) if component1.composite?\n\n print \"RESULT: #{component1.operation}\"\nend", "def new\n @composition = Composition.new\n end", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def initialize(*)\n super\n reduce(public, any)\n end", "def build_arel(*)\n arel = super\n arel.only if self.itself_only_value === true\n build_inheritances(arel)\n arel\n end", "def initialize(composite_parent, opts = {}, &blk)\n @container = Swt::Widgets::Composite.new(composite_parent, Swt::SWT::NONE || Swt::SWT::BORDER)\n\n width, height = opts['width'] || DEFAULT_WIDTH, opts['height'] || DEFAULT_HEIGHT\n\n # RowLayout is horizontal by default, wrapping by default\n @layout = Swt::Layout::RowLayout.new\n\n @layout.type = opts['layout_type'] if opts['layout_type']\n\n # set the margins\n set_layout_margins(opts[:margin]) if opts[:margin]\n\n if width && height\n #@border = Swt::Widgets::Composite.new(composite_parent, Swt::SWT::BORDER)\n #debugger\n @container.setSize(width, height)\n end\n\n @container.setLayout(@layout)\n\n instance_eval &blk if block_given?\n\n @container.pack unless width && height\n\n end", "def compose(block)\n block.yield self\n end", "def build(*args)\n # create the container they ask for with these args\n @container = @container_class.new *args\n # tack on the layout they wanted\n @container.layout = layout if layout\n\n # go through all the children, add them on and tack on the callbacks\n @children.each {|child|\n if @contents[child]\n # if this component answers the each call then go through all\n component = @contents[child]\n each_or_one(component) {|c| @container.add(c) }\n\n configure_interactions_for child, component\n end\n }\n\n # yield to the caller so that they can configure more before\n # we make it visible and pack it\n yield @container if block_given?\n\n # even though swing doesn't do this, we do\n @container.pack if @container.respond_to? :pack\n @container.visible = true if @container.respond_to? :visible\n\n # and now they can do whatever they want to the container\n @container\n end", "def clone\n super\n end", "def build(name, *traits_and_overrides, &block); end", "def prerequisites\n\tsuper\n end", "def prerequisites\n\tsuper\n end", "def component_instance(name, strong_config = {})\n composite = self\n name.to_s.split('__').each do |cmp|\n cmp = cmp.to_sym\n\n component_config = composite.components[cmp]\n raise ArgumentError, \"No child component '#{cmp}' defined for component '#{composite.global_id}'\" if component_config.nil?\n\n component_class_name = component_config[:class_name]\n raise ArgumentError, \"No class_name specified for component #{cmp} of #{composite.global_id}\" if component_class_name.nil?\n\n component_class = constantize_class_name(component_class_name)\n raise ArgumentError, \"Unknown constant #{component_class_name}\" if component_class.nil?\n\n instance_config = weak_children_config.merge(component_config).merge(strong_config).merge(:name => cmp)\n\n composite = component_class.new(instance_config, composite) # params: config, parent\n end\n composite\n end", "def compose(interactor)\n Interactors::Sequence.new.compose(self).compose(interactor)\n end", "def mathtex(*)\n super\n end", "def m1\n\t\t\t\t\tsuper * 2 \t\t\t\t\t\t\t\t\t\t\t# second override to #m1 \n\t\t\t\tend", "def metaclass\n class << self\n self\n end \n end", "def build_base_component(type, args, &block)\n build_sub_component :div, type, args, &block\n end", "def components\n\n end", "def % (other)\n if other.kind_of?(Complex)\n Complex(@real % other.real, @image % other.image)\n elsif Complex.generic?(other)\n Complex(@real % other, @image % other)\n else\n x , y = other.coerce(self)\n x % y\n end\n end", "def code_of_conduct; end", "def composite?\n relation.is_a?(Relation::Composite)\n end", "def clone\n super\n end", "def initialize(*rest) end", "def group_builder; end", "def abstract!; end", "def construct_for( world )\n\t\tentity = world.create_blank_entity\n\t\tself.components.each do |component_type, args|\n\t\t\tcomponent = component_type.new( *args )\n\t\t\tworld.add_component_to( entity, component )\n\t\tend\n\n\t\treturn entity\n\tend", "def composite!(output, args={})\n tokens = [\"composite\"]\n tokens << convert_to_arguments(args) if args\n tokens << \" '#{@file}#{\"[#{args[:layer].to_s}]\" if args[:layer]}'\"\n tokens << \" -annotate #{args[:annotate].to_s}\" if args[:annotate]\n tokens = convert_to_command(tokens)\n success = run(tokens)[1]\n success\n end", "def initialize(ss,rest)\n super(ss.name,ss.ammoPower, ss.fuelUnits, ss.shieldPower, ss.weapons, ss.shieldBoosters,ss.hangar,ss.nMedals, ss.pendingDamage)\n @collaborators = Array.new\n for i in (0...rest.size)\n @collaborators.push(rest[i])\n end \n @base=ss\n end", "def child_collection_builder\n IIIFManifest::ManifestServiceLocator::InjectedFactory.new(\n CollectionManifestBuilder,\n builders:\n composite_builder_factory.new(\n record_property_builder,\n see_also_builder,\n license_builder,\n rendering_builder,\n composite_builder: composite_builder\n ),\n top_record_factory: iiif_collection_factory\n )\n end", "def metaclass\n class << self\n self\n end\n end", "def metaclass\n class << self\n self\n end\n end", "def initialize(instance, compendium)\n super(compendium)\n\n @instance = instance\n\n instance.class.properties(true).each do |property|\n if property.single?\n # Single valued properties are set by their name\n define_singleton_method property.name do |value = nil, &block|\n if value.is_a? Symbol\n value = compendium.type_instances[property.type][value] || raise(\"Could not find instance :#{value.to_s} in predefined #{property.type.name} types\")\n end\n\n begin\n instance.send \"#{property.name}=\", value\n rescue RuntimeError => e\n raise RuntimeError, \"Cannot set property '#{property.name}' of Type #{@instance.class.name}: #{e}\", e.backtrace\n end\n end\n else\n # Multi-valued properties are added to by their singular name\n define_singleton_method property.name.singularize do |*property_values, &block|\n existing_list = instance.send \"#{property.name}\"\n\n unless property_values.empty?\n # If there is just one parameter for a multi-valued property setter\n if property_values.length == 1\n # It could be a symbol, which would resolve to a predefined type instance of the same name\n if property_values[0].is_a?(Symbol)\n predefined_value = compendium.type_instances[property.type][property_values[0]]\n\n raise \"Could not find instance :#{property_values[0]} in predefined #{property.type.name} types\" unless predefined_value\n\n existing_list << compendium.type_instances[property.type][property_values[0]]\n # Or better: it could already be an instance of the type - e.g. when using the implemented #method_mssing\n elsif property_values[0].is_a? property.type\n existing_list << property_values[0]\n end\n else\n new_list_item = property.type.new\n\n set_value(property.type, new_list_item, *property_values)\n\n self.class.new(new_list_item, @compendium).instance_exec(&block) unless block.nil?\n\n existing_list << new_list_item\n end\n end\n end\n end\n end\n end", "def base; self; end", "def subcommands() __subcommands__ end", "def common_joinees_with(model)\n rebuild_instances(self.joinees) & rebuild_instances(model.joinees)\n end", "def child_class\n Objekt\n end", "def traits; end", "def pipet_master_mixes(compositions:, microtiter_plate:)\n compositions.each do |composition|\n pipet_master_mix(\n composition: composition,\n microtiter_plate: microtiter_plate\n )\n end\n end", "def create_component(circuit)\n return nil if @component.nil?\n comp = @component.new(circuit) do |comp|\n @accessors.each do |arr|\n getter = arr[0]\n property = arr[2]\n property.set(comp, getter.call)\n end\n end\n\n return comp\n end", "def abstract?; end", "def into_generic()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Component.new(Native.SumOfBestComponent_into_generic(@handle.ptr))\n @handle.ptr = nil\n result\n end", "def multi; end", "def botones_compuestos titulo, type: 'primary', direction: 'left', caret: true\n widget = Widget::BotonesCompuestos.new(titulo, type: type, direction: direction, caret: caret)\n yield widget\n widget\n end", "def botones_compuestos titulo, type: 'primary', direction: 'left', caret: true\n widget = Widget::BotonesCompuestos.new(titulo, type: type, direction: direction, caret: caret)\n yield widget\n widget\n end", "def new\n @name_composite = NameComposite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @name_composite }\n end\n end", "def compose\n @compose ||= begin\n @aggregated_data = transformer.manufacture(\n lighthouse_appointments:,\n locations:,\n organizations:,\n facilities:,\n questionnaires:,\n questionnaire_responses:,\n save_in_progress:\n )\n\n aggregated_data.combine\n end\n end", "def get_child(name, options)\n constant.constants.each do |constant_symbol|\n constant = self.constant.const_get(constant_symbol)\n\n # Check to see if constant is a child class of the public PageObject interface\n next unless constant < get_page_object(options[:interface])\n\n name = constant.name.split('::').last.to_underscore.to_sym\n return create_composite(constant, options[:interface], name)\n end\n\n nil\n end", "def mixins(*scopes); end", "def test_3\n charge1 = Charge.new(:reservation_id => 10,\n\t\t\t :season_id => 3,\n\t\t\t :rate => 10.00,\n\t\t\t :period => 2,\n\t\t\t :start_date => Date.today,\n\t\t\t :end_date => Date.today + 2.days,\n\t\t\t :amount => 20.00,\n\t\t\t :discount => 0.00,\n\t\t\t :charge_units => 1)\n charge2 = Charge.new(:reservation_id => 20,\n\t\t\t :season_id => 2,\n\t\t\t :rate => 20.00,\n\t\t\t :period => 2,\n\t\t\t :start_date => Date.today + 3.days,\n\t\t\t :end_date => Date.today + 4.days,\n\t\t\t :amount => 20.00,\n\t\t\t :discount => 0.00,\n\t\t\t :charge_units => 2)\n charge1.methods.sort\n assert_raise(RuntimeError, 'different_units') { charge1.combine charge2 }\n charge2.charge_units = 1\n assert_raise(RuntimeError, 'different_rate') { charge1.combine charge2 }\n charge2.rate = 10.00\n assert_raise(RuntimeError, 'different_season') { charge1.combine charge2 }\n charge2.season_id = 3\n assert_raise(RuntimeError, 'different_reservation') { charge1.combine charge2 }\n charge2.reservation_id = 10\n assert_raise(RuntimeError, 'not_sequential') { charge1.combine charge2 }\n charge2.start_date = Date.today + 2.days\n assert_nothing_raised() { charge1 += charge2 }\n end", "def collection_manifest_builders\n composite_builder_factory.new(\n record_property_builder,\n child_manifest_builder_factory,\n see_also_builder,\n license_builder,\n thumbnail_builder,\n rendering_builder,\n composite_builder: composite_builder\n )\n end", "def subtype; end", "def define_pseudized_method(m)\n @class.class_eval <<-EOT\n define_method('#{pseudized_method_name(m)}') do\n collection = ancestors[0..-2].inject([]) do |result, cls|\n result |= cls.#{m}\n end & pseudo_model.#{m}\n\n head_of_commons = collection.index(:instance_eval)\n collection[0...head_of_commons]\n end\n EOT\n end", "def initialize(*args)\n \n components = args.last.kind_of?(Hash) ? args.pop : {}\n \n used_keys = Set.new\n \n args.each do | mod |\n if mod.kind_of? Module\n extend mod\n end\n end\n \n if args.first.kind_of? Humanized::Humanizer\n \n humanizer = args.first\n \n modules = (class << humanizer; included_modules ; end ) - self.class.included_modules\n \n modules.each do | mod |\n \n extend mod\n \n end\n \n (class << self ; self ; end).each_component do |name, options|\n if humanizer.respond_to? name\n if components.key? name\n self.send(\"#{name}=\".to_sym, options[:initializer].call(components[name],humanizer.respond_to?(name) ? humanizer.send(name) : nil ))\n else\n self.send(\"#{name}=\".to_sym, humanizer.send(name))\n end\n else\n self.send(\"#{name}=\".to_sym, options[:initializer].call(components[name],nil))\n end\n used_keys << name\n end\n else\n \n (class << self ; self ; end).each_component do |name, options|\n self.send(\"#{name}=\".to_sym, options[:initializer].call(components[name], nil))\n used_keys << name\n end\n \n end\n \n components.each do | k, v |\n warn \"Unused key #{k.inspect} with value #{v.inspect} in Humanizer.initialize\" unless used_keys.include? k\n end\n \n \n end", "def metaadd m\n\t\treturn m\n\tend", "def inherited(child)\n super\n child.attribute_names = self.attribute_names ? self.attribute_names.dup : [:id]\n child.reverse_solr_name_cache = self.reverse_solr_name_cache ? self.reverse_solr_name_cache.dup : {}\n child.attribute_cache = self.attribute_cache ? self.attribute_cache.dup : {}\n child.facets = self.facets ? self.facets.dup : []\n child.solr_calc_attributes = self.solr_calc_attributes.present? ? self.solr_calc_attributes.dup : {}\n # child.derived_af_class\n\n # If there's no class between +LockedLdpObject+ and this child that's\n # already had +visibility+ and +owner+ defined, define them.\n child.class_eval do\n unless attribute_names.include?(:visibility)\n has_attribute :visibility, ::VOCABULARY[:jupiter_core].visibility, solrize_for: [:exact_match, :facet]\n end\n unless attribute_names.include?(:owner)\n has_attribute :owner, ::VOCABULARY[:jupiter_core].owner, solrize_for: [:exact_match]\n end\n unless attribute_names.include?(:record_created_at)\n has_attribute :record_created_at, ::VOCABULARY[:jupiter_core].record_created_at, type: :date,\n solrize_for: [:sort]\n end\n end\n end", "def initialize(*_)\n super\n end", "def metaclass\n class << self;\n self\n end\n end", "def metaclass\n class << self;\n self\n end\n end" ]
[ "0.7033753", "0.68594503", "0.68151736", "0.6432141", "0.6201741", "0.61867356", "0.61589366", "0.6085571", "0.58576995", "0.57957995", "0.5789823", "0.5641363", "0.55706114", "0.5565378", "0.5533577", "0.5495722", "0.54502153", "0.5439057", "0.5426689", "0.5392588", "0.5379464", "0.5340909", "0.5271556", "0.5271556", "0.5205491", "0.5202388", "0.5186655", "0.5182773", "0.5159817", "0.5159817", "0.51518226", "0.5137609", "0.5098688", "0.509455", "0.5049969", "0.504196", "0.50247186", "0.501703", "0.5009796", "0.50046587", "0.49775347", "0.49683565", "0.49652034", "0.49652034", "0.49652034", "0.49561864", "0.49497923", "0.4948724", "0.49319395", "0.4895796", "0.48899028", "0.48800743", "0.48701483", "0.48701483", "0.48698756", "0.4862639", "0.48606247", "0.48500624", "0.4846804", "0.48463503", "0.48384577", "0.48343563", "0.48198506", "0.4818532", "0.48054048", "0.47916013", "0.47911838", "0.47879088", "0.47754416", "0.47743303", "0.47708783", "0.4770421", "0.47606745", "0.47606745", "0.47597545", "0.4748415", "0.4740001", "0.47358918", "0.4734547", "0.4730987", "0.4728801", "0.47219935", "0.4716509", "0.47118175", "0.4710628", "0.47053075", "0.47053075", "0.4704216", "0.47014594", "0.46954492", "0.46941802", "0.46920982", "0.4685687", "0.46850058", "0.46801534", "0.4678429", "0.46783262", "0.46779332", "0.4673211", "0.46700796", "0.46700796" ]
0.0
-1
How would we present a classification in the history summary?
def show_compact(classification) curi = classification.complianceClassification.uri image_description = image_compact(curi) if CLASSIFICATION_IMAGES.key?(curi) image = image_description && "<img src='#{image_description[:src]}' alt='#{image_description[:alt]}'></img>" "#{classification.year} #{image} #{classification.complianceClassification.name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classification\n @line1[07]\n end", "def train\n run_aggregation\n run_syntetics\n run_values_to_ranges\n run_reverse\n\n [name, classifier]\n end", "def analyze_human_history(history)\n move_count = Hash.new(0)\n # Every move object is different, so to make a\n # hash with objects as keys they need to be\n # converted to strings and back\n history.each { |move| move_count[move.to_s] += 1 }\n most_frequent_move = move_count.values.max\n move = move_count.key(most_frequent_move)\n move = string_to_move_obj(move)\n adjust_for_skill(move)\n end", "def word_classification_detail(word)\n\n p \"word_probability\"\n result=self.categories.inject({}) do |h, cat|\n h[cat]=self.word_probability(word, cat); h\n end\n p result\n\n p \"word_weighted_average\"\n result=categories.inject({}) do |h, cat|\n h[cat]=word_weighted_average(word, cat); h\n end\n p result\n\n p \"doc_probability\"\n result=categories.inject({}) do |h, cat|\n h[cat]=doc_probability(word, cat); h\n end\n p result\n\n p \"text_probability\"\n result=categories.inject({}) do |h, cat|\n h[cat]=event_probability(word, cat); h\n end\n p result\n\n end", "def classify(example)\n self.probability(example)[:class]\n end", "def notes_from_training\n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def summary\n \n end", "def classify(commit)\n @classifier.classify(commit)\n end", "def writeup_classification\n classification_label().split(\"-\").first\n end", "def test\n rows = Util.get_rows(:file => 'data/vehicles.csv', :n => 3000, :pre_process => true)\n classes = rows.transpose.last\n rows = rows.transpose[0..-2].transpose\n train(rows.first(2000), classes.first(2000))\n \"#{classes.last} classified as #{classify(rows.last)}\"\n end", "def summary\n end", "def summary\n end", "def label() @positive end", "def anatomy_past_tense; end", "def history_added; end", "def to_s; \"<Veritable::Prediction #{super}>\"; end", "def history\n self.class.history.chronological.of(self)\n end", "def classify\n pos_probs = cond_probs(:pos)\n neg_probs = cond_probs(:neg)\n\n # Label the reviews in each polarity folder\n pos_labels = @features[:pos].map { |f| label(f, pos_probs, neg_probs) }\n neg_labels = @features[:neg].map { |f| label(f, pos_probs, neg_probs) }\n\n { pos_labels: pos_labels, neg_labels: neg_labels }\n end", "def labels; end", "def classify\n Rails.logger.debug \"Classification #{id}.classify\"\n weights_sum = classifiers.map( &:weight ).reduce( 0, :+ )\n Rails.logger.debug \"weights_sum: #{weights_sum}\"\n\n available_sum = classifiers.reduce( 0.0 ) { |sum, c|\n true_weight = weights_sum / c.weight\n Rails.logger.debug \"#{c.name} true_weight: #{true_weight}\"\n\n sum += c.available * true_weight\n }\n\n Rails.logger.debug \"available_sum: #{available_sum}\"\n self.available = available_sum / classifiers.length\n Rails.logger.debug \"available: #{available}\"\n\n if available >= @@available_threshold\n self.status = 'up'\n else\n self.status = 'down'\n end\n end", "def activity_list es\n class_names = es.map(&:class_name).uniq.select {|cn| class_months(es, cn).count >= 4 }\n last_date = last_commit_month(es)\n class_names.map {|cn| [percent_active(es, cn, last_date), cn] }\n .sort_by(&:first)\n .reverse\nend", "def classify(text)\n scores = classification_scores(text)\n if scores.any?\n (scores.sort_by { |a| -a[1] })[0][0]\n else\n ''\n end\n end", "def writeup_classification\n classification_label.split(\"-\").first\n end", "def classification\n return @classification\n end", "def classification\n return @classification\n end", "def summary\n # TODO\n end", "def show\n @test.relations = Relation.joins(:question).where(\"relations.test_id = ?\", @test.id).select(\"relations.id, questions.identifier, questions.description\")\n @quantity = Relation.joins(:question).where(\"relations.test_id = ?\", @test.id).select(\"relations.id, questions.identifier, questions.description\").count(:all)\n questions = Question.where(\"questions.id IN (?)\", Relation.where(\"test_id = ?\", @test.id).select(\"question_id\"))\n classificat = Classification.all\n\n classifications = []\n \n questions.each do |question|\n classif = {}\n value = false\n if classifications === []\n classif['classification'] = question.classification_id\n classif['quantity'] = 1\n classifications.push(classif)\n else\n for i in 0..classifications.length-1\n if classifications[i]['classification'] === question.classification_id\n classifications[i]['quantity'] = classifications[i]['quantity'] + 1 \n value = true\n break\n end\n end\n if value === false\n classif['classification'] = question.classification_id\n classif['quantity'] = 1\n classifications.push(classif) \n end\n end\n end\n\n classificat.each do |classif|\n for i in 0..classifications.length-1\n if classifications[i]['classification'] === classif.id\n classifications[i]['classification'] = classif.description\n break\n end\n end\n end\n @classifications = classifications\n end", "def assess_status(summary)\n birth = summary[:patient].birth_date\n age = summary[:patient].age_years\n imms = summary.keys\n imms.delete(:patient)\n imms.each do |imm|\n summary[imm][:next] = imm + ': none'\n end\n summary[:age] = age\n\n # HIB\n next_dose = nil\n count = summary['hib'][:count]\n since = summary['hib'][:since]\n last = summary['hib'][:last]\n if since.nil?\n age_at_last = nil\n else\n age_at_last = age - (since/365) # This is age in years at the last Hib dose\n end\n case count\n when 0\n next_dose = Date.today if age.between?(6/52, 5)\n\n when 1\n # Interval = 4 weeks if first dose at < 12 months\n next_dose = last + 28 if ( age < 5 && age_at_last < 1 )\n # Interval = 8 weeks (as final dose) if first dose administered at age 12-14 months\n next_dose = last + 56 if ( age < 5 && age_at_last.between?(1, 1.25))\n\n when 2\n # Interval = 4 weeks if current age < 12 months\n next_dose = last + 28 if ( age < 5 && age_at_last < 1 )\n # Interval = 8 weeks current age > 12 months and second dose administered at age < 15 months\n next_dose = last + 56 if ( age.between?(1, 5) && age_at_last < 1.25)\n\n when 3\n next_dose = birth + 455 # 15 months of age\n next_dose = last + 56 if ( age.between?(1.25, 5) && age_at_last < 1 )\n end\n if next_dose\n next_dose = today.to_date if next_dose < today\n date_s = next_dose.to_s\n date_s = 'today' if next_dose == today\n else\n date_s = 'none'\n end\n summary = update_next_dose(summary, 'hib', next_dose)\n\n # Meningococcus\n next_dose = ''\n since = summary['mening'][:since]\n if since.nil? || since > 730 # if no previous immunization or imm > 2 years ago\n next_dose = today\n next_dose = birth + 0.75*365 if age < 0.75 # if less than nine months old, set next dose to when age is 9 months\n else\n next_dose = last + 730\n end\n summary = update_next_dose(summary, 'mening', next_dose)\n\n # Polio\n next_dose = ''\n count = summary['opv'][:count]\n since = summary['opv'][:since]\n last = summary['opv'][:last]\n if since.nil?\n age_at_last = nil\n else\n age_at_last = age - (since/365) # This is age in years at the last Hib dose\n end\n case count\n when 0\n next_dose = birth + 42 # first dose due at 6 weeks\n when 1..2\n next_dose = last + 28\n when 3\n if age_at_last < 4 # \"fourth dose not needed if third given at older than 4 years of age\"\n next_dose = last + 28\n next_dose = birth + (365*4) if (next_dose < birth + 365*4) # fourth dose given at min 4 years old (check Nigeria policy**\n end\n end\n summary = update_next_dose(summary, 'opv', next_dose)\n\n # DPT\n next_dose = ''\n count = summary['dpt'][:count]\n since = summary['dpt'][:since]\n last = summary['dpt'][:last]\n if since.nil?\n age_at_last = nil\n else\n age_at_last = age - (since/365) # This is age in years at the last dose\n end\n case count\n when 0\n next_dose = birth + 42 # first dose due at 6 weeks\n when 1..2\n next_dose = last + 28\n when 3\n next_dose = last + 183 # Six month interval to fourth dose -- is fourth dose given here? When, at 9 mo?\n when 4\n if age_at_last < 4 # \"fourth dose not needed if third given at older than 4 years of age\"\n next_dose = last + 183\n next_dose = birth + (365*4) if (next_dose < birth + 365*4) # fourth dose given at min 4 years old (check Nigeria policy**\n end\n end\n summary = update_next_dose(summary, 'dpt', next_dose)\n\n # After all the immunizations are assessed and next dose dates calculated\n return summary\n end", "def modeler_description\n return 'Reports resilience metric(s) of interest.'\n end", "def ilo_progress_class_details\n result = {}\n return result if students.length < 10\n\n data = student_ilo_progress_stats\n\n return {} if data.nil?\n\n tutorials.each do |tute|\n result[tute.id] = _ilo_progress_summary(data[tute.id])\n # if data[tute.id]\n # result[tute.id][:students] = data[tute.id]\n # else\n # result[tute.id][:students] = []\n # end\n end\n\n result['all'] = _ilo_progress_summary(data.values.reduce(:+))\n\n result\n end", "def activity_class\n if last_updated < 4.months\n 'high'\n elsif last_updated < 12.months\n 'medium'\n else\n 'low'\n end\n end", "def desc() summary; end", "def experience_replay\n @experience_replay_log.sample(100).each do |entry|\n @action_log = entry[:actions]\n @next_q_max_log = entry[:next_q_max]\n @state_log = entry[:state]\n @q_values_log = entry[:q_values]\n index = @action_log.size - 1\n while index >= 0\n inputs = board_to_nn_inputs(@state_log[index])\n outputs = @q_values_log[index]\n # replace the q value of the move made with the discounted observation\n outputs[@action_log[index]] = DISCOUNT * @next_q_max_log[index]\n # do one training step\n @fann.train(inputs, outputs)\n index -= 1\n end\n end\n end", "def history\n @history ||= PublicEarth::Db::History.many.descriptive_changes_by_user(self.id)\n end", "def history; end", "def history; end", "def history; end", "def pred_s\n a_s(@pred)\n end", "def new_classifiers\n CLASSIFIERS.map { |classifier_name| [classifier_name, {}] }.to_h\n end", "def class_timeline\n\t\tif self.state==0\n \treturn \"info\"\n elsif self.state==4\n \t\treturn \"success\"\n \telsif self.state==2\n \treturn \"success\"\n elsif self.state==6\n \treturn \"danger\"\n elsif self.state==5\n \treturn \"danger-circle\"\n elsif self.state >= 10\n return \"info\"\n else\n \treturn \"warning\"\n end\n\tend", "def history\r\n\r\n end", "def print_history\n\t\t@generations.each_with_index do | gen, n |\n\t\t\tmod_print = @modifications[n].to_s\n\t\t\tputs \"gen: \" + n.to_s + \" - \" + gen.word.to_s + \" | mod: \" + mod_print\n\t\tend\n\tend", "def max_history; end", "def max_history; end", "def train_one_classifier(dataset)\n model = LogisticRegressionModelL2.new(0.000)\n lr = 1\n w = Hash.new {|h,k| h[k] = (rand * 0.1) - 0.05}\n sgd = StochasticGradientDescent.new(model, w, lr)\n sgd, iter, losses = train(sgd, model, w, dataset, num_epoch = 18, batch_size = 20)\n df = Daru::DataFrame.new({x: iter, y: losses})\n df.plot(type: :line, x: :x, y: :y) do |plot, diagram|\n plot.x_label \"Batches\"\n plot.y_label \"Cumulative Loss\"\n end.export_html\n return sgd\nend", "def to_l(history)\n return {} if history.nil? || history.empty?\n history[\"items\"].find { |f| f[\"field\"].eql? \"labels\" }\n end", "def past_frequency(history)\n count = 0\n history.each do |past_board|\n count += 1 if compare_board(self, past_board)\n end\n count \n end", "def confidence; end", "def total_cat_count\n @training_count\n end", "def total_cat_count\n @training_count\n end", "def classification=(value)\n @classification = value\n end", "def classification=(value)\n @classification = value\n end", "def classify(text)\n classify_features(features_of(text)).last\n end", "def classification\n classifications = @data[\"spData\"][\"classifications\"]\n if classifications.empty?\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n Classification.new(classifications.first)\n end", "def save_history(instance,args)\n invocation = instance.instance_variable_get(\"@_invocations\").to_a[0]\n classes = invocation[0].to_s\n name = invocation[1].first\n classes.gsub!(/Thor::Sandbox::/,\"\")\n classes.gsub!(/::/,\":\")\n classes.downcase!\n options = [args,instance.options]\n history = Bio::Ngs::Record.new(Bio::Ngs::HISTORY_FILE)\n history.save(classes+\":\"+name,options)\n end", "def exams_statistics\n end", "def predict(tokens)\n\n @data.each do |category, counts|\n \n end\n\n predicted_category\n end", "def past_participle; end", "def classify(text)\n choose classifications(text)\n end", "def predictions\n @predictions ||= Prediction.predict_for(self)\n end", "def history_essay(topic, title, name, date, thesis)\n\tif topic == \"person\"\n\t\tprint \"#{title}. This essay is about a biography of #{name}. He/she was born on #{date}. #{thesis}.\"\n\telsif topic == \"place\"\n\t\tprint \"#{title}. This essay is about a history of #{name}. Independence day in #{name} is annually celebrated on #{date}. #{thesis}.\"\n\telsif topic == \"invention\"\n\t\tprint \"#{title}. This essay is about a history of #{name}. It was invented on #{date}. #{thesis}.\"\n\tend\nend", "def printTrainRecordsSummary count = 1, scale = 20\r\n\t\tdata = @trainTestStruct.trainingData.getDataStructure(true)\r\n\t\tLpr.p \"Print summary for #{@machineClass.name}\"\r\n\t\t(0...count).each{|index|\r\n\t\t\tLpr.s \"Record #{index} regular\"\r\n\t\t\tLpr.graphIt @trainTestStruct.trainingData.getDataStructure(true)[index], scale\r\n\t\t\tLpr.graphIt @trainTestStruct.testSets(index).getDataStructure(true)[index], scale\r\n\t\t}\r\n\tend", "def chart_turbulence events\n chart(['method name','commits','complexity'], turbulence(events))\nend", "def clasifica(mensajeRec)\n classifier = Classifier::Bayes.new 'sells','client','human'\n\n #Train the classifier\n\n Correo.where(:departamento => \"Ventas\").find_each do |v|\n classifier.train_sells v.mensaje\n end\n\n Correo.where(:departamento => \"Recursos humanos\").find_each do |h|\n classifier.train_human h.mensaje\n end\n\n Correo.where(:departamento => \"Atencion a cliente\").find_each do |c|\n classifier.train_client c.mensaje\n end\n\n return classifier.classify mensajeRec\n end", "def followers_history; counter_per_day(:followers); end", "def inference_classification\n return @inference_classification\n end", "def history\n render_success Offer.where(assignment: @assignment).order(\n created_at: :desc\n )\n end", "def recent_status_score\n recent_status[:ok] / recent_status[:count]\n end", "def inherit_classification(parent)\n raise(\"missing parent!\") unless parent\n raise(\"only do this on genera or up!\") if below_genus?\n raise(\"parent has no classification!\") if parent.classification.blank?\n\n str = parent.classification.to_s.sub(/\\s+\\z/, \"\")\n str += \"\\r\\n#{parent.rank}: _#{parent.text_name}_\\r\\n\"\n change_classification(str)\n end", "def successful_review_session\n event_display(\"The T.A.'s hold a GREAT REVIEW SESSION!\")\n group_event_hash_creator({technical_skills: 2})\n end", "def history(id)\n http.get(\"/nfse/#{id}/history\") do |response|\n respond_with_collection(response, Entities::NfseStatusTransition)\n end\n end", "def feed_explanation\n end", "def evaluation_detail\n name\n end", "def analyze\n @categories = Violation.unique_categories\n end", "def classification\n return nil if tracking_is_empty\n\n delivery_status_details_box ||= @tracking_page.css(\".indent table[summary='配達状況詳細']\")\n classification = delivery_status_details_box.css(\"tr:last .w_380\").text.strip\n return classification\n end", "def rank_history\n # ToDo: Change the hard coded report to a Report setting, or client base\n raise 'Hard coded report implementation' unless RAILS_ENV =~ /susbkk/\n end", "def history\n self.class.history.of(self)\n end", "def history\n self.class.history.of(self)\n end", "def to_s\r\n # \"#{@title} has a rank of #{normalized_rank}\"\t\r\n \"#{@title} has a rank of #{@rank}(#{status})\"\t\r\n end", "def display_class_info\n end", "def train\n run_thresholds\n run_values_to_ranges\n run_reverse\n\n @classifiers\n end", "def update_classification\n Notifications::Base.build_classified_notifications\n @pending_notifications = Notifications::Base.filtered_classified_notifications\n end", "def summary\n {}\n end", "def current_train_status\n\t\tService.find_by(name: self.service_name).traffic\n\tend", "def display_entity_counts\n @log.info @tracker.display\n end", "def history(circuit)\n raise NotImplementedError\n end", "def getDecision(output, data_source)\r\n key = data_source.to_sym\r\n\r\n # Last sold check\r\n idx = output[key][:metricsNames].index(\"Last Sold History\")\r\n output[:reason][0] = \"Sold too recently\" if !output[key][:metricsPass][idx]\r\n\r\n # Rurality Checks\r\n rs_idx = output[:Census][:metricsNames].index(\"Rurality Score\")\r\n vol_idx = output[key][:metricsNames].index(\"St. Dev. of Historical Home Price\")\r\n\r\n if output[:region] == \"East\"\r\n output[:reason][1] = \"Too rural\" if (!output[:Census][:metricsPass][rs_idx] || !output[key][:metricsPass][vol_idx]) \r\n end\r\n\r\n if output[:region] == \"West\"\r\n output[:reason][1] = \"Too rural\" if !output[:Census][:metricsPass][rs_idx]\r\n end\r\n\r\n # Typicality\r\n typ_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Typicality\" }\r\n typ_fail_cnt = typ_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n\r\n if data_source == \"Zillow\"\r\n neigh_idx = output[key][:metricsNames].index(\"Neighbors Available\")\r\n sqft_idx = output[key][:metricsNames].index(\"SqFt Typicality - Comps\")\r\n est_idx = output[key][:metricsNames].index(\"Estimate Typicality - Comps\")\r\n\r\n if output[key][:metrics][neigh_idx] >= 4\r\n sqfi_nb_idx = output[key][:metricsNames].index(\"SqFt Typicality - Neighbors\")\r\n est_nb_idx = output[key][:metricsNames].index(\"Estimate Typicality - Neighbors\")\r\n\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 3\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 65.0 || output[key][:metrics][est_idx] > 65.0)\r\n output[:reason][2] = \"Atypical property\" if !output[key][:metricsPass][sqft_idx] && !output[key][:metricsPass][sqfi_nb_idx]\r\n output[:reason][2] = \"Atypical property\" if !output[key][:metricsPass][est_idx] && !output[key][:metricsPass][est_nb_idx]\r\n else\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 2\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 60.0 || output[key][:metrics][est_idx] > 60.0)\r\n end\r\n else\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 2\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 60.0 || output[key][:metrics][est_idx] > 60.0)\r\n end\r\n\r\n # Liquidity (allow one false)\r\n liq_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Liquidity\" }\r\n liq_fail_cnt = liq_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n output[:reason][3] = \"Illiquidity\" if liq_fail_cnt >= 2\r\n\r\n # Investment Guidelines\r\n est_idx = output[key][:metricsNames].index(\"Estimated Value\")\r\n type_idx = output[key][:metricsNames].index(\"Property Use\")\r\n build_idx = output[key][:metricsNames].index(\"Build Date\")\r\n msa_idx = output[key][:metricsNames].index(\"Pre-approval\")\r\n\r\n output[:reason][4] = \"Out of $ Range\" if !output[key][:metricsPass][est_idx]\r\n output[:reason][5] = \"Not Prop Type\" if !output[key][:metricsPass][type_idx]\r\n output[:reason][6] = \"New Construction\" if !output[key][:metricsPass][build_idx]\r\n output[:reason][7] = \"Not in MSAs\" if !output[key][:metricsPass][msa_idx]\r\n\r\n # Volatility (allow one false)\r\n vol_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Volatility\" }\r\n vol_fail_cnt = vol_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n output[:reason][8] = \"Price Vol\" if vol_fail_cnt >= 2\r\n\r\n # Combo Rural (if applicable)\r\n cr_idx = output[:Census][:metricsNames].index(\"Combo Rural\")\r\n output[:reason][9] = \"Combo Rural\" if !output[:Census][:metricsPass][cr_idx]\r\n\r\n # Distance\r\n output[:reason][10] = \"MSA Distance\" if !output[:Google][:metricsPass].any?\r\n\r\n # Approve if not issues\r\n output[:reason][11] = \"Approved\" if output[:reason].compact.size == 0\r\n end", "def future_position_summaries\n []\n end", "def to_s\r\n return \"#{@train}\"\r\n end", "def propagate_classification\n raise(\"Name#propagate_classification only works on genera for now.\") \\\n if rank != \"Genus\"\n\n subtaxa = subtaxa_whose_classification_needs_to_be_changed\n Name.where(id: subtaxa).\n update_all(classification: classification)\n NameDescription.where(name_id: subtaxa).\n update_all(classification: classification)\n Observation.where(name_id: subtaxa).\n update_all(classification: classification)\n end", "def status_for(exam)\n if exam.last_report\n exam.last_report.status\n else\n \"Ordered\"\n end\n end", "def history\n @step = Step.find(params[:id])\n @activities = @step.step_activities.order(\"created_at desc\").all\n end", "def category_scores(event)\n probabilities = {}\n categories.each do |cat|\n probabilities[cat] = event_probability(event, cat)\n end\n probabilities.map { |k, v| [k, v] }\n end", "def classify(hash)\n hash.reduce({}) do |acc, (var, vals)|\n type, data = identity(vals)\n acc[var] = {\n type: type,\n data: data\n }\n acc\n end\n end", "def semantic_information\n -Math::log10(self.semantic_probability)\n end", "def summary\n self.to_s\n end", "def initialize \n\t\t@predictions = []\n\tend" ]
[ "0.59846663", "0.5837875", "0.5659145", "0.5619961", "0.55832857", "0.5577075", "0.5419695", "0.5419695", "0.5419695", "0.5419695", "0.54122114", "0.5368415", "0.53660685", "0.5345161", "0.5336046", "0.5336046", "0.53346", "0.53112805", "0.5295775", "0.5293207", "0.5286591", "0.52864325", "0.5284828", "0.52531654", "0.5242423", "0.52273494", "0.52256185", "0.52232546", "0.52232546", "0.5198063", "0.519057", "0.51436925", "0.5128712", "0.51213384", "0.5103614", "0.5088225", "0.50846124", "0.5053693", "0.50430644", "0.50430644", "0.50430644", "0.50320524", "0.502586", "0.5017782", "0.5017756", "0.50126606", "0.5012069", "0.5012069", "0.50082105", "0.5003347", "0.50018024", "0.4994096", "0.49919245", "0.49919245", "0.4970407", "0.4970407", "0.4960694", "0.4958704", "0.49367234", "0.4931151", "0.4925934", "0.4925269", "0.49240303", "0.49178222", "0.49149558", "0.48975116", "0.48897853", "0.48795432", "0.48650467", "0.48630238", "0.48603845", "0.4858661", "0.48574314", "0.4846971", "0.48422545", "0.48406282", "0.4840484", "0.4840067", "0.48382273", "0.48313683", "0.48309624", "0.48309624", "0.48291433", "0.482891", "0.48240915", "0.48229185", "0.48226938", "0.48216087", "0.48194072", "0.4815179", "0.48134968", "0.48109683", "0.48077098", "0.48046172", "0.48007193", "0.47968736", "0.4789141", "0.47889128", "0.47886088", "0.47860554", "0.47823262" ]
0.0
-1
Gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
def additional_data return @additional_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
Sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
def additional_data=(value) @additional_data = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
Instantiates a new win32LobAppRestartSettings and sets the default values.
def initialize() @additional_data = Hash.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_default_settings!\n self.class.default_settings.dup.each do |var, vals|\n setting_objects.detect { |s| s.var == var.to_s } || setting_objects.create(var: var.to_s, value: vals, target: self)\n end\n end", "def reset_to_defaults!\n @allowlist_regexp = nil\n @custom_http_auth_scheme = UnsetString.new(\"custom_http_auth_scheme\")\n @env_var_to_hold_api_client_primary_key = NonNullString.new(\"env_var_to_hold_api_client_primary_key\",\"STITCHES_API_CLIENT_ID\")\n @env_var_to_hold_api_client= NonNullString.new(\"env_var_to_hold_api_client\",\"STITCHES_API_CLIENT\")\n @max_cache_ttl = NonNullInteger.new(\"max_cache_ttl\", 0)\n @max_cache_size = NonNullInteger.new(\"max_cache_size\", 0)\n @disabled_key_leniency_in_seconds = ActiveSupport::Duration.days(3)\n @disabled_key_leniency_error_log_threshold_in_seconds = ActiveSupport::Duration.days(2)\n end", "def defaults!\n self.max_retries = 5\n self.retry_delay = 10\n end", "def defaults!\n self.max_retries = 5\n self.retry_delay = 10\n end", "def puppet_default_settings\n Puppet.settings.initialize_app_defaults(\n {\n :logdir => '/dev/null',\n :confdir => '/dev/null',\n :vardir => '/dev/null',\n :rundir => '/dev/null',\n :hiera_config => '/dev/null',\n }\n )\n end", "def initialize(default_options={}, use_defaults=false)\n if default_options.keys.include? :exponential_retry\n @_exponential_retry = ExponentialRetryOptions.new(default_options[:exponential_retry])\n end\n super(default_options, use_defaults)\n end", "def init\n self.current_time ||= 1800\n self.setting_time ||= 1800\n self.enabled ||= true\n self.state ||= false\n self.mode ||= 'auto'\n end", "def reload!\n set_instance_variables(self.class.defaults)\n end", "def set_defaults\n self.mmr ||= 1500\n self.k_value ||= 40\n self.home_mmr ||= self.mmr\n self.away_mmr ||= self.mmr\n self.active ||= true\n self.total_games ||= 0\n end", "def load_defaults\n @project_root ||= default_project_root\n @packaging_root ||= default_packaging_root\n\n Pkg::Params::DEFAULTS.each do |v|\n unless self.instance_variable_get(\"@#{v[:var]}\")\n self.instance_variable_set(\"@#{v[:var]}\", v[:val])\n end\n end\n end", "def load_defaults\n @dev_port = @default_dev_port\n @dev_pid = @default_dev_pid\n @dev_log = @default_dev_log\n @prod_port = @default_prod_port\n @prod_pid = @default_prod_pid\n @prod_log = @default_prod_log\nend", "def set_defaults\n @defaults = RHC::Vendor::ParseConfig.new()\n @opts = RHC::Vendor::ParseConfig.new() # option switches that override config file\n\n @env_config = RHC::Vendor::ParseConfig.new()\n @global_config = nil\n @local_config = nil\n @opts_config = nil # config file passed in the options\n @additional_config = nil\n\n @default_proxy = nil\n\n @defaults.add('insecure', false)\n @defaults.add('libra_server', openshift_online_server)\n\n @env_config.add('libra_server', libra_server_env) if libra_server_env\n @env_config.add('libra_server', rhc_server_env) if rhc_server_env\n\n @opts_config_path = nil\n end", "def set_defaults!\n __load_config( DEFAULTS )\n end", "def init_command\n restart_winrm_service if config[:restart_winrm]\n end", "def reset_defaults; end", "def reset_default\n \n w=WinReg.new(@file)\n w.debug=@debug\n FOLDER_DEFAULTS.each do |key|\n w.write_key(FOLDERS_BASE+'\\\\'+key[:name],PROFILE_BASE+'\\\\'+key[:dir])\n end\n end", "def init_new_installs\n CONFIG.keys.each { |script| reset(script) unless self.send(script) }\n end", "def set_prerun_config_defaults\n @@config.daemon_name = File.basename(__FILE__) unless @@config.daemon_name\n @@config.pid_file = \"#{@@config.daemon_name}.pid\" unless @@config.pid_file\n @@config.force_kill_wait = nil unless @@config.force_kill_wait\n @@config.group = nil unless @@config.group\n @@config.user = nil unless @@config.user\n end", "def set_uninitialized_defaults_as_instance_variables\n DEFAULTS.each do |k, v|\n var_name = \"@#{k}\".to_sym\n if instance_variable_get(var_name).nil?\n self.instance_variable_set(var_name, v)\n end\n end\n end", "def set_defaults\n self.last_run ||= '1999-9-9 00:00:00 UTC'\n self.status ||= 3\n self.query_run_time ||= 0\n self.alert_value ||= '0'\n end", "def init!\n @defaults = {\n :@refresh_token => ShakeTheCounter::Config.refresh_token,\n :@id => ShakeTheCounter::Config.client_id,\n :@secret => ShakeTheCounter::Config.client_secret,\n :@language_code => ShakeTheCounter::Config.language_code,\n }\n end", "def set_defaults\n end", "def set_defaults\n end", "def reset!\n @defaults.each { |key, value| instance_variable_set(key, value) }\n end", "def reset!\n @defaults.each { |key, value| instance_variable_set(key, value) }\n end", "def init!\n @defaults = {\n :@refresh_token => ENV[\"STC_REFRESH_TOKEN\"],\n :@client_id => ENV[\"STC_CLIENT_ID\"],\n :@client_secret => ENV[\"STC_CLIENT_SECRET\"],\n :@language_code => \"nl-NL\",\n :@environment => 'test',\n :@version => 1,\n :@verbose => false,\n }\n end", "def set_apps_to_restart(app_names)\n make_call(NO_TIMEOUT, RETRY_ON_FAIL, \"set_apps_to_restart\") {\n @conn.set_apps_to_restart(app_names, @secret)\n }\n end", "def initialize_default_instance_vars\n @success = true\n @code = STATUS_CODE[:ok]\n end", "def new(**settings)\n __new_without_defaults__(\n **default_settings.merge(settings)\n )\n end", "def init_settings\n merge_in_user_settings(copy_hash(DEFAULT_SETTINGS))\n end", "def initialize_default_values!\n Marshal.load(Marshal.dump(self.class.default_values)).each do |k, v|\n self[k] ||= v\n end\n end", "def set_defaultsettings\r\n AppSettings.item.to_hash.each do |setting, value|\r\n s = RailsSettings::Settings.new \r\n s.var = setting.to_s\r\n s.value = value[:default]\r\n s.thing_id = self.id\r\n s.thing_type = \"Item\" \r\n s.save\r\n end\r\n end", "def init_default_config\n configuration.project_id ||= (Cloud.configure.project_id || ErrorReporting::Project.default_project_id)\n configuration.credentials ||= Cloud.configure.credentials\n configuration.service_name ||= ErrorReporting::Project.default_service_name\n configuration.service_version ||= ErrorReporting::Project.default_service_version\n configuration.ignore_classes = Array(configuration.ignore_classes)\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def default_setting!\n self.session_inactivity_timeout = GlobalConstant::AdminSessionSetting.default_session_inactivity_timeout\n self.mfa_frequency = GlobalConstant::AdminSessionSetting.default_mfa_frequency\n end", "def reset!\n @defaults.each do |k, v|\n instance_variable_set(k, v)\n end\n end", "def init_default_config\n configuration.project_id ||= Debugger.default_project_id\n configuration.credentials ||= Debugger.default_credentials\n configuration.service_name ||= Debugger.default_service_name\n configuration.service_version ||= Debugger.default_service_version\n end", "def restart=(restart)\n validator = EnumAttributeValidator.new('String', ['Always', 'WhenNotActive', 'Never', 'NotDefined'])\n unless validator.valid?(restart)\n fail ArgumentError, 'invalid value for \"restart\", must be one of #{validator.allowable_values}.'\n end\n @restart = restart\n end", "def automatic_restart=(value)\n @automatic_restart = value\n end", "def init_quick_defaults\n @quick_defaults=Hash.new\n @quick_defaults['enabled']=false\n @quick_defaults['launch']='ONETIME'\n @quick_defaults['launch_now']=true\n @quick_defaults['description']='Created with nessus_rest'\n end", "def default_settings()\n @default_settings ||= {}\n end", "def restart_soon\n @restart = true\n @shutdown = true\n end", "def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end", "def defaults()\n\t\t@height ||= 200\n\t\t@width ||= 350\n\t\t@title ||= \"Savable Settings Demo\"\n\t\t@text ||= \"Try changing the window size, title and text in this window. You will see that it saves its state \" +\n\t\t\t\"to a file named settings.yaml. So when you run this program again, it will be the same as \" +\n\t\t\t\"when you left. To see this file, click the 'Refresh' button. To reset to \" +\n\t\t\t\"defaults, just delete settings.yaml.\"\n\tend", "def set_default_values\n # Ethernet configuration\n self.network_1_id ||= 1\n self.ethernet_ip_assignment_method_id ||=1\n # GRPS\n self.gprs_mtu ||= 1450\n # PSTN\n self.pstn_mtu ||= 1500\n # Time configuration\n self.time_zone ||= 'UTC'\n # Interval configuration\n self.configuration_update_interval ||= 3600\n self.status_interval ||= 3600\n self.send_data_interval ||= 86400\n # Software update configuration\n self.auto_update ||= false\n self.software_update_interval ||= 604800\n self.repo_type ||= 'stable'\n # Log configuration\n self.send_log_files ||= false\n # State XML\n self.state_xml ||= \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<modified>true</modified>\\n\"\n end", "def initialize\n set_defaults\n end", "def initialize\n set_defaults\n end", "def set_defaultsettings\n AppSettings.item.to_hash.each do |setting, value|\n s = RailsSettings::Settings.new \n s.var = setting.to_s\n s.value = value[:default]\n s.thing_id = self.id\n s.thing_type = \"Group\" \n s.save\n end\n end", "def initial_settings\n #{Settings::INITIAL_WINDOW_SIZE => 0x7fffffff, Settings::ACCEPT_GZIPPED_DATA => 1}\n #{Settings::INITIAL_WINDOW_SIZE => 0x7fffffff}\n {Settings::INITIAL_WINDOW_SIZE => 0x20000, Settings::MAX_FRAME_SIZE => @dsil.max_frame_size, Settings::ACCEPT_GZIPPED_DATA => 1}\n end", "def restart_mode\n @options['restart_mode'] || 'term-start'\n end", "def initialize(restart_callback, offline_stats)\n @restart_vote = restart_callback\n @restart_vote_timer = nil\n @restart_vote_count = 0\n @offline_stats = offline_stats\n @state = :created\n @mode = :initializing\n @queue = []\n end", "def default_settings\n {}\n end", "def initialize\n @mutex = Mutex.new\n @config_hash = {}\n set_defaults\n end", "def load_defaults\n @main[:link_file] = File.expand_path \"~/Pictures/single\"\n @main[:directory] = File.expand_path \"~/Pictures\"\n @main[:mask] = \"**/*\"\n @main[:cache_dir] = File.expand_path \"~/.cache/\"\n @main[:cache_file] = File.expand_path \"~/.cache/next_background/cache.yaml\"\n @main[:timeout] = 10\n self.save\n end", "def reset\n keys.each do |key|\n instance_variable_set(:\"@#{key}\", defaults[key])\n self\n end\n end", "def reset\n CONFIGURATION_DEFAULTS.each { |k, v| send(\"#{k}=\", v) }\n self\n end", "def reset\n self.tap do |c|\n c.base_uri = DEFAULT_BASE_URI\n c.endpoint = DEFAULT_END_POINT\n c.api_secret = DEFAULT_API_SECRET\n c.api_key = DEFAULT_API_KEY\n end\n end", "def initialize_copy( original )\n\t\t@settings = original.settings.dup\n\t\t@overridden_settings = {}\n\tend", "def set_default_options()\n @options = OpenStruct.new(\n :output_base => nil,\n :verbose => false,\n :config_file => nil,\n :samples => nil,\n :delay => 30,\n :scheduler_opts => ''\n )\nend", "def reset\n @options = VALID_OPTIONS_KEYS.inject({}) do |opts, k|\n default_option = OnTheSnow::Config.const_get(\"DEFAULT_#{k.upcase}\")\n self.send(\"#{k}=\", default_option)\n opts[k.to_s] = default_option #unless default_option.nil?\n opts\n end\n self\n end", "def set_defaults\n self.help ||= ENV['help_text']\n self.help_url ||= ENV['help_url']\n self.created_at ||= DateTime.current\n end", "def set_default_values\n self.class.defaults.each do |key, default|\n self[key] ||= default\n end\n end", "def initialize(default_settins_path = DEFAULT_SETTINGS_PATH, overriden_settings_path = OVERRIDEN_SETTINGS_PATH, enabled_properties_to_override = [\"debug\", \"show_debug_events\"])\n @enabled_properties = enabled_properties_to_override\n @env_properties = ConfigParser.new()\n files = [default_settins_path]\n files << overriden_settings_path if File.exist? overriden_settings_path\n @file_properties = ConfigParser.new(files)\n # define dynamic properties\n @file_properties.override_value(\"project_dir\", File.expand_path(\".\"))\n end", "def default_configuration=(_arg0); end", "def set_defaults\n self.notification_id ||= Thrive::Util::Uuid.generate\n self.state = 'new' unless state\n end", "def default_settings\n {\n :ctrip_username => '',\n :ctrip_password => '',\n :ctrip_hotel_id => '',\n :ctrip_code_context => '',\n\n :ctrip_company_code => 'C',\n\n # 10 is for Channel Manager (see Ctrip Integration API Specification V2.2.pdf)\n # While 1 is for indifidual hotel.\n :ctrip_user_category => 10\n }\n end", "def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end", "def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end", "def restart; end", "def initialize_user_settings_defaults\n self.disabled_sports = []\n self.locale = 'en'\n self.device_ids = []\n end", "def set_defaults\n self.min_service_life_months ||= 0\n self.replacement_cost ||= 0\n self.lease_length_months ||= 0\n self.rehabilitation_service_month ||= 0\n self.rehabilitation_labor_cost ||= 0\n self.rehabilitation_parts_cost ||= 0\n self.extended_service_life_months ||= 0\n self.min_used_purchase_service_life_months ||= 0\n self.cost_fy_year ||= current_planning_year_year\n end", "def reset!\n @setting_objects = @setting_templates.map { |k, _| [k, []] }.to_h\n @settings.values.each(&:reset!)\n end", "def initialize( settings={} )\n\t\tsuper()\n\n\t\t@settings = settings\n\t\t@overridden_settings = {}\n\tend", "def reset!\n tap { set_defaults }\n end", "def restart config={}\n stop\n start(config)\n end", "def initialize(settings = {})\n settings = self.class.defaults.merge(settings)\n settings.each do |key, value|\n set key, value\n end\n end", "def initialize(options = {})\n options = ActiveSupport::HashWithIndifferentAccess.new(options)\n unknown_keys = options.keys - self.class.all_options.map(&:to_s)\n raise Informative, \"Unknown installation options: #{unknown_keys.to_sentence}.\" unless unknown_keys.empty?\n self.class.defaults.each do |key, default|\n value = options.fetch(key, default)\n send(\"#{key}=\", value)\n end\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.macOsLobAppAssignmentSettings\"\n end", "def set_defaults\n self.version = 0\n end", "def initialize\n @sleep_time = nil\n @number_of_retries = nil\n end", "def reset!\n @apps = {}\n @default_params = {}\n @basic_auth = nil\n end", "def apply_system_defaults\n if @region.nil? && @zone.nil?\n @region, @zone = Rudy::DEFAULT_REGION, Rudy::DEFAULT_ZONE\n elsif @region.nil?\n @region = @zone.to_s.gsub(/[a-z]$/, '').to_sym\n elsif @zone.nil?\n @zone = \"#{@region}b\".to_sym\n end\n \n @environment ||= Rudy::DEFAULT_ENVIRONMENT\n @role ||= Rudy::DEFAULT_ROLE\n @localhost ||= Rudy.sysinfo.hostname || 'localhost'\n @auto = false if @auto.nil?\n end", "def initialize(o_manifest)\n hash2vars(o_manifest)\n reset\n raise ManifestError, ERR_OPTION_NULL if !name || name.strip.empty?\n end", "def restart\n request('restart')\n end", "def reset!\n @application_name = NgpVan::Default.application_name\n @api_key = NgpVan::Default.api_key\n @api_endpoint = NgpVan::Default.api_endpoint\n @user_agent = NgpVan::Default.user_agent\n self\n end", "def initialize(*args)\n DEFAULT_OPTIONS.each do |option|\n self.send(:\"#{option}=\", self.class.send(:class_variable_get, :\"@@default_#{option}\") )\n end\n end", "def set_interval_defaults\n Interval::Config.configure do |config|\n config.alias = nil\n config.controller = params[:controller]\n config.action = params[:action]\n end\n end", "def create_defaults\n @parameters[:date] = Time.parse(\"00:00\").to_s\n @parameters[:period] = \"24\"\n @parameters[:default] = true\n end", "def options_reload\n @cooldown, @ignore, @control, @thread =\n OPTIONS.values_at(:cooldown, :ignore, :control, :thread)\n end", "def reset\n set Exchange::Configuration::DEFAULTS[key]\n end", "def restart_count=(value)\n @restart_count = value\n end", "def initialize default_opts = {}\n @var_map = {}\n @default_opts = default_opts\n end", "def set_defaults\n\t self.year ||= Date.today.cwyear\n\t self.start_week ||= 1\n self.end_week ||= Date.new(Date.today.cwyear, 12, 28).cweek #calc for number of weeks in current year\n\t self.hours_in_week ||= 40\n\t self.holiday ||= 8\n\t self.billable_rate ||= 90\n self.billable_per_week ||= self.hours_in_week\n \tend", "def reset!\n Coinprism::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Coinprism::Default.options[key])\n end\n self\n end", "def set_defaults\n self.annual_inflation_rate ||= 1.1\n self.pcnt_residual_value ||= 0\n self.condition_rollup_weight ||= 0\n end", "def set_default_properties\n @properties = {\n :InstanceType => \"t2.micro\",\n :ImageId => \"ami-d05e75b8\"\n }\n end" ]
[ "0.5677274", "0.5496078", "0.5455873", "0.5455873", "0.5435116", "0.54043627", "0.53806263", "0.53736943", "0.5325208", "0.5321597", "0.53078824", "0.5269786", "0.52443665", "0.5219328", "0.5207854", "0.5186338", "0.5170751", "0.51225865", "0.51161003", "0.5106178", "0.5105431", "0.5093724", "0.5093724", "0.50849986", "0.50849986", "0.50841266", "0.507394", "0.5069352", "0.5051925", "0.50431705", "0.5042688", "0.5042369", "0.5041984", "0.5031551", "0.5031551", "0.5031551", "0.5031551", "0.5031551", "0.5031551", "0.5031378", "0.5027633", "0.5019618", "0.5014673", "0.5001804", "0.49909776", "0.49811336", "0.496431", "0.49604994", "0.49512875", "0.49496692", "0.49346283", "0.49346283", "0.49282494", "0.49278998", "0.49274546", "0.49235407", "0.49226403", "0.49107975", "0.49038076", "0.49018312", "0.48682502", "0.48579264", "0.485766", "0.4856596", "0.485173", "0.48494652", "0.4835695", "0.4825682", "0.4808275", "0.48020315", "0.47881803", "0.4768683", "0.4768683", "0.47655213", "0.47623047", "0.47615725", "0.47585586", "0.4753913", "0.47537035", "0.47420362", "0.47387275", "0.47370133", "0.47316092", "0.4725304", "0.47215933", "0.4718309", "0.470507", "0.47035936", "0.4703504", "0.46835104", "0.46821344", "0.46800396", "0.46792427", "0.46781227", "0.46769005", "0.46758723", "0.46752757", "0.466975", "0.4667498", "0.46653715", "0.46538255" ]
0.0
-1
Gets the countdownDisplayBeforeRestartInMinutes property value. The number of minutes before the restart time to display the countdown dialog for pending restarts.
def countdown_display_before_restart_in_minutes return @countdown_display_before_restart_in_minutes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end", "def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end", "def restart_count\n return @restart_count\n end", "def minutes\n (@seconds.abs / 60) % 60 * (@seconds < 0 ? -1 : 1)\n end", "def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def countdown\n time_left = self.time_remaining\n m = (time_left / 60).to_s\n s = (time_left % 60)\n s = s >= 10 ? s.to_s : \"0#{s}\"\n \"0#{m}:#{s}\"\n end", "def minutes\n (seconds % 3600) / 60\n end", "def restart_count=(value)\n @restart_count = value\n end", "def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end", "def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end", "def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end", "def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def minutes() 60 * seconds end", "def passcode_minutes_of_inactivity_before_lock\n return @passcode_minutes_of_inactivity_before_lock\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout\n return @work_profile_password_minutes_of_inactivity_before_screen_timeout\n end", "def minutes\n _nudge[1]\n end", "def minute(padded = false)\n min = (seconds_since_start_of_hour / M_SECS).to_i\n if padded && min < 10\n min = \"0#{min}\"\n end\n min\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout=(value)\n @work_profile_password_minutes_of_inactivity_before_screen_timeout = value\n end", "def seconds\n @seconds.abs % 60 * (@seconds < 0 ? -1 : 1)\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def passcode_minutes_of_inactivity_before_screen_timeout\n return @passcode_minutes_of_inactivity_before_screen_timeout\n end", "def passcode_minutes_of_inactivity_before_lock=(value)\n @passcode_minutes_of_inactivity_before_lock = value\n end", "def calc_mins_till\n (@difference.round(2) / 60.00).round(2)\n end", "def beginning_of_minute\n change(sec: 0)\n end", "def beginning_of_minute\n change(sec: 0)\n end", "def seconds_remaining\n ends_at ? (ends_at - started_at).round : 0\n end", "def passcode_minutes_of_inactivity_before_screen_timeout=(value)\n @passcode_minutes_of_inactivity_before_screen_timeout = value\n end", "def minutes\n\t\treturn self * 60\n\tend", "def minutes\n\t\treturn self * 60\n\tend", "def display_duration_minutes\n if duration_minutes >= 60\n hour_value = duration_minutes / 60\n minutes_value = duration_minutes.remainder(60)\n\n return \"#{hour_value} #{'hour'.pluralize(hour_value)}\" if minutes_value.zero?\n\n \"#{hour_value} #{'hour'.pluralize(hour_value)} #{duration_minutes.remainder(60)} minutes\"\n else\n \"#{duration_minutes} minutes\"\n end\n end", "def format_countdown(seconds)\n minutes = (seconds / 60).to_s.rjust(2,\"0\")\n while seconds >= 60\n seconds -= 60\n end\n seconds = seconds.to_s.rjust(2,\"0\")\n\n \"#{pomodoro_status} -- #{minutes}:#{seconds}\"\n end", "def total_preparation_submission_minutes\n (DateTime.now.to_i - submission.client.created_at.to_datetime.to_i) / 60\n end", "def running_time_in_minutes\n return 0 if self.started_at.nil? and self.stopped_at.nil?\n\n if self.stopped_at.nil?\n # Raid has not yet been stopped, use the current time\n ((Time.now - self.started_at)/60.0).floor\n else\n ((self.stopped_at - self.started_at)/60.0).floor\n end\n end", "def minutes_remaining\n time_elapsed = (Time.new - @start_time) / 60\n (@total_paid * 60 - time_elapsed).floor\n end", "def getMinutes\r\n\t\t\t\t\treturn @minutes\r\n\t\t\t\tend", "def get_time_required\n 0 # number of minutes\n end", "def minutes\n self * SECONDS_IN_MINUTES\n end", "def minutes ; self * 60 ; end", "def lifetime_in_minutes\n return @lifetime_in_minutes\n end", "def average_restarts\n return @average_restarts\n end", "def seconds\n self * 60\n end", "def seconds\n (hour * 60 * 60) + (min * 60)\n end", "def minutes\n self.to_i * 60\n end", "def getminute()\n\t\treturn @min\n\tend", "def in_seconds\n @seconds\n end", "def seconds_in_minutes(num_min)\n\tnum_min * 60\nend", "def minute\n if self.in_play?\n return self.round.minute\n else\n if self.finished?\n return MINUTES\n else\n return 0\n end\n end\n end", "def minutes_since_creation\n ((Time.now - created_at) / 60.0).floor\n end", "def minutes\n value_parts[1]\n end", "def minutes\n value_parts[1]\n end", "def minimum_lead_time\n return @minimum_lead_time\n end", "def countdown(seconds)\n seconds.downto(0).each do |remaining|\n if remaining <= 5\n puts \" #{remaining} \" if @verbose\n elsif remaining % 60 == 0\n minutes = remaining / 60\n puts \"Retrying in #{minutes} minutes...\" if @verbose\n end\n sleep 1\n end\n end", "def seconds ; return aseconds % SPM ; end", "def seconds\n (Time.now - @start_time).to_i\n end", "def grace_period_in_minutes\n return @grace_period_in_minutes\n end", "def min_interval\n MIN_INTERVAL\n end", "def seconds_until\n (start_time - Time.now).to_i\n end", "def seconds_until\n (start_time - Time.now).to_i\n end", "def maintenance_start_time\n return @maintenance_start_time\n end", "def minute\n @minute\n end", "def in_minutes\n Duration::new(seconds: @seconds).to_minutes\n end", "def remaining_time\n # calculate how old is the feedback\n created_at = self.created_at.to_time\n diff_seconds = (Time.now - created_at).round\n remaining = TEN_MINUTES - diff_seconds\n\n remaining.to_s\n end", "def deprecated_day_number\n time_zone = self.program_player.user.time_zone_or_default\n now_in_time_zone = Time.now.in_time_zone(time_zone)\n \n # If this budge has been paused, return the number of days until it is UNpaused\n # Note that if they paused this on day 6, and it's starting tomorrow, the day number will still be -1, but\n # tomorrow it will be 6, since it will resume with the day number that it was paused at.\n if !self.program_player.respond_to?(:restart_at)\n if self.program_player.temp_restart_at.present? and self.program_player.temp_restart_day_number.present?\n restart_at_in_time_zone = self.datetime_in_time_zone(self.program_player.temp_restart_at)\n return (now_in_time_zone.to_date-self.program_player.temp_restart_at.to_date+1).ceil\n \n elsif self.start_date.present?\n start_date_in_time_zone = datetime_in_time_zone(self.start_date).midnight\n \n # Rounding up, since start dates are set to 1 day in the future by default\n return ((now_in_time_zone - start_date_in_time_zone)/60/60/24).ceil\n else\n return nil\n end\n elsif self.program_player.restart_at.present? and self.program_player.restart_day_number.present?\n restart_at_in_time_zone = self.datetime_in_time_zone(self.program_player.restart_at)\n return (now_in_time_zone.to_date-self.program_player.restart_at.to_date+1).ceil\n \n elsif self.start_date.present?\n start_date_in_time_zone = datetime_in_time_zone(self.start_date).midnight\n \n # Rounding up, since start dates are set to 1 day in the future by default\n return ((now_in_time_zone - start_date_in_time_zone)/60/60/24).ceil\n else\n return nil\n end\n end", "def respawn_window\n @options['respawn_window'] ? @options['respawn_window'].to_i : 3600\n end", "def hours\n @seconds.abs / 60 / 60 * (@seconds < 0 ? -1 : 1)\n end", "def seconds_left\n if @last_run\n [(@last_run + interval / 1000.0) - Time.now, 0].max\n else\n interval / 1000.0\n end\n end", "def start_time_in_seconds\n @start_time_in_seconds ||= seconds_from_time(start_time)\n end", "def duration_before_escalation\n return @duration_before_escalation\n end", "def pretty_runtime\n return nil if total_time.nil?\n t = total_time / 1000\n minutes = t / 60\n seconds = t - 60 * minutes\n sprintf '%d:%02d', minutes, seconds\n end", "def get_time_remaining\n\n end", "def minretrydelay\r\n\t\t\t`#{BITS::BITSADMIN} /getminretrydelay {#{@id}}`\r\n\t\tend", "def core_login_time_in_ms\n return @core_login_time_in_ms\n end", "def core_login_time_in_ms\n return @core_login_time_in_ms\n end", "def time_counter\n counter = Time.new.to_i - @time_counter\n return counter < 0 ? 0 : counter\n end", "def start\n starts_at.strftime(\"%R\")\n end", "def hours\n return \"There are #{self * (60 * 60)} seconds in #{self} hours\"\n end", "def today_minutes_resting\n self[:min_rest]\n end", "def dep_time_loc_minutes\n dep_minutes_since_midnight\n end", "def get_elapse_time\n @start_time ||= @time_now\n return @time_now - @start_time\n end", "def getMin(mod = 60, unit = 1)\n return normalize(getSec(0,0)/60.0, mod, unit) ;\n end", "def gametime\n \"#{self.gametime_maths/60} minutes\"\n end", "def secs\n self / 3600.0\n end", "def last_minute_activity\n self[:last_min_activity]\n end", "def lauch_time\n content.launch_time\n end", "def random_spawn_countdown minimum\n 10.randomize(:ratio, :sign).to_i + 60\n end", "def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end", "def minutes; self * MINUTE; end", "def minutes; self * MINUTE; end", "def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end", "def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end", "def remaining_minutes()\n current_time = Time.now\n start_time = Delay.find_newest_travel_time(stop_position.bus.id, current_time)\n predicted_time = start_time + minutes_delayed * 60\n return predicted_time - current_time\n end", "def to_i\n @seconds\n end", "def total_minutes\n hours * 60 + minutes\n end", "def calculate_display_time\n case @display_granularity\n when :one_minute \n min = @fuzzed.min\n when :ten_minute\n min = (@fuzzed.min / 10) * 10\n when :one_hour\n min = 0\n end\n\n @display = Time.mktime( @fuzzed.year, @fuzzed.month, @fuzzed.day, @fuzzed.hour, min, 0, 0)\n end", "def average_restarts=(value)\n @average_restarts = value\n end" ]
[ "0.77445376", "0.5822122", "0.58177066", "0.5649487", "0.561191", "0.55909705", "0.55909705", "0.55469835", "0.54971653", "0.5386674", "0.53762263", "0.53762263", "0.5256719", "0.5256719", "0.51962405", "0.51962405", "0.5191844", "0.51666063", "0.5147846", "0.5135285", "0.5131239", "0.51228094", "0.510936", "0.50803053", "0.50803053", "0.5047757", "0.50103724", "0.50092953", "0.5000577", "0.5000577", "0.49875715", "0.48816618", "0.48791614", "0.48791614", "0.48783013", "0.4876599", "0.4860872", "0.47879866", "0.47726768", "0.4768542", "0.47402984", "0.47168234", "0.4710446", "0.46957108", "0.4686469", "0.46802408", "0.4656652", "0.46397296", "0.46270028", "0.46119112", "0.46102533", "0.45949182", "0.45911223", "0.45904157", "0.45904157", "0.4582406", "0.45675832", "0.45614395", "0.45608914", "0.45550954", "0.45419204", "0.4512669", "0.4512669", "0.45114622", "0.4499612", "0.44906136", "0.44803864", "0.4475787", "0.446202", "0.44606304", "0.44571203", "0.4451608", "0.44470724", "0.44384283", "0.4431534", "0.44290283", "0.44280565", "0.44280565", "0.4427057", "0.44261292", "0.44134784", "0.44035745", "0.4402989", "0.4400153", "0.43952492", "0.4393127", "0.43853", "0.4375357", "0.43633017", "0.43613106", "0.4351867", "0.43508145", "0.43508145", "0.43506667", "0.43506667", "0.43414092", "0.4340985", "0.4335274", "0.43332195", "0.4314458" ]
0.82854724
0
Sets the countdownDisplayBeforeRestartInMinutes property value. The number of minutes before the restart time to display the countdown dialog for pending restarts.
def countdown_display_before_restart_in_minutes=(value) @countdown_display_before_restart_in_minutes = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n end", "def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end", "def restart_count=(value)\n @restart_count = value\n end", "def reset_times_after_display\n @@resets_after_display = true\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout=(value)\n @work_profile_password_minutes_of_inactivity_before_screen_timeout = value\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def passcode_minutes_of_inactivity_before_screen_timeout=(value)\n @passcode_minutes_of_inactivity_before_screen_timeout = value\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def passcode_minutes_of_inactivity_before_lock=(value)\n @passcode_minutes_of_inactivity_before_lock = value\n end", "def automatic_restart=(value)\n @automatic_restart = value\n end", "def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def beginning_of_minute\n change(sec: 0)\n end", "def beginning_of_minute\n change(sec: 0)\n end", "def restart_count\n return @restart_count\n end", "def countdown\n time_left = self.time_remaining\n m = (time_left / 60).to_s\n s = (time_left % 60)\n s = s >= 10 ? s.to_s : \"0#{s}\"\n \"0#{m}:#{s}\"\n end", "def redisplay_delay\r\n 20\r\n end", "def countdown(seconds)\n seconds.downto(0).each do |remaining|\n if remaining <= 5\n puts \" #{remaining} \" if @verbose\n elsif remaining % 60 == 0\n minutes = remaining / 60\n puts \"Retrying in #{minutes} minutes...\" if @verbose\n end\n sleep 1\n end\n end", "def lazy_min=(newmin)\n newmin = newmin.to_f\n \n #Add hours for every 60 minutes given.\n if newmin > 60 or newmin < 0\n hours = (newmin.to_f / 60.0).floor\n newmin -= (hours.to_f * 60.0)\n self.add_hours(hours)\n end\n \n #Convert any decimals to setting the second.\n diff = newmin - newmin.floor\n self.lazy_sec = diff * 60 if diff > 0.0\n \n #Set the actual minute.\n @t_min = newmin.floor\n \n self\n end", "def setMinutes(minutes)\r\n\t\t\t\t\t@minutes = minutes\r\n\t\t\t\tend", "def set_time_left(value)\n if value\n @time_left.set_text(\"#{value} seconds left before crashing.\")\n else\n @time_left.set_text(\"Select an option:\")\n end\n end", "def enable_restart\n println _INTL('Changes have been made: the game must restart')\n @restart = true\n end", "def minute(padded = false)\n min = (seconds_since_start_of_hour / M_SECS).to_i\n if padded && min < 10\n min = \"0#{min}\"\n end\n min\n end", "def average_restarts=(value)\n @average_restarts = value\n end", "def minutes\n (@seconds.abs / 60) % 60 * (@seconds < 0 ? -1 : 1)\n end", "def maintenance_start_time=(value)\n @maintenance_start_time = value\n end", "def restart_category=(value)\n @restart_category = value\n end", "def lazy_sec=(newsec)\n newsec = newsec.to_i\n \n if newsec > 60 or newsec < 0\n mins = (newsec.to_f / 60.0).floor\n newsec -= (mins * 60)\n self.add_mins(mins)\n end\n \n @t_sec = newsec\n end", "def minutes() 60 * seconds end", "def work_profile_password_sign_in_failure_count_before_factory_reset=(value)\n @work_profile_password_sign_in_failure_count_before_factory_reset = value\n end", "def vote_to_restart(timer_trigger = false)\n if @restart_vote\n @restart_vote.call\n if timer_trigger\n start_timer\n else\n @restart_vote_count = 0\n end\n end\n true\n end", "def format_countdown(seconds)\n minutes = (seconds / 60).to_s.rjust(2,\"0\")\n while seconds >= 60\n seconds -= 60\n end\n seconds = seconds.to_s.rjust(2,\"0\")\n\n \"#{pomodoro_status} -- #{minutes}:#{seconds}\"\n end", "def automatic_restart\n @automatic_restart = true if @automatic_restart.nil?\n @automatic_restart\n end", "def reset_interval\n options[:reset_interval].to_f\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout\n return @work_profile_password_minutes_of_inactivity_before_screen_timeout\n end", "def startCountdown\n # get the current time in milliseconds for reference use\n @curPauseTime = Time.now\n # this tells the program to start counting\n @countdown = true\n end", "def grace_period_in_minutes=(value)\n @grace_period_in_minutes = value\n end", "def respawn_window\n @options['respawn_window'] ? @options['respawn_window'].to_i : 3600\n end", "def calculate_display_time\n case @display_granularity\n when :one_minute \n min = @fuzzed.min\n when :ten_minute\n min = (@fuzzed.min / 10) * 10\n when :one_hour\n min = 0\n end\n\n @display = Time.mktime( @fuzzed.year, @fuzzed.month, @fuzzed.day, @fuzzed.hour, min, 0, 0)\n end", "def set_StartSleepTime(value)\n set_input(\"StartSleepTime\", value)\n end", "def minretrydelay=(retry_delay)\r\n\t\t\t`#{BITS::BITSADMIN} /setminretrydelay {#{@id}} #{retry_delay}`\r\n\t\tend", "def password_sign_in_failure_count_before_factory_reset=(value)\n @password_sign_in_failure_count_before_factory_reset = value\n end", "def password_sign_in_failure_count_before_factory_reset=(value)\n @password_sign_in_failure_count_before_factory_reset = value\n end", "def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end", "def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end", "def core_login_time_in_ms=(value)\n @core_login_time_in_ms = value\n end", "def core_login_time_in_ms=(value)\n @core_login_time_in_ms = value\n end", "def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end", "def initial_silence_timeout_in_seconds=(value)\n @initial_silence_timeout_in_seconds = value\n end", "def minutes\n (seconds % 3600) / 60\n end", "def tock\n @minute += 1\n end", "def elapsed_time_preset preset, show_seconds=TrackingConfig[:show_elapsed_seconds]\n\t\t\tcase preset\n\t\t\twhen :colons\n\t\t\t\tpreset = '%02d:%02d:%02d'\n\t\t\t\tpreset_secs = ':%02d'\n\t\t\twhen :letters\n\t\t\t\tpreset = '%02dd %02dh %02dm'\n\t\t\t\tpreset_secs = ' %02ds'\n\t\t\tend\n\t\t\tpreset += preset_secs if show_seconds\n\t\t\treturn preset\n\t\tend", "def min=(newmin)\n newmin = newmin.to_i\n raise ArgumentError, \"Invalid minute: '#{newmin}'.\" if newmin < 0 or newmin > 60\n @t_min = newmin\n end", "def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end", "def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end", "def restart=(restart)\n validator = EnumAttributeValidator.new('String', ['Always', 'WhenNotActive', 'Never', 'NotDefined'])\n unless validator.valid?(restart)\n fail ArgumentError, 'invalid value for \"restart\", must be one of #{validator.allowable_values}.'\n end\n @restart = restart\n end", "def setTimer\n return NSTimer.timerWithTimeInterval( 1.0,\n target: self,\n selector: 'updateCountdown:',\n userInfo: nil,\n repeats: true )\n .tap do |timer|\n @countdown = @delayTime\n @timerField.stringValue = @countdown.to_int.to_s\n end if @delayTime > 1\n nil\n end", "def show\n @begin = @timed_form.begin\n @countdown_remaining = @timed_form.begin\n \n a = @begin.split(\":\")\n @minutes = a[0].to_i\n @seconds= a[1].to_i\n @time_seconds = -(@minutes * 60 + @seconds) + 600\n @time_format = Time.at(@time_seconds).utc.strftime(\"%M:%S\")\n end", "def start_time=(value)\n @start_time = value\n end", "def set_MinCount(value)\n set_input(\"MinCount\", value)\n end", "def set_MinCount(value)\n set_input(\"MinCount\", value)\n end", "def passcode_minutes_of_inactivity_before_screen_timeout\n return @passcode_minutes_of_inactivity_before_screen_timeout\n end", "def start_clock\n @start_time = Time.now\n end", "def minimum_lead_time=(value)\n @minimum_lead_time = value\n end", "def reconnect_attempts=(val)\n @j_del.setReconnectAttempts(val)\n self\n end", "def advance_start_at_duration_days=(value)\n value = if value.present? && value.to_i > 0\n value.to_i.days\n else\n nil\n end\n settings(:course).advance_start_at_duration = value\n end", "def minute\n set_function_and_argument(:minute, nil)\n end", "def advance_minutes(mins)\n self + (mins * 60)\n end", "def beginning_of_hour\n change(min: 0)\n end", "def beginning_of_hour\n change(min: 0)\n end", "def needs_restart?\n return false if !profile or profile.restart_freq == 0\n # Age is given in seconds - 86400 seconds to a day\n return age / 86400 > profile.restart_freq\n end", "def reset(seconds_to_expiry=nil)\n if seconds_to_expiry != nil then\n @seconds_to_expiry = seconds_to_expiry\n end\n @start_time = @timer.now.to_f\n end", "def updateCountdown(timer)\n @countdown -= 1\n @timerField.stringValue = @countdown.to_int.to_s\n if @countdown <= 0\n @timerField.stringValue = ''\n timer.invalidate\n NSApp.abortModal\n end\n end", "def set_start_time\n @start_time = Time.now.to_f\n end", "def set_start_time\n @start_time = Time.now.to_f\n end", "def set_show_fps_counter(show:)\n {\n method: \"Overlay.setShowFPSCounter\",\n params: { show: show }.compact\n }\n end", "def start_clock\n condition = true\n while condition do\n puts \"current time : #{@hour.to_s.rjust(2, \"0\")}:#{@min.to_s.rjust(2, \"0\")}:#{@sec.to_s.rjust(2, \"0\")}\"\n sleep 1.0\n\n increment_sec\n\n check_alarm\n end\n end", "def minute=(value)\n RangeValidator.validate \"DateGroupItem.minute\", 0, 59, value\n @minute = value\n end", "def display_duration_minutes\n if duration_minutes >= 60\n hour_value = duration_minutes / 60\n minutes_value = duration_minutes.remainder(60)\n\n return \"#{hour_value} #{'hour'.pluralize(hour_value)}\" if minutes_value.zero?\n\n \"#{hour_value} #{'hour'.pluralize(hour_value)} #{duration_minutes.remainder(60)} minutes\"\n else\n \"#{duration_minutes} minutes\"\n end\n end", "def before_restart(arg = nil, &block)\n arg ||= block\n set_or_return(:before_restart, arg, kind_of: [Proc, String])\n end", "def passcode_minutes_of_inactivity_before_lock\n return @passcode_minutes_of_inactivity_before_lock\n end", "def seconds\n @seconds.abs % 60 * (@seconds < 0 ? -1 : 1)\n end", "def seconds=(new_seconds)\n\t\t@seconds = new_seconds\n\tend", "def minutes ; self * 60 ; end", "def set_max_wait_time\n q = 'Set the MAX WAIT TIME after executing the RESTART command ' \\\n '(>= 180 secs): '\n until @max_wait && @max_wait.to_i > 179\n @max_wait = Utils.qna(q.cyan, true)\n end\n end", "def startup_performance_score=(value)\n @startup_performance_score = value\n end", "def mins\n Thread.current[:datet_mode] = :mins\n return self\n end", "def setPlayerRespawnTime _args\n \"setPlayerRespawnTime _args;\" \n end", "def restart\n budget.restart\n cost_payment_plan.restart\n self.update(actual_week: 0, status: 'Inicio')\n milestones.map { |mile| mile.restart }\n end", "def RecalcRemainingTimes(force_recalc)\n if !force_recalc &&\n Ops.less_than(Builtins.time, SlideShow.next_recalc_time)\n # Nothing to do (yet) - simply return\n return false\n end\n\n\n # Actually do recalculation\n\n elapsed = SlideShow.total_time_elapsed\n\n if Ops.greater_or_equal(SlideShow.start_time, 0)\n elapsed = Ops.subtract(\n Ops.add(elapsed, Builtins.time),\n SlideShow.start_time\n )\n end\n\n if elapsed == 0\n # Called too early - no calculation possible yet.\n # This happens regularly during initialization, so an error\n # message wouldn't be a good idea here.\n\n return false\n end\n\n # This is the real thing.\n\n real_bytes_per_second = Ops.divide(@total_size_installed, elapsed)\n\n # But this turns out to be way to optimistic - RPM gets slower and\n # slower while installing. So let's add some safety margin to make\n # sure initial estimates are on the pessimistic side - the\n # installation being faster than initially estimated will be a\n # pleasant surprise to the user. Most users don't like it the other\n # way round.\n #\n # The \"pessimistic factor\" progressively decreases as the installation\n # proceeds. It begins with about 1.7, i.e. the data transfer rate is\n # halved to what it looks like initially. It decreases to 1.0 towards\n # the end.\n\n pessimistic_factor = 1.0\n\n if Ops.greater_than(@total_size_to_install, 0)\n pessimistic_factor = Ops.subtract(\n 1.7,\n Ops.divide(\n Builtins.tofloat(@total_size_installed),\n Builtins.tofloat(@total_size_to_install)\n )\n )\n end\n @bytes_per_second = Builtins.tointeger(\n Ops.add(\n Ops.divide(\n Builtins.tofloat(real_bytes_per_second),\n pessimistic_factor\n ),\n 0.5\n )\n )\n\n @bytes_per_second = 1 if Ops.less_than(@bytes_per_second, 1)\n\n @remaining_times_per_cd_per_src = []\n\n # Recalculate remaining times for the individual CDs\n\n Builtins.foreach(@remaining_sizes_per_cd_per_src) do |remaining_sizes_list|\n remaining_times_list = []\n remaining_time = -1\n Builtins.foreach(remaining_sizes_list) do |remaining_size|\n remaining_time = remaining_size\n if Ops.greater_than(remaining_size, 0)\n remaining_time = Ops.divide(remaining_size, @bytes_per_second)\n\n if Ops.less_than(remaining_time, @min_time_per_cd)\n # It takes at least this long for the CD drive to spin up and\n # for RPM to do _anything_. Times below this values are\n # ridiculously unrealistic.\n remaining_time = @min_time_per_cd\n elsif Ops.greater_than(remaining_time, @max_time_per_cd) # clip off at 2 hours\n # When data throughput goes downhill (stalled network connection etc.),\n # cut off the predicted time at a reasonable maximum.\n remaining_time = @max_time_per_cd\n end\n end\n remaining_times_list = Builtins.add(\n remaining_times_list,\n remaining_time\n )\n end\n @remaining_times_per_cd_per_src = Builtins.add(\n @remaining_times_per_cd_per_src,\n remaining_times_list\n )\n end\n\n\n # Recalculate slide interval\n\n if Slides.HaveSlides\n slides_remaining = Ops.subtract(\n Ops.subtract(Builtins.size(Slides.slides), SlideShow.current_slide_no),\n 1\n )\n\n if Ops.greater_than(slides_remaining, 0)\n # The remaining time for the rest of the slides depends on the\n # remaining time for the current CD only: This is where the\n # slide images and texts reside. Normally, only CD1 has slides\n # at all, i.e. the slide show must be finished when CD1 is\n # done.\n #\n # In addition to that, take elapsed time for current slide\n # into account so all slides get about the same time.\n\n time_remaining = Ops.subtract(\n Ops.add(\n Ops.get(\n @remaining_times_per_cd_per_src,\n [\n Ops.subtract(@current_src_no, 1),\n Ops.subtract(@current_cd_no, 1)\n ],\n 1\n ),\n Builtins.time\n ),\n SlideShow.slide_start_time\n )\n SlideShow.slide_interval = Ops.divide(\n time_remaining,\n slides_remaining\n )\n Builtins.y2debug(\n \"New slide interval: %1 - slides remaining: %2 - remaining time: %3\",\n SlideShow.slide_interval,\n slides_remaining,\n time_remaining\n )\n\n if Ops.less_than(\n SlideShow.slide_interval,\n SlideShow.slide_min_interval\n )\n SlideShow.slide_interval = SlideShow.slide_min_interval\n Builtins.y2debug(\n \"Resetting slide interval to min slide interval: %1\",\n SlideShow.slide_interval\n )\n end\n\n if Ops.greater_than(\n SlideShow.slide_interval,\n SlideShow.slide_max_interval\n )\n SlideShow.slide_interval = SlideShow.slide_max_interval\n Builtins.y2debug(\n \"Resetting slide interval to max slide interval: %1\",\n SlideShow.slide_interval\n )\n end\n end\n end\n\n SlideShow.next_recalc_time = Ops.add(\n Builtins.time,\n SlideShow.recalc_interval\n )\n\n true\n end", "def add_mins(mins = 1)\n mins = mins.to_i\n cur_mins = @t_min\n next_min = cur_mins + mins\n \n if next_min >= 60\n @t_min = 0\n self.add_hours(1)\n mins_left = (mins - 1) - (60 - cur_mins)\n self.add_mins(mins_left) if mins_left > 0\n elsif next_min < 0\n @t_min = 59\n self.add_hours(-1)\n mins_left = mins + cur_mins + 1\n self.add_mins(mins_left) if mins_left > 0\n else\n @t_min = next_min\n end\n \n return self\n end", "def status_restart!()\n @status = TAC_PLUS_AUTHEN_STATUS_RESTART\n end", "def redis_restart_on_change\n restart_on_change = configuration[:redis][:restart_on_change]\n restart_on_change = true if restart_on_change.nil? # nil is true so we have a default value.\n restart_on_change\n end", "def start=(new_start)\n @start = new_start ? new_start.to_i : nil\n end", "def refresh_interval_param(seconds)\n return nil unless seconds\n \"refreshInterval:(display:'#{seconds}%20seconds',\" \\\n \"pause:!f,section:1,value:#{seconds * 1000})\"\n end", "def restart_pending?\n @restart ||= false\n end", "def advance_start_at_duration\n settings(:course).advance_start_at_duration\n end" ]
[ "0.7300913", "0.5887486", "0.5757111", "0.5319283", "0.52962637", "0.5211868", "0.5211868", "0.51519156", "0.51368046", "0.51368046", "0.5113679", "0.5015245", "0.49272695", "0.49153465", "0.49153465", "0.49071556", "0.49071556", "0.4846544", "0.4619251", "0.45845246", "0.4573155", "0.4570038", "0.4518871", "0.45153725", "0.45068756", "0.44890937", "0.44628513", "0.43865263", "0.4359076", "0.42992485", "0.42961866", "0.42560598", "0.42505664", "0.4247854", "0.4237076", "0.42233273", "0.42058098", "0.4197597", "0.41889998", "0.41873616", "0.41466084", "0.41335505", "0.41296914", "0.41283658", "0.41277933", "0.41277933", "0.41213578", "0.41213578", "0.41047812", "0.41047812", "0.40965402", "0.40821752", "0.40758878", "0.4064942", "0.4048466", "0.4048012", "0.40456647", "0.40456647", "0.4041646", "0.4040418", "0.4032349", "0.40263408", "0.4025437", "0.4025437", "0.40101847", "0.39995962", "0.39995325", "0.399835", "0.39944693", "0.3991834", "0.39726815", "0.39722416", "0.39722416", "0.39656478", "0.3957063", "0.39522868", "0.3949769", "0.3949769", "0.39443713", "0.3936315", "0.39350316", "0.39301196", "0.39282224", "0.39255154", "0.39182198", "0.39065382", "0.3901515", "0.38923737", "0.38875782", "0.38852847", "0.38808456", "0.38737628", "0.38732013", "0.38725293", "0.38706696", "0.38692412", "0.38466653", "0.38379267", "0.38305172", "0.3825216" ]
0.8163413
0
The deserialization information for the current model
def get_field_deserializers() return { "countdownDisplayBeforeRestartInMinutes" => lambda {|n| @countdown_display_before_restart_in_minutes = n.get_number_value() }, "gracePeriodInMinutes" => lambda {|n| @grace_period_in_minutes = n.get_number_value() }, "@odata.type" => lambda {|n| @odata_type = n.get_string_value() }, "restartNotificationSnoozeDurationInMinutes" => lambda {|n| @restart_notification_snooze_duration_in_minutes = n.get_number_value() }, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end", "def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"fileDetails\" => lambda {|n| @file_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n })\n end", "def serialized_attributes\n read_inheritable_attribute(\"attr_serialized\") || { }\n end", "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"file\" => lambda {|n| @file = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"fileHash\" => lambda {|n| @file_hash = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"committedContentVersion\" => lambda {|n| @committed_content_version = n.get_string_value() },\n \"contentVersions\" => lambda {|n| @content_versions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppContent.create_from_discriminator_value(pn) }) },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"attribution\" => lambda {|n| @attribution = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImageInfo.create_from_discriminator_value(pn) }) },\n \"backgroundColor\" => lambda {|n| @background_color = n.get_string_value() },\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayText\" => lambda {|n| @display_text = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"detectionType\" => lambda {|n| @detection_type = n.get_string_value() },\n \"method\" => lambda {|n| @method = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resourceReference\" => lambda {|n| @resource_reference = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceReference.create_from_discriminator_value(pn) }) },\n \"resourceVisualization\" => lambda {|n| @resource_visualization = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceVisualization.create_from_discriminator_value(pn) }) },\n \"weight\" => lambda {|n| @weight = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"maxImageSize\" => lambda {|n| @max_image_size = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"timeout\" => lambda {|n| @timeout = n.get_duration_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"contentData\" => lambda {|n| @content_data = n.get_string_value() },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"headerValue\" => lambda {|n| @header_value = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"callEndSubReason\" => lambda {|n| @call_end_sub_reason = n.get_number_value() },\n \"callType\" => lambda {|n| @call_type = n.get_string_value() },\n \"calleeNumber\" => lambda {|n| @callee_number = n.get_string_value() },\n \"callerNumber\" => lambda {|n| @caller_number = n.get_string_value() },\n \"correlationId\" => lambda {|n| @correlation_id = n.get_string_value() },\n \"duration\" => lambda {|n| @duration = n.get_number_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"failureDateTime\" => lambda {|n| @failure_date_time = n.get_date_time_value() },\n \"finalSipCode\" => lambda {|n| @final_sip_code = n.get_number_value() },\n \"finalSipCodePhrase\" => lambda {|n| @final_sip_code_phrase = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"inviteDateTime\" => lambda {|n| @invite_date_time = n.get_date_time_value() },\n \"mediaBypassEnabled\" => lambda {|n| @media_bypass_enabled = n.get_boolean_value() },\n \"mediaPathLocation\" => lambda {|n| @media_path_location = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"signalingLocation\" => lambda {|n| @signaling_location = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"successfulCall\" => lambda {|n| @successful_call = n.get_boolean_value() },\n \"trunkFullyQualifiedDomainName\" => lambda {|n| @trunk_fully_qualified_domain_name = n.get_string_value() },\n \"userDisplayName\" => lambda {|n| @user_display_name = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isCourseActivitySyncEnabled\" => lambda {|n| @is_course_activity_sync_enabled = n.get_boolean_value() },\n \"learningContents\" => lambda {|n| @learning_contents = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningContent.create_from_discriminator_value(pn) }) },\n \"learningCourseActivities\" => lambda {|n| @learning_course_activities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningCourseActivity.create_from_discriminator_value(pn) }) },\n \"loginWebUrl\" => lambda {|n| @login_web_url = n.get_string_value() },\n \"longLogoWebUrlForDarkTheme\" => lambda {|n| @long_logo_web_url_for_dark_theme = n.get_string_value() },\n \"longLogoWebUrlForLightTheme\" => lambda {|n| @long_logo_web_url_for_light_theme = n.get_string_value() },\n \"squareLogoWebUrlForDarkTheme\" => lambda {|n| @square_logo_web_url_for_dark_theme = n.get_string_value() },\n \"squareLogoWebUrlForLightTheme\" => lambda {|n| @square_logo_web_url_for_light_theme = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"versionId\" => lambda {|n| @version_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"buildNumber\" => lambda {|n| @build_number = n.get_string_value() },\n \"bundleId\" => lambda {|n| @bundle_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"versionNumber\" => lambda {|n| @version_number = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroups\" => lambda {|n| @section_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroupsUrl\" => lambda {|n| @section_groups_url = n.get_string_value() },\n \"sections\" => lambda {|n| @sections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"sectionsUrl\" => lambda {|n| @sections_url = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"dataType\" => lambda {|n| @data_type = n.get_string_value() },\n \"isSyncedFromOnPremises\" => lambda {|n| @is_synced_from_on_premises = n.get_boolean_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"targetObjects\" => lambda {|n| @target_objects = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"imageFile\" => lambda {|n| @image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n \"parentProcessCreationDateTime\" => lambda {|n| @parent_process_creation_date_time = n.get_date_time_value() },\n \"parentProcessId\" => lambda {|n| @parent_process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"parentProcessImageFile\" => lambda {|n| @parent_process_image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"processCommandLine\" => lambda {|n| @process_command_line = n.get_string_value() },\n \"processCreationDateTime\" => lambda {|n| @process_creation_date_time = n.get_date_time_value() },\n \"processId\" => lambda {|n| @process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"userAccount\" => lambda {|n| @user_account = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityUserAccount.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::OperationStatus) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"completedDateTime\" => lambda {|n| @completed_date_time = n.get_date_time_value() },\n \"progress\" => lambda {|n| @progress = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::DataPolicyOperationStatus) },\n \"storageLocation\" => lambda {|n| @storage_location = n.get_string_value() },\n \"submittedDateTime\" => lambda {|n| @submitted_date_time = n.get_date_time_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"completedUnits\" => lambda {|n| @completed_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"progressObservationDateTime\" => lambda {|n| @progress_observation_date_time = n.get_date_time_value() },\n \"totalUnits\" => lambda {|n| @total_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"units\" => lambda {|n| @units = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"provisioningStepType\" => lambda {|n| @provisioning_step_type = n.get_enum_value(MicrosoftGraph::Models::ProvisioningStepType) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::ProvisioningResult) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"downloadUri\" => lambda {|n| @download_uri = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fulfilledDateTime\" => lambda {|n| @fulfilled_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodEndDateTime\" => lambda {|n| @review_history_period_end_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodStartDateTime\" => lambda {|n| @review_history_period_start_date_time = n.get_date_time_value() },\n \"runDateTime\" => lambda {|n| @run_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::AccessReviewHistoryStatus) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"check32BitOn64System\" => lambda {|n| @check32_bit_on64_system = n.get_boolean_value() },\n \"comparisonValue\" => lambda {|n| @comparison_value = n.get_string_value() },\n \"fileOrFolderName\" => lambda {|n| @file_or_folder_name = n.get_string_value() },\n \"operationType\" => lambda {|n| @operation_type = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppFileSystemOperationType) },\n \"operator\" => lambda {|n| @operator = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppRuleOperator) },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n })\n end", "def read_object\n if @version == 0\n return amf0_deserialize\n else\n return amf3_deserialize\n end\n end", "def get_field_deserializers()\n return {\n \"destinationFileName\" => lambda {|n| @destination_file_name = n.get_string_value() },\n \"sourceFile\" => lambda {|n| @source_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemReference.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return {\n \"newText\" => lambda {|n| @new_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"numBytes\" => lambda {|n| @num_bytes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"oldText\" => lambda {|n| @old_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"startNum\" => lambda {|n| @start_num = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"audioDeviceName\" => lambda {|n| @audio_device_name = n.get_string_value() },\n \"bookingType\" => lambda {|n| @booking_type = n.get_enum_value(MicrosoftGraph::Models::BookingType) },\n \"building\" => lambda {|n| @building = n.get_string_value() },\n \"capacity\" => lambda {|n| @capacity = n.get_number_value() },\n \"displayDeviceName\" => lambda {|n| @display_device_name = n.get_string_value() },\n \"emailAddress\" => lambda {|n| @email_address = n.get_string_value() },\n \"floorLabel\" => lambda {|n| @floor_label = n.get_string_value() },\n \"floorNumber\" => lambda {|n| @floor_number = n.get_number_value() },\n \"isWheelChairAccessible\" => lambda {|n| @is_wheel_chair_accessible = n.get_boolean_value() },\n \"label\" => lambda {|n| @label = n.get_string_value() },\n \"nickname\" => lambda {|n| @nickname = n.get_string_value() },\n \"tags\" => lambda {|n| @tags = n.get_collection_of_primitive_values(String) },\n \"videoDeviceName\" => lambda {|n| @video_device_name = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"targetType\" => lambda {|n| @target_type = n.get_enum_value(MicrosoftGraph::Models::FeatureTargetType) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"managedDevices\" => lambda {|n| @managed_devices = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }) },\n \"platform\" => lambda {|n| @platform = n.get_enum_value(MicrosoftGraph::Models::DetectedAppPlatformType) },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"sizeInByte\" => lambda {|n| @size_in_byte = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"activationUrl\" => lambda {|n| @activation_url = n.get_string_value() },\n \"activitySourceHost\" => lambda {|n| @activity_source_host = n.get_string_value() },\n \"appActivityId\" => lambda {|n| @app_activity_id = n.get_string_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"contentInfo\" => lambda {|n| @content_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fallbackUrl\" => lambda {|n| @fallback_url = n.get_string_value() },\n \"historyItems\" => lambda {|n| @history_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ActivityHistoryItem.create_from_discriminator_value(pn) }) },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::Status) },\n \"userTimezone\" => lambda {|n| @user_timezone = n.get_string_value() },\n \"visualElements\" => lambda {|n| @visual_elements = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::VisualInfo.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"category\" => lambda {|n| @category = n.get_string_value() },\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"malwareIdentifier\" => lambda {|n| @malware_identifier = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"lastActionDateTime\" => lambda {|n| @last_action_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operation\" => lambda {|n| @operation = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"identityType\" => lambda {|n| @identity_type = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"dataLocationCode\" => lambda {|n| @data_location_code = n.get_string_value() },\n \"hostname\" => lambda {|n| @hostname = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"root\" => lambda {|n| @root = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Root.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return {\n \"address\" => lambda {|n| @address = n.get_string_value() },\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"relevanceScore\" => lambda {|n| @relevance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"selectionLikelihood\" => lambda {|n| @selection_likelihood = n.get_enum_value(MicrosoftGraph::Models::SelectionLikelihoodInfo) },\n }\n end", "def get_field_deserializers()\n return {\n \"hashes\" => lambda {|n| @hashes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Hashes.create_from_discriminator_value(pn) }) },\n \"mimeType\" => lambda {|n| @mime_type = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"processingMetadata\" => lambda {|n| @processing_metadata = n.get_boolean_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"configurationVersion\" => lambda {|n| @configuration_version = n.get_number_value() },\n \"errorCount\" => lambda {|n| @error_count = n.get_number_value() },\n \"failedCount\" => lambda {|n| @failed_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"notApplicableCount\" => lambda {|n| @not_applicable_count = n.get_number_value() },\n \"pendingCount\" => lambda {|n| @pending_count = n.get_number_value() },\n \"successCount\" => lambda {|n| @success_count = n.get_number_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"format\" => lambda {|n| @format = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartDataLabelFormat.create_from_discriminator_value(pn) }) },\n \"position\" => lambda {|n| @position = n.get_string_value() },\n \"separator\" => lambda {|n| @separator = n.get_string_value() },\n \"showBubbleSize\" => lambda {|n| @show_bubble_size = n.get_boolean_value() },\n \"showCategoryName\" => lambda {|n| @show_category_name = n.get_boolean_value() },\n \"showLegendKey\" => lambda {|n| @show_legend_key = n.get_boolean_value() },\n \"showPercentage\" => lambda {|n| @show_percentage = n.get_boolean_value() },\n \"showSeriesName\" => lambda {|n| @show_series_name = n.get_boolean_value() },\n \"showValue\" => lambda {|n| @show_value = n.get_boolean_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"errorDetails\" => lambda {|n| @error_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::GenericError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"sourceId\" => lambda {|n| @source_id = n.get_string_value() },\n \"targetId\" => lambda {|n| @target_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"contentSource\" => lambda {|n| @content_source = n.get_string_value() },\n \"hitId\" => lambda {|n| @hit_id = n.get_string_value() },\n \"isCollapsed\" => lambda {|n| @is_collapsed = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"rank\" => lambda {|n| @rank = n.get_number_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resultTemplateId\" => lambda {|n| @result_template_id = n.get_string_value() },\n \"summary\" => lambda {|n| @summary = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"assignedUserPrincipalName\" => lambda {|n| @assigned_user_principal_name = n.get_string_value() },\n \"groupTag\" => lambda {|n| @group_tag = n.get_string_value() },\n \"hardwareIdentifier\" => lambda {|n| @hardware_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"importId\" => lambda {|n| @import_id = n.get_string_value() },\n \"productKey\" => lambda {|n| @product_key = n.get_string_value() },\n \"serialNumber\" => lambda {|n| @serial_number = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentityState.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"audioRoutingGroups\" => lambda {|n| @audio_routing_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AudioRoutingGroup.create_from_discriminator_value(pn) }) },\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_string_value() },\n \"callOptions\" => lambda {|n| @call_options = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallOptions.create_from_discriminator_value(pn) }) },\n \"callRoutes\" => lambda {|n| @call_routes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CallRoute.create_from_discriminator_value(pn) }) },\n \"callbackUri\" => lambda {|n| @callback_uri = n.get_string_value() },\n \"chatInfo\" => lambda {|n| @chat_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ChatInfo.create_from_discriminator_value(pn) }) },\n \"contentSharingSessions\" => lambda {|n| @content_sharing_sessions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ContentSharingSession.create_from_discriminator_value(pn) }) },\n \"direction\" => lambda {|n| @direction = n.get_enum_value(MicrosoftGraph::Models::CallDirection) },\n \"incomingContext\" => lambda {|n| @incoming_context = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IncomingContext.create_from_discriminator_value(pn) }) },\n \"mediaConfig\" => lambda {|n| @media_config = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaConfig.create_from_discriminator_value(pn) }) },\n \"mediaState\" => lambda {|n| @media_state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallMediaState.create_from_discriminator_value(pn) }) },\n \"meetingInfo\" => lambda {|n| @meeting_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MeetingInfo.create_from_discriminator_value(pn) }) },\n \"myParticipantId\" => lambda {|n| @my_participant_id = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CommsOperation.create_from_discriminator_value(pn) }) },\n \"participants\" => lambda {|n| @participants = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Participant.create_from_discriminator_value(pn) }) },\n \"requestedModalities\" => lambda {|n| @requested_modalities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Modality.create_from_discriminator_value(pn) }) },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"source\" => lambda {|n| @source = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ParticipantInfo.create_from_discriminator_value(pn) }) },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::CallState) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"targets\" => lambda {|n| @targets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::InvitationParticipantInfo.create_from_discriminator_value(pn) }) },\n \"tenantId\" => lambda {|n| @tenant_id = n.get_string_value() },\n \"toneInfo\" => lambda {|n| @tone_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ToneInfo.create_from_discriminator_value(pn) }) },\n \"transcription\" => lambda {|n| @transcription = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallTranscriptionInfo.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"teacherNumber\" => lambda {|n| @teacher_number = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"key\" => lambda {|n| @key = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"thumbprint\" => lambda {|n| @thumbprint = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"usage\" => lambda {|n| @usage = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"allowMultipleLines\" => lambda {|n| @allow_multiple_lines = n.get_boolean_value() },\n \"appendChangesToExistingText\" => lambda {|n| @append_changes_to_existing_text = n.get_boolean_value() },\n \"linesForEditing\" => lambda {|n| @lines_for_editing = n.get_number_value() },\n \"maxLength\" => lambda {|n| @max_length = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"textType\" => lambda {|n| @text_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"assignCategories\" => lambda {|n| @assign_categories = n.get_collection_of_primitive_values(String) },\n \"copyToFolder\" => lambda {|n| @copy_to_folder = n.get_string_value() },\n \"delete\" => lambda {|n| @delete = n.get_boolean_value() },\n \"forwardAsAttachmentTo\" => lambda {|n| @forward_as_attachment_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"forwardTo\" => lambda {|n| @forward_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"markAsRead\" => lambda {|n| @mark_as_read = n.get_boolean_value() },\n \"markImportance\" => lambda {|n| @mark_importance = n.get_enum_value(MicrosoftGraph::Models::Importance) },\n \"moveToFolder\" => lambda {|n| @move_to_folder = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"permanentDelete\" => lambda {|n| @permanent_delete = n.get_boolean_value() },\n \"redirectTo\" => lambda {|n| @redirect_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"stopProcessingRules\" => lambda {|n| @stop_processing_rules = n.get_boolean_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"acceptMappedClaims\" => lambda {|n| @accept_mapped_claims = n.get_boolean_value() },\n \"knownClientApplications\" => lambda {|n| @known_client_applications = n.get_collection_of_primitive_values(UUIDTools::UUID) },\n \"oauth2PermissionScopes\" => lambda {|n| @oauth2_permission_scopes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PermissionScope.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preAuthorizedApplications\" => lambda {|n| @pre_authorized_applications = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PreAuthorizedApplication.create_from_discriminator_value(pn) }) },\n \"requestedAccessTokenVersion\" => lambda {|n| @requested_access_token_version = n.get_number_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdByAppId\" => lambda {|n| @created_by_app_id = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"level\" => lambda {|n| @level = n.get_number_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PageLinks.create_from_discriminator_value(pn) }) },\n \"order\" => lambda {|n| @order = n.get_number_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSection\" => lambda {|n| @parent_section = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"userTags\" => lambda {|n| @user_tags = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return {\n \"failedRuns\" => lambda {|n| @failed_runs = n.get_number_value() },\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulRuns\" => lambda {|n| @successful_runs = n.get_number_value() },\n \"totalRuns\" => lambda {|n| @total_runs = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_guid_value() },\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"recommendedActions\" => lambda {|n| @recommended_actions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RecommendedAction.create_from_discriminator_value(pn) }) },\n \"resolvedTargetsCount\" => lambda {|n| @resolved_targets_count = n.get_number_value() },\n \"simulationEventsContent\" => lambda {|n| @simulation_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SimulationEventsContent.create_from_discriminator_value(pn) }) },\n \"trainingEventsContent\" => lambda {|n| @training_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TrainingEventsContent.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"hint\" => lambda {|n| @hint = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"secretText\" => lambda {|n| @secret_text = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"isRequired\" => lambda {|n| @is_required = n.get_boolean_value() },\n \"locations\" => lambda {|n| @locations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LocationConstraintItem.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"suggestLocation\" => lambda {|n| @suggest_location = n.get_boolean_value() },\n }\n end", "def metadata\n self.class.metadata\n end", "def get_field_deserializers()\n return {\n \"activityType\" => lambda {|n| @activity_type = n.get_string_value() },\n \"chainId\" => lambda {|n| @chain_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"previewText\" => lambda {|n| @preview_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"recipient\" => lambda {|n| @recipient = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkNotificationRecipient.create_from_discriminator_value(pn) }) },\n \"templateParameters\" => lambda {|n| @template_parameters = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::KeyValuePair.create_from_discriminator_value(pn) }) },\n \"topic\" => lambda {|n| @topic = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkActivityTopic.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return {\n \"activityIdentifier\" => lambda {|n| @activity_identifier = n.get_string_value() },\n \"countEntitled\" => lambda {|n| @count_entitled = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEntitledForProvisioning\" => lambda {|n| @count_entitled_for_provisioning = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowed\" => lambda {|n| @count_escrowed = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowedRaw\" => lambda {|n| @count_escrowed_raw = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExported\" => lambda {|n| @count_exported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExports\" => lambda {|n| @count_exports = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImported\" => lambda {|n| @count_imported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedDeltas\" => lambda {|n| @count_imported_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedReferenceDeltas\" => lambda {|n| @count_imported_reference_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"error\" => lambda {|n| @error = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::SynchronizationTaskExecutionResult) },\n \"timeBegan\" => lambda {|n| @time_began = n.get_date_time_value() },\n \"timeEnded\" => lambda {|n| @time_ended = n.get_date_time_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"content\" => lambda {|n| @content = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"transportKey\" => lambda {|n| @transport_key = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"activeDeviceCount\" => lambda {|n| @active_device_count = n.get_number_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"modelAppHealthScore\" => lambda {|n| @model_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceAccess\" => lambda {|n| @resource_access = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ResourceAccess.create_from_discriminator_value(pn) }) },\n \"resourceAppId\" => lambda {|n| @resource_app_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"key\" => lambda {|n| @key = n.get_string_value() },\n \"volumeType\" => lambda {|n| @volume_type = n.get_enum_value(MicrosoftGraph::Models::VolumeType) },\n })\n end", "def get_field_deserializers()\n return {\n \"anchor\" => lambda {|n| @anchor = n.get_boolean_value() },\n \"apiExpressions\" => lambda {|n| @api_expressions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::StringKeyStringValuePair.create_from_discriminator_value(pn) }) },\n \"caseExact\" => lambda {|n| @case_exact = n.get_boolean_value() },\n \"defaultValue\" => lambda {|n| @default_value = n.get_string_value() },\n \"flowNullValues\" => lambda {|n| @flow_null_values = n.get_boolean_value() },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeDefinitionMetadataEntry.create_from_discriminator_value(pn) }) },\n \"multivalued\" => lambda {|n| @multivalued = n.get_boolean_value() },\n \"mutability\" => lambda {|n| @mutability = n.get_enum_value(MicrosoftGraph::Models::Mutability) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"referencedObjects\" => lambda {|n| @referenced_objects = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ReferencedObject.create_from_discriminator_value(pn) }) },\n \"required\" => lambda {|n| @required = n.get_boolean_value() },\n \"type\" => lambda {|n| @type = n.get_enum_value(MicrosoftGraph::Models::AttributeType) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"averageBlueScreens\" => lambda {|n| @average_blue_screens = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"averageRestarts\" => lambda {|n| @average_restarts = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"blueScreenCount\" => lambda {|n| @blue_screen_count = n.get_number_value() },\n \"bootScore\" => lambda {|n| @boot_score = n.get_number_value() },\n \"coreBootTimeInMs\" => lambda {|n| @core_boot_time_in_ms = n.get_number_value() },\n \"coreLoginTimeInMs\" => lambda {|n| @core_login_time_in_ms = n.get_number_value() },\n \"deviceCount\" => lambda {|n| @device_count = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"diskType\" => lambda {|n| @disk_type = n.get_enum_value(MicrosoftGraph::Models::DiskType) },\n \"groupPolicyBootTimeInMs\" => lambda {|n| @group_policy_boot_time_in_ms = n.get_number_value() },\n \"groupPolicyLoginTimeInMs\" => lambda {|n| @group_policy_login_time_in_ms = n.get_number_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"loginScore\" => lambda {|n| @login_score = n.get_number_value() },\n \"manufacturer\" => lambda {|n| @manufacturer = n.get_string_value() },\n \"model\" => lambda {|n| @model = n.get_string_value() },\n \"modelStartupPerformanceScore\" => lambda {|n| @model_startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"operatingSystemVersion\" => lambda {|n| @operating_system_version = n.get_string_value() },\n \"responsiveDesktopTimeInMs\" => lambda {|n| @responsive_desktop_time_in_ms = n.get_number_value() },\n \"restartCount\" => lambda {|n| @restart_count = n.get_number_value() },\n \"startupPerformanceScore\" => lambda {|n| @startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"connectingIP\" => lambda {|n| @connecting_i_p = n.get_string_value() },\n \"deliveryAction\" => lambda {|n| @delivery_action = n.get_string_value() },\n \"deliveryLocation\" => lambda {|n| @delivery_location = n.get_string_value() },\n \"directionality\" => lambda {|n| @directionality = n.get_string_value() },\n \"internetMessageId\" => lambda {|n| @internet_message_id = n.get_string_value() },\n \"messageFingerprint\" => lambda {|n| @message_fingerprint = n.get_string_value() },\n \"messageReceivedDateTime\" => lambda {|n| @message_received_date_time = n.get_date_time_value() },\n \"messageSubject\" => lambda {|n| @message_subject = n.get_string_value() },\n \"networkMessageId\" => lambda {|n| @network_message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"application\" => lambda {|n| @application = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Identity.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preventsDownload\" => lambda {|n| @prevents_download = n.get_boolean_value() },\n \"scope\" => lambda {|n| @scope = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"webHtml\" => lambda {|n| @web_html = n.get_string_value() },\n \"webUrl\" => lambda {|n| @web_url = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"uploadUrl\" => lambda {|n| @upload_url = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"attributeMappings\" => lambda {|n| @attribute_mappings = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeMapping.create_from_discriminator_value(pn) }) },\n \"enabled\" => lambda {|n| @enabled = n.get_boolean_value() },\n \"flowTypes\" => lambda {|n| @flow_types = n.get_enum_value(MicrosoftGraph::Models::ObjectFlowTypes) },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ObjectMappingMetadataEntry.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"scope\" => lambda {|n| @scope = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Filter.create_from_discriminator_value(pn) }) },\n \"sourceObjectName\" => lambda {|n| @source_object_name = n.get_string_value() },\n \"targetObjectName\" => lambda {|n| @target_object_name = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceCountWithCrashes\" => lambda {|n| @device_count_with_crashes = n.get_number_value() },\n \"isLatestUsedVersion\" => lambda {|n| @is_latest_used_version = n.get_boolean_value() },\n \"isMostUsedVersion\" => lambda {|n| @is_most_used_version = n.get_boolean_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionLinks.create_from_discriminator_value(pn) }) },\n \"pages\" => lambda {|n| @pages = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenotePage.create_from_discriminator_value(pn) }) },\n \"pagesUrl\" => lambda {|n| @pages_url = n.get_string_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appHangCount\" => lambda {|n| @app_hang_count = n.get_number_value() },\n \"crashedAppCount\" => lambda {|n| @crashed_app_count = n.get_number_value() },\n \"deviceAppHealthScore\" => lambda {|n| @device_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"messageId\" => lambda {|n| @message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"replyChainMessageId\" => lambda {|n| @reply_chain_message_id = n.get_string_value() },\n \"threadId\" => lambda {|n| @thread_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"isUsable\" => lambda {|n| @is_usable = n.get_boolean_value() },\n \"isUsableOnce\" => lambda {|n| @is_usable_once = n.get_boolean_value() },\n \"lifetimeInMinutes\" => lambda {|n| @lifetime_in_minutes = n.get_number_value() },\n \"methodUsabilityReason\" => lambda {|n| @method_usability_reason = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"temporaryAccessPass\" => lambda {|n| @temporary_access_pass = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"bargeInAllowed\" => lambda {|n| @barge_in_allowed = n.get_boolean_value() },\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"initialSilenceTimeoutInSeconds\" => lambda {|n| @initial_silence_timeout_in_seconds = n.get_number_value() },\n \"maxRecordDurationInSeconds\" => lambda {|n| @max_record_duration_in_seconds = n.get_number_value() },\n \"maxSilenceTimeoutInSeconds\" => lambda {|n| @max_silence_timeout_in_seconds = n.get_number_value() },\n \"playBeep\" => lambda {|n| @play_beep = n.get_boolean_value() },\n \"prompts\" => lambda {|n| @prompts = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Prompt.create_from_discriminator_value(pn) }) },\n \"stopTones\" => lambda {|n| @stop_tones = n.get_collection_of_primitive_values(String) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"owner\" => lambda {|n| @owner = n.get_string_value() },\n \"properties\" => lambda {|n| @properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ExtensionSchemaProperty.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n \"targetTypes\" => lambda {|n| @target_types = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"response\" => lambda {|n| @response = n.get_enum_value(MicrosoftGraph::Models::ResponseType) },\n \"time\" => lambda {|n| @time = n.get_date_time_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"driveId\" => lambda {|n| @drive_id = n.get_string_value() },\n \"driveType\" => lambda {|n| @drive_type = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n \"shareId\" => lambda {|n| @share_id = n.get_string_value() },\n \"sharepointIds\" => lambda {|n| @sharepoint_ids = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SharepointIds.create_from_discriminator_value(pn) }) },\n \"siteId\" => lambda {|n| @site_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"activeMalwareDetectionCount\" => lambda {|n| @active_malware_detection_count = n.get_number_value() },\n \"category\" => lambda {|n| @category = n.get_enum_value(MicrosoftGraph::Models::WindowsMalwareCategory) },\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"distinctActiveMalwareCount\" => lambda {|n| @distinct_active_malware_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"issuerName\" => lambda {|n| @issuer_name = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::CertificateStatus) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"subjectName\" => lambda {|n| @subject_name = n.get_string_value() },\n \"uploadDateTime\" => lambda {|n| @upload_date_time = n.get_date_time_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"servicePrincipalId\" => lambda {|n| @service_principal_id = n.get_string_value() },\n \"servicePrincipalName\" => lambda {|n| @service_principal_name = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"riskDetections\" => lambda {|n| @risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskDetection.create_from_discriminator_value(pn) }) },\n \"riskyServicePrincipals\" => lambda {|n| @risky_service_principals = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyServicePrincipal.create_from_discriminator_value(pn) }) },\n \"riskyUsers\" => lambda {|n| @risky_users = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyUser.create_from_discriminator_value(pn) }) },\n \"servicePrincipalRiskDetections\" => lambda {|n| @service_principal_risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ServicePrincipalRiskDetection.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return {\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"failedUsers\" => lambda {|n| @failed_users = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulUsers\" => lambda {|n| @successful_users = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"durationInSeconds\" => lambda {|n| @duration_in_seconds = n.get_number_value() },\n \"joinDateTime\" => lambda {|n| @join_date_time = n.get_date_time_value() },\n \"leaveDateTime\" => lambda {|n| @leave_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"applicationId\" => lambda {|n| @application_id = n.get_string_value() },\n \"changeType\" => lambda {|n| @change_type = n.get_string_value() },\n \"clientState\" => lambda {|n| @client_state = n.get_string_value() },\n \"creatorId\" => lambda {|n| @creator_id = n.get_string_value() },\n \"encryptionCertificate\" => lambda {|n| @encryption_certificate = n.get_string_value() },\n \"encryptionCertificateId\" => lambda {|n| @encryption_certificate_id = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"includeResourceData\" => lambda {|n| @include_resource_data = n.get_boolean_value() },\n \"latestSupportedTlsVersion\" => lambda {|n| @latest_supported_tls_version = n.get_string_value() },\n \"lifecycleNotificationUrl\" => lambda {|n| @lifecycle_notification_url = n.get_string_value() },\n \"notificationQueryOptions\" => lambda {|n| @notification_query_options = n.get_string_value() },\n \"notificationUrl\" => lambda {|n| @notification_url = n.get_string_value() },\n \"notificationUrlAppId\" => lambda {|n| @notification_url_app_id = n.get_string_value() },\n \"resource\" => lambda {|n| @resource = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"entityType\" => lambda {|n| @entity_type = n.get_string_value() },\n \"mailNickname\" => lambda {|n| @mail_nickname = n.get_string_value() },\n \"onBehalfOfUserId\" => lambda {|n| @on_behalf_of_user_id = n.get_guid_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"actionName\" => lambda {|n| @action_name = n.get_string_value() },\n \"actionState\" => lambda {|n| @action_state = n.get_enum_value(MicrosoftGraph::Models::ActionState) },\n \"lastUpdatedDateTime\" => lambda {|n| @last_updated_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"accountName\" => lambda {|n| @account_name = n.get_string_value() },\n \"azureAdUserId\" => lambda {|n| @azure_ad_user_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"domainName\" => lambda {|n| @domain_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n \"userSid\" => lambda {|n| @user_sid = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"uri\" => lambda {|n| @uri = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_guid_value() },\n \"cloudServiceDeploymentEnvironment\" => lambda {|n| @cloud_service_deployment_environment = n.get_string_value() },\n \"cloudServiceDeploymentId\" => lambda {|n| @cloud_service_deployment_id = n.get_string_value() },\n \"cloudServiceInstanceName\" => lambda {|n| @cloud_service_instance_name = n.get_string_value() },\n \"cloudServiceName\" => lambda {|n| @cloud_service_name = n.get_string_value() },\n \"deviceDescription\" => lambda {|n| @device_description = n.get_string_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"mediaLegId\" => lambda {|n| @media_leg_id = n.get_guid_value() },\n \"mediaQualityList\" => lambda {|n| @media_quality_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TeleconferenceDeviceMediaQuality.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"participantId\" => lambda {|n| @participant_id = n.get_guid_value() },\n }\n end", "def _before_validation\n serialize_deserialized_values\n super\n end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isBuiltIn\" => lambda {|n| @is_built_in = n.get_boolean_value() },\n \"roleAssignments\" => lambda {|n| @role_assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RoleAssignment.create_from_discriminator_value(pn) }) },\n \"rolePermissions\" => lambda {|n| @role_permissions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RolePermission.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"kind\" => lambda {|n| @kind = n.get_string_value() },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"color\" => lambda {|n| @color = n.get_string_value() },\n \"criterion1\" => lambda {|n| @criterion1 = n.get_string_value() },\n \"criterion2\" => lambda {|n| @criterion2 = n.get_string_value() },\n \"dynamicCriteria\" => lambda {|n| @dynamic_criteria = n.get_string_value() },\n \"filterOn\" => lambda {|n| @filter_on = n.get_string_value() },\n \"icon\" => lambda {|n| @icon = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookIcon.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operator\" => lambda {|n| @operator = n.get_string_value() },\n \"values\" => lambda {|n| @values = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end" ]
[ "0.6509998", "0.63227415", "0.6322392", "0.6309548", "0.62951833", "0.6238928", "0.6232376", "0.62152934", "0.61999905", "0.6199392", "0.61739326", "0.6173496", "0.61706567", "0.6162942", "0.6162062", "0.61583054", "0.6155537", "0.61427283", "0.61399007", "0.6137798", "0.6120025", "0.6088851", "0.60868955", "0.60789084", "0.6078404", "0.6070221", "0.6063158", "0.6062596", "0.60611033", "0.6058345", "0.60554725", "0.60513496", "0.6046613", "0.60464156", "0.6031814", "0.60290515", "0.6028043", "0.6025454", "0.602198", "0.6021075", "0.6009831", "0.59888804", "0.5984757", "0.5979247", "0.5975307", "0.59697145", "0.59676003", "0.5966398", "0.5965411", "0.5962747", "0.59516203", "0.59507483", "0.594572", "0.5944817", "0.5939268", "0.5936285", "0.5936266", "0.5932101", "0.59312516", "0.5930864", "0.5930243", "0.5926375", "0.59258074", "0.59237", "0.5922048", "0.5916617", "0.59134203", "0.59132415", "0.5912952", "0.5910477", "0.5905932", "0.5905854", "0.59042746", "0.5903413", "0.59029424", "0.5902557", "0.5902169", "0.59018713", "0.5901364", "0.58974844", "0.58913356", "0.5890406", "0.5885685", "0.58855057", "0.58848786", "0.5883642", "0.5883642", "0.5883642", "0.58811307", "0.5878333", "0.58768684", "0.5869237", "0.5844152", "0.58428645", "0.5840328", "0.58383965", "0.5836443", "0.5835752", "0.5835697", "0.58346224", "0.5833712" ]
0.0
-1
Gets the gracePeriodInMinutes property value. The number of minutes to wait before restarting the device after an app installation.
def grace_period_in_minutes return @grace_period_in_minutes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grace_period\n config['grace_period'] || 60\n end", "def grace_period_in_minutes=(value)\n @grace_period_in_minutes = value\n end", "def grace_period\n Integer(ENV[\"BUDDY_CHECK_GRACE_PERIOD\"].presence || \"4\").hours\n end", "def grace_period\n (ENV[\"BUDDY_CHECK_GRACE_PERIOD\"].presence || \"4\").to_i.hours\n end", "def health_check_grace_period\n @group.health_check_grace_period\n end", "def remaining_days_of_grace\n self.expire_on - Date.today - 1\n end", "def date_inside_grace_window(expires_on)\n (expires_on + Rails.configuration.registration_grace_window) - 1.day\n end", "def shutdown_grace_timeout\n @shutdown_grace_timeout || 2\n end", "def lifetime_in_minutes\n return @lifetime_in_minutes\n end", "def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end", "def grace_period_expires_date\n read_datetime_from_string('grace_period_expires_date')\n end", "def grace_duration=(grace_duration)\n\n if !grace_duration.nil? && grace_duration < 0\n fail ArgumentError, \"invalid value for 'grace_duration', must be greater than or equal to 0.\"\n end\n\n @grace_duration = grace_duration\n end", "def lock_interval\n get_settings[:lock_interval]\n end", "def last_day_of_standard_grace_window\n (expiry_date + Rails.configuration.grace_window.days) - 1.day\n end", "def timeout_in_minutes\n data[:timeout_in_minutes]\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def lock_timeout\n result = Mimi::DB.execute('select setting from pg_settings where name = ?', :lock_timeout)\n value = result.first['setting'].to_i\n value = value.to_f / 1000 unless value == 0\n value\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if self.admin?\n 10.minutes\n else\n 15.minutes\n end\n end", "def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end", "def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end", "def last_day_of_grace_window_with_covid_extension\n (expiry_date + Rails.configuration.covid_grace_window.days) - 1.day\n end", "def monitoring_interval\n data[:monitoring_interval]\n end", "def monitoring_interval\n data[:monitoring_interval]\n end", "def last_day_of_extended_grace_window\n (expiry_date + Rails.configuration.expires_after.years) - 1.day\n end", "def period_length_in_seconds\n @period_length_in_seconds ||= period_length.to_i.minutes.to_i\n end", "def days_remaining_until_password_expire\n @attributes[:days_remaining_until_password_expire]\n end", "def timeout_in\n 30.days\n end", "def grace_days_usable\n course_grace_days = assessment.course.grace_days\n assessment_max_grace_days = assessment.max_grace_days\n\n # save doing potentially expensive stuff if not needed\n return 0 if course_grace_days == 0 || assessment_max_grace_days == 0\n\n grace_days_left = course_grace_days - cumulative_grace_days_used_before\n raise \"fatal: negative grace days left\" if grace_days_left < 0\n\n # if the assessment has no max_grace_days specified, then upto grace_days_left\n # number of grace days can be used on this assessment\n if assessment_max_grace_days\n [grace_days_left, assessment_max_grace_days].min\n else\n grace_days_left\n end\n end", "def shutdown_timeout\n (\n options[:shutdown_timeout] ||\n rails_config[:shutdown_timeout] ||\n env['GOOD_JOB_SHUTDOWN_TIMEOUT'] ||\n DEFAULT_SHUTDOWN_TIMEOUT\n ).to_f\n end", "def expired?(grace_period = 60)\n Time.now > read_attribute(:created_at) + read_attribute(:expires_in) - grace_period\n end", "def max_interval\n MAX_INTERVAL\n end", "def retry_interval\n @options[:retry_interval]\n end", "def on_grace_period\n !!(ends_at && ends_at.future?)\n end", "def inactivity_timeout\n\t\tif (ENV['inactivity_timeout'] != nil)\n\t\t ENV['inactivity_timeout'].to_i\n\t\telse\n\t\t 1200\n\t\tend\n\tend", "def interval\n 30.seconds\n end", "def group_policy_boot_time_in_ms\n return @group_policy_boot_time_in_ms\n end", "def group_policy_boot_time_in_ms\n return @group_policy_boot_time_in_ms\n end", "def period_in_secs\n if period_in_ns\n period_in_ns * (10**-9)\n end\n end", "def backup_retention_period\n data[:backup_retention_period]\n end", "def backup_retention_period\n data[:backup_retention_period]\n end", "def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end", "def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end", "def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end", "def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end", "def today_minutes_resting\n self[:min_rest]\n end", "def timeout_in\n 15.minutes\n end", "def persistent_delay\n get_config_value(:persistent_delay, 5)\n end", "def server_timeout\n get_configuration 'server_timeout', @config\n rescue\n 60\n end", "def trial_days_remaining\n days_elapsed = (Time.now.to_i - self.trial_started_at.to_i) / 60 / 60 / 24\n remaining = APP_CONFIG['trial_length'] - days_elapsed\n remaining = 0 if remaining < 0\n remaining\n end", "def lock_duration\n Core::Utils::Interval.try_convert(@lock_duration)\n end", "def poll_interval\n interval = (\n options[:poll_interval] ||\n rails_config[:poll_interval] ||\n env['GOOD_JOB_POLL_INTERVAL']\n )\n\n if interval\n interval.to_i\n elsif Rails.env.development? && execution_mode.in?([:async, :async_all, :async_server])\n DEFAULT_DEVELOPMENT_ASYNC_POLL_INTERVAL\n else\n DEFAULT_POLL_INTERVAL\n end\n end", "def timelimit\n 15.minutes\n end", "def seen_renewals_remaining\n Float::INFINITY\n end", "def heartbeat_timeout\n data.heartbeat_timeout\n end", "def getMinutes\r\n\t\t\t\t\treturn @minutes\r\n\t\t\t\tend", "def _timeout_in\n 1.minute\n end", "def schedule_to_close_timeout; Float::INFINITY; end", "def timeout_in\n\t if self.role=='admin'\n\t 7.days\n\t else\n\t 2.days\n\t end\n\tend", "def retry_interval\n @retry_interval ||= options[:retry_interval] || RETRY_INTERVAL\n end", "def version_retention_period\n @grpc.version_retention_period\n end", "def unpaid_grace_period_amount\n total_grace_period_amount - paid_grace_period_amount\n end", "def duration_before_automatic_denial\n return @duration_before_automatic_denial\n end", "def timeout_seconds\n return 1200\n end", "def default_task_heartbeat_timeout; Float::INFINITY; end", "def max_wait_time\n @data[\"max_wait_time\"]\n end", "def threshold_for_offline\n 8.days\n end", "def time_remaining\n member.last_backup_job.time_remaining rescue 0\n end", "def donation_interval\n # Some donors can have a custom donation interval\n if custom_donation_interval.present?\n return custom_donation_interval\n end\n \n if donations.where(amount: most_typical_amount).count > 2\n span_secs = donations.maximum(:donated_at) - donations.minimum(:donated_at)\n avg_secs = span_secs / (donations.where(amount: most_typical_amount).count - 1)\n (avg_secs / (24 * 60 * 60)).round\n else\n 30\n end\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout\n return @work_profile_password_minutes_of_inactivity_before_screen_timeout\n end", "def worker_watchdog_threshold\n 60\n end", "def work_profile_password_expiration_days\n return @work_profile_password_expiration_days\n end", "def passcode_minutes_of_inactivity_before_lock\n return @passcode_minutes_of_inactivity_before_lock\n end", "def is_in_billing_retry_period # rubocop:disable Naming/PredicateName\n read_integer('is_in_billing_retry_period')\n end", "def connect_retry_period\n NewRelic::CONNECT_RETRY_PERIODS[connect_attempts] || NewRelic::MAX_RETRY_PERIOD\n end", "def alarm\n return @alarm ||= Mhc::PropertyValue::Period.new\n end", "def alarm\n return @alarm ||= Mhc::PropertyValue::Period.new\n end", "def interval\n config_get('bfd_global', 'interval', @get_args)\n end", "def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time.now.utc.to_i\n end", "def interval\n (self['resque.interval'] || 5).to_i\n end", "def max_req_timeout\n @max_req_timeout ||= ENV.fetch(\"MAX_REQ_TIMEOUT\", 60 * 60 * 1_000).to_i\n end", "def getDurationMinutes\r\n\t\t\t\t\treturn @durationMinutes\r\n\t\t\t\tend", "def backup_retention_period\n @dbi.backup_retention_period\n end", "def backup_retention_period\n @dbi.backup_retention_period\n end", "def wait_time\n if rate_limit_remaining < 50\n [rate_limit_reset - Time.zone.now, 0.001].sort.last\n else\n 3600.0 / rate_limiting\n end\n end", "def seconds_until_expiration(now=Time.now)\n ((@ends_at - now).abs).round\n end", "def credentials_refresh_threshold\n @aws_credentials_refresh_threshold_seconds || 15\n end", "def heartbeat_timeout; Float::INFINITY; end", "def version_check_interval\n Tml.config.cache[:version_check_interval] || 3600\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def idle_time_before_sleep_in_seconds\n return @idle_time_before_sleep_in_seconds\n end", "def dep_time_loc_minutes\n dep_minutes_since_midnight\n end", "def get_time_required\n 0 # number of minutes\n end", "def fabricpath_interval\n config_get('bfd_global', 'fabricpath_interval', @get_args)\n end", "def getFrequency()\n# @config[\"demandFactoryConf\"][\"frequency\"]\n interval = @config[\"demandFactoryConf\"][\"configList\"][0][\"interval\"] ;\n return 60 * 60 / interval.to_f ;\n end", "def minutes\n _nudge[1]\n end" ]
[ "0.7927201", "0.7733176", "0.75255436", "0.7262469", "0.6507338", "0.62577146", "0.5999537", "0.59116185", "0.5834151", "0.57465625", "0.57101595", "0.5709149", "0.5608274", "0.55790067", "0.5444113", "0.53648925", "0.53648925", "0.53526986", "0.53356713", "0.53356713", "0.53356713", "0.533268", "0.5325971", "0.5325971", "0.5324852", "0.53178984", "0.53178984", "0.53075546", "0.5291337", "0.5273149", "0.52692395", "0.52675873", "0.5263535", "0.5249007", "0.52363855", "0.5223236", "0.5218177", "0.52176976", "0.5207515", "0.5178125", "0.5178125", "0.5167208", "0.5141991", "0.5141991", "0.50887805", "0.5079422", "0.5059413", "0.5059413", "0.5034724", "0.5019949", "0.5008845", "0.50052834", "0.49963742", "0.49878874", "0.4984495", "0.49713764", "0.49486777", "0.49470094", "0.4946818", "0.49432757", "0.49425426", "0.49395445", "0.49124044", "0.4908246", "0.49027", "0.49012193", "0.48985356", "0.4896744", "0.48963144", "0.48934877", "0.48924023", "0.4886044", "0.48661146", "0.48619187", "0.48588687", "0.48346657", "0.4826013", "0.48209643", "0.48107088", "0.48107088", "0.48103443", "0.480832", "0.48041442", "0.4794908", "0.47902825", "0.4785261", "0.4785261", "0.47830418", "0.4782134", "0.47801596", "0.47759703", "0.47745332", "0.47713026", "0.47713026", "0.4769284", "0.47633806", "0.47556525", "0.47496033", "0.4745407", "0.47444624" ]
0.852647
0
Sets the gracePeriodInMinutes property value. The number of minutes to wait before restarting the device after an app installation.
def grace_period_in_minutes=(value) @grace_period_in_minutes = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grace_period\n config['grace_period'] || 60\n end", "def grace_period_in_minutes\n return @grace_period_in_minutes\n end", "def grace_period\n Integer(ENV[\"BUDDY_CHECK_GRACE_PERIOD\"].presence || \"4\").hours\n end", "def grace_period\n (ENV[\"BUDDY_CHECK_GRACE_PERIOD\"].presence || \"4\").to_i.hours\n end", "def grace_duration=(grace_duration)\n\n if !grace_duration.nil? && grace_duration < 0\n fail ArgumentError, \"invalid value for 'grace_duration', must be greater than or equal to 0.\"\n end\n\n @grace_duration = grace_duration\n end", "def shutdown_grace_timeout\n @shutdown_grace_timeout || 2\n end", "def expire_after_grace!(transaction = nil)\n return unless self.expire_on.nil? # You only set this once subsequent failed transactions shouldn't affect expiration\n self.expire_on = [Date.today, paid_through].max + Freemium.days_grace\n transaction.message = \"now set to expire on #{self.expire_on}\" if transaction\n Freemium.mailer.deliver_expiration_warning(self)\n transaction.save! if transaction\n save!\n end", "def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end", "def date_inside_grace_window(expires_on)\n (expires_on + Rails.configuration.registration_grace_window) - 1.day\n end", "def health_check_grace_period\n @group.health_check_grace_period\n end", "def remaining_days_of_grace\n self.expire_on - Date.today - 1\n end", "def on_grace_period\n !!(ends_at && ends_at.future?)\n end", "def set_max_wait_time\n q = 'Set the MAX WAIT TIME after executing the RESTART command ' \\\n '(>= 180 secs): '\n until @max_wait && @max_wait.to_i > 179\n @max_wait = Utils.qna(q.cyan, true)\n end\n end", "def grace_period_expires_date\n read_datetime_from_string('grace_period_expires_date')\n end", "def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end", "def signal_restart_graceful\n @signal_operation_queue << :restart_graceful\n interrupt_server_polling_sleep\n nil\n end", "def terminate_at(seconds = 60)\n @terminate_at = seconds\n end", "def setMinutes(minutes)\r\n\t\t\t\t\t@minutes = minutes\r\n\t\t\t\tend", "def implicit_wait=(seconds); end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def lock_interval= value\n put_settings(get_settings.tap {|s| s[:lock_interval] = value})\n end", "def reconnect_interval=(val)\n @j_del.setReconnectInterval(val)\n self\n end", "def retry_interval\n @options[:retry_interval]\n end", "def lock_interval\n get_settings[:lock_interval]\n end", "def automatic_restart=(value)\n @automatic_restart = value\n end", "def start_expiry_period!\n self.update_attribute(:access_token_expires_at, Time.now + Devise.timeout_in)\n end", "def retry_interval\n @retry_interval ||= options[:retry_interval] || RETRY_INTERVAL\n end", "def destroy_older_apps(minutes: TTL_MINUTES, force_refresh: @apps.empty?, on_conflict: :refresh_api_and_continue)\n MUTEX_FILE.flock(File::LOCK_EX)\n\n refresh_app_list if force_refresh\n\n while app = @apps.pop\n age = AppAge.new(created_at: app[\"created_at\"], ttl_minutes: minutes)\n if !age.can_delete?\n @apps.push(app)\n break\n else\n begin\n destroy_with_log(\n id: app[\"id\"],\n name: app[\"name\"],\n reason: \"app age (#{age.in_minutes}m) is older than #{minutes}m\"\n )\n rescue AlreadyDeletedError => e\n if handle_conflict(\n strategy: on_conflict,\n conflict_message: e.message,\n ) == :stop\n break\n end\n end\n end\n end\n ensure\n MUTEX_FILE.flock(File::LOCK_UN)\n end", "def minretrydelay=(retry_delay)\r\n\t\t\t`#{BITS::BITSADMIN} /setminretrydelay {#{@id}} #{retry_delay}`\r\n\t\tend", "def reset_interval\n options[:reset_interval].to_f\n end", "def default_timeout\n 900\n end", "def schedule_to_close_timeout; Float::INFINITY; end", "def refresh_interval\n @refresh_interval ||= options[:refresh_interval] || REFRESH_INTERVAL\n end", "def refresh_interval\n @refresh_interval ||= options[:refresh_interval] || REFRESH_INTERVAL\n end", "def refresh_interval\n @refresh_interval ||= options[:refresh_interval] || REFRESH_INTERVAL\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def default_conditions(w)\n w.interval = 30.seconds\n w.start_grace = 1.minute\n w.start_if do |start|\n start.condition(:process_running) do |c|\n c.interval = 1.minute\n c.running = false\n end\n end\nend", "def default_expiration= new_default_expiration\n patch_gapi! default_expiration: new_default_expiration\n end", "def refresh_timeout\n @refresh_timeout ||= (options[:timeout] || 5)\n end", "def timer_task_options\n { run_now: true, execution_interval: reaper_interval }\n end", "def default_timeout\n 60\n end", "def expired?(grace_period = 60)\n Time.now > read_attribute(:created_at) + read_attribute(:expires_in) - grace_period\n end", "def last_day_of_standard_grace_window\n (expiry_date + Rails.configuration.grace_window.days) - 1.day\n end", "def pause_scaling_events\n client.suspend_processes(auto_scaling_group_name: asg_name,\n scaling_processes:\n %w[ReplaceUnhealthy AlarmNotification ScheduledActions AZRebalance])\n end", "def reload_interval=(interval)\n raise ArgumentError, 'Argument must be Integer.' unless interval.kind_of?(Integer)\n self.enable_reload = false if interval == 0 # Sett\n self.reload_interval = interval\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout=(value)\n @work_profile_password_minutes_of_inactivity_before_screen_timeout = value\n end", "def timeout_in\n 30.days\n end", "def sleep_time\n\t\t\t# TODO: Hard-coded for now. See doc/app_manager.rdoc for some\n\t\t\t# thoughts on this.\n\t\t\t1\n\t\tend", "def timelimit\n 15.minutes\n end", "def lock_timeout\n result = Mimi::DB.execute('select setting from pg_settings where name = ?', :lock_timeout)\n value = result.first['setting'].to_i\n value = value.to_f / 1000 unless value == 0\n value\n end", "def passcode_minutes_of_inactivity_before_lock=(value)\n @passcode_minutes_of_inactivity_before_lock = value\n end", "def connect_retry_period\n NewRelic::CONNECT_RETRY_PERIODS[connect_attempts] || NewRelic::MAX_RETRY_PERIOD\n end", "def shutdown_timeout\n (\n options[:shutdown_timeout] ||\n rails_config[:shutdown_timeout] ||\n env['GOOD_JOB_SHUTDOWN_TIMEOUT'] ||\n DEFAULT_SHUTDOWN_TIMEOUT\n ).to_f\n end", "def script_timeout=(seconds); end", "def worker_watchdog_threshold\n 60\n end", "def set_desired_capacity capacity, options = {}\n client_opts = {}\n client_opts[:auto_scaling_group_name] = name\n client_opts[:desired_capacity] = capacity\n client_opts[:honor_cooldown] = options[:honor_cooldown] == true\n client.set_desired_capacity(client_opts)\n nil\n end", "def group_policy_boot_time_in_ms=(value)\n @group_policy_boot_time_in_ms = value\n end", "def group_policy_boot_time_in_ms=(value)\n @group_policy_boot_time_in_ms = value\n end", "def extend_and_limit_session_time\n if Settler[:user_session_time_limit_enabled]\n request.session_options[:expire_after] = current_user && current_user.is_privileged? ? Settler[:user_session_privileged_timeout].minutes : Settler[:user_session_timeout].minutes\n end\n end", "def inactivity_timeout\n\t\tif (ENV['inactivity_timeout'] != nil)\n\t\t ENV['inactivity_timeout'].to_i\n\t\telse\n\t\t 1200\n\t\tend\n\tend", "def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end", "def ddos_protect(max)\n sleep(((60 / max) * 10).ceil/10)\n end", "def timeout_in\n if self.admin?\n 10.minutes\n else\n 15.minutes\n end\n end", "def increase_baked_minutes(minutes)\n $baked_minutes = $baked_minutes + minutes\n end", "def interval\n 30.seconds\n end", "def persistent_timeout(seconds); end", "def start_expiry_period!\n self.update_attribute(:access_token_expires_at, 2.days.from_now)\n end", "def length=(minutes)\n write_attribute(:length, minutes.to_i * 60)\n end", "def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end", "def lock_timeout=(value)\n raise ArgumentError, 'Numeric value expected as timeout' unless value.is_a?(Numeric)\n value = (value * 1000).to_i\n Mimi::DB.execute('update pg_settings set setting = ? where name = ?', value, :lock_timeout)\n end", "def interval\n (self['resque.interval'] || 5).to_i\n end", "def respawn_window\n @options['respawn_window'] ? @options['respawn_window'].to_i : 3600\n end", "def api_timeout=(seconds)\n @@api_timeout = seconds.to_i\n end", "def boot_option_num_retry=(boot_option_num_retry)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"5\", \"13\", \"Infinite\"])\n unless validator.valid?(boot_option_num_retry)\n fail ArgumentError, \"invalid value for \\\"boot_option_num_retry\\\", must be one of #{validator.allowable_values}.\"\n end\n @boot_option_num_retry = boot_option_num_retry\n end", "def timeout=(timeout)\n @timeout = timeout.to_f/1000 * 60\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def update_whenever \n begin\n ::Whenever::CommandLine.execute({:update => true, :file => \"#{Rails.root}/config/schedule.rb\"})\n rescue SystemExit # whenever quits after updating cron jobs, we need to stop him\n end\n end", "def timeout_in\n 15.minutes\n end", "def default_task_heartbeat_timeout; Float::INFINITY; end", "def rate_limit_interval\n interval = ENV['RATE_LIMIT_INTERVAL'].to_i\n interval > 0 ? interval : 1\n end", "def daily_midnight\n logger.info \" daily_midnight\"\n PersistStatsJob.create({})\n Gift.send_expiration_reminders(5)\n Gift.send_expiration_reminders(3)\n Gift.send_expiration_reminders(1)\n end", "def setDurationMinutes(durationMinutes) \r\n\t\t\t\t\t@durationMinutes = durationMinutes\r\n\t\t\t\tend", "def timeout_seconds\n return 1200\n end", "def last_day_of_grace_window_with_covid_extension\n (expiry_date + Rails.configuration.covid_grace_window.days) - 1.day\n end", "def on_grace_period?\n (canceled? && Time.current < ends_at) || (paused? && pause_starts_at? && Time.current < pause_starts_at)\n end", "def initialize(app, frequency=100, minutes=15)\n @app = app\n @frequency = frequency\n @request_count = 0\n @queue = Queue.new\n @mutex = Mutex.new\n\n if defined?(PhusionPassenger)\n # https://github.com/suyccom/yousell/blob/master/config.ru\n # https://www.phusionpassenger.com/library/indepth/ruby/out_of_band_work.html\n if PhusionPassenger.respond_to?(:require_passenger_lib)\n PhusionPassenger.require_passenger_lib 'rack/out_of_band_gc'\n else\n # Phusion Passenger < 4.0.33\n require 'phusion_passenger/rack/out_of_band_gc'\n end\n\n @passenger = PhusionPassenger::Rack::OutOfBandGc.new(app, frequency)\n end\n\n Thread.kill(@@background) if @@background\n\n if minutes\n # divide minutes by frequency and use the result to determine the\n # time between simulated requests\n @@background = Thread.new do\n seconds = minutes * 60.0 / frequency\n loop do\n sleep seconds\n maybe_perform_gc\n end\n end\n end\n end", "def with_cool_off_time(cool_off_time)\n reconfigure(configuration.with(cool_off_time: cool_off_time))\n end", "def set_apps_to_restart(app_names)\n make_call(NO_TIMEOUT, RETRY_ON_FAIL, \"set_apps_to_restart\") {\n @conn.set_apps_to_restart(app_names, @secret)\n }\n end", "def ends_at=(val)\n raise Timely::ConfigurationError, \"starts_at must be set before setting ends_at\" unless starts_at\n\n duration_in_seconds = val - starts_at\n period_duration = period == :quarter ? 3.months : 1.send(period)\n\n self.length = (duration_in_seconds.to_f / period_duration).ceil\n\n reset\n end", "def asg_suspend_termination\n @asg_suspend_termination = true\n end", "def credentials_refresh_threshold\n @aws_credentials_refresh_threshold_seconds || 15\n end", "def _timeout_in\n 1.minute\n end", "def last_day_of_extended_grace_window\n (expiry_date + Rails.configuration.expires_after.years) - 1.day\n end" ]
[ "0.72385937", "0.6891492", "0.63716114", "0.6176589", "0.5830609", "0.54698396", "0.53761536", "0.5191597", "0.51391387", "0.50907636", "0.5034328", "0.49405888", "0.4938738", "0.48332992", "0.4831327", "0.48058861", "0.47441655", "0.47361067", "0.46910712", "0.4637752", "0.4637752", "0.46373147", "0.4588626", "0.4588626", "0.4587147", "0.45451915", "0.4543601", "0.45380136", "0.45349374", "0.45268527", "0.45051733", "0.44836217", "0.44700056", "0.4468513", "0.44650534", "0.44490978", "0.43811113", "0.43811113", "0.43811113", "0.43791145", "0.43791145", "0.43383324", "0.43345675", "0.43283272", "0.43253466", "0.43243703", "0.4324355", "0.43176925", "0.43034273", "0.4299406", "0.428881", "0.42860228", "0.42562714", "0.42526615", "0.42487818", "0.4246462", "0.42413378", "0.42378643", "0.42313865", "0.422815", "0.4224663", "0.4214314", "0.4214314", "0.42040715", "0.4203587", "0.4196252", "0.4194588", "0.41914016", "0.41784304", "0.4174978", "0.41749567", "0.41746175", "0.41717714", "0.4168521", "0.41581857", "0.41561595", "0.41531196", "0.41528937", "0.4146468", "0.4146068", "0.41440707", "0.41440707", "0.41440707", "0.4137793", "0.41250986", "0.4120123", "0.41186956", "0.4117692", "0.41121277", "0.41104102", "0.4109503", "0.41055492", "0.41049674", "0.41020253", "0.41020027", "0.40972155", "0.40863755", "0.40831313", "0.40793428", "0.40779787" ]
0.7802341
0
Gets the restartNotificationSnoozeDurationInMinutes property value. The number of minutes to snooze the restart notification dialog when the snooze button is selected.
def restart_notification_snooze_duration_in_minutes return @restart_notification_snooze_duration_in_minutes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end", "def minutes\n _nudge[1]\n end", "def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n end", "def getDurationMinutes\r\n\t\t\t\t\treturn @durationMinutes\r\n\t\t\t\tend", "def restart_count\n return @restart_count\n end", "def getMinutes\r\n\t\t\t\t\treturn @minutes\r\n\t\t\t\tend", "def minutes\n (seconds % 3600) / 60\n end", "def in_minutes\n Duration::new(seconds: @seconds).to_minutes\n end", "def grace_period_in_minutes\n return @grace_period_in_minutes\n end", "def durationInMinutes\n @duration/60.0 #Force floating pt.\n end", "def minutes\n (@seconds.abs / 60) % 60 * (@seconds < 0 ? -1 : 1)\n end", "def minutes\n\t\treturn self * 60\n\tend", "def minutes\n\t\treturn self * 60\n\tend", "def lifetime_in_minutes\n return @lifetime_in_minutes\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def get_duration_integer_minutes\n\t\t((end_time - start_time) / 60).to_i\n\tend", "def running_time_in_minutes\n return 0 if self.started_at.nil? and self.stopped_at.nil?\n\n if self.stopped_at.nil?\n # Raid has not yet been stopped, use the current time\n ((Time.now - self.started_at)/60.0).floor\n else\n ((self.stopped_at - self.started_at)/60.0).floor\n end\n end", "def minutes() 60 * seconds end", "def timeout_in_minutes\n data[:timeout_in_minutes]\n end", "def minutes_as_duration\n WorkEntry.minutes_as_duration(self.minutes)\n end", "def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end", "def minutes\n self * SECONDS_IN_MINUTES\n end", "def timeout_in_minutes\n @stack.timeout_in_minutes\n end", "def today_minutes_resting\n self[:min_rest]\n end", "def minutes\n value_parts[1]\n end", "def minutes\n value_parts[1]\n end", "def get_duration\n ((finish - start) / 60 / 60) - (break_length / 60)\n end", "def retry_interval\n @options[:retry_interval]\n end", "def duration_in_seconds\n return @duration_in_seconds\n end", "def respawn_window\n @options['respawn_window'] ? @options['respawn_window'].to_i : 3600\n end", "def minutes\n self.to_i * 60\n end", "def minutes ; Duration[self * 60] ; end", "def duration_block_in_minutes\n 180\n end", "def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end", "def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end", "def minute\n if self.in_play?\n return self.round.minute\n else\n if self.finished?\n return MINUTES\n else\n return 0\n end\n end\n end", "def calc_mins_till\n (@difference.round(2) / 60.00).round(2)\n end", "def remaining_minutes()\n current_time = Time.now\n start_time = Delay.find_newest_travel_time(stop_position.bus.id, current_time)\n predicted_time = start_time + minutes_delayed * 60\n return predicted_time - current_time\n end", "def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end", "def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end", "def durationInMinutes=( value)\r\n @duration = (value * 60).to_i\r\n end", "def reset_interval\n options[:reset_interval].to_f\n end", "def duration_in_days\n return @duration_in_days\n end", "def get_time_required\n 0 # number of minutes\n end", "def minutes_remaining\n time_elapsed = (Time.new - @start_time) / 60\n (@total_paid * 60 - time_elapsed).floor\n end", "def lock_duration\n Core::Utils::Interval.try_convert(@lock_duration)\n end", "def seconds_in_minutes(num_min)\n\tnum_min * 60\nend", "def seconds\n self * 60\n end", "def in_seconds\n @seconds\n end", "def time_tolerance_seconds\n 600\n end", "def drive_time_in_minutes\n if @status != \"OK\"\n drive_time = 0\n else\n drive_time = @doc.css(\"duration value\").last.text\n convert_to_minutes(drive_time)\n end\n end", "def seconds\n @seconds.abs % 60 * (@seconds < 0 ? -1 : 1)\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout\n return @work_profile_password_minutes_of_inactivity_before_screen_timeout\n end", "def seconds_remaining\n ends_at ? (ends_at - started_at).round : 0\n end", "def timeout_in\n if self.admin?\n 10.minutes\n else\n 15.minutes\n end\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def minutes ; self * 60 ; end", "def grace_period_in_minutes=(value)\n @grace_period_in_minutes = value\n end", "def minretrydelay\r\n\t\t\t`#{BITS::BITSADMIN} /getminretrydelay {#{@id}}`\r\n\t\tend", "def duration\n 30\n end", "def seconds\n _nudge[2]\n end", "def restart_count=(value)\n @restart_count = value\n end", "def retry_interval\n @retry_interval ||= options[:retry_interval] || RETRY_INTERVAL\n end", "def min_interval\n MIN_INTERVAL\n end", "def total_minutes\n hours * 60 + minutes\n end", "def average_restarts\n return @average_restarts\n end", "def send_interval\n @attributes[:send_interval]\n end", "def send_interval\n @attributes[:send_interval]\n end", "def getminute()\n\t\treturn @min\n\tend", "def duration_before_escalation\n return @duration_before_escalation\n end", "def getDurationHours\r\n\t\t\t\t\treturn @durationHour\r\n\t\t\t\tend", "def minutes_flight\n stamp = @raw_data[:FlightDuration].split(\"PT\")[1]\n stamp.split(\"H\")[1].split(\"M\")[0].to_i\n rescue\n nil\n end", "def min_suggested_duration\n source_node[:minSuggestedDuration]\n end", "def to_minutes; Rational === @val ? @val/60 : @val/60.0 end", "def responsive_desktop_time_in_ms\n return @responsive_desktop_time_in_ms\n end", "def responsive_desktop_time_in_ms\n return @responsive_desktop_time_in_ms\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout=(value)\n @work_profile_password_minutes_of_inactivity_before_screen_timeout = value\n end", "def get_minutes\n de = self.string_to_datetime(@from)\n a = self.string_to_datetime(@to)\n \n total = ((a.hour - de.hour) * 60) + (a.min - de.min)\n end", "def get_minutes_in_day(date)\n hours = self.class.special_days[:days][date.to_s] || user.daily_hours\n hours * 60\n end", "def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end", "def timeInterval()\n\t\t@duration\n\tend", "def mins\n @msecs / MIN_TO_MS_F\n end", "def get_break_time\n return {break_time: @config.short_break_duration}\n end", "def today_minutes_playing\n self[:min_play]\n end", "def duration\n @duration\n end", "def duration\n return @duration\n end", "def duration\n return @duration\n end", "def shift_duration #get the duration of a shift\n ((self.start_time && self.end_time) ? self.end_time - self.start_time : 0)/60/60\n end", "def heartbeat_timeout\n data.heartbeat_timeout\n end", "def getDuration\r\n\t\t\t\t\treturn @duration\r\n\t\t\t\tend", "def seconds\n (hour * 60 * 60) + (min * 60)\n end", "def passcode_minutes_of_inactivity_before_screen_timeout\n return @passcode_minutes_of_inactivity_before_screen_timeout\n end", "def minutes; self * MINUTE; end", "def minutes; self * MINUTE; end", "def seconds\n (Time.now - @start_time).to_i\n end", "def duration\n return -1.0 if @start_time.nil? || @end_time.nil?\n (@end_time - @start_time) / 60.0\n end", "def hours\n\t\treturn self * 60.minutes\n\tend", "def hours\n\t\treturn self * 60.minutes\n\tend" ]
[ "0.80405897", "0.58074635", "0.57878417", "0.57857066", "0.5722918", "0.5672198", "0.56698054", "0.5646157", "0.55132204", "0.5461743", "0.5448392", "0.54086286", "0.54086286", "0.54074484", "0.54024965", "0.54024965", "0.5375624", "0.53550667", "0.535254", "0.53249764", "0.5319535", "0.5300941", "0.5262884", "0.5242884", "0.5232975", "0.5218101", "0.5218101", "0.52081895", "0.5137828", "0.5119624", "0.510859", "0.5104291", "0.5103873", "0.5098948", "0.50773454", "0.50773454", "0.50450915", "0.5004592", "0.49723604", "0.4948392", "0.4948392", "0.49479228", "0.49347836", "0.49294686", "0.49103755", "0.49099672", "0.4903961", "0.48893946", "0.48832753", "0.48739213", "0.4872147", "0.48705342", "0.48580682", "0.48541898", "0.48536682", "0.48478237", "0.47968754", "0.47968754", "0.47960564", "0.4795589", "0.47917026", "0.47867906", "0.4768437", "0.47604966", "0.47500542", "0.47495142", "0.47483528", "0.47470555", "0.47460124", "0.47460124", "0.47410753", "0.47353488", "0.47340426", "0.4712605", "0.4705274", "0.46958438", "0.46874744", "0.46874744", "0.46769053", "0.4672677", "0.46706855", "0.466752", "0.46665007", "0.4664289", "0.46623507", "0.46622482", "0.46602845", "0.46474928", "0.46474928", "0.464305", "0.46413022", "0.4640152", "0.4636547", "0.46342197", "0.46282604", "0.46282604", "0.46223933", "0.46214923", "0.46162552", "0.46162552" ]
0.86595196
0
Sets the restartNotificationSnoozeDurationInMinutes property value. The number of minutes to snooze the restart notification dialog when the snooze button is selected.
def restart_notification_snooze_duration_in_minutes=(value) @restart_notification_snooze_duration_in_minutes = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end", "def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end", "def restart_count=(value)\n @restart_count = value\n end", "def setMinutes(minutes)\r\n\t\t\t\t\t@minutes = minutes\r\n\t\t\t\tend", "def automatic_restart=(value)\n @automatic_restart = value\n end", "def grace_period_in_minutes=(value)\n @grace_period_in_minutes = value\n end", "def setDurationMinutes(durationMinutes) \r\n\t\t\t\t\t@durationMinutes = durationMinutes\r\n\t\t\t\tend", "def restart=(restart)\n validator = EnumAttributeValidator.new('String', ['Always', 'WhenNotActive', 'Never', 'NotDefined'])\n unless validator.valid?(restart)\n fail ArgumentError, 'invalid value for \"restart\", must be one of #{validator.allowable_values}.'\n end\n @restart = restart\n end", "def restart( timeout = 5 )\n stop( timeout )\n start\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end", "def vote_to_restart(timer_trigger = false)\n if @restart_vote\n @restart_vote.call\n if timer_trigger\n start_timer\n else\n @restart_vote_count = 0\n end\n end\n true\n end", "def respawn_window\n @options['respawn_window'] ? @options['respawn_window'].to_i : 3600\n end", "def reset_interval\n options[:reset_interval].to_f\n end", "def work_profile_password_minutes_of_inactivity_before_screen_timeout=(value)\n @work_profile_password_minutes_of_inactivity_before_screen_timeout = value\n end", "def restart_autosync\n #Remove current timeout.\n Gtk.timeout_remove(@autosync_timeout) if @autosync_timeout\n @autosync_timeout = nil\n \n #Get various info from db.\n enabled = Knj::Strings.yn_str(Knj::Opts.get(\"autosync_enabled\"), true, false)\n interval = Knj::Opts.get(\"autosync_interval\").to_i\n interval_msecs = interval * 60 * 1000\n \n if !enabled #dont continue if autosync isnt enabled.\n self.status = _(\"Disabled automatic synchronization.\")\n return nil\n end\n \n self.status = sprintf(_(\"Restarted automatic sync. to run every %s minutes.\"), Knj::Locales.number_out(interval, 1))\n \n #Start new timeout.\n @autosync_timeout = Gtk.timeout_add(interval_msecs, &self.method(:gtk_timeout))\n end", "def restart(timeout=nil)\n stop(timeout)\n start!\n end", "def minretrydelay=(retry_delay)\r\n\t\t\t`#{BITS::BITSADMIN} /setminretrydelay {#{@id}} #{retry_delay}`\r\n\t\tend", "def restart\n request('restart')\n end", "def reconnect_interval=(val)\n @j_del.setReconnectInterval(val)\n self\n end", "def retry_interval\n @options[:retry_interval]\n end", "def start_timer\n if @restart_vote && @state != :terminating\n @restart_vote_timer ||= EM::Timer.new(RESTART_VOTE_DELAY) { vote_to_restart(timer_trigger = true) }\n end\n true\n end", "def restart_count\n return @restart_count\n end", "def reconnect_attempts=(val)\n @j_del.setReconnectAttempts(val)\n self\n end", "def restart!\n # Permissions are handled by the script, use: :sudo => false\n run_script! :restart, :sudo => false\n end", "def retry_interval\n @retry_interval ||= options[:retry_interval] || RETRY_INTERVAL\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def automatic_restart_time\n data[:automatic_restart_time]\n end", "def passcode_minutes_of_inactivity_before_screen_timeout=(value)\n @passcode_minutes_of_inactivity_before_screen_timeout = value\n end", "def adjust_duration\n # convert minutes into seconds\n self.duration = duration.to_i * 60\n end", "def restart\n stop\n sleep 2\n start\n end", "def dnd_setSnooze(options = {})\n post('dnd.setSnooze', options)\n end", "def restart\n\t\tself.stop_heartbeat\n\t\tsuper\n\t\tself.start_heartbeat\n\tend", "def setPlayerRespawnTime _args\n \"setPlayerRespawnTime _args;\" \n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end", "def restart!\n JobRestarter.restart(self)\n end", "def increase_baked_minutes(minutes)\n $baked_minutes = $baked_minutes + minutes\n end", "def restart config={}\n stop\n start(config)\n end", "def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n end", "def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end", "def restart_soon\n @restart = true\n @shutdown = true\n end", "def restart\n if @time < @next_restart\n log.info \"synapse: at time #{@time} waiting until #{@next_restart} to restart\"\n return\n end\n\n @next_restart = @time + @restart_interval\n @next_restart += rand(@restart_jitter * @restart_interval + 1)\n\n # do the actual restart\n res = `#{opts['reload_command']}`.chomp\n unless $?.success?\n log.error \"failed to reload haproxy via #{opts['reload_command']}: #{res}\"\n return\n end\n log.info \"synapse: restarted nginx\"\n\n @restart_required = false\n end", "def restart\n raw \"RESTART\\r\\n\"\n end", "def signal_restart_forced\n @signal_operation_queue << :restart_forced\n interrupt_server_polling_sleep\n nil\n end", "def durationInMinutes=( value)\r\n @duration = (value * 60).to_i\r\n end", "def signal_restart_graceful\n @signal_operation_queue << :restart_graceful\n interrupt_server_polling_sleep\n nil\n end", "def restart(*args)\n stop\n start\n end", "def restart_mode\n @options['restart_mode'] || 'term-start'\n end", "def restart\n stop\n sleep(1)\n start\n end", "def restart\n stop\n sleep(1)\n start\n end", "def restart_stop_code=(value)\n @restart_stop_code = value\n end", "def restart\n # Permissions are handled by the script, use: :sudo => false\n run_script :stop, :sudo => false\n end", "def restart\n\t\t@x = $Width/2 - 15 #centers the ship\n\t\t@y = $Height - 100\n\t\t@exists = true\n\t\t@powerup_name = \"\"\n\t\t@laser_timeout = Time.now\n\t\t@shields = 0\n\t\t@missles = 0\n\tend", "def redis_restart_on_change\n restart_on_change = configuration[:redis][:restart_on_change]\n restart_on_change = true if restart_on_change.nil? # nil is true so we have a default value.\n restart_on_change\n end", "def restart # :nodoc:\n put :restart\n end", "def restart\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n [\"Restarting dynos\", {}]\n when /.+\\..+/\n ps = args.first\n [\"Restarting #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Restarting #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_restart(app, options)\n end\n end", "def restart\n if @restart_command\n run_command(@restart_command)\n else\n stop\n start\n end\n end", "def restart_server\n stop_server\n sleep 1\n start_server\n end", "def restart\n budget.restart\n cost_payment_plan.restart\n self.update(actual_week: 0, status: 'Inicio')\n milestones.map { |mile| mile.restart }\n end", "def automatic_restart\n @automatic_restart = true if @automatic_restart.nil?\n @automatic_restart\n end", "def enable_restart\n println _INTL('Changes have been made: the game must restart')\n @restart = true\n end", "def retry_options\n {tries: 15, sleep: 1}\n end", "def refresh_timeout\n @refresh_timeout ||= (options[:timeout] || 5)\n end", "def restart!\n start!\n end", "def reconnect_interval(val = nil)\n if val\n @j_del.setReconnectInterval(val)\n self\n else\n @j_del.getReconnectInterval\n end\n end", "def advance_minutes(mins)\n self + (mins * 60)\n end", "def restart!\n stop!\n start!\n end", "def restart_worker_if_needed\n @seconds_until_restart_next_worker ||= @restart_after\n\n if @seconds_until_restart_next_worker > 0\n @seconds_until_restart_next_worker -= LOOP_SLEEP_SECONDS\n else\n w = next_worker_to_restart\n debug(\"Time to restart a worker: Calling #stop_with_wait for worker #{w.inspect}\")\n w.stop_with_wait\n debug(\"Worker has been stopped: #{w.inspect}\")\n w.start!\n debug(\"Worker has been restarted: #{w.inspect}\")\n w = nil\n\n # Reset the counter\n @seconds_until_restart_next_worker = @restart_after\n end\n end", "def restart()\n shutdown()\n start()\n end", "def initial_silence_timeout_in_seconds=(value)\n @initial_silence_timeout_in_seconds = value\n end", "def boot_option_num_retry=(boot_option_num_retry)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"5\", \"13\", \"Infinite\"])\n unless validator.valid?(boot_option_num_retry)\n fail ArgumentError, \"invalid value for \\\"boot_option_num_retry\\\", must be one of #{validator.allowable_values}.\"\n end\n @boot_option_num_retry = boot_option_num_retry\n end", "def action_restart\n return if options['never_restart']\n action_stop\n action_start\n end", "def restart(options={})\n response = service.restart_network( options.merge({'id'=> self.id}))\n service.jobs.new(response['restartnetworkresponse'])\n end", "def restart\n self.stop\n self.start\n end", "def watch=(seconds)\n @watch = seconds.to_i\n end", "def restart\n @target = @time_start = Time.now\n end", "def terminate_at(seconds = 60)\n @terminate_at = seconds\n end", "def set_minutes_minute\n @minutes_minute = Minutes::Minute.includes(items: [motions: [:mover]]).find(params[:id])\n end", "def restart_game\n\t\tclear_screen\n\t\tpause_game(@pause)\n\t\t@asteroids_missed = 0\n\t\t@asteroids_hit = 0\n\t\t@asteroids_hit_missles = 0\n\t\t@shots_fired = 0\n\t\t@missles_fired = 0\n\t\t@pause = false\n\t\t@game_done = false\n\t\t@win = false\n\t\t@level = $StartingLevel\n\t\t@level_time = Time.now + $TimeLimit\n\tend", "def restart\n client.restart\n end", "def in_minutes\n Duration::new(seconds: @seconds).to_minutes\n end", "def restart!\n IbmCloudRest.post \"#{@uri}/_restart\"\n end", "def increase_reconnect_delay\n\n @reconnect_delay *= @parameters[:back_off_multiplier] if @parameters[:use_exponential_back_off]\n @reconnect_delay = @parameters[:max_reconnect_delay] if @reconnect_delay > @parameters[:max_reconnect_delay]\n\n @reconnect_delay\n end", "def restart(pid)\n `kill -s USR2 #{pid}`\n end", "def update_sleep_goals(min_duration_minutes)\n post_json(path_user_version('/sleep/goal'), 'minDuration' => min_duration_minutes)\n end", "def passcode_minutes_of_inactivity_before_lock=(value)\n @passcode_minutes_of_inactivity_before_lock = value\n end", "def restart\n stop\n start\n end", "def duration_block_in_minutes\n 180\n end", "def length=(minutes)\n write_attribute(:length, minutes.to_i * 60)\n end", "def restart!\n CouchRest.post \"#{@uri}/_restart\"\n end", "def minutes() 60 * seconds end", "def restart\n if booted then\n kill\n end\n start\n end", "def restart(wait = true)\n stop(wait)\n start(wait)\n end", "def average_restarts=(value)\n @average_restarts = value\n end", "def block_delivery_start_time\n unless delivery_slots_from.blank?\n delivery_slots_from.round_up(60.minutes)\n end\n end", "def round_off(seconds = 60)\n Time.at((self.to_f / seconds).round * seconds)\n end", "def tock\n @minute += 1\n end", "def reload_interval=(interval)\n raise ArgumentError, 'Argument must be Integer.' unless interval.kind_of?(Integer)\n self.enable_reload = false if interval == 0 # Sett\n self.reload_interval = interval\n end", "def set_StartSleepTime(value)\n set_input(\"StartSleepTime\", value)\n end" ]
[ "0.7709535", "0.54065514", "0.5065944", "0.50300866", "0.48830426", "0.48774555", "0.48566982", "0.48280942", "0.48192656", "0.47637227", "0.47637227", "0.47322124", "0.46878687", "0.46627617", "0.46418434", "0.45728937", "0.45712686", "0.45511588", "0.45501104", "0.45446718", "0.453462", "0.4518573", "0.45174542", "0.4490002", "0.44726196", "0.44701624", "0.44697043", "0.44697043", "0.446461", "0.44460133", "0.44245633", "0.44233042", "0.44115573", "0.44113553", "0.4399936", "0.4399936", "0.4398201", "0.43784833", "0.43450204", "0.43448505", "0.43347663", "0.4329578", "0.43222815", "0.4316843", "0.43150392", "0.4308918", "0.4306894", "0.42950332", "0.4294224", "0.42842567", "0.42842567", "0.4265661", "0.42299137", "0.42175502", "0.42172286", "0.42143425", "0.4214111", "0.42101932", "0.42036772", "0.41911235", "0.41887861", "0.41771692", "0.41764933", "0.41730797", "0.4171209", "0.41685155", "0.41624826", "0.4159283", "0.41570354", "0.4155943", "0.41239077", "0.41227537", "0.41081926", "0.4101778", "0.40969598", "0.40933818", "0.40888667", "0.40866402", "0.40802178", "0.4074911", "0.40731508", "0.40726945", "0.40712753", "0.4067128", "0.40633273", "0.40614703", "0.4059499", "0.4055098", "0.4050054", "0.4034674", "0.40332437", "0.40139687", "0.40043238", "0.40042585", "0.400424", "0.40026614", "0.39988118", "0.39916697", "0.39824492", "0.39719152" ]
0.84445095
0
Serializes information the current object
def serialize(writer) raise StandardError, 'writer cannot be null' if writer.nil? writer.write_number_value("countdownDisplayBeforeRestartInMinutes", @countdown_display_before_restart_in_minutes) writer.write_number_value("gracePeriodInMinutes", @grace_period_in_minutes) writer.write_string_value("@odata.type", @odata_type) writer.write_number_value("restartNotificationSnoozeDurationInMinutes", @restart_notification_snooze_duration_in_minutes) writer.write_additional_data(@additional_data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n end", "def serialize(object) end", "def serialize; end", "def serialize; end", "def serialize\n \n end", "def serialize\n raise NotImplementedError\n end", "def serialize\n raise NotImplementedError\n end", "def dump\r\n super + to_s\r\n end", "def serialize\n self.to_hash.to_json\n end", "def serialized\n serializer_class.new(self).serializable_hash\n end", "def serialize\n @raw_data\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"identityType\", @identity_type)\n end", "def serialize\n @serializer.serialize(self.output)\n end", "def serialize(_object, data); end", "def serialize(_object, data); end", "def to_json\n\t\t\tself.instance_variable_hash\n\t\tend", "def serializer; end", "def serialize!\n end", "def serialize(object)\n object.serializable_hash\n end", "def serialize(object)\n object.to_s\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"device\", @device)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"keyStrength\", @key_strength)\n end", "def marshal\n Marshal.dump self\n end", "def marshal\n Marshal.dump self\n end", "def marshal\n Marshal.dump self\n end", "def inspect\n serialize.to_s\n end", "def serialize\n YAML::dump(self)\n end", "def inspect()\n serialize.to_s()\n end", "def inspect()\n serialize.to_s()\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_collection_of_object_values(\"answers\", @answers)\n writer.write_object_value(\"assignment\", @assignment)\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionCalloutInstances\", @custom_extension_callout_instances)\n writer.write_enum_value(\"requestType\", @request_type)\n writer.write_object_value(\"requestor\", @requestor)\n writer.write_object_value(\"schedule\", @schedule)\n writer.write_enum_value(\"state\", @state)\n writer.write_string_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"initiator\", @initiator)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_date_time_value(\"visibleHistoryStartDateTime\", @visible_history_start_date_time)\n end", "def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_primitive_values(\"aliases\", @aliases)\n writer.write_collection_of_object_values(\"countriesOrRegionsOfOrigin\", @countries_or_regions_of_origin)\n writer.write_object_value(\"description\", @description)\n writer.write_date_time_value(\"firstActiveDateTime\", @first_active_date_time)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_enum_value(\"kind\", @kind)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"targets\", @targets)\n writer.write_string_value(\"title\", @title)\n writer.write_object_value(\"tradecraft\", @tradecraft)\n end", "def serialize(object, data); end", "def serialize\n JSON.generate(to_h)\n end", "def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"life\", @life)\n writer.write_object_value(\"per\", @per)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end", "def inspect\n id_string = (respond_to?(:id) && !id.nil?) ? \" id=#{id}\" : ''\n \"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: \" +\n Clever::JSON.dump(@values, pretty: true)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"owner\", @owner)\n writer.write_collection_of_object_values(\"properties\", @properties)\n writer.write_string_value(\"status\", @status)\n writer.write_collection_of_primitive_values(\"targetTypes\", @target_types)\n end", "def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_string_value(\"dataType\", @data_type)\n writer.write_boolean_value(\"isSyncedFromOnPremises\", @is_synced_from_on_premises)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_primitive_values(\"targetObjects\", @target_objects)\n end", "def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend", "def _dump(depth)\n scrooge_fetch_remaining\n scrooge_invalidate_updateable_result_set\n scrooge_dump_flag_this\n str = Marshal.dump(self)\n scrooge_dump_unflag_this\n str\n end", "def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end", "def to_dump\n @time = Time.now\n Base64.encode64(Marshal.dump(self))\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 inspect\n serialize.to_s\n end", "def inspect\n serialize.to_s\n end", "def inspect\n serialize.to_s\n end", "def serialize(options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"apiConnectorConfiguration\", @api_connector_configuration)\n writer.write_collection_of_object_values(\"identityProviders\", @identity_providers)\n writer.write_collection_of_object_values(\"languages\", @languages)\n writer.write_collection_of_object_values(\"userAttributeAssignments\", @user_attribute_assignments)\n writer.write_collection_of_object_values(\"userFlowIdentityProviders\", @user_flow_identity_providers)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"clientContext\", @client_context)\n writer.write_object_value(\"resultInfo\", @result_info)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_number_value(\"memberCount\", @member_count)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_enum_value(\"tagType\", @tag_type)\n writer.write_string_value(\"teamId\", @team_id)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_object_value(\"resource\", @resource)\n writer.write_object_value(\"weight\", @weight)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"comment\", @comment)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"deletedDateTime\", @deleted_date_time)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_boolean_value(\"hostOnly\", @host_only)\n writer.write_string_value(\"hostOrDomain\", @host_or_domain)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"path\", @path)\n writer.write_enum_value(\"sourceEnvironment\", @source_environment)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"category\", @category)\n writer.write_date_time_value(\"firstSeenDateTime\", @first_seen_date_time)\n writer.write_object_value(\"host\", @host)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"large\", @large)\n writer.write_object_value(\"medium\", @medium)\n writer.write_object_value(\"small\", @small)\n writer.write_object_value(\"source\", @source)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_enum_value(\"allowedTargetScope\", @allowed_target_scope)\n writer.write_object_value(\"automaticRequestSettings\", @automatic_request_settings)\n writer.write_object_value(\"catalog\", @catalog)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionStageSettings\", @custom_extension_stage_settings)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"expiration\", @expiration)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"questions\", @questions)\n writer.write_object_value(\"requestApprovalSettings\", @request_approval_settings)\n writer.write_object_value(\"requestorSettings\", @requestor_settings)\n writer.write_object_value(\"reviewSettings\", @review_settings)\n writer.write_collection_of_object_values(\"specificAllowedTargets\", @specific_allowed_targets)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"deviceId\", @device_id)\n writer.write_string_value(\"key\", @key)\n writer.write_enum_value(\"volumeType\", @volume_type)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"assignedTo\", @assigned_to)\n writer.write_date_time_value(\"closedDateTime\", @closed_date_time)\n writer.write_object_value(\"createdBy\", @created_by)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"dataSubject\", @data_subject)\n writer.write_enum_value(\"dataSubjectType\", @data_subject_type)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_object_value(\"insight\", @insight)\n writer.write_date_time_value(\"internalDueDateTime\", @internal_due_date_time)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"notes\", @notes)\n writer.write_collection_of_primitive_values(\"regulations\", @regulations)\n writer.write_collection_of_object_values(\"stages\", @stages)\n writer.write_enum_value(\"status\", @status)\n writer.write_object_value(\"team\", @team)\n writer.write_enum_value(\"type\", @type)\n end", "def serializable_hash\n self.attributes\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_string_value(\"joinWebUrl\", @join_web_url)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"modalities\", @modalities)\n writer.write_object_value(\"organizer\", @organizer)\n writer.write_collection_of_object_values(\"participants\", @participants)\n writer.write_collection_of_object_values(\"sessions\", @sessions)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_enum_value(\"type\", @type)\n writer.write_object_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"axes\", @axes)\n writer.write_object_value(\"dataLabels\", @data_labels)\n writer.write_object_value(\"format\", @format)\n writer.write_object_value(\"height\", @height)\n writer.write_object_value(\"left\", @left)\n writer.write_object_value(\"legend\", @legend)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_object_values(\"series\", @series)\n writer.write_object_value(\"title\", @title)\n writer.write_object_value(\"top\", @top)\n writer.write_object_value(\"width\", @width)\n writer.write_object_value(\"worksheet\", @worksheet)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"name\", @name)\n writer.write_enum_value(\"scenarios\", @scenarios)\n end", "def serialize\n JSON.dump(@hash)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_boolean_value(\"isUsable\", @is_usable)\n writer.write_boolean_value(\"isUsableOnce\", @is_usable_once)\n writer.write_number_value(\"lifetimeInMinutes\", @lifetime_in_minutes)\n writer.write_string_value(\"methodUsabilityReason\", @method_usability_reason)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_string_value(\"temporaryAccessPass\", @temporary_access_pass)\n end", "def to_s\r\n dump\r\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"callee\", @callee)\n writer.write_object_value(\"caller\", @caller)\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_object_value(\"failureInfo\", @failure_info)\n writer.write_collection_of_object_values(\"media\", @media)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"deviceCount\", @device_count)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"managedDevices\", @managed_devices)\n writer.write_enum_value(\"platform\", @platform)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_object_value(\"sizeInByte\", @size_in_byte)\n writer.write_string_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_string_value(\"roleTemplateId\", @role_template_id)\n writer.write_collection_of_object_values(\"scopedMembers\", @scoped_members)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"options\", @options)\n writer.write_boolean_value(\"protected\", @protected)\n end", "def serialize(io)\n Encoder.encode(io, self)\n io\n end", "def _dump() end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"authenticationConfiguration\", @authentication_configuration)\n writer.write_object_value(\"clientConfiguration\", @client_configuration)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"endpointConfiguration\", @endpoint_configuration)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"container\", @container)\n writer.write_string_value(\"containerId\", @container_id)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_object_value(\"member\", @member)\n writer.write_string_value(\"memberId\", @member_id)\n writer.write_enum_value(\"outlierContainerType\", @outlier_container_type)\n writer.write_enum_value(\"outlierMemberType\", @outlier_member_type)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"body\", @body)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"imageUrl\", @image_url)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_date_time_value(\"lastUpdatedDateTime\", @last_updated_date_time)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"tags\", @tags)\n writer.write_string_value(\"title\", @title)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_object_value(\"progress\", @progress)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"storageLocation\", @storage_location)\n writer.write_date_time_value(\"submittedDateTime\", @submitted_date_time)\n writer.write_string_value(\"userId\", @user_id)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"accessPackages\", @access_packages)\n writer.write_enum_value(\"catalogType\", @catalog_type)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customWorkflowExtensions\", @custom_workflow_extensions)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isExternallyVisible\", @is_externally_visible)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"resourceRoles\", @resource_roles)\n writer.write_collection_of_object_values(\"resourceScopes\", @resource_scopes)\n writer.write_collection_of_object_values(\"resources\", @resources)\n writer.write_enum_value(\"state\", @state)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"bundles\", @bundles)\n writer.write_string_value(\"driveType\", @drive_type)\n writer.write_collection_of_object_values(\"following\", @following)\n writer.write_collection_of_object_values(\"items\", @items)\n writer.write_object_value(\"list\", @list)\n writer.write_object_value(\"owner\", @owner)\n writer.write_object_value(\"quota\", @quota)\n writer.write_object_value(\"root\", @root)\n writer.write_object_value(\"sharePointIds\", @share_point_ids)\n writer.write_collection_of_object_values(\"special\", @special)\n writer.write_object_value(\"system\", @system)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"classification\", @classification)\n writer.write_string_value(\"feature\", @feature)\n writer.write_string_value(\"featureGroup\", @feature_group)\n writer.write_string_value(\"impactDescription\", @impact_description)\n writer.write_boolean_value(\"isResolved\", @is_resolved)\n writer.write_enum_value(\"origin\", @origin)\n writer.write_collection_of_object_values(\"posts\", @posts)\n writer.write_string_value(\"service\", @service)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"connectors\", @connectors)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_boolean_value(\"isShared\", @is_shared)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_date_time_value(\"registeredDateTime\", @registered_date_time)\n writer.write_collection_of_object_values(\"shares\", @shares)\n writer.write_collection_of_object_values(\"taskTriggers\", @task_triggers)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_collection_of_object_values(\"deviceStates\", @device_states)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_object_value(\"installSummary\", @install_summary)\n writer.write_object_value(\"largeCover\", @large_cover)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_date_time_value(\"publishedDateTime\", @published_date_time)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_collection_of_object_values(\"userStateSummary\", @user_state_summary)\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_collection_of_object_values(\"categories\", @categories)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"developer\", @developer)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_object_value(\"largeIcon\", @large_icon)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"notes\", @notes)\n writer.write_string_value(\"owner\", @owner)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_enum_value(\"publishingState\", @publishing_state)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"platformType\", @platform_type)\n writer.write_number_value(\"settingCount\", @setting_count)\n writer.write_collection_of_object_values(\"settingStates\", @setting_states)\n writer.write_enum_value(\"state\", @state)\n writer.write_number_value(\"version\", @version)\n end", "def _dump()\n #This is a stub, used for indexing\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"templateId\", @template_id)\n writer.write_collection_of_object_values(\"values\", @values)\n end", "def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"containers\", @containers)\n writer.write_object_value(\"controller\", @controller)\n writer.write_collection_of_object_values(\"ephemeralContainers\", @ephemeral_containers)\n writer.write_collection_of_object_values(\"initContainers\", @init_containers)\n writer.write_object_value(\"labels\", @labels)\n writer.write_string_value(\"name\", @name)\n writer.write_object_value(\"namespace\", @namespace)\n writer.write_object_value(\"podIp\", @pod_ip)\n writer.write_object_value(\"serviceAccount\", @service_account)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"detectionStatus\", @detection_status)\n writer.write_object_value(\"imageFile\", @image_file)\n writer.write_string_value(\"mdeDeviceId\", @mde_device_id)\n writer.write_date_time_value(\"parentProcessCreationDateTime\", @parent_process_creation_date_time)\n writer.write_object_value(\"parentProcessId\", @parent_process_id)\n writer.write_object_value(\"parentProcessImageFile\", @parent_process_image_file)\n writer.write_string_value(\"processCommandLine\", @process_command_line)\n writer.write_date_time_value(\"processCreationDateTime\", @process_creation_date_time)\n writer.write_object_value(\"processId\", @process_id)\n writer.write_object_value(\"userAccount\", @user_account)\n end", "def inspect\n self.to_hash.inspect\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end", "def inspect\n \"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: \" +\n JSON.pretty_generate(@data)\n end", "def encode\n raise Errors::SerializerNotConfigured if serializer_missing?\n\n serializer.encode(self)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"activationUrl\", @activation_url)\n writer.write_string_value(\"activitySourceHost\", @activity_source_host)\n writer.write_string_value(\"appActivityId\", @app_activity_id)\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_object_value(\"contentInfo\", @content_info)\n writer.write_string_value(\"contentUrl\", @content_url)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_string_value(\"fallbackUrl\", @fallback_url)\n writer.write_collection_of_object_values(\"historyItems\", @history_items)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"userTimezone\", @user_timezone)\n writer.write_object_value(\"visualElements\", @visual_elements)\n end", "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 serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"basis\", @basis)\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"datePurchased\", @date_purchased)\n writer.write_object_value(\"firstPeriod\", @first_period)\n writer.write_object_value(\"period\", @period)\n writer.write_object_value(\"rate\", @rate)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end", "def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end" ]
[ "0.7951372", "0.7645999", "0.7579812", "0.7579812", "0.7440032", "0.720861", "0.720861", "0.7207583", "0.7016516", "0.70007193", "0.6992252", "0.69838214", "0.69723576", "0.69666415", "0.69666415", "0.6942002", "0.69417155", "0.6933786", "0.6913977", "0.6891677", "0.68810964", "0.687664", "0.687664", "0.687664", "0.6875119", "0.68510306", "0.68364877", "0.68364877", "0.6825542", "0.6815931", "0.68061364", "0.68006235", "0.67944074", "0.67717844", "0.67341864", "0.67289317", "0.66964674", "0.66828746", "0.6673492", "0.6668077", "0.6666333", "0.6659732", "0.6656788", "0.66513675", "0.6635875", "0.66275525", "0.66275525", "0.66275525", "0.6627384", "0.66165835", "0.66141444", "0.6611379", "0.6597342", "0.65968686", "0.6594517", "0.6592636", "0.6583964", "0.6580536", "0.65803635", "0.6575503", "0.65716475", "0.65712893", "0.6566952", "0.6560253", "0.65554273", "0.65410006", "0.65378475", "0.65346783", "0.6527361", "0.6525178", "0.65242875", "0.65235287", "0.65174305", "0.65141636", "0.6508169", "0.6499713", "0.6498714", "0.6496881", "0.6486202", "0.6482482", "0.64814615", "0.6479782", "0.6476621", "0.6475453", "0.64677024", "0.64633876", "0.64619535", "0.6461202", "0.6457243", "0.64497435", "0.6439583", "0.6433183", "0.643078", "0.6424316", "0.6420337", "0.6420337", "0.6420337", "0.6420337", "0.6420337", "0.6418776", "0.64156514" ]
0.0
-1
belongs_to :user belongs_to :logo, class_name: "Upload" , foreign_key: :pyr_upload_id belongs_to :logo, class_name: "Upload" , foreign_key: :upload_id
def created_at object.created_at.in_time_zone.iso8601 if object.created_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logo_params\n params.require(:logo).permit(:name, :belongs_to)\n end", "def upload_params\n params.require(:upload).permit(:title, :upload, :user_id)\n end", "def set_upload_logo\n @upload_logo = UploadLogo.find(params[:id])\n end", "def set_upload\n\n\n @upload = Upload.find(params[:id])\n\n \n \n end", "def upload_params\n params.require(:upload).permit(:uploaded_file, :user_id, :folder_id,:label)\n end", "def logo_params\n params.require(:logo).permit(:name,:user_id)\n end", "def upload_params\n params.require(:upload).permit(:upload, :user_id, :folder_id)\n end", "def set_upload\n@upload = Upload.find(params[:id])\nend", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def upload_file(upload, user, client_name)\n if upload != nil\n if user.link_picture != nil\n File.delete('public/images/' << user.link_picture)\n end\n name = upload['img'].original_filename\n directory = 'public/images/' + client_name + '/users/' + user.username\n path = File.join(directory, name)\n File.open(path, 'wb') { |f| f.write(upload['img'].read) }\n path_img = client_name + '/users/' + user.username + '/' + name\n User.where(:id => user.id).update_all(link_picture: path_img)\n end\n end", "def set_upload\n @upload = current_user.uploads.find(params[:id])\n end", "def upload_logo_params\n params.require(:upload_logo).permit(:logo)\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def set_upload\n @upload = Upload.find(params[:id])\n end", "def fetch_upload\n @upload = Upload.find_by_id(params[:id])\n end", "def set_upload \n @upload = LibraryUpload.friendly.find(params[:id])\n end", "def set_upload\n @upload = WeddingPhoto.find(params[:id])\n end", "def upload_params\n params.require(:upload).permit(:user_id, :country_id, :university_id, :image)\n end", "def create\n@upload = Upload.create(upload_params)\nend", "def set_upload\n @upload = nil\n @upload = Upload.find(params[:upload_id]) if params[:upload_id]\n @upload = @content.upload if @upload.nil? && !@content.nil?\n end", "def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end", "def set_upload_file\n @upload_file = UploadFile.find(params[:id])\n end", "def set_upload\n @upload = Upload.friendly.find(params[:id])\n end", "def upload_user_bikes\n end", "def upload\r\n \r\n end", "def set_image_upload\n @image_upload = ImageUpload.find(params[:id])\n end", "def set_upload\n @photo = Photo.find(params[:id])\n end", "def load_uploadable\r\n \tklass = [Project, Event].detect { |c| params[\"#{c.name.underscore}_id\"] }\r\n \t@uploadable = klass.find(params[\"#{klass.name.underscore}_id\"])\r\n end", "def set_upload_file\n @upload_file = UploadFile.find(params[:id])\n end", "def set_upload_file\n @upload_file = UploadFile.find(params[:id])\n end", "def set_upload_file\n @upload_file = UploadFile.find(params[:id])\n end", "def upload_params\n params.require(:upload).permit(:upload)\n end", "def logo_params\n params.require(:logo).permit(:image, :campaign_id, :user_id)\n end", "def upload_params\n params.require(:upload).permit(:election_id, :file_type_id, :public, :file) # Not status, address or checksum.\n end", "def upload_save(hash_arr) \n @upload_file = UploadFile.new(hash_arr)\n if @upload_file.save \n return @upload_file.id\n end\n end", "def file_uploads; end", "def set_file_upload\n @file_upload = FileUpload.find(params[:id])\n end", "def set_file_upload\n @file_upload = FileUpload.find(params[:id])\n end", "def upload_logo\n @company = Company.find(params[:company_id])\n @company.logo.present? && (cdn_file = CdnFile.find(@company.logo)) && cdn_file.present? ? cdn_file.update_attributes(params[:cdn_file]) : (cdn_file = CdnFile.create(params[:cdn_file]))\n @company.update_attributes(:logo => cdn_file.id)\n \n respond_to do |format|\n format.js\n end\n end", "def fotosprofile_params\n params.require(:fotosprofile).permit(:user_id, :mis_fotos)\n end", "def upload\n end", "def upload\n end", "def set_picture_upload\n @picture_upload = PictureUpload.find(params[:id])\n end", "def set_uploadphoto\n @uploadphoto = Uploadphoto.find(params[:id])\n end", "def associate_uploads(key_name, target, uploads)\n if target\n associations = AssociationMap.new(target)\n uploads.each do |up|\n associations.put(\"U#{up.id}_#{key_name}\", up)\n end\n associations.save\n end\n end", "def upload_params \n params.require(:library_upload).permit(:title, :description, :tags, :image, :file)\n end", "def getUploadedBy\r\n\t\t\t\t\treturn @uploadedBy\r\n\t\t\t\tend", "def set_upload\n @upload = Upload.find_by_object_key(params[:id]) unless params[:id].nil?\n if @upload.nil?\n redirect_to '/404'\n return\n end\n end", "def filedownload_params\n params.require(:filedownload).permit(:user_id, :fileupload_id)\n end", "def create\n @upload = Upload.new(params[:upload])\n @upload.user_id = current_user.id if current_user\n if @upload.save\n redirect_to \"/patients\"\n else\n render :new\n end\n end", "def store_owner_id\n self.user_id = self.album.user_id\n end", "def upload_params\nparams[:upload].permit(:uploaded_file)\nend", "def presupuesto_foto_params\n # params.require(:presupuesto_foto).permit(:image_file, :descripcion ,:lugar)\n params.permit(:image_file)\n#:tipo_contenido, :nombre_archivo, :bits, :tempfile, :image_uid, :image_name\n#thumbnail, :fotolizable_id, :fotolizable_type, :cv_id, :presupuesto_id,\n end", "def userfile_params\n params.require(:userfile).permit(:filename, :user_id, :mycontact_id, :meeting_id, :references)\n end", "def upload_params\n params.require(:upload).permit(:title, :file_attachment)\n end", "def uploading_pictures\n end", "def upload_params\n params[:upload].permit(:photo)\n end", "def user_params\n params.require(:user).permit(:id,:avatar)\n end", "def set_uploaded_file\n @uploaded_file = UploadedFile.find(params[:id])\n end", "def create\n @user=User.find(params[:user_id])\n @file_upload = @user.file_uploads.new(file_upload_params)\n\n respond_to do |format|\n if @file_upload.save\n format.html { redirect_to user_file_upload_path(@user,@file_upload), notice: 'File was successfully uploaded.' }\n format.json { render :show, status: :created, location: @file_upload }\n @md5 = Digest::MD5.file(@file_upload.attachment.path).hexdigest \n @file_upload[:hash_val]=@md5\n @file_upload.save\n\n else\n format.html { render :new }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_params\n params.require(:upload).permit(:datafile,:thumbnail)\n params.require(:video).permit(:title,:description,:user_id)\n end", "def image_params\n params.require(:image).permit(:picture, :user_id)\n end", "def user_params\n params.require(:upload).permit(:file)\n end", "def galleryPhotoUpload\n\t\t\tif params[:id]\n\t\t\t\t\t@userfile= params[:userfile]\n\t\t\t\t\t@userfile.rewind\n\t\t\t\t\t@filename = \"#{Rails.root}/public/\"+rand(1000000000).to_s+@userfile.original_filename\n\n\t\t\t\t\tFile.open(@filename, \"wb\") do |file|\n\t\t\t\t\tfile.write(@userfile.read)\n\t\t\t\t\tend \n\n\t\t\t#@user.photos=File.open(@filename)\n\t\t\t\t\t\tif params[:before_after]==\"User_Photo\"\n\t\t\t\t\t\tparams[:before_after]=\"user_photo\"\n\t\t\t\t\t\telsif params[:before_after]==\"Photo_Before_Measurement\"\n\t\t\t\t\t\tparams[:before_after]=\"before\"\n\t\t\t\t\t\telse \n\t\t\t\t\t\tparams[:before_after]=\"after\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\tpicture=Photo.new(:photo=> open(@filename), :user_id=>params[:id], :before_after=>params[:before_after])\n\n\t\t\t\t\tif picture.save\n\t\t\t\t\t@status={\"status-msg\"=>\"141\"}\n\t\t\t\t\tFile.delete(@filename)\n\t\t\t\t\telse\n\t\t\t\t\t@status={\"status-msg\"=>\"142\"}\n\t\t\t\t\tend \n\t\t\telse\n\t\t\t@status={\"status-msg\"=>\"user not exist\"}\n\t\t\tend\n\t\trender :json =>@status.to_json\n\t\tend", "def image_user_params\n params.require(:image_user).permit(:image_id, :user_id)\n end", "def image_user_params\n params.require(:image_user).permit(:image_id, :user_id)\n end", "def find_upload_from_show(up_show, up_sym)\n # Makes a query to find the uploaded file by its default :id\n upload = up_show[up_sym].map {|up_hash| Upload.find(up_hash[:id])}.shift \n return upload\n end", "def create\n @upload_photo = UploadPhoto.new(params[:upload_photo])\n\n @upload_photo.user_id = 0 - @session_id.to_i # this will be updated when user logged in.\n @upload_photo.user_id = params[:user_id] unless params[:user_id].blank?\n\n if @upload_photo.save\n\t\t render :text => @upload_photo.data.url(:medium).split('?').first # @upload_photo.data.url(:thumb)\n else\n render :text => \"ERROR WHILE UPLOADING IMAGE\"\n end\n end", "def upload_params\n params.require(:upload).permit(:filename, :key)\n end", "def uploadImage\n post = DataFile.save(params[:upload], \"\")\n \n f = Family.where(turn: -1).first\n if f.nil?\n f = Family.new\n f.turn = -1\n f.save\n end\n \n f.name = post.to_s\n f.save\n \n # render :text => \"File has been uploaded successfully\"\n redirect_to :back\n end", "def upload_params\n params.require(:upload).permit(:user_name, :user_email, :recipient_email, :message, :package)\n end", "def upload_photo(cocktail_id)\n cocktailloader = Cocktailloader.find_by(mrcock_id: cocktail_id)\n cocktail = Cocktail.find(cocktail_id)\n img = cocktailloader.strDrinkThumb if cocktailloader\n cocktail.remote_photo_url = img if img\n puts \"photo saved\"\n cocktail.save\nend", "def before_saving\n self.save_to_gallery(self.file, self.filename, self.photo_gallery_id, self.user_id)\n# self.save\n# end\n end", "def set_fileupload\n @fileupload = Fileupload.find(params[:id])\n end", "def upload\n @project = current_user.projects.find(params[:id])\n\n uploaded_io = params[:file]\n if uploaded_io == nil \n render 'show', :alert => \"File fails to upload\"\n end \n\n file_name = Time.now.to_i.to_s + \"_\" + uploaded_io.original_filename # Attach the timestamp to avoid overwriting old files\n file_path = Rails.public_path + \"/uploads/\" + file_name\n File.open(file_path, 'wb') do |file|\n file.write(uploaded_io.read)\n end \n\n @project_file = ProjectFile.new( :file_name => file_name, \n :file_path => file_path, \n :user_id => params[:user_id], \n :project_id => params[:project_id],\n :original_file_name => uploaded_io.original_filename)\n\n if @project_file.save\n record_activity(\"uploaded \" + file_name)\n redirect_to :back, :notice => \"File uploaded successfully\"\n else\n record_activity(\"upload failed \" + file_name)\n render 'show', :alert => \"File info is failed to save\"\n end \n end", "def asset_params\n params.require(:asset).permit(:user_id, :upload_file, :folder_id,:level_id)\n end", "def foreign_key\n self.name + \"_id\"\n end", "def upload_params\n params.require(:upload).permit(:image)\n end", "def albumsix_params\n params.require(:albumsix).permit(:title, :avatar, :user_id)\n end", "def set_dbedt_upload\n @dbedt_upload = DbedtUpload.find(params[:id])\n end", "def upload_params\n params.require(:upload).permit(:name, :category, :information, :course_id, :assignment_id)\n end", "def upload_params\n params.require(:upload).permit(:dir, :pfad, :inhalt)\nend", "def upload_path picture\n entity = picture.class.name.sub('Picture','').upcase\n \"PICTURE_#{entity}_PATH\".constantize\n end", "def rock_photo_params\n params.permit(:uuid, :base64image, :filename, :rock_id,:deleted_at)\n end", "def path\n \"#{RAILS_ROOT}/photos/#{self.visit.user_id}/#{self.visit_id}\"\n \n# \"#{RAILS_ROOT}/public/images/#{self.class.to_s.underscore.pluralize}\"\n end", "def set_attachment\n @project = Project.find(params[:project_id])\n @attachment = @project.attachments.find(params[:id])\n @attachment.owner\n end", "def albumfour_params\n params.require(:albumfour).permit(:title, :avatar, :user_id)\n end", "def upload\n self._create params[:upfile], params[:pictitle]\n end" ]
[ "0.66150653", "0.64066476", "0.6385146", "0.62939334", "0.6274697", "0.6152687", "0.61321497", "0.6098173", "0.6042074", "0.6042074", "0.5981241", "0.5913107", "0.58974385", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5868643", "0.5823473", "0.5791651", "0.5780702", "0.577803", "0.5748807", "0.5730434", "0.5726712", "0.570141", "0.56763095", "0.5676065", "0.5636696", "0.5634387", "0.56260234", "0.5569184", "0.5559465", "0.5559465", "0.5559465", "0.55476433", "0.5543056", "0.5541244", "0.55366695", "0.55338013", "0.5521017", "0.5521017", "0.55196846", "0.54942214", "0.5490933", "0.5490933", "0.5481284", "0.5476878", "0.5469823", "0.54634196", "0.54598457", "0.5457184", "0.54562116", "0.5431491", "0.5416213", "0.5392036", "0.5367814", "0.53633136", "0.53618586", "0.5346086", "0.5343953", "0.53294414", "0.5322779", "0.5321116", "0.5313064", "0.52952373", "0.5286799", "0.5285399", "0.52835417", "0.52835417", "0.5278862", "0.52787405", "0.52719444", "0.5270416", "0.5267451", "0.5256036", "0.5248136", "0.5246315", "0.5245903", "0.5245782", "0.52407324", "0.5236158", "0.5223826", "0.5221775", "0.52151006", "0.5211512", "0.5210908", "0.52084666", "0.5203346", "0.5199478", "0.5197295", "0.51970154" ]
0.0
-1
Set authorization codes and go to index
def oauth2callback @g_cal_api.oauth2callback end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @authorize_codes = AuthorizeCode.all\n end", "def index\n head :unauthorized\n end", "def index\n\t\tredirect_to oauth_applications_path\n\tend", "def index\n @access_codes = AccessCode.all\n end", "def set_authorize_code\n @authorize_code = AuthorizeCode.find(params[:id])\n end", "def authorize(authcode)\n\t\t@client.authorization.code = authcode\n\t\t@client.authorization.fetch_access_token!\n\t\t@client.authorization.access_token\n\tend", "def authorization; end", "def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end", "def grant_authorization\n create_verification_code if authorized?\n redirect_back\n end", "def authorize\n end", "def authorize\n end", "def index\n @users = User.all\n @page_title = 'Управление топлива и транспорта'\n @authorized_user = User.find(session[:user_id])\n\n respond_to do |format|\n format.html {redirect_to(controller: 'users', action: 'home') if @authorized_user.grants & 256 == 0}\n format.json { render json: @users }\n end\n end", "def authorize_switch_user\n authenticate_user!\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n render :text => @authorizer.redirect_uri\n end", "def index\n @claimppriorauthorizations = Claimppriorauthorization.all\n end", "def index\n @authorizations = Authorization.all\n end", "def index\n @authorizations = Authorization.all\n end", "def index\n # set_user, is the only action taken here\n end", "def index\n # set_user, is the only action taken here\n end", "def index\n authorize Authentication, :index?\n @authentications = policy_scope(Authentication)\n end", "def codes\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '2'\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end\n @unused_codes = Code.where(\"admin_id=? and valid ='t'\", current_admin.id);\n @used_codes = Code.where(\"admin_id=? and valid ='f'\", current_admin.id);\n end", "def index\n skip_policy_scope\n @applications = current_user&.oauth_applications\n if @applications&.empty?\n skip_authorization\n else\n @applications&.each do |app|\n authorize app, policy_class: Oauth::ApplicationPolicy\n end\n end\n end", "def index\n if !session[:token].nil?\n if (session[:user_id] == 'superadmin')\n redirect_to admin_companies_path\n else\n redirect_to dashboard_path\n end\n else\n render layout: false\n end\n end", "def index\n custom_role = CustomRole.all\n if !custom_role.nil? and custom_role.size == 1\n redirect_to :action => \"show\", :id => custom_role[0].realmId\n else\n redirect_to realm_management_index_path\n end\n end", "def index \n @sims_biga_licenses = SimsBigaLicense.order(cnh_pes_id: :asc).page(params[:page]).per(20) \n authorize @sims_biga_licenses \n end", "def index\r\n redirect_to :action => :login\r\n end", "def index\n @admins = Admin.order(:email)\n authorize @admins\n end", "def authenticate\n oauth2_client = Qbo.get_client\n callback = Setting.host_name + \"/qbo/oauth_callback/\" \n grant_url = oauth2_client.auth_code.authorize_url(redirect_uri: callback, response_type: \"code\", state: SecureRandom.hex(12), scope: \"com.intuit.quickbooks.accounting\")\n redirect_to grant_url\n end", "def index\n # Insert ruby code...\n redirect_to home_path if current_user\n end", "def index\n if current_authkey.authkey.eql?(\"#fl0wk27er\")\n @batons = Baton.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batons }\n end\n elsif current_authkey.authkey.eql?(\"#daneld2130\")\n redirect_to daniel_batons_path\n elsif current_authkey.authkey.eql?(\"#cassaj0105\")\n redirect_to casa_batons_path\n elsif current_authkey.authkey.eql?(\"#hulkh2051\")\n redirect_to hulk_batons_path\n elsif current_authkey.authkey.eql?(\"#genllt5055\")\n redirect_to think_batons_path\n else\n redirect_to root_path\n end\n end", "def index\n if is_logged_in\n redirect_to(:action=>'list')\n end\n #all logic in login_redirect_logic\n end", "def index\n params[:response_type] ||= 'code'\n\n raise pre_auth.error_response.body.to_s unless pre_auth.authorizable?\n valid_request = validates_devise_authentication?\n crypt = ActiveSupport::MessageEncryptor.new(Rails.application.secrets.secret_key_base)\n @session_data = crypt.encrypt_and_sign(session.to_hash.to_json)\n return if valid_request\n\n render json: { error: I18n.t('devise.failure.not_found_in_database', authentication_keys: 'email') },\n status: :unauthorized\n end", "def authorization(*args, &block); end", "def authorization_mode=(mode); end", "def index\n # The hook below can access controller's instance variables.\n if current_user\n if current_user.role?:livia_admin\n redirect_to companies_url\n elsif is_secretary_or_team_manager?\n redirect_to \"/wfm/notes\"\n elsif current_user.end_user\n redirect_to physical_clientservices_home_index_path\n elsif is_client\n redirect_to matter_clients_url\n elsif current_user.role?:lawfirm_admin\n redirect_to lawfirm_admins_url\n return\n end\n else\n flash[:error] = t(:flash_DB_error)\n redirect_to login_url\n end\n end", "def index\n authorize Order\n super\n end", "def index \n if logged_in?\n case current_user.role.name\n when \"sitter\"\n redirect_to dashboard_sitter_path(current_user) \n when \"parent\"\n redirect_to dashboard_parent_path(current_user)\n when \"admin\"\n redirect_to :action => 'index', :controller => 'admin'\n end\n end\n\n @metro_areas, @states = setup_locations_for_public_search\n end", "def index\n @codes = Code.public_codes\n end", "def index\n @authorizedusers = Authorizeduser.all\n end", "def set_access_code\n @access_code = AccessCode.find(params[:id])\n end", "def set_access_code\n @access_code = AccessCode.find(params[:id])\n end", "def index\n if can?(:>=, \"5\")\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def index\n @loan_manager_profiles = LoanManagerProfile.all\n authorize LoanManagerProfile\n end", "def index\n authorize Student\n if User.find_by_email(current_user.email).provider == 'facebook' and Student.find_by_email(current_user.email).education == 'DUMMY'\n redirect_to edit_student_path(Student.find_by_email(current_user.email)), notice: 'Please fill out details first !'\n end\n\n @students = Student.all\n # authorize Student\n end", "def authorize\n\n if Rails.env.production?\n @clientid = '40928'\n @clients = 'dc6d5affd7d09115b0cd36e8f325b11d0125dfbd'\n else\n @clientid = '40250'\n @clients = '700b02392cd20d926d066de6a28601acb90772a8'\n end\n\n response = RestClient.post 'https://www.strava.com/oauth/token', { client_id: @clientid, client_secret: @clients, code: params[\"code\"], grant_type: 'authorization_code' }\n json = JSON.parse(response)\n user = User.find_by(id: params[\"user_id\"])\n user.update(strava_id: json['athlete']['id'], access_token: json['access_token'], access_token_expiry: Time.at(json['expires_at']), refresh_token: json['refresh_token'])\n redirect_to root_url\n end", "def authorize\n\n # redirect to kpass for authorization (and authentication if they're not\n # signed in.)\n # \n \n\n authorize_url = \"#{ENV['KPASS_ENDPOINT']}/oauth/authorize?app_id=#{ENV['KPASS_APP_ID']}\"\n redirect_to authorize_url\n end", "def check_auth\n unless params[:code]\n\t redirect_to(FACEBOOK_URL) and return\n end\n end", "def index\n User.all #take all auth stuff\n end", "def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to vault_dashboard_path\n end\n end", "def show\n authorize HighschoolCompletion\n end", "def index\n #authorize! :index, @login, :message => 'Not authorized as an administrator.'\n #É preciso ir buscar a clinica do gestor atual para carregar a informação\n manager = Manager.first(:conditions => \"login_id = #{current_login.id}\")\n @clinic = manager.clinic\n\n @managers = Manager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managers }\n end\n end", "def authorise\n @oauth_client = OauthClient.find(params[:id])\n\n response = @oauth_client.exchange(params[:code], request.original_url) if params[:code]\n @oauth_client.access_token = response[\"access_token\"]\n @oauth_client.refresh_token = response[\"refresh_token\"]\n @oauth_client.expires_at = response[\"expires_at\"]\n\n respond_to do |format|\n if @oauth_client.save\n format.html { redirect_to oauth_client_path(@oauth_client), notice: 'OAuth client was successfully authorised.' }\n format.json { head :no_content }\n else\n format.html { render action: \"show\", error: 'OAuth client was not successfully authorised.' }\n format.json { render json: @oauth_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user_edorg = session[:edOrgId]\n\n load_apps()\n\n # create a list of app auth info including edorgs element, count of authorized edorgs, and app name\n @app_auth_info = []\n user_app_auths = ApplicationAuthorization.findAllInChunks\n user_app_auths.each do |auth|\n info = {}\n app = @apps_map[auth.appId]\n info[:edorg_auth] = auth\n info[:count] = get_edorg_auth_count(auth)\n info[:name] = app ? app.name : ''\n @app_auth_info.push(info)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n if token_and_options(request)\n access_key = AccessKey.find_by_access_token(token_and_options(request))\n @user = User.find_by_id(access_key.user_id)\n \n p \"INDEx\"\n end\n end", "def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end", "def index\n if current_authkey.authkey.eql?(\"#fl0wk27er\")\n @testers = Tester.all\n else\n redirect_to root_path\n end\n end", "def index\n authorize Arduino\n end", "def authenticate(code)\n request_access('authorization_code', code: code, redirect_uri: @redirect_uri)\n end", "def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = @user.org.token_permission_types\n end", "def authorize\n\t if session[:user_id].nil?\n\t\t session[:original_uri] = request.request_uri\n\t\t redirect_to(login_path)\n\t\t flash[:notice] = \"Please login or sign up to access The Mashera Project!\"\n\t end\n end", "def index\n @users = User.all\n authorize User\n end", "def index\n @account_codes = AccountCode.all\n end", "def auth\n end", "def auth\n end", "def index\n @details = Detail.all\n authorize @details \n end", "def index\n jump_to(\"/accounts/#{session[:account_id]}/edit\")\n end", "def index\n @authorized_clients = AuthorizedClient.all\n end", "def url\n PagSeguro.site_url(\"v2/authorization/request.jhtml?code=#{code}\") if code\n end", "def authorize_cli\n authenticate_user!\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n client_application = ClientApplication.find_by_key(params[:client_id])\n statsd = StatsManager.new\n statsd.feedAuthorizeMetric(current_user, client_application)\n render :text => @authorizer.code.token\n end", "def index\n @accounts = current_user.accounts\n @wallet = current_user.wallet\n authorize @accounts\n end", "def index\n @secret_codes = SecretCode.paginate(page: params[:page])\n end", "def index\n unless access_token\n redirect_to controller: 'oauths', action: 'welcome'\n return\n end\n \n @drivers = [:chrome, :ff, :ie, :safari]\n @scenarios = Scenario.where(user_id: current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scenarios }\n end\n end", "def secret_show\n redirect_to codes_path, notice: 'No Code Found.' if @code.blank?\n end", "def callback\n\n client = Signet::OAuth2::Client.new(client_options)\n client.code = params[:code]\n\n response = client.fetch_access_token!\n\n session[:authorization] = response\n redirect_to '/leagues/calendar/events/federicobucci504@gmail.com'\n end", "def authorize!\n redirect '/auth' unless authorized?\n end", "def index\n authority_status = latest_authority_status\n if refresh? || expired_status? || authority_status.blank?\n validate(authorities_list)\n status_log.delete_passing\n update_authority_status\n authority_status = latest_authority_status\n end\n @authority_count = authorities_list.size\n # TODO: Include historical data too\n @presenter = presenter_class.new(authority_count: @authority_count,\n authority_status: @latest_authority_status,\n current_data: @status_data,\n historical_data: [])\n render 'index', :status => :internal_server_error if authority_status.failure_count.positive?\n end", "def authorized\n redirect_to '/signin' unless current_driver\n end", "def index\n @authentics = Authentic.all\n end", "def index\n \t@secret_codes = SecretCodes.includes(:user).all\n\tend", "def index\n\n # Authentication\n @oauth_redirect_url = request.url\n if params[:code]\n session[:access_token] = Koala::Facebook::OAuth.new(@oauth_redirect_url).get_access_token(params[:code])\n redirect_to \"#{request.protocol}#{request.host_with_port}#{request.path}\" and return\n end\n\n @fb_users = FbUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @fb_user }\n end\n end", "def authorize!\n\t\t\tredirect '/login' unless authorized?\n\t\tend", "def authorize\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n client_application = ClientApplication.find_by_key(params[:client_id])\n statsd = StatsManager.new\n statsd.feedAuthorizeMetric(current_user, client_application)\n #If this is an auto authentication transparent for end user\n redirect_to @authorizer.redirect_uri\n end", "def authorize\n if current_user.nil?\n redirect_to events_manager_index_path, :notice => \"Login to continue!\"\n return false\n else\n end \n end", "def index\n @view.apps = RegisteredApplication.where('user_id = ?', current_user.id)\n authorize @view.apps\n # Response: Controller will forward_to\n # /views/registered_applications/index.html.erb with @view\n end", "def index\n login_first\n @title = 'Welcome to DCID!'\n redirect :routing\n end", "def oauth2_callback\n # Swap Auth token for an access token\n token = oauth2_client.auth_code.get_token(params[:code])\n\n # Remember the access token\n session[:access_token] = token.token\n redirect_to repo_index_path\n end", "def index\n redirect_to accounts_path, notice:'Entries can only be accsessed through Accounts'\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def index\n @codes = Code.all\n end", "def access_control\n \n end", "def index\n\t\tif signed_in?\n \t\t user=User.find(session[:user_id])\n \t\tcase user.role\n \twhen \"s\"\n \t\tredirect_to supervisor_index_path and return\n \twhen \"a\"\n \t redirect_to receptionnist_index_path and return\n \tend\t\n \tend\n\tend", "def index\n @project = Project.find(params[:project_id].to_i)\n authorize_user!( @project )\n end", "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 index\n #TODO: determine how/what we're going to serve to get the user's ticket classes and acess_code_types\n @access_codes = AccessCode.where(user_access_code_type: @user_access_code_types).order('created_at DESC')\n @access_code = AccessCode.new\n\n # access code types available to this user.\n @access_code_types = current_user.access_code_types.where(event: @event)\n # only show ticket classes available to the user via their access code types\n @ticket_classes = TicketClass.joins('INNER JOIN access_code_types_ticket_classes ON access_code_types_ticket_classes.ticket_class_id = ticket_classes.id').where('access_code_types_ticket_classes.access_code_type_id': @access_code_types).distinct.order('cost ASC, sales_start ASC')\n\n end", "def authorize_code(authorization_code)\n client.authorization.code = authorization_code\n client.authorization.fetch_access_token!\n client.authorization.refresh_token ||= oauth_data[:refresh_token]\n oauth_data[:refresh_token] = client.authorization.refresh_token\n end", "def index\n authorize!(:view_configuration_management)\n end", "def index\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end", "def index\n @role = session[:role]\n @househunters = Househunter.all\n if session[:role] != \"admin\"\n redirect_to login_path, notice: \"You are not allowed to access that url\"\n end\n end", "def index\n @tutor_groups = TutorGroup.where(academic_session_id: session[:global_academic_session])\n if !@tutor_groups.blank?\n authorize @tutor_groups\n end\n \n end", "def authorize\n return credentials if credentials\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = $stdin.gets\n authorizer.get_and_store_credentials_from_code(\n user_id: user_id,\n code: code,\n base_url: OOB_URI\n )\n end" ]
[ "0.6984273", "0.6526871", "0.6475551", "0.6322765", "0.6171734", "0.61640507", "0.615604", "0.60372543", "0.6015449", "0.6014099", "0.6014099", "0.5959635", "0.5945048", "0.5905424", "0.58806235", "0.58806235", "0.587843", "0.587843", "0.58746034", "0.5850359", "0.58481234", "0.5847906", "0.58340776", "0.5797431", "0.57633007", "0.5762672", "0.5761171", "0.574986", "0.57315195", "0.57263786", "0.57151693", "0.57139", "0.57092386", "0.5702152", "0.57005817", "0.5681178", "0.5674128", "0.5659735", "0.56593335", "0.56593335", "0.56565744", "0.56544775", "0.5649518", "0.56455255", "0.5645469", "0.5644024", "0.56416255", "0.5633366", "0.5632815", "0.56312776", "0.5629621", "0.5625672", "0.56249475", "0.5623389", "0.56176275", "0.5600974", "0.55950457", "0.55934453", "0.5593282", "0.5589538", "0.5584667", "0.55842716", "0.55842716", "0.55823267", "0.557916", "0.55771095", "0.55704004", "0.5557152", "0.5550618", "0.55465686", "0.5541442", "0.5537461", "0.5535932", "0.5535772", "0.5535076", "0.5530038", "0.5522223", "0.5520839", "0.5519446", "0.5518394", "0.55152524", "0.55143", "0.5511464", "0.5509573", "0.5499808", "0.5499645", "0.5497482", "0.5497482", "0.5497482", "0.5497482", "0.54963475", "0.54942656", "0.5490643", "0.5489711", "0.54858834", "0.5484666", "0.54829353", "0.5481742", "0.5477061", "0.5475623", "0.5475251" ]
0.0
-1
Produces a sensible friendly name for this payload, shown in UIs. Must be inferred from serialized job parameters or else won't be shown properly in remote jobs. Should be unique but does not need to be. Has no operational effect. Abstract, your job should override.
def name application_job_overrides_method!(__method__) # default implementation for framework jobs job_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_name\n if @description\n @name + ' ' + @description\n else\n @name\n end\n end", "def readable_name\n \"(#{@type}) #{@name}\"\n end", "def to_s; @name || self; end", "def to_s; @name || self; end", "def to_s\n self.name || super\n end", "def to_s\n self.name || super\n end", "def name\n @name ||= [action, resource.name, resource.type].compact.map(&:to_s).join('_').underscore\n end", "def simple_name\n [@parent.simple_name, self.name.parameterize].compact.join('_')\n end", "def display_name\n job_class\n end", "def name\n @custom_name || @attribute.to_s.humanize\n end", "def unique_name\n unique_name = @name\n unique_name += \" (#{@disambiguation})\" if @disambiguation\n return unique_name\n end", "def name\n super.to_s\n end", "def name\n super.to_s\n end", "def name\n @name.to_s\n end", "def name\n @name.to_s\n end", "def to_s\n longname\n end", "def name()\n to_s\n end", "def name\n @name ? @name.to_s : unique_id\n end", "def synthesize_job_name\n klass_name = name.scan(/[^:]+/).last\n klass_name = klass_name[/(.+)Job/, 1] || klass_name\n klass_name.scan(/[A-Z][a-z]+/).map(&:downcase).join('_').to_sym\n end", "def to_s() name end", "def name\n self._id.to_s\n end", "def to_s\n self.name.to_s || super\n end", "def to_s\n return \"#{self.name}\"\n end", "def pretty_name\n @pretty_name || self.to_s\n end", "def pretty_name\n @pretty_name || self.to_s\n end", "def name\n return '_untitled_' if self[:name].blank?\n self[:name]\n end", "def get_name\n return \"#{name}\"\n end", "def serialized_name\n @serialized_name ||= to_s.demodulize.underscore\n end", "def display_name\n NAME\n end", "def display_name\n NAME\n end", "def name\n @_name\n end", "def to_s; name; end", "def name\n @name ||= parse_name(id.name)\n end", "def display_name\n self.class.display_name_for(definition[\"name\"] || name)\n end", "def to_s\n @final_name ||= (Functional.lookup(self) || @name).to_s\n end", "def get_job_name(course, assessment, submission)\n \"#{course.name}_#{assessment.name}_#{submission.version}_#{submission.course_user_datum.email}\"\n end", "def to_human\n encoded_name = super\n decode_name(encoded_name)\n end", "def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end", "def name\n # The name must be a string\n id.to_s\n end", "def name\n internal_name\n end", "def name\n base = config[:name]\n @formatted ? \"#{base} (#{@formatted})\" : base\n end", "def name\n @name.empty? ? to_s : @name\n end", "def display_name\n name\n end", "def name\n id = arguments&.first&.fetch(:id)\n job_id = arguments&.first&.fetch(:job_id)\n \"Analysis for: #{id}, job=#{job_id}\"\n end", "def getName()\n\t\t\treturn @_name\n\t\tend", "def name\n super.to_s.titleize\n end", "def job_spec_name\n self.job_spec.name\n end", "def name\n @name || object_id.to_s\n end", "def to_name; @name; end", "def name_key\n return base_key + \".name\"\n end", "def get_name\n return \"Name: \" + @name\n end", "def name()\n return @name\n end", "def get_name\r\n self.name\r\n end", "def name\n data[:name]\n end", "def to_s\n extended_name\n end", "def name\n \"#{id}-#{company_name}\"\n end", "def name\n self[:name]\n end", "def display_name\n @name\n end", "def original_name\r\n return @name\r\n end", "def human_name\n cn = name\n\n if respond_to?(:is_dynamic_model) && is_dynamic_model || respond_to?(:is_activity_log) && is_activity_log\n cn = cn.split('::').last\n end\n\n cn.underscore.humanize.captionize\n end", "def display_name\n name\n end", "def display_name\n name\n end", "def to_s\n short_name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def full_name\n return @full_name if @full_name\n if primitive_is_complex? name\n full_name = primitives[name]['name']\n debug \"Using full name '#{full_name}' for complex primitive '#{name}'\"\n @full_name = full_name\n else\n @full_name = name\n end\n end", "def to_s\n name || ''\n end", "def to_s\n name || ''\n end", "def pretty_name\n super || name.humanize\n end", "def to_s\n unique_name.to_s\n end", "def to_s\n return self.name\n end", "def to_s\n return self.name\n end", "def to_s\n return self.name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def to_s\n name\n end", "def canonical_long_name\n if respond_to?(:verbose_name)\n verbose_name\n elsif respond_to?(:short_name)\n name\n elsif respond_to?(:description)\n description\n else\n ''\n end\n end", "def name\n raw_data[:Name]\n end", "def name\n raw_data[:Name]\n end", "def name_template\n @name_template || self.to_s\n end", "def display_name\n \t\"#{name}\"\n end", "def name\n @name ||= metadata.attributes['Name'].value\n end", "def to_s ; @qname || \"#<#{self.class}:#{self.object_id}>\" ; end", "def unique_name_for(item)\n item.to_s\n end", "def name() return @name end", "def name() return @name end", "def name_with_title\n \"#{self.name}: #{self.title}\"\n end", "def display_name\n @data['display_name']\n end", "def to_s\n @name\n end", "def name\n @name || @id.to_s.capitalize\n end", "def name\n @display_name || @name\n end" ]
[ "0.6755389", "0.66901404", "0.66427547", "0.66427547", "0.6612011", "0.6612011", "0.657596", "0.6556003", "0.65279055", "0.65095", "0.65082246", "0.65019745", "0.65019745", "0.6493959", "0.6493959", "0.64901716", "0.6482224", "0.6466556", "0.64630014", "0.645534", "0.6447452", "0.6409122", "0.6402521", "0.6397102", "0.6397102", "0.639449", "0.639019", "0.63872015", "0.6384607", "0.6384607", "0.6367959", "0.63539046", "0.6343524", "0.63359815", "0.6320866", "0.6293001", "0.62885123", "0.62865466", "0.6284492", "0.6284486", "0.6279973", "0.6246178", "0.6245377", "0.623574", "0.62346035", "0.6232928", "0.6226769", "0.622033", "0.6213817", "0.6213711", "0.6212021", "0.6211104", "0.621011", "0.62100536", "0.6209276", "0.62023234", "0.6202095", "0.6198485", "0.61940527", "0.61856365", "0.61829495", "0.61829495", "0.61803186", "0.6164988", "0.6164988", "0.6164988", "0.6164988", "0.6164988", "0.6164795", "0.61593616", "0.61593616", "0.61583376", "0.61573035", "0.61573035", "0.61573035", "0.61573035", "0.61510414", "0.61510414", "0.61510414", "0.61510414", "0.61510414", "0.61510414", "0.61510414", "0.61510414", "0.61510414", "0.6147939", "0.61461884", "0.61461884", "0.614457", "0.61441934", "0.61381286", "0.61357754", "0.61334616", "0.6130576", "0.6130576", "0.61206", "0.6119621", "0.61158013", "0.611453", "0.61107546" ]
0.66230166
4
Job ID for this job.
def job_id=(value) @job_id = value.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_id\n @gapi.job_reference.job_id\n end", "def job_id\n raise NotImplementedError\n end", "def job_id\n async && async.job_id\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def id\n active_job_id\n end", "def get_job_id\n # check if the job ID has already been set (the job name will not change\n # during execution, so it is safe to assume that the job ID won't change)\n if not defined? @job_id or @job_id == '' or @job_id == nil\n result = veeamconfig('job', 'list').lines\n if result.length > 1\n result.each_with_index do |line, index|\n # skip the first line of output, since it is just the table setup\n next if index == 0\n\n # split line into array by space\n bits = line.split(' ')\n # pull out the repository name\n job_name = bits[0]\n\n # parse and return the job ID\n @job_id = bits[1].tr('{}', '') if job_name == @resource[:job_name]\n return @job_id\n end\n\n # return false if the job doesn't exist\n false\n else\n # return false if there are no jobs that exist\n false\n end\n else\n # return the job ID if it's already set\n @job_id\n end\n end", "def job_spec_id\n self.job_spec.id\n end", "def parent_job_id\n @gapi.statistics.parent_job_id\n end", "def jobid_prefix\n @jobid_prefix\n end", "def project_id\n @gapi.job_reference.project_id\n end", "def create_job_id\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n Generators.generate_uuid(self)\n end", "def name\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n job_id\n end", "def job_key; Thread.current[:job_key]; end", "def run_id\n job_group.execution_variables['run_id']\n end", "def job\n job_uuid && Jobber::Job::Base.find_job(job_uuid)\n end", "def send_job(job)\n begin\n response = RestClient::Request.execute(\n method: :post,\n url: build_jobs_url,\n payload: job.to_codem_json,\n timeout: EBU::NETWORK_TIMEOUT,\n open_timeout: EBU::NETWORK_TIMEOUT\n )\n if response.code == 202\n if (obj = JSON.parse(response.to_str))\n obj[\"job_id\"]\n else\n raise \"Job #{job.id} was created on transcoder #{self.id}, but no job ID was returned.\"\n end\n else\n nil\n end\n rescue Timeout::Error => e\n nil\n rescue => e\n nil\n end\n end", "def job(id)\n Job.new(id, self)\n end", "def attempt_id\n ENV['mapred_task_id']\n end", "def get_job_id(error = true)\n job_id = get_env_var('SLURM_JOB_ID', error_ = false)\n job_id = get_env_var('SLURM_JOBID', error_ = error) unless job_id\n job_id.to_i\nend", "def job\n return nil if self.job_id.nil?\n Delayed::Job.find(self.job_id)\n end", "def jenkins_task_id\n @jenkins_task_id ||= task_id(@options['jenkins_task_name'] || 'jenkins sync')\n end", "def jobPath\n @jobPath ||= File.join(Utils.getSpoolPath, Utils.getJobFilename(@id))\n end", "def jid\n JID::new(attributes['jid'])\n end", "def jid\n JID::new(attributes['jid'])\n end", "def jid\n JID::new(attributes['jid'])\n end", "def job_key\n Digest::MD5.hexdigest(path)\n end", "def job\n job_name.constantize.new({\n :context => self\n })\n end", "def jid\n (a = attributes['jid']) ? JID.new(a) : nil\n end", "def get_identifier\n return @task_arn\n end", "def job_name\n @job_name ||= QA::Runtime::Env.ci_job_name&.gsub(%r{ \\d{1,2}/\\d{1,2}}, '')\n end", "def thread_id()\n #This is a stub, used for indexing\n end", "def id\n self[:identifier]\n end", "def get_id()\n return @id\n end", "def job\n JenkinsApi::Client::Job.new(self)\n end", "def job\n JenkinsApi::Client::Job.new(self)\n end", "def current_job\n return @job_current\n end", "def thread_id\n return @thread_id\n end", "def id\n @__metadata__.key || @id\n end", "def job\n @job\n end", "def job\n @job\n end", "def next_job_id\n new_id = rand(10*5)\n get_job_status(new_id).nil? ? new_id : next_job_id\n end", "def id\n read_attribute(self.class.primary_key)\n end", "def id\n read_attribute(self.class.primary_key)\n end", "def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end", "def id\n @properties[self.class.primary_key].to_i unless new_record?\n end", "def job_position(job)\n jobs.index(job)\n end", "def job_position(job)\n jobs.index(job)\n end", "def record_identifier(record)\n record.id\n end", "def jobinfo\n dir + JOBINFO_FILENAME\n end", "def job\n @job\n end", "def batch_id\n @batch && @batch.id\n end", "def to_id\n queue.to_id + '_' + ppg\n end", "def job_spec_name\n self.job_spec.name\n end", "def id\n jrdd.id\n end", "def job=(job_name)\n @job = job_name\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def _execution_id\n attributes['id']\n end", "def get_identifier\n identifier = get_project_name\n fail(\n ActiveRecord::RecordNotFound,\n \"Project identifier not specified\"\n ) if identifier.nil?\n identifier.to_s\n end", "def job_identity(args)\n Digest::SHA1.hexdigest([ Time.now.to_f, rand, self, args ].join)\n end", "def file_number\n begin\n self.job.file_number\n rescue\n \"\"\n end\n end", "def oid\n id(get_oid())\n end", "def id\n @attributes[\"#{self.class.to_s.split('::').last.underscore.downcase}_id\".to_sym]\n end", "def job\n\t\tjid = @db.hget('sgt-unit:'+@id, 'job')\n\t\treturn nil if jid == nil\n\t\tgetJob(@db, jid)\n\tend", "def show\n @job_id = @part.job.id\n end", "def id\n raise NotConfiguredError, \"please configure DCell with DCell.setup\" unless @configuration\n @configuration['id']\n end", "def job(job_name)\n jobs job_name\n end", "def initialize(job_id)\r\n\t\t\tif %r!([A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12})! =~ job_id\r\n\t\t\t\t@id = $1\r\n\t\t\telse\r\n\t\t\t\traise JobParseException, \"Unable to parse '#{job_id}' into a job description. Maybe the format has changed?\"\r\n\t\t\tend\r\n\t\tend", "def record_id(record)\n record.id\n end", "def id\n @record.id\n end", "def last_job_number\n @jobs.length\n end", "def id\n record.id.to_s\n end", "def process_id\n return @process_id\n end", "def find_job\n @job = Job.find(params[:job_id])\n end", "def id\n raise MissingID if not defined?(@id)\n @id.to_i\n end", "def id\n self._id.to_s if self._id\n end", "def pid\n @pid ||= metadata.fetch(@args.command, nil)\n end", "def id\n raise Errno::ENOENT, \"This object has been deleted.\" if self.deleted?\n raise \"No ID on object.\" if !@id\n return @id\n end", "def id\n (read_property 'Id') || name\n end", "def process!\n raise MissingOutputFormat.new if @output_formats.blank?\n \n @query = self.to_create_query\n \n begin\n @result = self.connection.request('/apis/encoding-com/jobs/create', 'post', @query)\n rescue => e\n fatal 'An error occured in sending your encoding request'\n fatal e\n raise e\n end\n \n return @result['job_id']\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end" ]
[ "0.8665632", "0.8343201", "0.80267394", "0.7953702", "0.7953702", "0.7953702", "0.7953702", "0.7953702", "0.7953702", "0.7953702", "0.78767943", "0.7573737", "0.7429571", "0.7276197", "0.7128654", "0.70065093", "0.69203395", "0.69159067", "0.68273455", "0.6780553", "0.6714613", "0.6617191", "0.6466871", "0.64451414", "0.63321334", "0.6320303", "0.6287908", "0.62877345", "0.6254045", "0.6254045", "0.6254045", "0.62194896", "0.6191615", "0.61915857", "0.6186792", "0.6185439", "0.6164951", "0.6130653", "0.61029184", "0.6080141", "0.6080141", "0.605932", "0.60588217", "0.60405886", "0.6015821", "0.6015821", "0.6014183", "0.600449", "0.600449", "0.5996006", "0.5972139", "0.59632", "0.59632", "0.59622365", "0.59490335", "0.59405464", "0.59308237", "0.5928024", "0.59136426", "0.5912626", "0.59052265", "0.5902907", "0.5902132", "0.5880018", "0.5869414", "0.58658516", "0.5865694", "0.5848381", "0.5847422", "0.58288205", "0.5826507", "0.5825315", "0.58245057", "0.5813249", "0.5813191", "0.5811747", "0.5810309", "0.58073", "0.5802476", "0.57956743", "0.5785466", "0.5782208", "0.5781115", "0.5777396", "0.57675517", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051", "0.5764051" ]
0.82318074
2
Optionally produces a unique key to ensure uniqueness of this job. See the Generators module methods for example job_id generators you can use.
def create_job_id application_job_overrides_method!(__method__) # default implementation for framework jobs Generators.generate_uuid(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_key\n @unique_key ||= section.identifier\n end", "def job_identity(args)\n Digest::SHA1.hexdigest([ Time.now.to_f, rand, self, args ].join)\n end", "def job_key\n Digest::MD5.hexdigest(path)\n end", "def key(name)\n @unique_key = name\n end", "def generate_key; end", "def job_id\n raise NotImplementedError\n end", "def gen_key(record)\n return Digest::SHA2.hexdigest(record.to_s)\n end", "def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end", "def job_id=(value)\n @job_id = value.to_s\n end", "def good_job_concurrency_key\n @good_job_concurrency_key || _good_job_concurrency_key\n end", "def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end", "def new_worker(opts={})\n @mutex.synchronize {\n job_key = opts[:job_key] || gen_key\n unless self[job_key]\n self[job_key] = instantiate_worker(opts[:class]).new(opts[:args])\n return job_key\n else\n raise ::BackgrounDRbDuplicateKeyError\n end \n }\n end", "def job_key; Thread.current[:job_key]; end", "def generate_primary_key\n self[self.class.primary_key] ||= self.class.new_primary_key(10_000)\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 generate_key(*args)\n @cache_keys[args.join] ||= @key_generator.generate_key(*args)\n end", "def jobid_prefix\n @jobid_prefix\n end", "def next_job_id\n new_id = rand(10*5)\n get_job_status(new_id).nil? ? new_id : next_job_id\n end", "def key\n @key ||= self.project.key + '-' + self.no.to_s\n end", "def uniqueness_generate\n self.uniqueness_options.each do |field, options|\n value = send(field)\n unless value.present?\n value = Uniqueness.generate(options)\n self.send(\"#{field}=\", value)\n end\n end\n end", "def generate_unique_key(now = Time.now)\n u1 = ((now.to_i*1000*1000+now.usec) << 12 | rand(0xfff))\n uid = [u1 >> 32, u1 & 0xffffffff, rand(0xffffffff), rand(0xffffffff)].pack('NNNN')\n uid.unpack('C*').map { |x| \"%02x\" % x }.join\n end", "def rand_key\n return JString.new\n end", "def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end", "def unique_key\n \"redis:bitops:#{SecureRandom.hex(20)}\"\n end", "def job_id\n async && async.job_id\n end", "def __object_unique_id__\n return @args[:data][:Key_name]\n end", "def generate_key\n proposed_key = nil\n\n loop do\n num_part = rand(10**7).to_s.rjust(7, \"0\")\n proposed_key = \"#{IDB_CONFIG[:key_prefix]}-#{num_part}\"\n break unless self.class.find_by(key: proposed_key)\n end\n proposed_key\n end", "def grab_job_uniq\n throw :notimpl\n end", "def prime(job_id)\n redis do |conn|\n conn.lpush(key.primed, job_id)\n end\n end", "def job_id\n @gapi.job_reference.job_id\n end", "def key\n @key ||= name.to_s\n end", "def generate_unique_id\n Digest::SHA256.hexdigest unique_id_elements.join\n end", "def key_for(id)\n lamb = @key_lambda || lambda { |id| \"deferred-job:#{id}\" }\n lamb.call id\n end", "def unique_id\n \"name-#{@language_id}-#{@name_id}\"\n end", "def _good_job_concurrency_key\n key = self.class.good_job_concurrency_config[:key]\n return if key.blank?\n\n key = instance_exec(&key) if key.respond_to?(:call)\n raise TypeError, \"Concurrency key must be a String; was a #{key.class}\" unless VALID_TYPES.any? { |type| key.is_a?(type) }\n\n key\n end", "def generate_unique_id\n \"1.3.6.1.4.1.21367.2009.5.14.#{id}.#{Time.now.to_i}\"\n end", "def default_key\n :\"#{self[:name]}_id\"\n end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def unique_id\n # check all_data instead of data, as we have to not reuse deleted key\n ids = Set.new(all_data.map { |e| e[:key] })\n id = 1\n loop do\n return id.to_s unless ids.include?(id.to_s)\n id += 1\n end\n end", "def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end", "def generate_user_key\n\t\tself.key = loop do\n random_hex = SecureRandom.urlsafe_base64\n break random_hex unless self.class.exists?(key: random_hex)\n end\n\tend", "def default_key\n :\"#{self[:name]}_id\"\n end", "def key(name = nil)\n \"#{@id}:#{name}\"\n end", "def key_id=(_arg0); end", "def globally_unique_identifier\n super\n end", "def generate_generation_id_(seckey)\n # NOTE: Do hsetnx with '-1' to detect weather the seckey is already set\n if @redis.hsetnx @url, seckey, '-1'\n max_genid = @redis.hincrby @url, 'max-genid', 1\n @redis.hset @url, seckey, max_genid.to_s\n return max_genid.to_s\n else\n return @redis.hget @url, seckey\n end\n end", "def unique_key\n key = []\n self.class.unique_key_columns.each do |col_name|\n key << self.send(col_name) || '-'\n end\n key.join\n end", "def unique_id\n \"#{@table.name}-#{@id}\"\n end", "def prefix_key(key)\n if self.instance_id\n [self.path, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end", "def unique_id #:nodoc:\n @unique_id = (@unique_id || 0) + 1\n end", "def cache_key\n if new_record?\n \"#{self.class.model_name.cache_key}/new\"\n else\n \"#{self.class.model_name.cache_key}/#{id}\"\n end\n end", "def queue_key\n Digest::SHA256.hexdigest(queues.sort.join(\";\"))\n end", "def unique_check_key\n @unique_check_key ||= SecureRandom.hex\n end", "def job_spec_id\n self.job_spec.id\n end", "def name\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n job_id\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 unique_identifier\n @u_id ||= \"T1\"\n @u_id = @u_id.succ\n end", "def slug\n job_id.gsub(/^job_/, '')\n end", "def prefix_key(key)\n if self.instance_id\n [KEY_PREFIX, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end", "def generate_submission_id(time = nil, prefix: true)\n prefix = SID_PREFIX if prefix.is_a?(TrueClass)\n time = time.is_a?(DateTime) ? time.to_time : (time || Time.now)\n base_id = time.tv_sec\n letter = SID_LETTERS.first + rand(SID_LETTER_SPAN)\n sprintf('%s%x%c%02d', prefix, base_id, letter, sid_counter)\n end", "def ensure_hash_id\n self.hash_id ||= unique_random_string_of_length(75 + Random.rand(26))\n end", "def generate_key\n self.key ||= SecureRandom.urlsafe_base64 32\n end", "def set_identifier\n time_tag = \"#{Time.now.to_s}\".gsub(/[^0-9]/,'')[0,14]\n fingerprint_tag = \"#{fingerprint}\".gsub(/[^0-9a-zA-Z]/,'')[-6,6]\n self.identifier ||=\n begin\n case key_type\n when KEY_TYPE_USER\n user.gitolite_identifier\n #\"#{user.gitolite_identifier}_#{fingerprint_tag}_#{time_tag}\"\n when KEY_TYPE_DEPLOY\n \"#{user.gitolite_identifier}_#{fingerprint_tag}_#{time_tag}_#{DEPLOY_PSEUDO_USER}\"\n end\n end\n end", "def generate_key(key_size = T.unsafe(nil)); end", "def generate_identifier\n self.identifier ||= self.name.parameterize.underscore\n end", "def key_pair_name\n\n # return the key_pair_name if one is already generated\n return @key_pair_name if @key_pair_name\n\n # generate on from a random string of 10 upper and lowercase letters\n o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n @key_pair_name = (0..10).map { o[rand(o.length)] }.join\n return @key_pair_name\n\n end", "def cache_key\n return \"#{model_key}/new\" if new_record?\n return \"#{model_key}/#{_id}-#{updated_at.utc.to_formatted_s(cache_timestamp_format)}\" if do_or_do_not(:updated_at)\n \"#{model_key}/#{_id}\"\n end", "def generate_uuid\n Digest::SHA2.hexdigest(\"#{@queue}#{encode(payload)}#{Time.now.to_i}\")\n end", "def key_id; end", "def queue_key\n super || default_queue_key\n end", "def job_uuid=(uuid)\n @raw_data[:job] ||= {}\n @raw_data[:job].update(uuid: uuid)\n end", "def tracking_key(*args)\n id = concurrent_identifier(*args)\n id = \".#{id}\" if id && id.strip.size > 0\n \"concurrent.tracking.#{self.to_s}#{id}\"\n end", "def simple_cache_key\n \"#{self.class.name.underscore}/#{id}\"\n end", "def create_key(arg = nil)\n set_or_return(\n :create_key,\n arg,\n kind_of: [ TrueClass, FalseClass ]\n )\n end", "def jenkins_task_id\n @jenkins_task_id ||= task_id(@options['jenkins_task_name'] || 'jenkins sync')\n end", "def make_unique_id(item)\n return item['id'] if item['id']\n\n unique_id = \"\"\n unique_id << item.title if item.title\n\n if summary = item.summary\n if summary.length < 200\n unique_id << summary\n else\n first_100 = summary[0,100]\n unique_id << first_100 unless first_100.nil?\n n = [100,summary.length].min\n last_100 = summary[-n..-1]\n unique_id << last_100 unless last_100.nil?\n end\n end\n\n Digest::SHA1.hexdigest(unique_id)\n end", "def get_cache_key(unique_hash)\n memcache_key_object.key_template % @options.merge(u_h: unique_hash)\n end", "def key_generator; end", "def key_generator; end", "def _key\n @_key || self.class.key.(self)\n end", "def cache_key\n \"#{self.class.cache_key_base}/#{self.id}\"\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end", "def hash_key\n options[:key] || :id\n end", "def hash_key\n options[:key] || :id\n end", "def get_job_id\n # check if the job ID has already been set (the job name will not change\n # during execution, so it is safe to assume that the job ID won't change)\n if not defined? @job_id or @job_id == '' or @job_id == nil\n result = veeamconfig('job', 'list').lines\n if result.length > 1\n result.each_with_index do |line, index|\n # skip the first line of output, since it is just the table setup\n next if index == 0\n\n # split line into array by space\n bits = line.split(' ')\n # pull out the repository name\n job_name = bits[0]\n\n # parse and return the job ID\n @job_id = bits[1].tr('{}', '') if job_name == @resource[:job_name]\n return @job_id\n end\n\n # return false if the job doesn't exist\n false\n else\n # return false if there are no jobs that exist\n false\n end\n else\n # return the job ID if it's already set\n @job_id\n end\n end", "def make_employee unique_index, contact_key\n\n job_title = ['manager', 'sales clerk', 'CEO', 'admin'].shuffle.first\n active = ['T', 'F'].shuffle.first\n\n %{INSERT INTO employees VALUES (#{unique_index}, '#{job_title}', '#{active}', #{contact_key});}\nend", "def key(msg_id, suffix)\n \"#{msg_id}:#{suffix}\"\n end", "def batch_key(_record)\n raise \"Implement in child\"\n end", "def generate_cache_key(record, namespace)\n \"#{namespace}-#{record.cache_key_with_version}\"\n end", "def unique_id\n generator = Sass::Script::Functions.random_number_generator\n Thread.current[:sass_last_unique_id] ||= generator.rand(36**8)\n # avoid the temptation of trying to guess the next unique value.\n value = (Thread.current[:sass_last_unique_id] += (generator.rand(10) + 1))\n # the u makes this a legal identifier if it would otherwise start with a number.\n identifier(\"u\" + value.to_s(36).rjust(8, '0'))\n end", "def generate_id \n end", "def key_for_series(bucketable, series_name, bucket_name)\n \"bucket_maker:#{bucketable.class.to_s.underscore}_#{bucketable.id}:#{series_name.to_s}:#{bucket_name.to_s}\" if bucketable && bucketable.id rescue nil\n end", "def generate_email_validation_key\n # Auto activated for employer\n # self.email_validation_key = SecureRandom.base64(8)\n end", "def generate_id\n @mutex.synchronize { @current_id += 1 }\n end", "def redis_key(str)\n \"user:#{self.id}:#{str}\"\n end", "def after_perform_check_unique_lock(*args)\n create_job(args).uniqueness.ensure_unlock_perform\n end", "def __object_lock_key\n @key ||= \"this.#{object_id}\".to_sym\n end", "def _report_key(uuid)\n \"#{@queue}__#{uuid}\"\n end", "def skill_key\n return item_in_use.seq_key[rand(item_in_use.seq_key.size)]\n end" ]
[ "0.69451106", "0.67873806", "0.6724584", "0.6546879", "0.65102255", "0.6479524", "0.62474793", "0.6236482", "0.621921", "0.620373", "0.61658543", "0.6165188", "0.6146043", "0.61419886", "0.6134388", "0.6120992", "0.60996795", "0.6059127", "0.6036548", "0.6024705", "0.60245883", "0.6008445", "0.5997236", "0.597887", "0.59474486", "0.5942782", "0.59291434", "0.59177876", "0.58889496", "0.5849052", "0.5848895", "0.5846557", "0.5837905", "0.582821", "0.581047", "0.58088934", "0.57879454", "0.5779614", "0.5778858", "0.57623714", "0.5762258", "0.575981", "0.57596606", "0.57586414", "0.5751275", "0.57453763", "0.57436407", "0.57393867", "0.57327956", "0.5700987", "0.5698215", "0.5697588", "0.56821024", "0.56700253", "0.56699073", "0.5661565", "0.5643166", "0.5641128", "0.5639629", "0.56379664", "0.5631889", "0.5620837", "0.56136316", "0.56087863", "0.5591857", "0.55881214", "0.5586826", "0.5586224", "0.55744135", "0.5572832", "0.5569602", "0.55478466", "0.55466735", "0.55460995", "0.55459493", "0.5541578", "0.5539255", "0.5537389", "0.5537389", "0.5536372", "0.55333906", "0.55319655", "0.5528705", "0.5521074", "0.5521074", "0.5518975", "0.55186945", "0.55153614", "0.5514233", "0.5513388", "0.5511846", "0.551158", "0.5510973", "0.5496036", "0.54952496", "0.5492775", "0.5490807", "0.54870945", "0.5481336", "0.5476581" ]
0.69101393
1
This is our hook into ActiveJob::Base. we hook like this to make sure we modify the job_id as soon on as possible, before any callbacks get the chance to use it.
def initialize(...) super(...) # there's no point making a job id on deserialization # deserialize creates the instance without assigning anything, # https://github.com/rails/rails/blob/58b46e9440f3460e93b8164205614e3ab85784da/activejob/lib/active_job/core.rb#L61 return if @arguments.nil? # otherwise we assume we were called by `perform` # finally, the magic! new_id = create_job_id # spaces in particular mess with redis self.job_id = new_id.gsub(' ', '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_id\n async && async.job_id\n end", "def ignored(job)\n @last_job_id = job.job_id\n end", "def id\n active_job_id\n end", "def job_id\n raise NotImplementedError\n end", "def create_job_id\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n Generators.generate_uuid(self)\n end", "def call(job)\n @processed_job_ids << job.job_id\n block.call(job)\n end", "def job_id=(value)\n @job_id = value.to_s\n end", "def job_spec_id\n self.job_spec.id\n end", "def Job(active_job)\n lambda do |object|\n active_job.perform_later(object.id)\n end\n end", "def set_background_job_ref(job)\n return unless respond_to?(:background_job_ref=)\n\n job = \"#{job.provider_job.class.name.ns_underscore}%#{job.provider_job.id}\" if job.respond_to?(:provider_job)\n self.background_job_ref = job\n end", "def ignored(job)\n @processed_job_ids << job.job_id\n end", "def call(job)\n @last_job_id = job.job_id\n block.call(job)\n end", "def jobid_prefix\n @jobid_prefix\n end", "def name\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n job_id\n end", "def enqueue(job_id)\n create_job_record(job_id)\n BEANSTALK_QUEUE.yput(:job_id => job_id)\n @last_queried[job_id] = Time.now\n end", "def enqueue\n # We need to save before passing to perform_later b/c perform_later will need our ID.\n # For this reason, the job_id col can't have a null constraint.\n save! unless persisted?\n job = job_class.constantize.perform_later(self, **job_params)\n update!(job_id: job.job_id, provider_job_id: job.provider_job_id)\n end", "def work( payload, metadata )\n\t\tself.job_counter.mark\n\t\tself.job_timer.time do\n\t\t\tsuper\n\t\tend\n\tend", "def job_id\n @gapi.job_reference.job_id\n end", "def delegate(job)\n job = job.stringify_keys\n job['id'] = generate_job_id(job) unless job_failed?(job)\n @jobs[job['id']] = job\n job['env_options'][CapistranoMulticonfigParallel::ENV_KEY_JOB_ID] = job['id']\n # debug(@jobs)\n # start work and send it to the background\n @workers.async.work(job, Actor.current)\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_myjob\n @myjob = Myjob.find(params[:id])\n end", "def set_job\n @job = Job.find_by_id(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_bake_job\n @bake_job = BakeJob.find(params[:id])\n end", "def set_running_job\n @running_job = RunningJob.find(params[:id])\n end", "def clear_job_id(job_id)\n @processed_job_ids.delete(job_id)\n end", "def set_delayed_job\n @delayed_job = DelayedJob.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def before job=nil\n processing!\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:id])\n end", "def job_key; Thread.current[:job_key]; end", "def set_job_request\n @job_request = JobRequest.find(params[:id])\n end", "def set_launched_job\n @launched_job = LaunchedJob.find(params[:id])\n end", "def set_job\n @job = Job.find(params[:job_id])\n end", "def dequeue\n self.job.destroy if self.job.present?\n self.job_id = nil\n end", "def set_db_job\n @db_job = DbJob.find(params[:id])\n end", "def register_worker_for_job(job, worker)\n job = job.stringify_keys\n if job['id'].blank?\n debug(\"job id not found. delegating again the job #{job.inspect}\") if self.class.debug_enabled?\n delegate(job)\n else\n start_worker(job, worker)\n end\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def getJobId()\n return @helper.getJobId()\n end", "def set_act_job\n @act_job = ActJob.find(params[:id])\n end", "def queue_job; end", "def prepare_job\n if @job_condition\n @job = Job.new\n @job_index = @job_index\n parse_values(\"JOB\", @job)\n @job.guid_number= parse(\"guid_number\")\n @job = update_job @job\n @jobs << @job\n end\n end", "def kill_job(job_id)\n __push([], :kill_job, job_id)\n end", "def enqueue(override = false)\n if self.job_id.nil? && !(self.last_fetch_at.present? && (Time.now - self.last_fetch_at) < UPDATE_TIME) && !override\n Delayed::Job.enqueue(ArtistWorker.new(self.id), 0, Time.now)\n self.job_id = Delayed::Job.last.id\n save\n end \n end", "def seen_job_with_id?(job_id)\n @processed_job_ids.include?(job_id)\n end", "def after_enqueue_batch(id, *args)\n mutex(id) do |bid|\n redis.rpush(bid, Resque.encode(:class => self.name, :args => args))\n end\n end", "def after_perform_increment_jobs_processed(*)\n @registry.hincrby key, 'jobs_processed', 1\n end", "def set_job\n @job = @company.jobs.find(params[:id])\n end", "def set_saved_job\n @saved_job = SavedJob.find(params[:id])\n end", "def set_pending_job\n @pending_job = PendingJob.find(params[:id])\n end", "def on_job_created(&block)\n @listeners[:job_created] << block\n end", "def set_job\n if current_user\n @job = Job.includes(submissions: :stage_transitions).find(params[:id])\n @submissions = JSON.parse(@job.submissions.to_json(include: [:stage_transitions]))\n @submitted_candidates = @job.submissions.pluck(:person_id)\n @person_id = Person.find_by(email_address: current_user&.email).try(:id)\n end\n @job = Job.find_by(id: params[:id])\n end", "def remove_batched_job!(id, *args)\n after_perform_batch(id, *args)\n end", "def on_before_enqueue\n return unless topic.long_running_job?\n\n # This ensures, that when running LRJ with VP, things operate as expected\n coordinator.on_enqueued do |first_group_message|\n # Pause at the first message in a batch. That way in case of a crash, we will not loose\n # any messages\n pause(first_group_message.offset, MAX_PAUSE_TIME)\n end\n end", "def set_job_manager\n @job_manager = JobManager.find(params[:id])\n end" ]
[ "0.6776416", "0.66619956", "0.65913486", "0.6571547", "0.6552382", "0.6353732", "0.63127846", "0.62516856", "0.6171758", "0.6131321", "0.61189544", "0.60998863", "0.6080193", "0.6059604", "0.60228765", "0.6009621", "0.5960613", "0.5923918", "0.5903697", "0.5870376", "0.586029", "0.5850285", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.58441687", "0.5829486", "0.5822879", "0.58172715", "0.5815652", "0.5804761", "0.57984155", "0.5792728", "0.5792728", "0.5792728", "0.5791648", "0.5770988", "0.57682955", "0.57496154", "0.57373124", "0.57369334", "0.5719506", "0.57150185", "0.57150185", "0.57150185", "0.57150185", "0.57150185", "0.57150185", "0.57150185", "0.569662", "0.56920606", "0.5675357", "0.56628054", "0.5660218", "0.56576204", "0.5637365", "0.56325805", "0.563064", "0.5628322", "0.56233966", "0.5607528", "0.5584592", "0.55837697", "0.5581141", "0.55729777" ]
0.66418654
2
Test if this job has a module named `/ApplicationJob/` in it's ancestors.
def application_job_class @application_job_class ||= self.class.ancestors.find { |ancestor| ancestor.name =~ /ApplicationJob/ } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_modules?\n m = @context.modules.find{|m| m.document_self}\n m ? true : false\n end", "def ancestor_exist?\n File.exist? @ancestor_path\n end", "def active?(submodule_name)\n active.select { |s| s[:name].to_s == submodule_name.to_s }.any?\n end", "def application?\n gem_dir\n end", "def application?\n gem_dir\n end", "def in_module_root?(path = Dir.pwd)\n PDK::Util::MODULE_FOLDERS.any? { |dir| PDK::Util::Filesystem.directory?(File.join(path, dir)) } ||\n PDK::Util::Filesystem.file?(File.join(path, 'metadata.json'))\n end", "def in_submodule?(component)\n return false unless File.exists?(gitmodules)\n # File.read(gitmodules) =~ %r![submodule \"#{freezer_dir}/#{component}\"]!\n File.read(gitmodules).match(%r!#{freezer_dir}/#{component}!)\n end", "def is_a_parent?\r\n count_of_sub_jobs = Job.where(\"parent_job_id = #{id}\").count\r\n if count_of_sub_jobs == 0\r\n false\r\n else\r\n true\r\n end\r\n end", "def includes_modules?\n @includes_modules\n end", "def has_parent?\n not history.empty?\n end", "def accessing_outside_parent(path)\n base_path = Pathname.new(\"#{__dir__}/../ECOLE\")\n pn = Pathname.new(path)\n return false if base_path.expand_path == pn.expand_path\n return false if pn.expand_path.to_s.start_with?(base_path.expand_path.to_s)\n\n true\n end", "def in_drupal_root?\n File.exist?(File.expand_path('modules/system/system.module'))\nend", "def matches_ancestors?(ancestors); end", "def application?\n (filtered_file =~ /^\\[PROJECT_ROOT\\]/i) && !(filtered_file =~ /^\\[PROJECT_ROOT\\]\\/vendor/i)\n end", "def accessing_outside_parent(path)\n base_path = Pathname.new(\"#{__dir__}/../ECOLE/ADMIN/admin\")\n pn = Pathname.new(path)\n return false if base_path.expand_path == pn.expand_path\n return false if pn.expand_path.to_s.start_with?(base_path.expand_path.to_s)\n\n true\n end", "def her_containing_module\n return unless name =~ /::/\n name.split(\"::\")[0..-2].join(\"::\").constantize\n end", "def included_extension_module?(base, extension_module)\n if base.kind_of?(Class)\n direct_superclass = base.superclass\n base.ancestors.take_while { |ancestor| ancestor != direct_superclass}.include?(extension_module)\n else\n base < extension_module # can't do better than that for modules\n end\n end", "def node_modules?\n !!name.match(/node_modules\\//)\n end", "def top_level?\n top_level == self\n end", "def has_parent?\n !parent_context.nil?\n end", "def contains? context\n until context.nil?\n return true if context == self\n context = context.parent\n end\n false\n end", "def namespace_module?\n return false if exp.type == :casgn\n contents = exp.children.last\n contents && contents.find_nodes([:def, :defs], [:casgn, :class, :module]).empty?\n end", "def installed?\n return prefix.children.length > 0\n rescue\n return false\n end", "def namespace_still_defined?(namespace)\n parent = Object\n outer_namespace_parts = []\n namespace.to_s.split(\"::\").each do |part|\n return false unless parent.const_defined?(part)\n\n outer_namespace_parts.push(part)\n parent = outer_namespace_parts.join(\"::\").constantize\n end\n true\n end", "def is_parent?( potential_parent )\n \n potential_parent_configuration = nil\n \n controller = @module.controller\n case potential_parent\n when ::CascadingConfiguration::Module::Configuration\n potential_parent_configuration = potential_parent\n else\n potential_parent_configuration = controller.configuration( potential_parent, @name )\n end\n\n return match_parent_configuration do |this_parent_configuration|\n this_parent_configuration.equal?( potential_parent_configuration )\n end ? true : false\n \n end", "def inactive?(submodule_name)\n !!!active?(submodule_name) && submodule(submodule_name).present?\n end", "def has_current_application?\n not self.current_application.nil?\n end", "def top_level? c\n @resolver.top_level_component? c\n end", "def include?(job)\n jobs.keys.include?(job.key)\n end", "def module_loaded? mod\n Bot::Modules.include? mod\n end", "def exist?(parent, ident)\n parent.model.include? instance_path(parent.path, ident)\n end", "def is_top_level?\n respond_to?(:includes_origen_top_level?)\n end", "def patched?\n target.included_modules.include? self\n end", "def exists?(module_name)\n const_name = module_name.to_s.camel_case\n slice_names.include?(const_name) && Object.const_defined?(const_name)\n end", "def object_has_hierarchy?\n filepaths.any?(/\\/+/)\n end", "def has_job?(job_name)\n jobs.exists?(job_name)\n end", "def ancestors?\n read_attribute(self.ancestry_base_class.ancestry_column).present?\n end", "def standalone?\n Merb.root == ::MerbAdmin.root\n end", "def has_parent?\n !root?\n end", "def parent_of?(folder)\n @location.parent_of?(folder.location)\n end", "def module_loaded?\n /^#{new_resource.modname}/.match?(::File.read(\"/proc/modules\"))\n end", "def check_module_exists(module_name)\n !get_module_data(module_name).nil?\n end", "def hierarchical_dimension?\n self.included_modules.include?(InstanceMethods)\n end", "def root_command?\n parents.empty?\n end", "def parent_exists?\n parent.exist?\n end", "def parent_exists?\n parent.exist?\n end", "def application_include\n @application_include || false\n end", "def autoloadable_module?(path_suffix)\n autoload_paths.each do |load_path|\n return load_path if File.directory? File.join(load_path, path_suffix)\n end\n nil\n end", "def job?\n layer_finder.job != nil\n end", "def users_third_party_apps_path?\n third_party_apps?\n end", "def parent_dir_link?(link)\n link[:href] == '../'\n end", "def hierarchical?\n if @path\n true\n else\n false\n end\n end", "def global?\n module_name.nil? || module_name == NAMESPACE_WILDCARD || module_name == ENVIRONMENT\n end", "def is_location_in_context?(iLocation)\n # * *iLocation* (_String_): Directory\n return $LOAD_PATH.include?(iLocation)\n end", "def kind_of?(thing)\n ancestors.include? thing\n end", "def incomplete_install?\n builtin_module_list = %w[aggregate canary puppetdb_fact secure_env_vars puppet_connect]\n (Dir.children(Bolt::Config::Modulepath::MODULES_PATH) - builtin_module_list).empty?\n end", "def current_root_menu_include?(menu)\n begin\n if current_root(self)\n current_root(self).traverse(:depth_first) do |menu_item|\n @current_root = menu_item if menu && menu_item && current_page?(menu_item.menu_target) && menu.menu_target[0] != '#'\n end\n end\n rescue => e\n Rails.logger.info(\"** NO ROOT PATH FOUND #{e.inspect}\")\n return false\n end\n @current_root != nil\n end", "def inside_testkitchen?\n !! defined?(::Kitchen)\n end", "def inside_testkitchen?\n !! defined?(::Kitchen)\n end", "def external_frame?(f)\n !!(f =~ %r{bundle/gems})\n end", "def has_parent?\n if !self.parent.nil?\n return self.parent\n else\n return false\n end\n end", "def include?(arg)\n arg.is_a?(Module) ? !!included_modules.detect{ |m| m === arg } : store.include?(arg)\n end", "def access?(application)\n applications.include?(application)\n end", "def has_parent?\n ! embedded['parent'].nil?\n end", "def standalone?\n if parent_type.equal?(:ensure)\n !parent.node.children.first.equal?(node)\n else\n !EMBEDDED_TYPES.include?(parent_type)\n end\n end", "def installed?\n (dir = installed_prefix).directory? && dir.children.length > 0\n end", "def current?\n # If this is called before the plugins are loaded (i.e. by a plugin's application file), then\n # it is definitely not the top-level app\n if Origen.application_loaded?\n Origen.app == self\n else\n Origen.root == root\n end\n end", "def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end", "def exist?\n ruby_gems_fetcher.started?\n end", "def submission_output?\n parent_type == \"Job\" && parent.submission.present?\n end", "def jobdir?(path)\n jobdir_name?(path.basename.to_s) && path.directory?\n end", "def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end", "def exist?\n jobinfo.exist?\n end", "def ancestor_of?(node)\n node.dotted_ids.length > self.dotted_ids.length && node.dotted_ids.starts_with?(self.dotted_ids)\n end", "def virtual_product?\n begin\n istomp = Product.find(\"istomp\")\n self.parents.include?(istomp)\n rescue\n false\n end\n end", "def jobdir_name?(name)\n name[/^\\d+$/]\n end", "def has_parent?\n !parent.nil?\n end", "def managed?(component)\n File.directory?(File.join(freezer_dir, component)) || in_submodule?(component)\n end", "def bundle_exists?\n File.exists? self.bundle_dir\n end", "def global?\n @parent.nil?\n end", "def is_sub_logic?\n self.class.name.underscore.include? \"/appointments/\"\n end", "def haveBootstrapped?\n @inventory.haveNode?(@server.mu_name)\n end", "def folder?\n children.any?\n end", "def has_parents?\n \n return ! @parents.empty?\n \n end", "def has_parents?\n \n return ! @parents.empty?\n \n end", "def is_require_relative?(code)\n # return code[0] && (code[0][0] == :command) &&\n # (code[0][1][1] == \"require_relative\")\n return code && (code[0] == :command) &&\n (code[1][1] == \"require_relative\")\n end", "def package?(package)\n # implement inside child\n end", "def parent_singleton?\n !parent_type_from_request.nil? && parent_type_from_params.nil?\n end", "def accessing_parent_of_ecole(current_dir_name, path)\n return true if current_dir_name == 'ECOLE' && path == '..'\n\n false\n end", "def has_own_breadcrumbs?\n !self.is_a?(SystemPage)\n end", "def module?\n @type == :module\n end", "def module?\n @type == :module\n end", "def parent?\n !parents.empty?\n end", "def root?\n context.root_component == self\n end", "def loaded_correctly?\n !!@module\n end", "def loaded_correctly?\n !!@module\n end", "def parent_singleton?\n !parent_type_from_request.nil? && parent_type_from_params.nil?\n end", "def hooked?\n self.class.get(base_module, constant_name) == self\n end", "def being_included?\n @being_included || false\n end", "def requesting_a_part?\n parts.any? && requested_content_item_path && requested_content_item_path != base_path\n end" ]
[ "0.60064316", "0.59737045", "0.59465766", "0.5925363", "0.5925363", "0.581879", "0.5794968", "0.57911587", "0.5690794", "0.566401", "0.56617373", "0.56369597", "0.56278485", "0.5624307", "0.5622493", "0.56205124", "0.56189495", "0.55977505", "0.5572676", "0.5548406", "0.5543503", "0.5540821", "0.55231434", "0.5512057", "0.5509935", "0.5496475", "0.548137", "0.54755956", "0.54733586", "0.5470011", "0.5454297", "0.54421216", "0.54021657", "0.5399816", "0.53870565", "0.53775567", "0.5361085", "0.5358059", "0.5316113", "0.531412", "0.5283121", "0.5281209", "0.5275677", "0.52702904", "0.526514", "0.526514", "0.5251065", "0.52428997", "0.52415323", "0.524017", "0.5232596", "0.5216757", "0.5212398", "0.5207138", "0.51951134", "0.5189184", "0.51849675", "0.51817006", "0.51817006", "0.5181157", "0.5177413", "0.5169444", "0.5168142", "0.51629156", "0.5152687", "0.5151814", "0.51487166", "0.5131092", "0.51302683", "0.5127709", "0.51268536", "0.5125932", "0.51221794", "0.51188874", "0.51121825", "0.510858", "0.51036507", "0.5103086", "0.5094899", "0.509375", "0.509074", "0.50906914", "0.50882363", "0.5086197", "0.5086197", "0.5081719", "0.5079726", "0.5077573", "0.50677645", "0.50671214", "0.5065897", "0.5065897", "0.50498164", "0.50456196", "0.50443435", "0.50443435", "0.5041141", "0.50406367", "0.50374895", "0.5031638" ]
0.5610389
17
def handle_low_stock supplier.notify_low_stock(self) supplier.create_new_order(self) end Compare self with other_item and return true / false if they're equivalent
def ==(other_item) @id == other_item.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_stock_on_create\n # Update current Stock\n if !update_stock(product, store, quantity, true)\n return false\n end\n true\n end", "def reorder_stock?\n stock < 100 && !current_reorder ? true : false\n end", "def trade_item_with_party(new_item, old_item)\n return false if new_item && !$game_party.has_item?(new_item)\n temp = UI_MSG::ITEM\n UI_MSG.const_set(:ITEM, false)\n $game_party.gain_item(old_item, 1)\n $game_party.lose_item(new_item, 1)\n UI_MSG.const_set(:ITEM, temp)\n return true\n end", "def enough_stock?\n\t\tif self.product.stock == 0\n\t\t\treturn false\n\t\telse\n\t\t\treturn self.product_quantity <= available_stock\n\t\tend\n\t\t#self.product_quantity <= self.product.stock\n\tend", "def item_stocking?(item)\n item_stocking_items.include?(item)\n end", "def check_stock(_product, _store, _quantity)\n _check_stock = true\n if _product.product_type.id != 2\n _stock = Stock.find_by_product_and_store(_product, _store)\n if !_stock.nil?\n if (_stock.current - _quantity) < 0\n errors.add(:description, I18n.t(\"activerecord.models.delivery_note_item.quantity_greater_than_stock_item\", stock: _stock.current))\n _check_stock = false\n end\n else\n errors.add(:description, I18n.t(\"activerecord.models.delivery_note_item.no_stock_store\"))\n _check_stock = false\n end\n end\n _check_stock\n end", "def trade_item_with_party(new_item, old_item)\n return false if new_item && !$game_party.has_item?(new_item)\n $game_party.force_gain_item(old_item, 1)\n $game_party.force_gain_item(new_item, -1)\n return true\n end", "def update_stock_on_update\n # What has changed?\n product_has_changed = product_changed? rescue false\n store_has_changed = store_changed? rescue false\n quantity_has_changed = quantity_changed? rescue false\n # Previous values\n product_prev = product_was rescue product\n store_prev = store_was rescue store\n quantity_prev = quantity_was rescue quantity\n # Stock\n if product_has_changed || store_has_changed\n # Current Stock\n if !update_stock(product, store, quantity, true)\n return false\n end\n # Roll back Previous Stock\n if !update_stock(product_prev, store_prev, quantity_prev, false)\n return false\n end\n elsif quantity_has_changed\n # Current Stock\n if !update_stock(product, store, quantity - quantity_prev, true)\n return false\n end\n end\n true\n end", "def in_stock?(quantity = 1)\n if !self.manage_stock?\n return true\n elsif self.is_in_stock && ((quantity.to_f <= self.quantity.to_f || quantity.to_f == 0) || self.backorders > 0)\n return true\n else\n return false\n end\n end", "def update_stock(_product, _store, _quantity, _is_new)\n if _product.product_type.id != 2\n _stock = Stock.find_by_product_and_store(_product, _store)\n if !_stock.nil?\n _stock.current = _is_new ? _stock.current - _quantity : _stock.current + _quantity\n if !_stock.save\n return false\n end\n end\n end\n true\n end", "def handle_stock_counts?\n current_shipment.order.completed? && current_stock_location != desired_stock_location\n end", "def in_stock?\n stock\n end", "def in_stock?\n if @stock <= 0\n false\n else\n true\n end\n end", "def buy_new_item(item_to_buy, quantity, account)\n return false if item_to_buy.auction\n preowner = item_to_buy.owner\n\n if (Integer(item_to_buy.price*quantity) > self.credits and item_to_buy.currency == \"credits\") or Integer(item_to_buy.quantity)<quantity\n Activity.log(account, \"item_bought_failure\", item_to_buy, self)\n Activity.log(account, \"item_sold_failure\", item_to_buy, preowner)\n return false\n end\n\n\n if !item_to_buy.wishlist_users.empty? and item_to_buy.quantity == quantity and !item_to_buy.permanent\n item_to_buy.wishlist_users.each {|trader| trader.remove_from_wishlist(item_to_buy); item_to_buy.wishlist_users.delete(trader)}\n end\n\n Holding.ship_item(item_to_buy, item_to_buy.owner, self, quantity)\n Activity.log(account, \"item_bought_success\", item_to_buy, self)\n Activity.log(account, \"item_sold_success\", item_to_buy, preowner)\n Mailer.item_sold(preowner.e_mail, \"Hi #{preowner.name}, \\n #{self.name} bought your Item #{item_to_buy.name}.\n Please Contact him for completing the trade. His E-Mail is: #{self.e_mail}\")\n\n return true\n end", "def in_stock?\n true\n end", "def in_stock?()\n if self.stock >0\n return true\n else\n return false\n end\n end", "def create_stock_item\n\n added_new_stock_item = false\n # Get stock location for appropriate location\n @product_row[:location].split(',').each do |sub_location|\n sub_location.chomp!\n stock_location = case sub_location.to_s.downcase\n when /george/\n @@loc_attic\n # NFS no matter what - JC10 OR buffalo display case OR back shop\n when /jc\\d{1,2}|buffalo|back\\sshop|attic/\n @@loc_home_nfs\n # NFS if listed as not for sale (don't count in quantity)\n when /w\\d{1,2}/\n (@product_row[:available] && @product_row[:available].downcase == \"n\") ? @@loc_home_nfs : @@loc_home\n when /[[:alpha:]]\\d{2,3}|D\\d{3}\\.\\d|h\\d|file\\scabinet|suite\\s2/\n (@product_row[:available] && @product_row[:available].downcase == \"n\") ? @@loc_suite2_nfs : @@loc_suite2\n # NWC08\n when /nw[[:alpha:]]\\d{1,2}|ste3/\n @@loc_suite3\n # Warehouse\n when /warehouse/\n @@loc_warehouse\n # West trailer OR east racks\n when /east\\sracks|west\\strailer/\n @@loc_east_racks\n else # if unidentifiable location\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Cannot identify location \" + sub_location }\n next # skip to next location\n end\n\n # if no exisiting sub location, add one\n if(@new_product_condition.add_sub_location(sub_location, stock_location))\n added_new_stock_item = true\n end\n\n end # end location loop\n\n added_new_stock_item # return true if at least one new stock item added\n\n end", "def load_item!(order_item, stock)\n if !order_item.product.tracked_stock? || source.enable_gateway?\n load_item_from_infinite_stock(order_item) && return\n end\n stock_items = stock.select { |item| item.product == order_item.product }\n return false if stock_items.none?\n\n if order_item.lot_code.present?\n load_item_by_lot_code(order_item, stock_items)\n else\n load_item_from_stock(order_item, stock_items)\n end\n end", "def sync_local_to_magento\n response = API::SOAP::CatalogInventory::StockItem.update(self)\n\n if response.success?\n self.sync_needed = false\n return true\n else\n errors.add(:base, response.body[:faultstring])\n return false\n end\n end", "def in_stock?\n \t\tif stock > 0 \n \t\t\tTRUE\n \t\telse \n \t\t\tFALSE \n \t\tend\n \tend", "def check_stock\n receiving_details.each{|p|\n #errors.add(:quantity, \" in size #{p.product_size.size_detail.size_number} can't be more than PO quantity\") if p.product_size.size_detail.present? && p.quantity.to_i > ProductDetail.find_by_warehouse_id_and_product_size_id(origin_warehouse_id, p.product_size_id).available_qty.to_i\n }\n end", "def quantity_based_on_stock\n if self.quantity > self.item.stock\n errors.add(:quantity, \"should not exceed what's available in stock\")\n end\n end", "def can_be_unconfirmed?\n reverse_adjustment_quantity = -1*diff \n \n wh_item = self.warehouse_item\n item = self.item \n \n final_item_ready = item.ready + reverse_adjustment_quantity\n final_wh_item_ready = wh_item.ready + reverse_adjustment_quantity\n \n if final_item_ready < 0 or final_wh_item_ready < 0 \n msg = \"Akan menyebabkan jumlah item ready menjadi : #{final_item_ready}.\"\n self.errors.add(:generic_errors, msg )\n return false\n end\n \n return true \n end", "def out_of_stock?\n quantity.zero? || reserved_count == quantity\n end", "def update_stock_on_destroy\n # Update current Stock\n if !update_stock(product, store, quantity, false)\n return false\n end\n true\n end", "def can_add_stock?(ticker_symbol)\n under_stock_limit? && !stock_already_added?(ticker_symbol)\n end", "def can_add_stock?(ticker_symbol)\n under_stock_limit? && !stock_already_added?(ticker_symbol)\n end", "def create\n notice = \"\"\n if current_member.disabled\n flash[:notice] = \"Account is disabled. Cannot order until re-enabled.\"\n redirect_to(root_path)\n return\n end\n params[:order][:order_details_attributes].each{ |k,v|\n params[:order][:order_details_attributes].delete(k) if v[:quantity].to_f == 0.0 or v[:quantity].strip == ''\n }\n\n # combine same-stock entries\n stock_quantities = {}\n params[:order][:order_details_attributes].each{ |k,v|\n sid = v[:stock_id].to_i\n q = v[:quantity].to_f\n if stock_quantities[sid].nil?\n stock_quantities[sid] = q\n else\n stock_quantities[sid] += q\n OrderDetail.find(v[:id]).destroy unless v[:id].nil?\n params[:order][:order_details_attributes].delete(k)\n end\n }\n params[:order][:order_details_attributes].each{ |k,v|\n params[:order][:order_details_attributes][k][:quantity] = stock_quantities[v[:stock_id].to_i]\n }\n\n @order = Order.new(params[:order])\n unless current_member.admin\n @order.member = current_member\n end\n\n # first check to make sure there is enough stock available\n @order.order_details.each{ |od|\n if od.stock.limited and od.stock.quantity < od.quantity\n unless current_member.admin\n @order.errors.add \"Limited Stock Item:\",\"Sorry, there are only #{od.stock.quantity} #{od.stock.product.units} #{od.stock.name} remaining\"\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n return false\n else\n notice = \"Limited Stock Item: There were only #{od.stock.quantity} \n #{od.stock.product.units} #{od.stock.name} remaining, \n but I let you do it anyway since you're the boss!\"\n end\n elsif od.stock.quantity < od.quantity and !od.stock.limited\n notice = \"You have ordered more than is currently in stock. There may be some delay in filling this order-item.\"\n end\n }\n\n respond_to do |format|\n if @order.save\n # calculate costs and update stock\n @order.order_details.each{ |od|\n od.stock.quantity -= od.quantity\n od.stock.save\n }\n format.html { redirect_to(orders_path, :notice => \"Order was successfully created. #{notice}\") }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def check_for_new_items\n @new_queue.each do |item|\n matches = @previous_queue.select { |match| same_item(item, match) }\n unless matches.any?\n @new_items.push(created_at: item.created_at, service_id: item.service_id, open: true)\n end\n end\n end", "def ==(another_item)\n self.description == another_item.description &&\n self.quantity == another_item.quantity &&\n self.amount == another_item.amount &&\n self.additional_data == another_item.additional_data &&\n self.expire == another_item.expire\n end", "def buy\n if self.inventory_count == 0\n return false\n else\n # for now, decrementing the inventory count when purchasing a product will do\n self.decrement!(:inventory_count)\n # in the future, could return a receipt number, etc.\n return true\n end\n end", "def confirm!\n no_stock_of = self.order_items.select(&:validate_stock_levels)\n unless no_stock_of.empty?\n raise Shoppe::Errors::InsufficientStockToFulfil, :order => self, :out_of_stock_items => no_stock_of\n end\n \n run_callbacks :confirmation do\n # If we have successfully charged the card (i.e. no exception) we can go ahead and mark this\n # order as 'received' which means it can be accepted by staff.\n self.status = 'received'\n self.received_at = Time.now\n self.save!\n\n self.order_items.each(&:confirm!)\n\n # Send an email to the customer\n deliver_received_order_email\n end\n \n # We're all good.\n true\n end", "def is_available\n\t\tself.stock_qty > 0\n\tend", "def load_item_from_infinite_stock(order_item)\n create_item_from(order_item, order_item.order.number)\n true\n end", "def has_ordered?(item_to_check)\n if item_to_check.class == Item\n @order.any? {|item| item.name == item_to_check.name}\n else \n false\n end \nend", "def unappliable_order?\n order.bought? == false\n end", "def can_add_stock?(ticker_symbol)\n\t\tunder_stock_limit? && !stock_already_added?(ticker_symbol)\n\tend", "def update\n @order.earliest_pickup_date = calculate_earliest_pickup_date(:update)\n # Save off original quantity for order_products\n original_quantities = {}\n @order.order_products.each { |order_product| original_quantities[order_product.id] = order_product.quantity }\n respond_to do |format|\n if @order.update(order_params)\n okay = true\n @order.order_products.each do |order_product|\n new_quantity = order_product.quantity\n original_quantity = original_quantities[order_product.id]\n unless (new_quantity == original_quantity)\n product = order_product.product\n new_quantity_in_stock = (product.quantity_in_stock + original_quantity - new_quantity)\n if new_quantity_in_stock < 0 # Desired quantity no longer available\n okay = false if okay\n # Update the order the best we can and notify user of discrepancy\n new_quantity_in_stock = 0\n # The original quantity was already subtracted from the stock; quantity should never have to decrease below what was previously ordered\n new_quantity = original_quantity + product.quantity_in_stock\n order_product.update_attributes(quantity: new_quantity)\n end\n product.update_attributes(quantity_in_stock: new_quantity_in_stock)\n end\n end\n redirect_to(edit_order_path(@order), notice: t('orders.not_available')) and return if (!okay) # \"One or more of the products you selected is not available in the desired quantity. Please review the updated order.\"\n if session[:showing_user]\n format.html { redirect_to @order.user, notice: t('orders.create') } # \"Order was successfully updated.\"\n format.json { head :no_content }\n else\n format.html { redirect_to orders_path, notice: t('orders.create') } # \"Order was successfully updated.\"\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def conditional_product_touch\n stock_changed = (saved_change_to_count_on_hand? && saved_change_to_count_on_hand.any?(&:zero?)) || saved_change_to_product_id?\n product.touch if stock_changed\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n beez_up_order_item_id == o.beez_up_order_item_id &&\n order_item_order_item_type == o.order_item_order_item_type &&\n order_item_merchant_imported_product_id == o.order_item_merchant_imported_product_id &&\n order_item_merchant_imported_product_id_column_name == o.order_item_merchant_imported_product_id_column_name &&\n order_item_merchant_imported_product_url == o.order_item_merchant_imported_product_url &&\n order_item_merchant_product_id_column_name == o.order_item_merchant_product_id_column_name &&\n order_item_beez_up_store_id == o.order_item_beez_up_store_id &&\n order_item_item_tax == o.order_item_item_tax &&\n order_item_title == o.order_item_title &&\n order_item_image_url == o.order_item_image_url &&\n order_item_merchant_product_id == o.order_item_merchant_product_id &&\n order_item_market_place_product_id == o.order_item_market_place_product_id &&\n order_item_item_price == o.order_item_item_price &&\n order_item_quantity == o.order_item_quantity &&\n order_item_total_price == o.order_item_total_price &&\n order_item_shipping_price == o.order_item_shipping_price\n end", "def fetch_saved?\n super and available_quantity_changed?\n end", "def receive_quietly backordered_units\n \n return if backordered_units.count < 1\n \n # TODO backordered units are not in stock\n \n self.variant.update_column(:count_on_hand, self.variant.on_hand + backordered_units.count)\n self.variant.save\n backordered_units.each(&:fill_backorder)\n \n end", "def backorderable?\n stock_items.any?(&:backorderable)\n end", "def check_luxire_inventory\n order = Spree::Order.find(params[:order_id])\n line_items = order.line_items\n line_items.each do |line_item|\n variant = Spree::Variant.find(line_item.variant_id)\n product = variant.product\n unless Spree::Product.non_depletable_product.include? product.name.downcase\n length_required_per_product = product.luxire_product.length_required\n quantity = line_item.quantity\n stock = product.luxire_stock\n unless stock.backorderable\n total_length_required = length_required_per_product * quantity\n if(stock.virtual_count_on_hands - total_length_required < 0)\n response = {msg: \"#{product.name} is out of stock\"}\n render json: response.to_json, status: 422 and return\n end\n end\n end\n end\n end", "def validate_product_quantity_in_stock\n init_order_and_order_item\n session[:cart].values.each do |item|\n product = Product.find_by id: item[\"product_id\"].to_i\n next if conditional_checking(product, item)\n @order.errors.add(:unit_in_stock, add_flash_danger(product))\n end\n return if @order.errors.blank?\n render :new\n end", "def lowest_stock # A refactoriser via méthode SQL, on peut faire beaucoup plus court\n # Pour chaque produit récupérer la remaining quantity\n # Vérifier si cette valeur est inférieure à un critère donné\n # Renvoyer la liste de tous les produits concernés\n @products = Product.all\n @products = @products.sort_by do |product|\n product.total_remaining_quantity\n end\n low_stock_trigger = 3 # Plancher de quantité qui trigger l'alimentation de la liste des low_stocks\n low_stock_list = Array.new\n @products.each do |product|\n if product.total_remaining_quantity < low_stock_trigger\n low_stock_list << product\n end\n end\n return low_stock_list.first # Pour l'instant on ne renvoit qu'un item pour qu'on ait une seule notif pour stock bas\n end", "def in_stock?\n \treturn @stock > 0 ? true : false\n end", "def in_stock?\n\t\tif self.downloadable?\n\t\t\ttrue\n\t\telsif self.inventory.xsmall > 0 || self.inventory.xxlarge > 0 || \n\t\t\tself.inventory.small > 0 || self.inventory.medium > 0 ||\n\t\t\tself.inventory.xlarge > 0 || self.inventory.large > 0\n\t\t \ttrue\n\t\telse \n\t\t\tfalse\n\t\tend\n\tend", "def in_stock?(product, quantity = 1)\n @inventory[product] && @inventory[product][\"quantity\"] >= quantity\nend", "def add_to_transactions\n if @product.stock == 0 \n raise OutOfStockError, \" OutOfStockError, #{@product.title} is out of stock.\"\n else\n @product.reduce_stock \n @@transactions << self \n end\n end", "def uniq_stocks?\n self.stocks = stocks.uniq\n end", "def update_product\n if inbound_order? || quantity_adjustment?\n product.update(stock: product.stock + quantity)\n else outbound_order?\n product.update(stock: product.stock - quantity)\n end\n end", "def stocked?\n inventory_item.present?\n end", "def feasible?\n return true if amount < 0 || source.nil? || !product.tracked_stock? || source.enable_gateway?\n inventory_item = source_item\n inventory_item.present? && inventory_item.available >= amount\n end", "def return_stock!(from_status, new_status)\n update_from_to_status!(from_status, new_status, noop: true) do\n order_items.each(&:return_items!)\n end\n end", "def update_others!\n if status_changed?\n\n if waiting_for_sell? || declined?\n ::Users::Notification.where(related_model_type:'Trading::BuyRequest', related_model_id: self.id).update_all(status: ::Users::Notification::Status::DELETED)\n end\n\n if waiting_for_sell?\n self.items.each{|item| item.status = ::Item::Status::BUYING; item.save; }\n\n elsif declined? || canceled?\n\n self.items.each{|item| item.activate! }\n\n elsif sold?\n\n self.items.each{|item| item.deactivate! }\n ::NotificationMail.create_from_mail(buyer.parent_id, seller.parent_id, UserMailer.new_buy_request_to_seller_parent(self) )\n\n end\n end\n end", "def create\n order = Order.find_by(id: session[:order_id])\n \n if session[:order_id].nil? || order.nil?\n order = Order.create\n session[:order_id] = order.id\n end\n \n order_items = {\n product_id: params[:product_id].to_i,\n quantity: params[:quantity].to_i,\n order_id: session[:order_id],\n }\n \n order = Order.find(session[:order_id])\n # if order item already exists in cart, increase quantity.\n order.order_items.each do |oi|\n if oi.product.id == order_items[:product_id]\n if oi.quantity + order_items[:quantity] > oi.product.stock\n flash[:failure] = \"Sorry, there are not enough items in stock.\"\n redirect_to product_path(order_items[:product_id])\n return\n else\n oi.quantity += order_items[:quantity]\n oi.save\n \n flash[:success] = \"Successfully updated quantity.\"\n redirect_to product_path(order_items[:product_id])\n return\n end\n end\n end\n \n order_item = OrderItem.new(order_items)\n if order_item.save\n flash[:success] = \"Successfully added item to your cart.\"\n redirect_to product_path(order_items[:product_id])\n return\n else\n flash[:failure] = \"Item could not be added to your cart.\"\n redirect_to product_path(order_items[:product_id])\n return\n end\nend", "def products_in_stock?(products)\n in_stock = false\n products.each_value {|p| in_stock = true if product_in_stock?(p) }\n return in_stock\n end", "def is_available?\n stock > 0\n end", "def load_item_from_stock(order_item, stock_items)\n amount = order_item.waiting\n stock_items.each do |item|\n all = item.available\n next if all <= 0\n\n if amount <= all\n # This inventory item satisfies the amount, we're done.\n item.reserved += amount\n return create_item_from(order_item, item.code, item.expires_at, amount)\n else\n # Load all of this item and continue with the remaining amount.\n item.reserved += all\n create_item_from(order_item, item.code, item.expires_at, all)\n amount -= all\n end\n end\n end", "def get_from_product_stock(product_id, quantity_to_add)\n product = Product.find_by(id: product_id)\n if (product.stock >= quantity_to_add)\n product.stock -= quantity_to_add\n self.quantity += quantity_to_add\n\n if self.valid? && product.valid?\n self.save\n product.save\n return self\n end\n end\n end", "def confirm\n elements=CartItem.where(:cart_id=>current_user.cart.id)\n\n # if there are no items in the cart, the order will not be placed\n if elements.length==0\n redirect_to carts_path, :notice => \"EMPTY CART!!!\"\n end\n\n # Checks to see if any item in the cart is low in stock. If so, abort. If not, update the sales, and stock quantity of the items\n out_of_stock_items=Item.check_validity(elements)\n\n # This actually checks if any items are below stock\n if out_of_stock_items.length!=0\n redirect_to carts_path, :notice => Item.show_low_stock_message(out_of_stock_items)\n else\n # Save the changes in sales and stocks.\n Item.save_sales(elements)\n #after all the validations are processed, the pre-place order view will be rendered\n @item_list=CartItem.where(:cart_id => current_user.cart.id)\n end\n end", "def delete_if_stock_too_low\n self.status_constant = SupplyItem::DELETED if self.stock < 0\n end", "def current_stock_larger_than_available_stock\n if available_stock < 0\n errors.add(:current_stock, \"is less than available stock\")\n end\n end", "def ready_to_exchange?\n self.balance >= self.promotion.points_to_exchange\n end", "def test_check_inventory\n # Create a cart and add some products.\n a_cart = Order.new\n a_cart.add_product(items(:red_lightsaber), 2)\n a_cart.add_product(items(:blue_lightsaber), 4)\n assert_equal a_cart.items.length, 2\n \n an_out_of_stock_product = items(:red_lightsaber)\n assert an_out_of_stock_product.update_attributes(:quantity => 1)\n \n # Assert that the product that was out of stock was removed.\n removed_products = a_cart.check_inventory\n assert_equal removed_products, [an_out_of_stock_product.name]\n\n # Should last the right quantity of the rest.\n assert_equal a_cart.items.length, 1\n end", "def shares_available_for_purchase?\n if Stock.all.find_by(id: trade.stock_id).shares_available < trade.num_shares\n return false\n else\n return true\n end\n end", "def process_transaction(trans, volume = trans.volume)\n # Fetch Portfolio of involved parties (buyer and seller)\n return false if !transaction_arg_check(trans.transaction_type, trans.stock.code, volume, trans.price) || !oddlot?(volume, trans)\n\n # Check if User-Stock relation already exist, create it it does not yet exists\n stocks << trans.stock unless BuyersStock.exists?(id, trans.stock.id)\n seller_stock = BuyersStock.exists?(trans.user.id, trans.stock.id) ? BuyersStock.find_entry(id, trans.stock.id) : BuyersStock.create(user_id: trans.user.id, stock_id: trans.stock.id, volume: 0, alloted_volume: 0)\n buyer_stock = BuyersStock.find_entry(id, trans.stock.id)\n # Actual Process transaction\n return false unless process(volume, trans, buyer_stock, seller_stock)\n\n # Set fulfilled original transaction\n trans.fulfilled = true\n # Save and check if there is an error in updating the involved models (buyer,seller, and respective user-stock relationship)\n if save\n ActiveRecord::Base.transaction do\n buyer_stock.save\n trans.user.save\n seller_stock.save\n trans.save\n Transaction.create(user_id: id, stock_id: trans.stock_id, volume: volume, transaction_type: trans.opposite_type, fulfilled: true, price: trans.price)\n logger.info 'Successful Transaction'\n return true\n end\n else\n logger.info 'Something went wrong'\n false\n end\n end", "def has_stock(ticker)\n found_stock = false\n @stocks.each do |item|\n if item.ticker == ticker\n found_stock = true\n end\n end\n found_stock\n end", "def in_stock?\n Spree::Config[:track_inventory_levels] ? on_hand > 0 : true\n end", "def in_stock?\n self.default_variant ? self.default_variant.in_stock? : (stock_control? ? stock > 0 : true)\n end", "def available_works?\n if prev.valid_tracking?\n prev.done > done\n else\n product_line_quantity > done\n end\n end", "def update\n \n @quantity_diference = params[:ordered_item][:quantity_new].to_i - params[:old_quantity].to_i\n \n @item = Item.find(@ordered_item.item_id)\n if @item.quantity - @quantity_diference > 0\n @ordered_items = OrderedItem.all\n \n if @ordered_item.update(quantity: @ordered_item.quantity + @quantity_diference) && @item.update(quantity: @item.quantity - @quantity_diference)\n flash[:notice] = \"Item quantity has been updated.\"\n redirect_to items_path\n else\n flash[:alert] = \"Something went wrong! Item quantity has not been changed.\"\n redirect_to ordered_items_path\n end\n \n else\n flash[:alert] = \"Item is not available\"\n redirect_to items_path\n end\n end", "def changed?\n\t\tchanged = (@price_new != @price_old)\n\t\t@price_old = @price_new\n\t\treturn changed\n\tend", "def issue_unissue_po_line_items_when_so_and_cart_diffs(issue_cart)\n logger.debug \"==@@@@==SalesOrder: issue unissue(), issuce_cart.id==== #{issue_cart.id}\"\n # so line_items not in cart(will be removed), issueback po\n self.line_items.each do |so_line|\n if not issue_cart.line_items.where(line_number: so_line.line_number).exists?\n logger.debug \"==@@@@==line_items to be removed from so==== #{so_line.id}\"\n self.issue_back_refer_line_item(so_line, so_line.quantity)\n end\n end\n\n # cart line_items not in so(will be added), issue po\n issue_cart.line_items.each do |line_item|\n # cart line_items not in so: to be added to so\n if not self.line_items.where(line_number: line_item.line_number).exists?\n logger.debug \"==@@@@==new line, to be added to so==== #{line_item.id}\" \n self.issue_refer_line_item(line_item, line_item.quantity) \n else # exist, but quantity different\n line = self.line_items.where(line_number: line_item.line_number).take\n logger.debug \"==@@@@==exsit line, update po==== #{line_item.id}\"\n if line.quantity < line_item.quantity\n self.issue_refer_line_item(line_item, line_item.quantity - line.quantity)\n elsif line.quantity > line_item.quantity\n self.issue_back_refer_line_item(line_item, line.quantity - line_item.quantity) \n end\n end\n end\n end", "def out_of_stock_message(product)\r\n \"out of stock\" unless product \r\n end", "def reserve_quantity(quantity)\n quantity = quantity.to_i\n begin\n Deal.transaction do\n deal = Deal.find(self.deal.id, :lock => true)\n if deal.max == 0 or deal.coupon_count + quantity - self.quantity <= deal.max\n self.update_attributes!(:quantity => quantity, :amount => quantity*deal.deal_price.to_f, :updated_at => Time.zone.now)\n return true\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n logger.error \"Order.reserce_quantity: Failed for Order #{self.inspect} #{invalid}\"\n end\n return false\n end", "def has_different_point_values?\n offer_value = Inventory.evaluate_items(@offer[:items])\n for_value = Inventory.evaluate_items(@for[:items])\n if offer_value != for_value\n add_error(:for, :items,\n \"Invalid Offer, the items offered and received do not worth the same\")\n true\n else false; end\n end", "def test_show_if_has_line_item\n assert_equal @order.has_line_item?(@order.order_line_items.find_by_name(items(:towel).name).id), true\n\n # Create a new order and put just one line item.\n new_order_line_item = OrderLineItem.for_product(items(:small_stuff))\n new_order = Order.new\n new_order.order_line_items << new_order_line_item\n assert new_order.save\n \n # Search for an existent line item of ANOTHER order.\n assert_equal @order.has_line_item?(new_order.order_line_items.find_by_name(items(:small_stuff).name).id), false\n end", "def create\n product = Product.find_by(id: params[:order_item][:product_id])\n if params[:order_item][:qty].to_i > product.inv_qty\n flash[:warning] = \"Quantity selected exceeds amount availabe in inventory\"\n redirect_to product_path(product.id)\n elsif @current_order.nil?\n @current_order = Order.new\n @current_order.save\n end\n\n @order_item = @current_order.order_items.new(order_item_params)\n @order_item.save\n @current_order.save\n @current_order.update(status: \"Pending\")\n session[:order_id] = @current_order.id\n redirect_to cart_path(@current_order.id)\n # else\n # flash[:warning] = \"Item order not placed\"\n # redirect_to root_path\n # # end\n end", "def changeItemSupplier(itemId)\n locationItem = Item.where(id: itemId)\n previousSupplierItem = Location.where(id:locationItem.lastSupplier).first.items.where(name:locationItem.name).first\n if(locationItem != previousSupplierItem)\n if(previousSupplierItem.amount > (locationItem.restockTo - locationItem.amount))\n previousSupplierItem.increment!(:amount, -(locationItem.restockTo - locationItem.amount))\n # PRETEND CASH ISN\"T A THING YET\n # locationItem.location.company.increment!(:cash, -previousSupplierItem.price * (locationItem.restockTo - locationItem.amount))\n locationItem.update(amount: locationItem.restockTo)\n else\n locationItem.increment!(:amount, previousSupplierItem.amount)\n # PRETEND CASH ISN\"T A THING YET\n # locationItem.location.company.increment!(:cash, -previousSupplierItem.price * previousSupplierItem.amount)\n previousSupplierItem.amount = 0\n end\n if(previousSupplierItem.amount <= previousSupplierItem.restockPoint)\n changeItemSupplier(previousSupplierItem.id)\n end\n end\n end", "def has_entered_warehouse?\n # return true if self.stored_at No se esta borrando al sacar por error\n return true if self.warehouse || self.dispatched_at\n false\n end", "def have_enough_items_to_trade?\n fetch_inventory\n\n is_valid = true\n\n max_avaliable_quantity = @offer[:records].map {|x|\n [x.item_name.to_sym ,x.quantity]}.to_h\n\n @offer[:items].each do |item, quantity|\n if quantity > max_avaliable_quantity[item.to_sym]\n is_valid = false\n add_error(:offer, :items, {item.to_sym =>\n \"Not enough items, only #{max_avaliable_quantity[item.to_sym]} available\"})\n end\n end\n\n max_avaliable_quantity = @for[:records].map {|x|\n [x.item_name.to_sym ,x.quantity]}.to_h\n\n @for[:items].each do |item, quantity|\n if quantity > max_avaliable_quantity[item.to_sym]\n is_valid = false\n add_error(:for, :items, {item.to_sym =>\n \"Not enough items, only #{max_avaliable_quantity[item.to_sym]} available\"})\n end\n end\n is_valid\n end", "def shipped\n corresponding_item = self.item.take\n current_inventory = corresponding_item.inventory_level\n corresponding_item.update_attribute(:inventory_level, (self.quantity + current_inventory)) unless previous.nil?\n self.update_attribute(:shipped_on, date.current.to_date)\n\n def item_exists_and_active?\n all_active_items = Item.active.all.map(&:id)\n if all_active_items.include?(self.item_id)\n return true\n end\n errors.add(:item_id, \"is not an active item at the chess store\")\n return false\n end\n\n def subtotal(date = nil)\n end\n\n def valid_quantity?\n if self.quantity >= 0\n return true\n end\n stock_quantity = self.item.inventory_level\n if (self.quantity* -1) > stock_quantity\n errors.add(:quantity, \"too much purchase quantity\")\n return false\n end\n return true\n end\nend", "def custom_order?\n order_items.all? { |oi| oi.purchasable_type == 'Effective::Product' }\n end", "def _order_upgrade_item!(upgrade_item_price)\n # put together an order\n upgrade_order = {\n 'complexType' => 'SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade',\n 'virtualGuests' => [{'id' => self.id }],\n 'properties' => [{'name' => 'MAINTENANCE_WINDOW', 'value' => Time.now.iso8601}],\n 'prices' => [ upgrade_item_price ]\n }\n\n self.softlayer_client[\"Product_Order\"].placeOrder(upgrade_order)\n end", "def validate_item_quantity\n return true if item.nil?\n unless item.could_be_ordered?(quantity - quantity_was.to_i) # check only quantities diff\n errors.add(:quantity, :could_not_be_ordered)\n end\n end", "def update_current\n if(update_existing?)\n #generate new quantity\n qty = @itm.quantity + self.quantity\n #update existing\n @itm.update_column(:quantity, qty)\n #if item belongs to an order update total\n if(!@itm.order.nil?)\n @parent.update_attributes(update_total: (self.quantity * \n @itm.purchase_price_cents))\n end\n #remove quantity from inventory\n update_inventory(0-self.quantity)\n #set current item quantity to 0\n self.quantity = 0\n #update ids for routing purposes\n update_ids \n return true\n end\n #ensures returning object can be routed properly\n update_ids\n return false\n end", "def handle_merge(current_line_item, other_order_line_item)\n if current_line_item\n current_line_item.quantity += other_order_line_item.quantity\n handle_error(current_line_item) unless current_line_item.save\n else\n order.line_items << other_order_line_item\n handle_error(other_order_line_item) unless other_order_line_item.save\n end\n end", "def check_for_equal_item(name, price, description, item_not_to_compare = nil)\r\n index = items.index {|x| x.name.eql?(name) and x.price.eql?(price) and x.description.eql?(description) and x != item_not_to_compare}\r\n return items[index] unless index == nil\r\n end", "def check_event_stock!\n event = self.exchange.event\n event.check_stock!\n\n # Agrego una tarea para revisar que los otros eventos de la misma experiencia tengan stock,\n # esto sirve principalmente para el stock de los eventos sin exclusividad.\n CheckEventStockWorker.perform_async(event.experience_id)\n end", "def validate_stock_addition(err_message)\n \t#verify that Stock_additions is valid\n \t#1. Get most recent stock for selected tank\n \t#2. Assign volume of recent stock to temporary variable\n \t#3. Verify that quantity_added does not exceed quantity_supplied\n \t#4. Verify that quantity_added + recent_stock does not exceed tank capacity\n \t#5. If step 3 and 4 pass, create instance of Stock_addition; assign the variables\n \t# prev_qty = temporary_variable; curr_qty = quantity_added + temporary_variable;\n \t#6. Create instace of Stock and assign its tank_id to selected tank\n \t# current_stock = curr_qty of stock_addition\n \t@waybill_approval.stock_additions.each do |stock_addition|\n \t\t#get recent stock for tank\n \t\ttemp_stock_value = stock_addition.tank.get_lastest_stock(tank.id)\n\n \t\t#verify quantity_supplied >= quantity_added \n \t\tif @waybill_approval.quantity_supplied >= stock_addition.quantity_added\n \t\t\tcurrent_stock = stock_addition.quantity_added + temp_stock_value\n\n \t\t\t#verify current_stock does not exceed tank capacity\n \t\t\tif current_stock <= stock_addition.tank.capacity\n \t\t\t\t#create instance of stock, add it to stock_addition and then save all\n \t\t\t\tstock_addition.stock = Stock.new( tank_id: stock_addition.tank.id, current_stock: current_stock)\n \t\t\t\t\n \t\t\t\tstock_addition.previous_quantity = temp_stock_value\n \t\t\t\tstock_addition.current_quantity = current_stock\n\n \t\t\telse\n \t\t\t\terr_message = \"Current stock greater than capacity of tank\"\n\n \t\t\tend\n \t\telse\n \t\t\terr_message = \"Quantity added greater than quantity supplied\"\n \t\t\t\n \t\tend\n\n \tend\n end", "def validate_on_update\n quantity_count = SupplierOrderFulfillment.sum(:quantity,\n :conditions => ['supplier_order_id=?',supplier_order_id])\n #total quantity in order >= all quantity in fulfillment\n current_quantity = SupplierOrderFulfillment.find(id).quantity\n puts quantity_count\n if supplier_order.total_quantity >= quantity_count + quantity - current_quantity\n return true\n else\n errors.add_to_base('total quantity < fulfillment quantity')\n return false\n end\n end", "def available?\n in_stock? || backorderable?\n end", "def item_stock(item)\n item_stocks.create(item_id: item.id)\n end", "def on_order?\n !self.paid?\n end", "def available?\n self.in_stock? || self.backorderable?\n end", "def add_stock_to_subscriber_delivery\n # get params\n @source_info = params[:id]\n @source_info_split = @source_info.split(\"-\")\n @page = @source_info_split[0]\n @related_id = @source_info_split[1]\n @customer_drink_quantity = params[:quantity].to_i\n \n # get delivery info\n @next_delivery = Delivery.where(account_id: current_user.account_id, status: [\"user review\", \"admin prep next\", \"admin prep\"]).order(delivery_date: :asc).first\n \n # get related info\n if @page == \"stock\"\n # get projected rating info\n @project_rating_info = ProjectedRating.find_by_id(@related_id)\n # get inventory info\n @inventory = Inventory.find_by_id(@project_rating_info.inventory_id)\n #Rails.logger.debug(\"Inventory: #{@inventory.inspect}\")\n # now check if this inventory item already exists in the Account Delivery table\n # get drink info\n @customer_drink_order = AccountDelivery.where(account_id: current_user.account_id, \n delivery_id: @next_delivery.id,\n inventory_id: @inventory.id).first\n else\n # get drink info\n @customer_drink_order = AccountDelivery.find_by_id(@related_id)\n # get inventory info\n @inventory = Inventory.find_by_id(@customer_drink_order.inventory_id)\n #Rails.logger.debug(\"Inventory: #{@inventory.inspect}\")\n # get projected rating info\n @project_rating_info = ProjectedRating.where(user_id: current_user.id, inventory_id: @inventory.id).first\n end\n #Rails.logger.debug(\"Next Delivery Drink Check: #{@customer_drink_order.inspect}\")\n if !@customer_drink_order.blank? #update entry\n #Rails.logger.debug(\"Found this drink\")\n # put inventory back before updating based on current quantity chosen\n @inventory.increment!(:stock, @customer_drink_order.quantity)\n @inventory.decrement!(:reserved, @customer_drink_order.quantity)\n \n # get related User Delivery info\n @related_user_delivery = UserDelivery.find_by_account_delivery_id(@customer_drink_order.id)\n \n # make adjustments to both delivery and inventory info\n if @customer_drink_quantity != 0\n \n # update delivery info\n @customer_drink_order.update(quantity: @customer_drink_quantity)\n @related_user_delivery.update(quantity: @customer_drink_quantity, user_addition: true)\n @next_delivery.update(has_customer_additions: true)\n # update inventory info\n @inventory.increment!(:reserved, @customer_drink_quantity)\n @inventory.decrement!(:stock, @customer_drink_quantity)\n else\n # remove related delivery items\n @customer_drink_order.destroy!\n @related_user_delivery.destroy!\n # already put inventory back, so no need to do more with inventory\n end\n else # create new Account and User delivery entries and adjust Inventory\n #Rails.logger.debug(\"Did not find this drink\")\n # get cellarable info\n @cellar = @inventory.beer.beer_type.cellarable\n if @cellar.nil?\n @cellar = false\n end\n # get size format info\n if @inventory.size_format_id == 5 || @inventory.size_format_id == 12 || @inventory.size_format_id == 14\n @large_format = true\n else\n @large_format = false\n end\n # adjust drink price to wholesale if user is admin\n if current_user.role_id == 1\n if !@inventory.sale_case_cost.nil?\n @wholesale_cost = (@inventory.sale_case_cost / @inventory.min_quantity)\n else\n @wholesale_cost = (@inventory.regular_case_cost / @inventory.min_quantity)\n end\n @stripe_fees = (@wholesale_cost * 0.029)\n @drink_price = (@wholesale_cost + @stripe_fees)\n else\n # get correct price of drink based on user's address\n @drink_price = UserAddress.user_drink_price_based_on_address(current_user.account_id, @inventory.id)\n end\n #Rails.logger.debug(\"Drink Price: #{@drink_price.inspect}\")\n # create new Account Delivery table entry\n @account_delivery = AccountDelivery.create(account_id: current_user.account_id, \n beer_id: @inventory.beer_id,\n quantity: @customer_drink_quantity,\n cellar: @cellar,\n large_format: @large_format,\n delivery_id: @next_delivery.id,\n drink_price: @drink_price,\n times_rated: 0,\n size_format_id: @inventory.size_format_id,\n inventory_id: @inventory.id)\n if @account_delivery.save!\n # create new User Delivery entry\n UserDelivery.create(user_id: current_user.id,\n account_delivery_id: @account_delivery.id,\n delivery_id: @next_delivery.id,\n quantity: @customer_drink_quantity,\n projected_rating: @project_rating_info.projected_rating,\n drink_category: @inventory.drink_category)\n \n # update inventory info\n @inventory.increment!(:reserved, @customer_drink_quantity)\n @inventory.decrement!(:stock, @customer_drink_quantity)\n end\n end\n\n # update Delivery totals\n # get all drinks in the Account Delivery Table\n @account_delivery_drinks = AccountDelivery.where(account_id: current_user.account_id, \n delivery_id: @next_delivery.id)\n @subtotal = @account_delivery_drinks.sum( \"drink_price*quantity\" ) \n @sales_tax = @subtotal * 0.101\n @total_drink_price = @subtotal + @sales_tax\n if @subtotal > 35\n @delivery_fee = 0\n else\n @delivery_fee = 5\n end\n @grand_total = @total_drink_price + @delivery_fee\n \n # update price info in Delivery table and set change confirmation to false so user gets notice\n @next_delivery.update(subtotal: @subtotal, sales_tax: @sales_tax, \n total_drink_price: @total_drink_price,\n delivery_fee: @delivery_fee,\n grand_total: @grand_total)\n \n # update page\n respond_to do |format|\n format.js\n end # end of redirect to jquery\n \n end", "def product_in_stock?(product)\n p = Product.find_by_name(product.to_s)\n return nil unless p\n coupons = Coupon.find_all_by_product_id_and_account_id_and_used(p.id, nil, 'N', :limit => 1) \n return nil unless coupons\n return nil if coupons.length == 0 \n return coupons[0]\n end", "def fetch_cart_and_check_inventory\n @cart = Cart.find_or_create_by user_id: @current_user.id\n\n # Check user's line items against current inventory levels\n updated_line_items = []\n\n @cart.line_items.each do |item|\n if item.quantity > item.product_size.quantity\n update_qty = item.get_update_qty item.quantity\n item.update quantity: update_qty\n updated_line_items << item\n end\n end\n\n # If items in the user's cart had to be adjusted,\n # redirect to carts#user_cart and set flash error\n if updated_line_items.length > 0\n flash[:item_error] = \"Sorry, stock is running low. Your shopping basket has been adjusted accordingly.\"\n redirect_to cart_path\n return\n end\n end", "def sell_stock(user)\n quote = Stock.stock_quote(Stock.all.find(self.stock_id).symbol)\n sell_trade = Trade.create(status: \"pending\", investor_id: user.id, num_shares: self.num_shares,\n stock_price: quote.delayed_price, bought_sold: \"In progress\", stock_id: self.stock_id, date: Date.today)\n sell_trade.purchase_price = quote.delayed_price * sell_trade.num_shares\n user.deposit_funds(sell_trade.purchase_price)\n original_order = Trade.all.find(self.id)\n original_order.bought_sold = \"sold\"\n original_order.save\n sell_trade.bought_sold = \"sell order\"\n sell_trade.status = \"completed\"\n sell_trade.save\n puts \"\\nCongratulations! You have successfully sold #{sell_trade.num_shares} shares of #{quote.company_name}\"\n end" ]
[ "0.7001791", "0.66873336", "0.66342664", "0.66234076", "0.6552515", "0.6530507", "0.65024805", "0.6487422", "0.6400829", "0.63834864", "0.6342684", "0.6335373", "0.6317685", "0.6293064", "0.62658036", "0.62519425", "0.6234587", "0.62134993", "0.62090427", "0.61974424", "0.61614627", "0.614841", "0.61265045", "0.61174893", "0.6093733", "0.60851157", "0.60683036", "0.6060613", "0.6000039", "0.59917516", "0.598067", "0.59796095", "0.5955683", "0.5944602", "0.5940286", "0.5938916", "0.593733", "0.5934369", "0.5920888", "0.59172964", "0.5915417", "0.5907786", "0.590714", "0.5889509", "0.5879294", "0.5868894", "0.58601236", "0.5851302", "0.5850261", "0.57796174", "0.5776157", "0.5755241", "0.57498735", "0.57470286", "0.57424086", "0.57270694", "0.5721253", "0.57115364", "0.57089305", "0.5701642", "0.57003033", "0.5692808", "0.5690484", "0.5666164", "0.56631386", "0.5656178", "0.56490713", "0.5640483", "0.5640315", "0.5640023", "0.561248", "0.56005067", "0.5598803", "0.55981934", "0.55975205", "0.5589605", "0.5585481", "0.5570683", "0.5564054", "0.55569685", "0.5556304", "0.5556158", "0.555349", "0.555096", "0.55473846", "0.5535796", "0.5530173", "0.5516812", "0.55142856", "0.55126035", "0.5510805", "0.5498845", "0.54949015", "0.5490379", "0.5486362", "0.5485436", "0.5476969", "0.5475907", "0.5470229", "0.5469581", "0.5467258" ]
0.0
-1
I may repeat myself at this point but this gives me the opportunity to add more elements in the quantity method
def quantity=(q) @quantity = q notify_observers unless @observers.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantity\n 1\n end", "def qty_to_add\n 0\n end", "def qty_to_add\n 0\n end", "def add_item(title, price, quantity=1)\n self.total += price * quantity #Think about this logically\n #you go into a store and buy and item. How do you get the total of the item.\n #you MULTIPLY BY THE PRICE!!!! DURRRRR!!! GOD MORTY YOUR SO DUMB\n @price = price\n #do this x amount of times.\n quantity.times do\n @items << title\n end\n\n end", "def quantity\n 1\n end", "def add_quantity(number)\n @quantity += number\n end", "def sell_quantity\r\n 100000000000\r\n end", "def quantity\n map(&:quantity).sum\n end", "def test_adds_up_in_quanttity\n\t\tcart = Cart.new\n\t\t3.times { cart.add_item 1 }\n\n\t\tassert_equal cart.items.length, 1 #solo un item\n\t\tassert_equal cart.items.first.quantity, 3 #varias unidades del mismo item\n\tend", "def add_item(title, price, quantity=1)\n self.total += price * quantity\n #quantity amount of times it'll add the title to the items array\n quantity.times {items << title}\n self.last_transaction = price * quantity\n end", "def quantity\n @quantity ||= DEFAULT_QUANTITY\n end", "def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend", "def qty()\n 1\n end", "def total_quantity\n total = 0.0\n self.quantities.each do |quantity|\n total = total + quantity.number\n end\n total\n end", "def add_item(item, price, *quantity)\n q = quantity.join(\"\").to_i\n if q > 1\n q.times do\n @items.push(item)\n end\n else\n @items.push(item)\n end\n if q > 1\n price_with_quantity = q * price\n @last = price_with_quantity\n @total += price_with_quantity\n else\n @last = price\n @total += price\n end\n\n end", "def add(quant)\n\t\tself.quantity += quant\n\tend", "def add_item(title, price, quantity=1) \n self.total += price * quantity\n quantity.times do\n items << title \n end\n self.last_transaction = price * quantity\n\n end", "def add_item (title, price, quantity=1)\n self.total += price * quantity\n quantity.times do\n @items << title\n end\n end", "def add_sign_to_quantity\n end", "def update_quantity(grocery_list, item, quantity)\r\n add_item(grocery_list, item, quantity)\r\n \r\nend", "def total_item_number\n @quantity * product.result_n\n end", "def supp_quantity \n\n supp_quantity = 0.0\n \n self.receptions.each do |mr|\n supp_quantity += mr.quantity ? mr.quantity : 0.0 # en caso de que no se haya definido el quantity\n end\n\n return supp_quantity\n\n end", "def add_item(title, price, quantity=1)\n #and increases the total\n self.total += price * quantity\n #times.do for all the items\n quantity.times do\n @items << title\n end\n #doesn't forget about the previous total\n self.last_transaction = price * quantity\n end", "def quantity\n @quantity ||= 1\n end", "def new_quantity(list, item, qty)\n list[item] += qty\n p list\nend", "def quantity\n quantity_initial - quantity_consumed\n end", "def add_item(title, price, quantity = 1)\n @total += price*quantity\n @instance_items << [title, price, quantity]\nend", "def increment_quantity\n @quantity += 1\n end", "def add_item (title, price, quantity = 1)\n i = 0\n while i < quantity\n @items << title\n i += 1\n end\n my_price = price * quantity\n @transactions << my_price\n @total += (price * quantity)\n end", "def add_item(title, p, q=1) # accepts a title and a price AND inc. the total. Optional quantity set to 1 since u will always have at least one item.\n @total += (p*q) # @ total is price times quantity, and increments (does not forget previous total as u add new items)\n q.times do # want to add the item as many times to the list as its quantity so keep doing this the # of times its quantity is\n @items << title\n end\n @last_transaction = p # the last transaction = the price of the last item added\n end", "def total_items\r\n\t\t@items.inject(0) { |sum, i| sum + i.quantity }\r\n\tend", "def increment_units\n contents.each do |key,content|\n id = content[\"_id\"] || content[\"item_id\"]\n begin\n \n product = shop.products.find(id)\n return false if product.nil? || product.dont_track_quantities?\n\n new_pv = []\n\n if product.price_variants.length==1\n\n new_pv = product.price_variants.first\n new_pv['quantity'] = new_pv['quantity'].to_i+content['quantity'].to_i\n product.num_orders = [product.num_orders-content['quantity'].to_i].max\n product.price_variants = [ new_pv ]\n\n else\n\n product.price_variants.each do |pv|\n name = [pv['primary'],pv['secondary']].join(\" \").downcase.trim\n name = \"\" if name==\" \"\n if name==content['variant_name'].trim.downcase && !pv['quantity'].blank?\n new_pv << pv.merge( 'quantity' => (pv['quantity'].to_i+content['quantity'].to_i) )\n else \n new_pv << pv\n end\n end\n product.num_orders = [product.num_orders-content['quantity'].to_i].max\n product.price_variants = new_pv\n\n end\n product.save\n\n rescue Exception => e\n ::Exceptional::Catcher.handle(e)\n # raise(e)\n end\n end\n end", "def add_item(item,quantity,first_list)\n if quantity == \"\"\n quantity = 1\n else\n quantity\n end\n first_list[item] = quantity\n\nend", "def update_quantity(name, quantity, list)\n list[name] += quantity\nend", "def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend", "def total_items\n order_items.inject(0) { |t,i| t + i.quantity }\n end", "def amount( item, list )\n \"#{ list.size } #{ item }#{ pl list }\"\nend", "def product_count\n self.items.inject(0) {|sum, item| sum + item.quantity}\n end", "def quantity\n return @ucItemNumber.value\n end", "def added_to_basket\n select_size\n choose_quantity \n click_add_to_basket\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 add_units(qty)\n qty.to_i.times do\n #create item\n item = supply_items.new\n item.status = SupplyItem::STATUS_AVAILABLE\n item.save\n end\n end", "def total_quantity\n line_items.sum(:quantity)\n end", "def update_qty(shopping_list, item, quantity)\r\n\r\n\tadd_item(shopping_list, item, quantity)\r\n\r\nend", "def update_quantity(grocery_list, item_name, qty = 1)\r\n\tgrocery_list = add_item(grocery_list, item_name, qty)\r\n\treturn grocery_list\r\nend", "def pick_from_magazine(quantity)\r\n end", "def new_quantity args={}\n SY::Quantity.new args.merge( composition: self )\n end", "def add_item(title, price, quantity =1)\t#increases the total\n\t\tcounter = quantity\n\n\t\twhile counter > 0\n\t\t\t@@all << title\n\t\t\tcounter -= 1\n\t\tend\n\n\t\t\n\t\t@prev_total = @total\n\t\t\n\t\t@total = (@prev_total + (price * quantity))\n\n\n\t\t@total \t\t\t\n\tend", "def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end", "def consume_items(item_quantities)\n item_quantities.each do |ingredient_name, quantity|\n @ingredients[ingredient_name] = @ingredients[ingredient_name] - quantity\n end\n end", "def add_item(item, price, quantity = 1)\n self.total += price * quantity\n self.last_item = price\n self.last_quantity = quantity\n\n counter = 0\n while counter < quantity\n self.cart << item\n counter += 1\n end\n self.cart\n end", "def reshelf(product, quantity)\n # NOT DEFINED IN EXAMPLES\n @inventory[product][\"quantity\"] += quantity\nend", "def formula_for(qty, desired_element)\n el = @elements[desired_element]\n qty += 1 while (qty % el.min_qty).positive? # Have to create in min quantity multiples\n scale = [qty / el.min_qty, 1].max # Then see if we need to multiply\n\n el.building_blocks.sort { |b, a| a[0].max_reactions <=> b[0].max_reactions }.map do |component, component_qty|\n [component.name, component_qty * scale]\n end\n end", "def total_items\n line_items.sum(:quantity)\n end", "def total_items\n line_items.sum(:quantity)\n end", "def increment_quantity\n self.quantity_needed += self.quantity\n save\n end", "def add_item(item, price, quantity = 1)\n @total += price * quantity\n @transactions << price * quantity\n i = quantity\n until i == 0 do\n @items << item\n i -= 1\n end\n end", "def add_to_order(add_qty=0)\n \t@quantity += add_qty\n end", "def add_to_cart(product, amount)\n purchase = \" • #{amount} #{product}\\n\"\n @cart << purchase\n\n cost_per_item = @inventory[product][\"price\"]\n @total_cart_value += (cost_per_item * amount)\n\n @inventory[product][\"quantity\"] -= amount\nend", "def add_item(title, amount, quantity=1)\n self.total += amount * quantity\n quantity.times do\n items << title\n end\n self.last_transaction = amount * quantity\n end", "def adding_item(list,item,quantity = 1)\r\n# if quantity == nil\r\n# quantity = 1\r\n# end\r\n list[item] = quantity\r\n list\r\nend", "def update_quantity(grocery_list, item_name, quantity)\n\tadd_item(grocery_list, item_name, quantity)\n\treturn grocery_list\nend", "def update_quantity(grocery_list, item_name, qty = 1)\n\tgrocery_list = add_item(grocery_list, item_name, qty)\n\treturn grocery_list\nend", "def add_item(string, float, integer = 1)\n # adds item price to total\n @total += float * integer\n # accepts an optional quantity of the item\n quantity = integer\n # loops to add item multiple times to the list \n quantity.times {@items << string}\n # holds the amount of the last transaction\n self.last_transaction = float * quantity\n end", "def add_item(title, price, quantity = 1)\n @title = title\n @price = price\n quantity.times {@items << title}\n @last_transaction = @price * quantity\n @total = @total + (@price * quantity)\n @total\n end", "def weight\n self.ingredients.map{|i| i.quantity}.reduce(:+)\n end", "def item_count\n order_items.map(&:quantity).sum\n end", "def add_inventory(product_name, quantity)\n @products.each do |product|\n if product.name == product_name.upcase\n product.quantity += quantity\n end\n end\n end", "def sepitem_quantity(counts)\n puts 'item ---- quantity'\n counts.each do |key, value|\n puts \"#{key} : #{value}\"\n\n item=Item.new\n v=item.pick_line(key)\n total_with_disc=discount_bill(key,value,v)\n without_disc_bill(key,value,v,total_with_disc)\n end\n end", "def quantity_max_available_for_amend\n quantity + quantity_rejected\n end", "def update_quantity(item_name, grocery_list, quantity)\n grocery_list[item_name] = quantity\n grocery_list\n end", "def add_item (title, price, quantity = 1)\n # adds purchase price to total\n @total += price * quantity\n # Adds proper quanity of item to cart\n count = 0\n while count < quantity\n @items << title\n count += 1\n end\n # keeps track of last_added item\n @last_transaction[:item] = title\n @last_transaction[:price] = price\n @last_transaction[:quantity] = quantity\n\n end", "def quantity_listed\n item_hash.deep_find(:quantity, 0)\n end", "def price(quantity)\n\tif quantity >= 100 \n\t\tprice_per_item = 8\n\t\n\telsif quantity >= 50\n\t\tprice_per_item = 9\n\t\n\telse quantity < 50\n\t\tprice_per_item = 10\n\tend\n\tquantity * price_per_item\nend", "def add_item(item, qty)\n for ele in @order do\n order_item = ele.keys[0]\n if order_item.name == item.name\n ele[order_item] += qty\n return \n end\n end\n @order.push({item => qty})\n \n end", "def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end", "def add_drink(order_qty)\r\n @qty += order_qty \r\n end", "def show_quantity(options = {})\n quantity_packed.to_s + 'boxes + ' + quantity_unpacked.to_s + 'pcs available'\n end", "def return_quantity_selection\n\n iterations = self.quantity_available\n\n quantity_options = []\n\n iterations.times do |number|\n quantity_options << number + 1\n end\n\n return quantity_options\n end", "def total_quantity\n category_quantity = 0 \n self.products.each do |product|\n category_quantity += product.quantity\n end\n category_quantity\n end", "def initialize( quantity)\n #@item_name = item_name\n @quantity = quantity\n\n end", "def get_total_qnty(line_items)\n line_items.map(&:quantity).sum\n end", "def get_total_qnty(line_items)\n line_items.map(&:quantity).sum\n end", "def add_item(item_name, price, quantity = 1)\n @transactions << Transaction.new(item_name, price, quantity)\n quantity.times{self.items << item_name}\n self.total += price*quantity\n end", "def items\n instance_item_display = []\n @instance_items.each do |entry|\n quantity = entry[2]\n item = entry[0]\n quantity.times{instance_item_display << item} \n end \n instance_item_display\nend", "def add_item(product_id, quantity)\n product = Product.find(product_id) # product is exists?\n\n quantity = quantity.blank? ? 1 : (quantity.to_i > 99? 99 : quantity.to_i)\n\n return if quantity < 1 # return if invalid quantity is provided\n \n if cart_item = @items.find { |item| item.id.to_i == product_id.to_i }\n cart_item.quantity += quantity\n cart_item.quantity < 99 ? cart_item.quantity : cart_item.quantity =99\n else\n @items << CartItem.new(product.id, quantity)\n end\n\n end", "def total_items\n\t\tline_items.sum(:quantity)\n\tend", "def quantified_items\n products.map { |product| [product.variant, product.quantity] }\n end", "def update_quantity(list, item, quantity)\n\tadd_to_list(list, item, quantity)\nend", "def quantity\n read_integer('quantity')\n end", "def use_item(item_name:, quantity:)\n total_items_quantity[item_name] -= quantity\n end", "def bought_products\n order_details.sum(:quantity)\n end", "def add_item(name, quantity = 1)\r\n if $grocery_list[name]\r\n $grocery_list[name] += quantity\r\n else\r\n $grocery_list[name] = quantity\r\n end\r\n print_list\r\nend", "def item_quantity(list, item_to_update, quantity)\n list[item_to_update] = quantity \nend", "def increment(n = 1)\n @quantity += n\n end", "def add_item(title, price, quantity = 1)\n item = {\n title: title,\n price: price,\n quantity: quantity\n}\n\n\n@items_array << item\n@total += price * quantity\n\n\nend", "def add\n @item.increment(:quantity)\n @item.save!\n\n refresh\n end", "def add_item(name, price, quantity = 1)\n self.total += price * quantity\n quantity.times {self.items << name}\n record_trans(name, price, quantity)\n end", "def quantity_with_recursion(depth=0)\n depth += 1\n raise \"Item.quantity_with_recursion: Cap of 5 reached.\" if depth > 5\n if self.parent\n return self.quantity_with_stock + self.parent.packaging_unit * self.parent.quantity_with_recursion(depth)\n else\n return self.quantity_with_stock\n end\n end", "def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity.to_i\n\tlist\nend" ]
[ "0.71410894", "0.7097543", "0.7097543", "0.7057663", "0.70555025", "0.7023739", "0.7018324", "0.7001784", "0.69785887", "0.69756186", "0.6960602", "0.69258606", "0.6915472", "0.6909458", "0.6852618", "0.68485457", "0.6841577", "0.6832404", "0.6825119", "0.6819864", "0.6816675", "0.6814381", "0.6802591", "0.6795594", "0.67943364", "0.67920256", "0.676482", "0.6763002", "0.67557675", "0.67411184", "0.6732479", "0.67319334", "0.6709815", "0.67001814", "0.667848", "0.6676124", "0.6674342", "0.66705763", "0.6663744", "0.6662202", "0.66573805", "0.66573805", "0.6640597", "0.66383946", "0.66362035", "0.66173947", "0.65998745", "0.6578044", "0.65721655", "0.6570012", "0.6551433", "0.65392065", "0.6538707", "0.65382844", "0.6533542", "0.6533542", "0.6525743", "0.65253484", "0.6515885", "0.65088826", "0.6503109", "0.64991504", "0.6483122", "0.6479797", "0.647321", "0.6470684", "0.6468941", "0.6467126", "0.6465254", "0.64572996", "0.64562833", "0.6455155", "0.64442706", "0.6440745", "0.64353395", "0.6434482", "0.64322823", "0.64288473", "0.6427653", "0.64269483", "0.6420144", "0.6410753", "0.640517", "0.640517", "0.6401501", "0.6398958", "0.63984126", "0.6394606", "0.63885766", "0.63856506", "0.63850605", "0.63841933", "0.6383714", "0.63825357", "0.6371977", "0.6370013", "0.6358975", "0.6357942", "0.6345838", "0.63389856", "0.6337961" ]
0.0
-1
This is a very basic program
def helloWorld puts "Hello World!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main; end", "def main\n\n end", "def main\n end", "def program; end", "def main\n\nend", "def program() @program end", "def main\n puts \"computor\"\nend", "def main()\n puts(\"Hello, Ruby.\")\n\nend", "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 run\n puts \"Hello world\"\n end", "def introduction # def opens a function/ method\n\tputs \"This is an introduction program to ruby.\" # puts includes \\n newline before displaying a string\n\tputs \"If you entered this from the command line it would have looked something like this...\"\n\tputs \"\\n\\t$\\t#{$0}\" # \"#{$0}\"\" displays the script ran from the command line. \nend", "def run_main\n end", "def hello\r\n\t\tputs \"New hello here.\"\r\n\tend", "def hello_world\n\t\n puts \"Hello, world!\" \n \nend", "def main(argv)\n # override this; no default action in main\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def main\r\n\r\n\tname = read_string('What is your name?')\r\n\tputs 'Your name is ' + name + '!'\r\n\tfamily_name = read_string('What is your family name?')\r\n\tputs 'Your family name is: ' + family_name + '!'\r\n\tyear_born = read_integer('What year were you born?')\r\n\tage = Date.today.year - year_born\r\n\tputs 'So you are ' + age.to_s + ' years old'\r\n\tvalue = read_float('Enter your height in metres (i.e as a float): ')\r\n\tvalue = value * INCHES\r\n\tputs 'Your height in inches is: '\r\n\tputs value.to_s\r\n\tputs 'Finished'\r\n\tcontinue = read_boolean('Do you want to continue?')\r\n\tif (continue)\r\n\t\tputs 'Ok, lets continue'\r\n\telse\r\n\t\tputs 'ok, goodbye'\r\n\tend\r\nend", "def run\n \n end", "def run\n \n end", "def how_it_works\r\n end", "def main(*args)\n #puts self.class # TODO: fix help\n raise NoCommandError\n end", "def run\n end", "def hello\n puts \"hello world!\"\n end", "def greeting\n puts \"Welcome to the world of practical effects\"\n end", "def prescription_1\n\tputs \"*** Prescription 1 ***\"\n\tputs \"Use the TDD process to create and adjust your code's design in small, incremental steps.\\n\\n\"\nend", "def imprimir()\n\tputs \"Hello World!\"\nend", "def hello_world\n puts \"Hello world!\"\n end", "def intro\n\tputs \"\\nHello, welcome to Secret Number, created by Jonathan Wang.\"\nend", "def main\n\n # test\n\n # Console.new\n console_start\n end", "def greeting(name)\n print \"hello \" + name + \" what the fuck is your problem?\"\nend", "def execute\n setup\n begin\n data = main\n rescue ArgumentError => e\n warn e.message\n exit 1\n end\n puts format_data(data)\n end", "def standalone; end", "def hello_world \n puts \"This is a crazy part of the world\"\n end", "def greeting \r\n puts \"Hi, Ruby programmer!\"\r\nend", "def meow #teaching the cat how to meow\n puts \"meow!\" \n end", "def usage; end", "def usage; end", "def run\n end", "def run\n end", "def make; end", "def print_greeting\n puts \"Welcome to Rummikub!\"\n puts \"For more info, please see http://en.wikipedia.org/wiki/Rummikub\"\nend", "def greeting(name)\n puts \"Hello #{name}, welcome to the program!\"\nend", "def run() end", "def greetings\n\tputs \"Greetings friend!\"\nend", "def greeting(name)\r\n print \"Hello there, #{name}!\"\r\nend", "def hello\n puts \"Hello\"\n end", "def run()\n end", "def hello(name, age)\n\tputs \"Welcome #{name}, #{age} is definitely not too old to learn how to code\" \nend", "def graffiti\n puts \" ______ _ _______ _ \"\n puts \" | ____| | | |__ __| | |\"\n puts \" | |__ _ __ _ _ __ _ __ _| | | |_ __ __ ___ _____| |\"\n puts \" | __| '__| | | |/ _` |/ _` | | | | '__/ _` \\\\ \\\\ / / _ \\\\ |\"\n puts \" | | | | | |_| | (_| | (_| | | | | | | (_| |\\\\ V / __/ |\"\n puts \" |_| |_| \\\\__,_|\\\\__, |\\\\__,_|_| |_|_| \\\\__,_| \\\\_/ \\\\___|_|\"\n puts \" __/ | \"\n puts \" |___/ \"\nend", "def intro\n\tputs \"\\nHey, this is Grandma. HOW ARE YOU DEARY?\"\nend", "def compliment_machine(name)\nputs \"Hey there, #{name}! Lookin' good today!\"\nputs \"Is that a new face? It looks nice!\"\nend", "def printUsage\n puts \"Usage: cities.rb City1 City2 City3 City4 City5\"\t \nend", "def greeting \n puts \"Hello World\"\nend", "def introduction\n puts 'hello welcome to the github scrapper'.light_blue\n puts 'this tool is desgined for fetching data from github quickly and saving it to a csv file'.light_blue\nend", "def greeting(name)\n\tputs \"Hello, \" + name + \". How are you doing?\"\nend", "def hello\n\tputs 10\nend", "def greeting(name)\n\tputs \"Hello \" + name + \". Have a nice day!\"\nend", "def greeting\n puts \"Hello World\"\nend", "def cmd; end", "def example num\n puts\n puts \"------ Example #{num} ------\"\nend", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def help\r\n\tputs \"-to add new student: add student\"\r\n\tputs \"-to display all students: display students\"\r\n\tputs \"-to display all subjects: display subjects\"\r\n\tputs \"-to update a grade: update grade\"\r\n\tputs \"-to display grades of a student: check grade\"\r\n\tputs \"-to quit: done, exit\"\r\nend", "def desc\n\t\t\"Basic I/O\"\n\tend", "def hello_house\n\t\tputs 'Hello from #{@name}.'\n\tend", "def demo\n end", "def printStat\n\tprint \"Hello World\"\n\tprint \"Good Morning\"\nend", "def make_pasta\n\t\tputs \"The chef makes pasta\"\n\tend", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def saludar\n\tputs \"Hello there\"\nend", "def hello\n puts 'Hello, world!'\nend", "def test\n puts \"this is a test\"\n end", "def hello\n puts \"this is hello method\"\n end", "def say_hello\n\tputs \"Bonjour!\"\nend", "def greeting\n\t\tputs \"Welcome to the Secret Number Game \\n\"\n\t\tputs \"Written by AxleMax\\n\\n\"\n\tend", "def main\n puts \"Welcome to the music player\"\n\talbum = read_album()\n\tprint_album(album)\nend", "def greet_me\n puts \"Hello\"\nend" ]
[ "0.76918614", "0.7553086", "0.7534648", "0.7285481", "0.6903553", "0.67122483", "0.6646864", "0.65999115", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.65616244", "0.6470243", "0.64579564", "0.6451093", "0.6397455", "0.63837886", "0.6346597", "0.6345159", "0.6330697", "0.6330697", "0.6330697", "0.6330697", "0.6330697", "0.6330697", "0.6330697", "0.6326204", "0.6291673", "0.6291673", "0.62699926", "0.6225401", "0.6209841", "0.6195407", "0.6173738", "0.6172809", "0.6164691", "0.61509466", "0.613502", "0.61169076", "0.6111104", "0.6109635", "0.61023265", "0.60970473", "0.6078693", "0.605553", "0.6053669", "0.6053669", "0.605302", "0.605302", "0.60505515", "0.6043863", "0.60353225", "0.60243654", "0.60223716", "0.6021499", "0.602002", "0.6015708", "0.6011476", "0.60060173", "0.6001903", "0.5985114", "0.5982428", "0.59758884", "0.596991", "0.59520894", "0.5943727", "0.5942227", "0.59391487", "0.5937867", "0.59354097", "0.59338045", "0.59338045", "0.59338045", "0.59338045", "0.59338045", "0.59338045", "0.59338045", "0.59338045", "0.5928327", "0.5924976", "0.59122163", "0.59110624", "0.5906991", "0.5904981", "0.5901651", "0.5901651", "0.5901651", "0.5901651", "0.58958066", "0.5895373", "0.5889601", "0.5888929", "0.5885737", "0.5883261", "0.5880494", "0.5877768" ]
0.0
-1
As in qrcode/libqr/qr.h where QR_EM_AUTO and others are defined
def get_mode(key) case key when "S", "s" then -1 # AUTO when "N", "n" then 0 # NUMERIC when "A", "a" then 1 # ALNUM - British number: 0-9 A-Z SP $% * + - /.: when "8" then 2 # 8BIT when "K", "k" then 3 # KANJI end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrgen\n end", "def qr!\n qr_private(true)\n end", "def create_qrcode\n\n end", "def create_qrcode\n\t\t@qr = RQRCode::QRCode.new( qr_code_params[:text], size: 4)\n\t\tbyebug \n\tend", "def get_default_qr(subscriber = nil)\n if !subscriber.nil? && !subscriber.broker.nil? && !subscriber.broker.firstname.nil?\n broker_name = subscriber.broker.firstname\n else\n broker_name = \"Conseiller\"\n end\n qr = [{\n \"type\": \"flow\",\n \"caption\": \"🏠 5 biens\",\n \"target\": ENV[\"QR_ADS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"🔍 Critères\",\n \"target\": ENV[\"QR_CRITERIA\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"👨‍💼 Mes pros\",\n \"target\": ENV[\"QR_PROS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"❤️ Favoris\",\n \"target\": ENV[\"QR_FAVORITES\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"🔑 Outils\",\n \"target\": ENV[\"QR_TOOLS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"💬 Ding Dong\",\n \"target\": ENV[\"QR_DING_DONG\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"⛔ Stop\",\n \"target\": ENV[\"QR_STOP\"],\n }]\n return qr\n end", "def fetch_qr_code\n self.qr_code = QrCodeFetcher.qr_code(code)\n end", "def qrcode\n \"#{self.short_url}.qrcode\"\n end", "def generateQRCode\n id = params[:id]\n\n #on recherche l'enregistrement correspondant\n query = Qrmodel.find(id)\n query_string = query.to_s\n\n #on commence le processus de rendu du qrcode\n qrcode = RQRCode::QRCode.new(query_string)\n qrmodel.qrcode.attach(\n qrcode.as_png(\n resize_gte_to: false,\n resize_exactly_to: false,\n fill: 'white',\n color: 'black',\n size: 360,\n border_modules: 4,\n module_px_size: 6,\n file: Rails.root.join(\"tmp/#{SecureRandom.hex(2).parameterize}.png\")\n )\n )\n\n end", "def qr_code_png\n data.qr_code_png\n end", "def rqrcode\n RQRCode::QRCode.new(data, :level => level, :size => size)\n end", "def qrcode\n @qr = RQRCode::QRCode.new(\"http://0.0.0.0:3000/visit/#{self.tag}\", :size => 6)\n return @qr\n end", "def customQRcode(inputStr) \n qrcode = RQRCode::QRCode.new(inputStr).as_png(fill: 'white', color: 'black', file: 'abc.png')\n avatar = ChunkyPNG::Image.from_file('abc.png')\n\n # alogo.png being the logo file\n badge = ChunkyPNG::Image.from_file('alogo.png')\n\n print(\"height of backgound:\")\n print(avatar.height)\n print(\"height of logo:\")\n print(badge.height)\n\n #Alpha Blending\n avatar.compose!(badge, avatar.height/2 - badge.height/2, avatar.height/2 - badge.height/2)\n avatar.save('composited.png', :fast_rgba)\nend", "def gPXE; iPXE; end", "def qr(a, mode:\"reduce\")\n qr,tau, = Lapack.call(:geqrf, a)\n *shp,m,n = qr.shape\n r = (m >= n && %w[economic raw].include?(mode)) ?\n qr[false, 0...n, true].triu : qr.triu\n mode = mode.to_s.downcase\n case mode\n when \"r\"\n return r\n when \"raw\"\n return [qr,tau]\n when \"reduce\",\"economic\"\n # skip\n else\n raise ArgumentError, \"invalid mode:#{mode}\"\n end\n if m < n\n q, = Lapack.call(:orgqr, qr[false, 0...m], tau)\n elsif mode == \"economic\"\n q, = Lapack.call(:orgqr, qr, tau)\n else\n qqr = qr.class.zeros(*(shp+[m,m]))\n qqr[false,0...n] = qr\n q, = Lapack.call(:orgqr, qqr, tau)\n end\n return [q,r]\n end", "def set_qr\n @qr = Qr.find(params[:id])\n end", "def qr\n require 'rqrcode'\n str = params[:str] || \"\"\n\n qr = RQRCode::QRCode.new(str)\n\n qr_img_stream = qr.as_png(\n border_modules: 2,\n color: \"24292e\"\n ).to_s\n\n send_data(qr_img_stream, type: 'image/png', disposition: 'inline')\n end", "def qr_data\n @qr_data ||= opts[:questionnaire_response]&.questionnaire_response_data\n end", "def print_my_qrcode\n require 'rqrcode'\n\n qrcode = RQRCode::QRCode.new(\"http://api.paiemequick.com/u/p/#{self.authentication_token}/\")\n\n # NOTE: showing with default options specified explicitly\n svg = qrcode.as_svg(\n offset: 5,\n color: '000',\n shape_rendering: 'crispEdges',\n module_size: 6,\n standalone: true\n )\n\n # save SVG file to folder\n File.open(\"app/assets/images/#{self.phone}\", \"w\") do |line|\n line.puts svg\n end\n end", "def set_hand\n # La forme la plus avancée de génération du QR code\n # \"#{self.authentication_token}@amount@lat@long@context\"\n hand = \"#{self.authentication_token}@0000@0.0@0.0@plateform@#{Time.now}\"\n self.hand = Base64.strict_encode64(hand) #.delete(\"\\n\")\n end", "def phq2?; end", "def initialize(qrcode, options={})\n @points = qrcode.points\n @background = options[:transparent] ? 0 : 1\n \n @height = qrcode.height\n @width = qrcode.width\n\n end", "def render_ansi\n qrcode.as_ansi if valid?\n end", "def barcode(args={})\n self.bare_barcode\n end", "def show\n require 'rqrcode'\n require 'rqrcode_png'\n require 'chunky_png' # to_data_urlはchunky_pngのメソッド\n\n content = 'Hello World'\n size = 3 # 1..40\n level = :h # l, m, q, h\n\n qr = RQRCode::QRCode.new(content, size: size, level: level)\n # png変換->リサイズ->base64エンコード\n @qr_base64 = qr.to_img.resize(200, 200).to_data_url\n end", "def generate_forever_qrcode(scene_id)\n _generate_qrcode(scene_id, 'QR_LIMIT_SCENE')\n end", "def generate_qrcode_matrix(qrstring)\n\n\t\tqrcode_matrix = RQRCode::QRCode.new(qrstring, :level => :h )\n\n\t\tif @config[:debug] # debugging\n\t\t\tdebug_image_name = \"../testdata/qr_code_image_before_modification.png\" \n\t\t\tqr_code_image = self.generate_qr_code_image(qrcode_matrix)\n\t\t\tqr_code_image.write(debug_image_name)\n\t\t\tputs \"Writing debug image: #{debug_image_name}\" \n\t\tend\n\n\t\treturn qrcode_matrix\n\n\tend", "def qr_code\n @patient = Patient.find(params[:id])\n @record_url = vacc_rec_patient_url(@patient)\n @qr = RQRCode::QRCode.new(@record_url, size: 10, level: :h)\n @png = @qr.as_png(\n bit_depth: 1,\n border_modules: 4,\n color_mode: ChunkyPNG::COLOR_GRAYSCALE,\n color: 'black',\n file: nil,\n fill: 'white',\n module_px_size: 6,\n resize_exactly_to: false,\n resize_gte_to: false,\n size: 400\n )\n end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def valid?\n !qrcode.nil?\n end", "def show\n #setup_reporting_fields\n rqrcode\n end", "def qrcode\n\n #integration de la gestion des erreurs 1.0\n # Il est important de noter que chaque transaction de QRCODE generé par le telephone\n # contient une clé unique, cela permet a quelqu'un qui a deja payé cette transaction via\n # ce QRCODE ne le repaye pas par erreur\n # Add new params\n # qr_id \t= params[:qrid]\n # TODO Update and add qrid to qrcode mobile app and add token header key\n\n begin\n\n data = Base64.strict_decode64(params[:data]).split(\"#\")\n\n #recheche du payeur\n payeur_data = data[0]\n\n #information du marchand\n marchand_data = data[1]\n\n #extraction des informations du payeur\n payeur = payeur_data.split(\"@\")\n\n @payeur = Customer.find_by_authentication_token(payeur[0])\n if @payeur.blank?\n puts \"Impossible de trouver ce customer\"\n render json: {\n status: 404,\n flag: :customer_not_found,\n message: \"Impossible de trouver cet utilisateur\"\n }\n else\n Rails::logger::info \"Recherche des informations sur le marchand\"\n marchand = marchand_data.split(\"@\")\n @marchand = Customer.find_by_authentication_token(marchand[0])\n if @marchand.blank?\n render json: {\n status: 404,\n flag: :customer_not_found,\n message: \"Ce marchand est inconnu.\"\n }\n else\n Rails::logger::info \"#{marchand[4]} ++ #{marchand[1]} ++ #{marchand[0]}\"\n render json: {\n message: true,\n context: marchand[4],\n name: @marchand.name,\n second_name: @marchand.second_name,\n amount: marchand[1],\n marchand_id: @marchand.authentication_token, #q.id,\n date: Time.now.strftime(\"%d-%m-%Y à %H:%M:%S\"),\n expire: 5.minutes.from_now #.strftime(\"%T\")\n }\n end\n end\n\n rescue ArgumentError => e\n\n render json: {\n message: false,\n content: \"Impossible de lire ce Qr Code : #{e}\"\n }\n\n\n end\n\n end", "def qseq; @mrna.seq; end", "def show\n @url = \"https://www.karmagrove.com/events/#{@event.id}/tickets/#{@ticket_purchase.ticket.id}/ticket_purchases/#{@ticket_purchase.id}\"\n @qr = RQRCode::QRCode.new( @url, :size => 7, :level => :h )\n end", "def illumina_barcode\n self.barcode_type == :illumina ? self.barcode : \"\"\n end", "def query_def; mrna.definition; end", "def quality_indicator_name\n \"code complexity\"\n end", "def generate()\n @qrcode = @qr_generator.new(@url)\n @png = @qrcode.as_png(\n size: @size,\n border_modules: DEFAULT_BORDER_MODULES\n )\n end", "def show\n @geocach = Geocach.find(params[:id])\n qr_code = \"#{ENV['URL']}#{@geocach.random_code}\"\n @qr = RQRCode::QRCode.new( qr_code.to_s , :size => 10, :level => :h )\n\n \n @qr_code = \"#{ENV['URL']}#{@geocach.random_code}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @geocach }\n format.png { render :qrcode => qr_code, :size => 10, :level => :h }\n format.gif { render :qrcode => qr_code, :size => 10, :level => :h }\n format.jpeg { render :qrcode => qr_code, :size => 10, :level => :h }\n end\n end", "def response?\n qr?\n end", "def render_qr_code(qr_code, **options)\n renderer = Renderer.new(qr_code, **options)\n renderer.render(self)\n end", "def voucher_has_qr_code?\n voucher_has_qr_code\n end", "def generate_qr_code_image(qrcode_matrix)\n\n\t\tsquare_width = @config[:square_size_px]\n\t\tsquare_height = @config[:square_size_px]\n\n\t\timage_width = qrcode_matrix.module_count * square_width\n\t\timage_height = image_width\n\n\t\t# Create a completely transparent image as a starting point\n\t\tqr_code_img = Image.new(image_width,image_height) { self.background_color = \"transparent\" }\n\n\t\t# Loop over every QR code square\n\t\tqrcode_matrix.modules.each_index do |row| \n\t\t\tqrcode_matrix.modules.each_index do |col| \n\n\t\t\t\t# create the black or white square image\n\t\t\t\tif qrcode_matrix.dark?(row,col)\n\t\t\t\t\tbgcolor = self.get_dark_square_color(row,col)\n\t\t\t\telse\n\t\t\t\t\tbgcolor = \"white\"\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\tsquare_img = Image.new(square_width,square_height) { self.background_color = bgcolor }\n\t\t\t\tsquare_img_pixels = square_img.get_pixels(0,0,square_width,square_height)\n\n\t\t\t\t# draw the square into the qr_code_img result\n\t\t\t\ty = row * square_height \n\t\t\t\tx = col * square_width\n\t\t\t\tqr_code_img.store_pixels(x,y,square_width,square_height,square_img_pixels)\n\n\t\t\tend\n\t\tend\n\n\t\tif @config[:debug] # debugging\n\t\t\tdebug_image_name = \"../testdata/qr_code_image_before_overlay.png\" \n\t\t\tqr_code_img.write(debug_image_name)\n\t\t\tputs \"Writing debug image: #{debug_image_name}\" \n\t\tend\n\n\t\treturn qr_code_img\n\n\tend", "def quality_start?\r\n if inn.to_i >= 6 && self.r.to_i < 4\r\n return true\r\n end\r\n return false\r\n end", "def custom_barcode\n self.barcode_type == :custom ? self.barcode : \"\"\n end", "def generate_temporary_qrcode(scene_id)\n _generate_qrcode(scene_id, 'QR_SCENE')\n end", "def kex_byte_requirement; end", "def qrcode_exist?(format)\n qrcode_setup_if_not_exist\n \n qrcode_storage.file_exist?(format)\n end", "def alt; end", "def test055()\n begin\n theCommands = CommandModule::SmigCommands.new\n theSize = MIShapes.make_size(4, 1)\n bitmapObject = theCommands.make_createbitmapcontext(\n size: theSize,\n addtocleanup: true,\n preset: \"AlphaPreMulFirstRGB8bpcInt\")\n fillRect = MIDrawElement.new(:fillrectangle)\n fillRect.rectangle = MIShapes.make_rectangle(size: theSize)\n fillRect.fillcolor = MIColor.make_rgbacolor(1,0,0)\n\n drawCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: fillRect)\n theCommands.add_command(drawCommand)\n pixelDataRect = MIShapes.make_rectangle(xloc: 0, yloc: 0,\n width: 1, height: 1)\n getPixelDataCommand = CommandModule.make_getpixeldata(\n bitmapObject,\n rectangle: pixelDataRect)\n theCommands.add_command(getPixelDataCommand)\n theResult = Smig.perform_commands(theCommands)\n previousResult = '{\"pixeldata\":[[0,0,255,255,0,0]],\"contextinfo\":{\"alphainfo\":16386,\"bitspercomponent\":8,\"colorspace\":\"kCGColorSpaceSRGB\",\"bitsperpixel\":32},\"columnnames\":[\"x\",\"y\",\"Alpha\",\"Red\",\"Green\",\"Blue\"]}'\n if theResult != previousResult\n puts theResult\n raise \"Pixel data has changed.\"\n end\n \n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: #{Smig.exitstring}\"\n end\n puts e.message\n puts e.backtrace.to_s\n puts #{Smig.exitstring}\"\n ensure\n end\nend", "def upc_e\n generate_barcode('barcode.upc_e')\n end", "def initialize(content)\n @qrcode = QRCode.generate_qrcode(content)\n end", "def ismn\n generate_barcode('barcode.ismn')\n end", "def imagemagick7?; end", "def GenQFP(name)\n leftgap = rightgap = 0\n pins = GetCnt('pins')\n if pins < 2 then print \"GenQFP(#{name}): We need at least two pins!\\n\" end\n width = GetDim('width')\n rows = GetCnt('rows')\n if rows <= 0 then rows = pins / 4 end\n cols = [(pins - 2 * rows + 1) / 2, 0].max # pins at bottom, at top may be one less\n quad = pins > 2 * rows\n if (rows > 1) or (cols > 1)\n pitch = GetDim('pitch')\n if pitch < 1000 # 10 mil\n print \"GenQFP(#{name}): pitch is too small!\\n\"\n end\n else\n pitch = 0\n end\n padthickness = GetDim('padthickness')\n padlength = GetDim('padlength')\n cpw = GetDim('centerpadwidth') / 2.0\n cph = GetDim('centerpadheight') / 2.0\n if (cpw < MinSilkWidth) or (cph < MinSilkWidth) then cpw = cph = 0 end\n clearance = GetDim('clearance')\n if quad\n height = GetDim('height')\n if width < MinSilkWidth then width = height end\n if height < MinSilkWidth then height = width end\n if width < 1000 # 10 mil\n print \"GenQFP(#{name}): Width or height is too small!\\n\"\n end\n else\n height = 0\n end\n if [width, padthickness, padlength].min < 1000 # 10 mil\n print \"GenQFP(#{name}): Width, padthickness or padlength too small!\\n\"\n end\n silkwidth = GetDim('silkwidth')\n silkoffset = GetDim('silkoffset')\n ovalpads = %w[1 yes oval ovalpads true].include?(AskStr('ovalpads'))\n silkbox = GetStr('silkbox')\n unless %w[outer inner custom].include?(silkbox); silkbox = 'none' end\n p1silkmark = AskStr('p1silkmark') # we can draw: circle, damage or slash\n if %w[1 yes mark p1mark silkmark p1silkmark true].include?(p1silkmark)\n p1silkmark = 'slash'\n end\n p1coppermark = %w[1 yes true mark p1mark coppermark p1coppermark].include?(AskStr('p1coppermark'))\n x = -width / 2.0 # y is center of topmost pad\n if quad then y = -height / 2.0 else y = -(pitch / 2.0) * (rows - 1) end\n boxoffset = silkoffset + (silkwidth + padlength) / 2.0\n if silkbox == 'outer' \n bx = x - boxoffset\n by = y - boxoffset\n elsif silkbox == 'inner'\n bx = x + boxoffset\n if quad then\n by = y + boxoffset\n else\n if cph > 0\n by = -cph - silkoffset - silkwidth / 2.0\n else\n by = y\n end\n end \n elsif silkbox == 'custom'\n bx = -GetDim('silkboxwidth') / 2.0\n by = -GetDim('silkboxheight') / 2.0\n if quad\n if bx + boxoffset < x and by + boxoffset < y\n silkbox = 'outer'\n elsif bx - boxoffset > x and by - boxoffset > y\n silkbox = 'inner'\n else\n silkbox = 'none'\n end\n else\n if bx - boxoffset > x\n silkbox = 'inner'\n elsif by + boxoffset < y\n silkbox = 'outer'\n if bx + boxoffset > x\n leftgap = 2 * (y.abs + silkoffset) + padthickness + silkwidth\n dy = (pitch / 2.0) * (pins - rows - 1)\n rightgap = 2 * (dy + silkoffset) + padthickness + silkwidth\n if p1silkmark == 'damage'\n p1silkmark = 'slash'\n end\n end\n else\n silkbox = 'none'\n end\n end\n if silkbox == 'none'\n print \"GenQFP(#{name}): Custom silkbox touches pads -- not drawn!\\n\"\n end\n else\n bx = by = 0\n end\n if (-bx < MinSilkWidth) or (-by < MinSilkWidth)\n silkbox = 'none'; bx = by = 0\n end\n if (x + padlength / 2.0 + clearance > -cpw) or\n (quad and (y + padlength / 2.0 + clearance > -cph))\n print \"GenQFP(#{name}): Centerpad touches pads!\\n\"\n Process.exit\n end\n if (silkbox != 'none') and (cpw > 0)\n if (bx + silkoffset + silkwidth / 2.0 > -cpw + 1) or (by + silkoffset + silkwidth / 2.0 > -cph + 1) # eps 0.01mil\n print \"GenQFP(#{name}): Silkbox overlaps Center Pad!\\n\"\n end\n end\n tx = [x, bx].min\n if quad then dy = padlength else dy = padthickness end\n ty = [y - dy / 2.0, by - silkwidth / 2.0].min - (PCB_DefaultTextSize + RefdesToSilkOffset) * GetCnt('refdessize')\n r = GenElementHeader(tx, ty, 0) + \"(\\n\"\n if ovalpads\n padflags = p1flags = ''\n if p1coppermark\n p1flags = 'square'\n end\n else\n padflags = p1flags = 'square'\n if p1coppermark\n p1flags = ''\n end\n end\n x, y, dx, dy, xext, yext = 0 # make these values global to do-loop\n (1..pins).each do |n|\n if n == 1\n x = -width / 2.0\n y = -(pitch / 2.0) * (rows - 1)\n dx = 0\n dy = pitch\n xext = padlength / 2.0\n yext = padthickness / 2.0\n end\n if n == rows + 1\n x = -(pitch / 2.0) * (cols - 1)\n y = height / 2.0\n dx = pitch\n dy = 0\n xext = padthickness / 2.0\n yext = padlength / 2.0\n end\n if n == (rows + cols) + 1\n x = width / 2.0\n if quad then y = rows else y = pins - rows end \n y = (pitch / 2.0) * (y - 1)\n dx = 0\n dy = -pitch\n xext = padlength / 2.0\n yext = padthickness / 2.0\n end \n if n == (2 * rows + cols) + 1\n x = (pitch / 2.0) * (pins - 2 * rows - cols - 1)\n y = - height / 2.0\n dx = -pitch\n dy = 0\n xext = padthickness / 2.0\n yext = padlength / 2.0\n end\n r += GenPad(x - xext, y - yext, x + xext, y + yext, n, n, p1flags)\n p1flags = padflags\n x += dx\n y += dy\n end\n if cpw > 0\n r += GenPad(-cpw, -cph, cpw, cph, pins + 1, pins + 1, 'square')\n end\n unless silkbox == 'none'\n if leftgap > 0\n r += GenGapBox(bx, by, -bx, -by, leftgap, rightgap)\n elsif p1silkmark == 'damage'\n r += GenDamagedBox(bx, by, -bx, -by)\n else\n r += GenSilkBox(bx, by, -bx, -by)\n end\n if p1silkmark == 'circle'\n dx = -(bx + by) / 20.0\n if silkbox == 'inner'\n dy = 2 * dx + silkwidth # offset of circle to upper left corner\n else\n dy = -dx - silkwidth\n end \n r += GenSilkArc(bx + dy, by + dy, dx, dx, 0, 360)\n elsif p1silkmark == 'slash'\n r += GenSilkLine(bx + 0.05 * (bx + by), by + 0.05 * (bx + by), bx, by)\n end\n end\n r += GenAttributes() + \")\\n\"\n WriteElementToFile(r, name)\nend", "def gastriloquism_quinnipiac_apodictical()\n end", "def define; end", "def barcode_string\n b_string = self.custom_barcode\n if b_string.empty?\n b_string = self.illumina_barcode_string\n end\n b_string\n end", "def fetch_qr\n qrcode = RQRCode::QRCode.new(current_user.provisioning_uri, size: 10, level: :h )\n png = qrcode.as_png(bit_depth: 1, border_modules: 4, color_mode: ChunkyPNG::COLOR_GRAYSCALE, color: 'black', file: nil, fill: 'white', module_px_size: 6, resize_exactly_to: false, resize_gte_to: false)\n user_id = current_user.id\n image_path = Rails.root.join(\"public/#{user_id}.png\")\n File.open(image_path, 'wb'){|image_file| image_file.write png }\n image = Cloudinary::Uploader.upload(image_path)\n File.delete(\"./public/#{user_id}.png\")\n qrcode = image.as_json(only: [\"public_id\", \"url\"])\n render json: {status: 200, message: \"QR fetched\", qr: qrcode}\n end", "def show\n @qrcode = Qrcode.find(params[:id])\n params[:quest_id]\n if @qrcode.imgloc == nil\n @qrcode.imgloc = request.protocol+request.host_with_port+request.fullpath+\".png\"\n @qrcode.save\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qrcode }\n format.png { render :qrcode => @qrcode.ref }\n end\n end", "def gen_qr_code data\r\n begin\r\n # Form query\r\n query = \"#{URL}#{QUERY}#{data}\"\r\n # Write file to output path\r\n File.open(QR_OUTPUT_PATH, \"wb\") do |file| \r\n file.write HTTParty.get(URI.escape query).parsed_response\r\n end\r\n # Update UI\r\n @qr_img_label.set_pixmap(Qt::Pixmap.new(QR_OUTPUT_PATH))\r\n @qr_data_label.set_text(data)\r\n rescue => e\r\n puts e.inspect\r\n title = \"QR Error\"\r\n error = \"Error: \\\"#{data}\\\" could not be rendered as QR Code!\"\r\n build_message_box(title, error)\r\n end\r\n end", "def all_inline?; end", "def inline?; false; end", "def inline?; false; end", "def king_richard_iii_quote; end", "def initialize( q, r, color: nil, border: false, data: nil )\n @q = q\n @r = r\n super( color, border, data )\n end", "def initialize( q, r, color: nil, border: false, data: nil )\n @q = q\n @r = r\n super( color, border, data )\n end", "def detect_radio()\n ret=get_cmd('OM;',0.1,1.0,5)\n if(ret)\n if(ret.include?('A'))\n $kx_atu=true\n end\n if(ret.include?('P'))\n $kx_pa=true\n end\n if(ret.include?('F'))\n $kx_filter=true\n end\n if(ret.include?('T'))\n $kx_extatu=true\n end\n if(ret.include?('B'))\n $kx_charger=true\n end\n if(ret.include?('X'))\n $kx_transverter=true\n end\n if(ret.include?('I'))\n $kx_rtcio=true\n end\n if(ret=~/01;$/)\n $kx_model=2\n end\n if(ret=~/02;$/)\n $kx_model=3\n end\n return(true)\n else\n return(nil)\n end\nend", "def show\n @qr_code = QrCode.find(params[:id]) if params[:id].present?\n @qr_code = QrCode.where(:hash_code=>params[:hash_code]).first if params[:hash_code].present?\n @engagement=@qr_code.try(:engagement)\n @engagement_type=@engagement.try(:engagement_type)\n @brand=@engagement.try(:campaign).try(:program).try(:business).try(:brand)\n respond_to do |format|\n format.pdf do\n render :pdf => \"qrcode\"\n end\n format.html {render :layout=>false}# show.html.erb\n format.xml { render :xml => @qr_code }\n end\n end", "def create\n @qr = Qr.new(qr_params)\n\n respond_to do |format|\n if @qr.save\n format.html { redirect_to @qr, notice: 'Qr was successfully created.' }\n format.json { render :show, status: :created, location: @qr }\n else\n format.html { render :new }\n format.json { render json: @qr.errors, status: :unprocessable_entity }\n end\n end\n end", "def paper_white_area() barcode_bit_area -1 end", "def band; end", "def band; end", "def rn_custom; @rn_custom; end", "def qr_responses\n hashed_qr[appt_id]\n end", "def barcode(reverse_complement: true)\n sequence =~ /#{index1_5prime}(.+)#{ipd_primer_3prime}/i\n bc = Regexp.last_match(1)\n bc = IlluminaAdapterSequence.complement(bc).reverse if bc.present? && reverse_complement\n bc\n end", "def qe_modifiers\n end", "def custom; end", "def custom; end", "def test_missing_qmark\n\texpect_error('<?xml version=\"1.0\">', /missing '?'/, 1)\n end", "def test_missing_qmark\n\texpect_error('<?xml version=\"1.0\">', /missing '?'/, 1)\n end", "def card_detection\n end", "def wechat_qrcode_url\n cache_key = \"wechat:qrcode:channel:#{id}\"\n if company.wechat_app && company.wechat_app.state.enabled?\n Rails.cache.fetch(cache_key) do\n scene = Wechat::Reducer.scan_scene(Wechat::Reducer::CHANNEL_SCAN, id)\n Wechat::Mp::Qrcode.generate(company.wechat_app.app_id, scene)\n end\n end\n rescue Wechat::Error::Unauthenticated\n nil\n end", "def generate_qrcode_bak(page)\n url = get_site_url(page)\n return if url.blank?\n qr = RQRCode::QRCode.new( url, :size => 6, :level => :h )\n png = qr.to_img # returns an instance of ChunkyPNG\n\n qr_dir = File.join(Rails.root, 'public', 'qrcode')\n FileUtils.mkdir_p qr_dir\n png_path = File.join(qr_dir, \"#{page.id}.png\")\n if File.exist? png_path\n #FileUtils.rm png_path\n else\n png.resize(120, 120).save(png_path)\n end \n end", "def generate(qrstring, logo_image)\n\n\t\t# get the QRCode matrix object from rQrCode\n\t\tqrcode_matrix = self.generate_qrcode_matrix(qrstring)\n\n\t\t# Create a completely transparent image with dimensions of target image\t\t\n\t\timage_width = self.image_width_pixels(qrcode_matrix.module_count) \n\t\ttransparent_img = Image.new(image_width,image_width) { self.background_color = \"transparent\" }\n\n\t\t# Center the logo in the transparent image created above\n\t\tqr_logo_raw_overlay_img = transparent_img.composite(logo_image, CenterGravity, OverCompositeOp)\n\n\t\t# Modify the qr code squares and whiten all squares which are overlapped by non-transparent areas of logo\n\t\tself.whiten_overlapped_squares(qrcode_matrix.modules, qr_logo_raw_overlay_img)\n\n\t\t# Generate the qr code image based on modified modules matrix\n\t\tqr_code_image = self.generate_qr_code_image(qrcode_matrix)\n\n\t\t# Composite with the logo overlay\n\t\tqr_code_image_plus_logo = qr_code_image.composite(qr_logo_raw_overlay_img, CenterGravity, OverCompositeOp)\n\n\t\t# Wrap in larger image to provide 1-square white margin\n\t\timage_width = ((qrcode_matrix.module_count + 2) * @config[:square_size_px])\n\t\ttransparent_img_margin = Image.new(image_width,image_width) { self.background_color = \"white\" }\n\t\tqr_code_logo_plus_margin = transparent_img_margin.composite(qr_code_image_plus_logo, CenterGravity, OverCompositeOp)\n\n\t\treturn qr_code_logo_plus_margin\n\t\n\tend", "def include_morsel?; true end", "def mozart; end", "def query_def; @seq1.definition; end", "def qr_params\n params.require(:qr).permit(:name, :path)\n end", "def is_mag?(); @type == GRT_MAG; end", "def inspect\n \"QRCodeCore: @data='#{@data}', @error_correct_level=#{@error_correct_level}, @version=#{@version}, @module_count=#{@module_count}\"\n end", "def marvin_quote; end", "def find_abstract_definition(style); end", "def query_def; @hit.mrna.definition; end", "def rrca\n end", "def metadata\n {\n :name => \"QRCode Raplet\",\n :description => \"Shows a QRCode under phone numbers in the HUD\",\n :welcome_text => %q{\n <p>In order to see this raplet in action, connect your Google Contacts\n to Rapportive and then click on a phone number.</p>\n <p>You'll then be able to take a photo of the QRCode instead of having\n to type the number into your phone.</p>\n },\n :provider_name => \"Conrad Irwin\",\n :provider_url => \"http://github.com/ConradIrwin/qrcode-raplet\",\n :type => 'telephony'\n }\n end", "def snippet_for_qd\n \"[QD#${1|#{list_qr_et_id(:qd).join(',')}|}]formate_qrd$0\"\n end", "def barcode_string\n return if not_registered\n @mim.barcode_bits.map do |b|\n b ? '1' : '0'\n end.join.reverse\n end", "def mode\n case @data_list\n when QRNumeric\n :mode_number\n when QRAlphanumeric\n :mode_alpha_numk\n else\n :mode_8bit_byte\n end\n end", "def intend_qrcode\n data = params[:customer_token]\n customer = Customer.find_by_authentication_token(data)\n\n #on imprime le qrcode\n customer.print_qrcode\n\n #on recupere le chemin du qrcode\n @path = customer.qrcode_path\n rescue => e\n render json:{\n message: \"Impossible de trouver cet utilisateur : #{e}\"\n }\n end" ]
[ "0.6680593", "0.6369212", "0.58728963", "0.5768988", "0.57662284", "0.55521315", "0.5543688", "0.55016404", "0.5436499", "0.5425199", "0.5403892", "0.5366494", "0.52558714", "0.5225098", "0.5211215", "0.51976705", "0.5127769", "0.5107308", "0.5097794", "0.50818354", "0.50578094", "0.50405467", "0.50184506", "0.49637675", "0.49449435", "0.49442008", "0.4922531", "0.49134436", "0.49134436", "0.49134436", "0.4896309", "0.4881189", "0.48741546", "0.48563063", "0.48523948", "0.48498803", "0.483378", "0.48258638", "0.48255447", "0.48142186", "0.48130852", "0.47843403", "0.4776882", "0.47765124", "0.4773444", "0.4767217", "0.47571865", "0.47561067", "0.47519445", "0.47518888", "0.4744424", "0.47314766", "0.47291124", "0.47283286", "0.47267538", "0.47233588", "0.4722238", "0.4708624", "0.4701331", "0.46983033", "0.46949312", "0.46854424", "0.46837646", "0.4675841", "0.4675841", "0.46745917", "0.46682796", "0.46682796", "0.4655191", "0.46536082", "0.46405306", "0.4636988", "0.46347225", "0.46347225", "0.46315747", "0.46231312", "0.46201155", "0.46073323", "0.46054456", "0.46054456", "0.45970634", "0.45970634", "0.45863914", "0.45683858", "0.4565067", "0.45624685", "0.4558453", "0.45549813", "0.45476037", "0.45450294", "0.45427784", "0.45386857", "0.45317852", "0.45209742", "0.4517184", "0.4513642", "0.451115", "0.45062074", "0.4499901", "0.44981915", "0.44933924" ]
0.0
-1
As in qrcode/libqr/qr.h where QR_ECL_L and others are defined
def get_level(key) case key when "L", "l" then 0 # Level L when "M", "m" then 1 # Level M when "Q", "q" then 2 # Level Q when "H", "h" then 3 # Level H end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qr!\n qr_private(true)\n end", "def qrgen\n end", "def error_correction_level\n QRERRORCORRECTLEVEL.invert[@error_correct_level]\n end", "def qr(a, mode:\"reduce\")\n qr,tau, = Lapack.call(:geqrf, a)\n *shp,m,n = qr.shape\n r = (m >= n && %w[economic raw].include?(mode)) ?\n qr[false, 0...n, true].triu : qr.triu\n mode = mode.to_s.downcase\n case mode\n when \"r\"\n return r\n when \"raw\"\n return [qr,tau]\n when \"reduce\",\"economic\"\n # skip\n else\n raise ArgumentError, \"invalid mode:#{mode}\"\n end\n if m < n\n q, = Lapack.call(:orgqr, qr[false, 0...m], tau)\n elsif mode == \"economic\"\n q, = Lapack.call(:orgqr, qr, tau)\n else\n qqr = qr.class.zeros(*(shp+[m,m]))\n qqr[false,0...n] = qr\n q, = Lapack.call(:orgqr, qqr, tau)\n end\n return [q,r]\n end", "def rqrcode\n RQRCode::QRCode.new(data, :level => level, :size => size)\n end", "def inspect\n \"QRCodeCore: @data='#{@data}', @error_correct_level=#{@error_correct_level}, @version=#{@version}, @module_count=#{@module_count}\"\n end", "def create_qrcode\n\t\t@qr = RQRCode::QRCode.new( qr_code_params[:text], size: 4)\n\t\tbyebug \n\tend", "def rhl\n return ((hex_side_length - 0.15) * Math.cos(Math::PI / 6)) \n end", "def fetch_qr_code\n self.qr_code = QrCodeFetcher.qr_code(code)\n end", "def ld_hl_sp_plusr8\n end", "def quality_indicator_name\n \"code complexity\"\n end", "def gPXE; iPXE; end", "def cget( q, r )\n hget( even_q_to_axial_hex( q, r ) )\n end", "def rrca\n end", "def qr_code_png\n data.qr_code_png\n end", "def initialize(qrcode, options={})\n @points = qrcode.points\n @background = options[:transparent] ? 0 : 1\n \n @height = qrcode.height\n @width = qrcode.width\n\n end", "def create_qrcode\n\n end", "def sbc_a_hl\n end", "def sbc_a_l\n end", "def rlca\n end", "def e48?\n return false if @code.size == 4\n num = [\n Resistor::ColorCode::DIGIT[@code[0]],\n Resistor::ColorCode::DIGIT[@code[1]],\n Resistor::ColorCode::DIGIT[@code[2]],\n ].join.to_i\n Resistor::ColorCode::E48_SERIES.any?{|n| n == num }\n end", "def crc; end", "def crc; end", "def crc; end", "def lsi; end", "def voucher_has_qr_code?\n voucher_has_qr_code\n end", "def customQRcode(inputStr) \n qrcode = RQRCode::QRCode.new(inputStr).as_png(fill: 'white', color: 'black', file: 'abc.png')\n avatar = ChunkyPNG::Image.from_file('abc.png')\n\n # alogo.png being the logo file\n badge = ChunkyPNG::Image.from_file('alogo.png')\n\n print(\"height of backgound:\")\n print(avatar.height)\n print(\"height of logo:\")\n print(badge.height)\n\n #Alpha Blending\n avatar.compose!(badge, avatar.height/2 - badge.height/2, avatar.height/2 - badge.height/2)\n avatar.save('composited.png', :fast_rgba)\nend", "def initialize( q, r, color: nil, border: false, data: nil )\n @q = q\n @r = r\n super( color, border, data )\n end", "def initialize( q, r, color: nil, border: false, data: nil )\n @q = q\n @r = r\n super( color, border, data )\n end", "def qrcode\n @qr = RQRCode::QRCode.new(\"http://0.0.0.0:3000/visit/#{self.tag}\", :size => 6)\n return @qr\n end", "def cp_l\n end", "def LCR\n attr_reader :value\n def initialize(?) # Indique los argumentos\n# Su c ́odigo aqu ́ı end\n def each(p)\n# Su c ́odigo aqu ́ı\n end\n def solve\n# Su c ́odigo aqu ́ı\n end\n end\n\n ##################################################### L C R\n\n end", "def get_lattice_constants\n return CrystalCell::LatticeAxes.axes_to_lc(@axes)\n end", "def e96?\n return false if @code.size == 4\n num = [\n Resistor::ColorCode::DIGIT[@code[0]],\n Resistor::ColorCode::DIGIT[@code[1]],\n Resistor::ColorCode::DIGIT[@code[2]],\n ].join.to_i\n Resistor::ColorCode::E96_SERIES.any?{|n| n == num }\n end", "def add_hl_bc\n end", "def cp_hl\n end", "def elv_armulys\n ((@code & 0xFFFF) % 10) <= 4\n end", "def king_richard_iii_quote; end", "def kex_byte_requirement; end", "def get_default_qr(subscriber = nil)\n if !subscriber.nil? && !subscriber.broker.nil? && !subscriber.broker.firstname.nil?\n broker_name = subscriber.broker.firstname\n else\n broker_name = \"Conseiller\"\n end\n qr = [{\n \"type\": \"flow\",\n \"caption\": \"🏠 5 biens\",\n \"target\": ENV[\"QR_ADS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"🔍 Critères\",\n \"target\": ENV[\"QR_CRITERIA\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"👨‍💼 Mes pros\",\n \"target\": ENV[\"QR_PROS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"❤️ Favoris\",\n \"target\": ENV[\"QR_FAVORITES\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"🔑 Outils\",\n \"target\": ENV[\"QR_TOOLS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"💬 Ding Dong\",\n \"target\": ENV[\"QR_DING_DONG\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"⛔ Stop\",\n \"target\": ENV[\"QR_STOP\"],\n }]\n return qr\n end", "def generate_qrcode_matrix(qrstring)\n\n\t\tqrcode_matrix = RQRCode::QRCode.new(qrstring, :level => :h )\n\n\t\tif @config[:debug] # debugging\n\t\t\tdebug_image_name = \"../testdata/qr_code_image_before_modification.png\" \n\t\t\tqr_code_image = self.generate_qr_code_image(qrcode_matrix)\n\t\t\tqr_code_image.write(debug_image_name)\n\t\t\tputs \"Writing debug image: #{debug_image_name}\" \n\t\tend\n\n\t\treturn qrcode_matrix\n\n\tend", "def gl(z=nil, &custom_gl_code); end", "def mode\n case @data_list\n when QRNumeric\n :mode_number\n when QRAlphanumeric\n :mode_alpha_numk\n else\n :mode_8bit_byte\n end\n end", "def cset( q, r, color: nil, border: false, data: nil )\n hset( even_q_to_axial_hex( q, r, color: color, border: border, data: data ) )\n end", "def qrcode\n \"#{self.short_url}.qrcode\"\n end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def cget( q, r )\n @hexes[ [ q, r ] ]\n end", "def cset( q, r, color: nil, border: false, data: nil )\n @hexes[ [ q, r ] ] = AxialHex.new( q, r, color: color, border: border, data: data )\n end", "def included_constants; end", "def show\n require 'rqrcode'\n require 'rqrcode_png'\n require 'chunky_png' # to_data_urlはchunky_pngのメソッド\n\n content = 'Hello World'\n size = 3 # 1..40\n level = :h # l, m, q, h\n\n qr = RQRCode::QRCode.new(content, size: size, level: level)\n # png変換->リサイズ->base64エンコード\n @qr_base64 = qr.to_img.resize(200, 200).to_data_url\n end", "def icc_2_1_ci_mcgraw(alpha=0.05)\n fd,fu=icc_2_1_fs(icc_2_1,alpha)\n cl=(n*(msr-fd*mse)).quo(fd*(k*msc+(k*n-k-n)*mse)+n*msr)\n cu=(n*(fu*msr-mse)).quo(k*msc+(k*n-k-n)*mse+n*fu*msr)\n [cl,cu]\n end", "def qe_modifiers\n end", "def snippet_for_qd\n \"[QD#${1|#{list_qr_et_id(:qd).join(',')}|}]formate_qrd$0\"\n end", "def constantsHack\n CV_RGB2GRAY\n CV_RGB2XYZ\n CV_RGB2YCrCb\n CV_RGB2HSV\n CV_RGB2HLS\n CV_RGB2Lab\n CV_RGB2Luv\n\n CV_THRESH_BINARY\n CV_THRESH_BINARY_INV\n CV_ADAPTIVE_THRESH_MEAN_C\n CV_ADAPTIVE_THRESH_GAUSSIAN_C\n\n MCV_BORDER_REPLICATE\n MCV_BORDER_REFLECT\n MCV_BORDER_WRAP\n MCV_BORDER_REFLECT_101\n MCV_BORDER_DEFAULT\n MCV_BORDER_TRANSPARENT\n MCV_BORDER_ISOLATED\n\n CV_RETR_EXTERNAL\n CV_RETR_LIST\n CV_RETR_CCOMP\n CV_RETR_TREE\n\n CV_CHAIN_APPROX_NONE\n CV_CHAIN_APPROX_SIMPLE\n CV_CHAIN_APPROX_TC89_L1\n CV_CHAIN_APPROX_TC89_KCOS\n end", "def phq2?; end", "def blg; end", "def test_ln\n assert_raises(Calc::MathError) { Calc::Q(0).ln }\n assert_rational_and_equal 0, Calc::Q(1).ln\n assert_rational_in_epsilon Math.log(2), Calc::Q(2).ln\n assert_complex_parts [0, 3.14159265358979323846], Calc::Q(-1).ln\n assert_complex_parts [0.69314718055994530942, 3.14159265358979323846], Calc::Q(-2).ln\n end", "def generateQRCode\n id = params[:id]\n\n #on recherche l'enregistrement correspondant\n query = Qrmodel.find(id)\n query_string = query.to_s\n\n #on commence le processus de rendu du qrcode\n qrcode = RQRCode::QRCode.new(query_string)\n qrmodel.qrcode.attach(\n qrcode.as_png(\n resize_gte_to: false,\n resize_exactly_to: false,\n fill: 'white',\n color: 'black',\n size: 360,\n border_modules: 4,\n module_px_size: 6,\n file: Rails.root.join(\"tmp/#{SecureRandom.hex(2).parameterize}.png\")\n )\n )\n\n end", "def gp_flags; end", "def r; end", "def r; end", "def quantum_number\n @l + @m + @n\n end", "def qr\n require 'rqrcode'\n str = params[:str] || \"\"\n\n qr = RQRCode::QRCode.new(str)\n\n qr_img_stream = qr.as_png(\n border_modules: 2,\n color: \"24292e\"\n ).to_s\n\n send_data(qr_img_stream, type: 'image/png', disposition: 'inline')\n end", "def rla\n end", "def initialize(q, r, l, total_no_of_bits)\r\n @q = q\r\n @r = r\r\n @l = l\r\n @total_no_of_bits = total_no_of_bits\r\n initial_sequence = generate_initial_bit_sequence()\r\n @total_sequence = generate_total_bit_sequence(initial_sequence)\r\n end", "def render_qr_code(qr_code, **options)\n renderer = Renderer.new(qr_code, **options)\n renderer.render(self)\n end", "def get_two_factor_secret_qr_code(size = 9, level = :h)\n secret = self.two_factor_secret\n if secret\n totp = ROTP::TOTP.new(secret)\n raw_string = totp.provisioning_uri(\"RailsApp #{self.email}\")\n # at the default size of 9, we can accomodate ~ 100 8 bit characters\n return nil if raw_string.length >= 100\n RQRCode::QRCode.new(raw_string, :size => size, :level => level)\n end\n end", "def show\n @url = \"https://www.karmagrove.com/events/#{@event.id}/tickets/#{@ticket_purchase.ticket.id}/ticket_purchases/#{@ticket_purchase.id}\"\n @qr = RQRCode::QRCode.new( @url, :size => 7, :level => :h )\n end", "def resolveEZCLAP;\r\n raise \"METHOD HAS NOT BEEN IMPLEMENTED.\";\r\n end", "def hsla_color; end", "def gen_qr_code data\r\n begin\r\n # Form query\r\n query = \"#{URL}#{QUERY}#{data}\"\r\n # Write file to output path\r\n File.open(QR_OUTPUT_PATH, \"wb\") do |file| \r\n file.write HTTParty.get(URI.escape query).parsed_response\r\n end\r\n # Update UI\r\n @qr_img_label.set_pixmap(Qt::Pixmap.new(QR_OUTPUT_PATH))\r\n @qr_data_label.set_text(data)\r\n rescue => e\r\n puts e.inspect\r\n title = \"QR Error\"\r\n error = \"Error: \\\"#{data}\\\" could not be rendered as QR Code!\"\r\n build_message_box(title, error)\r\n end\r\n end", "def cp_e\n end", "def lq_rx_segments(code)\n lq_rx_segments = []\n lq_rx_segments << 'LQ'\n lq_rx_segments << 'RX'\n lq_rx_segments << (code.blank? ? '' : code.strip)\n Output835.trim_segment(lq_rx_segments)\n lq_rx_segments.join(@element_seperator)\n end", "def auxiliary_colour\n @cr[0xe] >> 4\n end", "def cl\n field_fetch('CL')\n end", "def cops; end", "def cops; end", "def cops; end", "def valid?\n !qrcode.nil?\n end", "def too_complex; end", "def pre_rvtest\n RVTEST_RV64U()\n RVTEST_CODE_BEGIN()\n end", "def constants() end", "def rcc(c_cintura,c_cadera)\n\t\t@rcc = (c_cintura/c_cadera)\t\n\tend", "def question3 # Return the constant you defined above\n\n end", "def gecos(*) end", "def parse_inline_math; end", "def adc_a_l\n end", "def iqr(data)\n return q3(data) - q1(data)\n end", "def and_hl\n end", "def rh_factor; end", "def user_os_complex\r\n end", "def generate_qr_code_image(qrcode_matrix)\n\n\t\tsquare_width = @config[:square_size_px]\n\t\tsquare_height = @config[:square_size_px]\n\n\t\timage_width = qrcode_matrix.module_count * square_width\n\t\timage_height = image_width\n\n\t\t# Create a completely transparent image as a starting point\n\t\tqr_code_img = Image.new(image_width,image_height) { self.background_color = \"transparent\" }\n\n\t\t# Loop over every QR code square\n\t\tqrcode_matrix.modules.each_index do |row| \n\t\t\tqrcode_matrix.modules.each_index do |col| \n\n\t\t\t\t# create the black or white square image\n\t\t\t\tif qrcode_matrix.dark?(row,col)\n\t\t\t\t\tbgcolor = self.get_dark_square_color(row,col)\n\t\t\t\telse\n\t\t\t\t\tbgcolor = \"white\"\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\tsquare_img = Image.new(square_width,square_height) { self.background_color = bgcolor }\n\t\t\t\tsquare_img_pixels = square_img.get_pixels(0,0,square_width,square_height)\n\n\t\t\t\t# draw the square into the qr_code_img result\n\t\t\t\ty = row * square_height \n\t\t\t\tx = col * square_width\n\t\t\t\tqr_code_img.store_pixels(x,y,square_width,square_height,square_img_pixels)\n\n\t\t\tend\n\t\tend\n\n\t\tif @config[:debug] # debugging\n\t\t\tdebug_image_name = \"../testdata/qr_code_image_before_overlay.png\" \n\t\t\tqr_code_img.write(debug_image_name)\n\t\t\tputs \"Writing debug image: #{debug_image_name}\" \n\t\tend\n\n\t\treturn qr_code_img\n\n\tend", "def getc() end", "def getc() end", "def getc() end", "def error_class_constant(error_code); end", "def king_richard_iii; end", "def quality_start?\r\n if inn.to_i >= 6 && self.r.to_i < 4\r\n return true\r\n end\r\n return false\r\n end", "def find_direction(r_o, c_o, r_q, c_q)\n (Complex(c_o - c_q, r_o - r_q).phase / Math::PI * 4).round\nend" ]
[ "0.58929676", "0.56917536", "0.53126216", "0.5306257", "0.52803236", "0.50964993", "0.50866884", "0.5058369", "0.5021435", "0.50183284", "0.5000242", "0.49983957", "0.4944906", "0.4912101", "0.490266", "0.48873538", "0.48785958", "0.48675796", "0.486138", "0.4852858", "0.48475406", "0.48252928", "0.48252928", "0.48252928", "0.48141292", "0.47998703", "0.47994304", "0.47927958", "0.47927958", "0.47912353", "0.47911635", "0.47642514", "0.47349492", "0.47324207", "0.47244212", "0.47220537", "0.47205716", "0.4716608", "0.47113097", "0.47083333", "0.4695511", "0.4686367", "0.46593675", "0.46227777", "0.46041593", "0.45827886", "0.45827886", "0.45827886", "0.45742658", "0.45546672", "0.45529464", "0.4551617", "0.45501533", "0.45484254", "0.45459002", "0.4539728", "0.4531508", "0.45283264", "0.4528001", "0.45061427", "0.45029387", "0.44910413", "0.44910413", "0.44909778", "0.4483199", "0.44806758", "0.4478883", "0.44711", "0.44647744", "0.4437113", "0.44269463", "0.44259", "0.44250855", "0.44248554", "0.44237405", "0.44234142", "0.44228384", "0.44221953", "0.44221953", "0.44221953", "0.44218612", "0.4421449", "0.44177067", "0.44141898", "0.44138393", "0.44108632", "0.44077876", "0.4407089", "0.44045362", "0.4402684", "0.4401138", "0.43915084", "0.4389276", "0.4387343", "0.43866953", "0.43866953", "0.43866953", "0.43852177", "0.4380573", "0.43766683", "0.43751976" ]
0.0
-1
As in qrcode/libqr/qr.h where QR_FMT_PNG and others are defined
def get_fmt(key) case key when "PNG" , "png" then 0 when "BMP" , "bmp" then 1 when "TIFF" , "tiff" then 2 when "PBM" , "pbm" then 3 when "SVG" , "svg" then 4 when "JSON" , "json" then 5 when "DIGIT", "digit" then 6 when "ASCII", "ascii" then 7 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qr_code_png\n data.qr_code_png\n end", "def qr\n require 'rqrcode'\n str = params[:str] || \"\"\n\n qr = RQRCode::QRCode.new(str)\n\n qr_img_stream = qr.as_png(\n border_modules: 2,\n color: \"24292e\"\n ).to_s\n\n send_data(qr_img_stream, type: 'image/png', disposition: 'inline')\n end", "def qr_code\n @patient = Patient.find(params[:id])\n @record_url = vacc_rec_patient_url(@patient)\n @qr = RQRCode::QRCode.new(@record_url, size: 10, level: :h)\n @png = @qr.as_png(\n bit_depth: 1,\n border_modules: 4,\n color_mode: ChunkyPNG::COLOR_GRAYSCALE,\n color: 'black',\n file: nil,\n fill: 'white',\n module_px_size: 6,\n resize_exactly_to: false,\n resize_gte_to: false,\n size: 400\n )\n end", "def qrgen\n end", "def customQRcode(inputStr) \n qrcode = RQRCode::QRCode.new(inputStr).as_png(fill: 'white', color: 'black', file: 'abc.png')\n avatar = ChunkyPNG::Image.from_file('abc.png')\n\n # alogo.png being the logo file\n badge = ChunkyPNG::Image.from_file('alogo.png')\n\n print(\"height of backgound:\")\n print(avatar.height)\n print(\"height of logo:\")\n print(badge.height)\n\n #Alpha Blending\n avatar.compose!(badge, avatar.height/2 - badge.height/2, avatar.height/2 - badge.height/2)\n avatar.save('composited.png', :fast_rgba)\nend", "def is_png\n return @is_png unless @is_png.nil?\n @is_png = png_header == [137, 80, 78, 71, 13, 10, 26, 10].pack('C*')\n @is_png\n end", "def generate()\n @qrcode = @qr_generator.new(@url)\n @png = @qrcode.as_png(\n size: @size,\n border_modules: DEFAULT_BORDER_MODULES\n )\n end", "def print_my_qrcode\n require 'rqrcode'\n\n qrcode = RQRCode::QRCode.new(\"http://api.paiemequick.com/u/p/#{self.authentication_token}/\")\n\n # NOTE: showing with default options specified explicitly\n svg = qrcode.as_svg(\n offset: 5,\n color: '000',\n shape_rendering: 'crispEdges',\n module_size: 6,\n standalone: true\n )\n\n # save SVG file to folder\n File.open(\"app/assets/images/#{self.phone}\", \"w\") do |line|\n line.puts svg\n end\n end", "def create_qrcode\n\n end", "def png\n self.to_s\n end", "def rqrcode\n RQRCode::QRCode.new(data, :level => level, :size => size)\n end", "def generateQRCode\n id = params[:id]\n\n #on recherche l'enregistrement correspondant\n query = Qrmodel.find(id)\n query_string = query.to_s\n\n #on commence le processus de rendu du qrcode\n qrcode = RQRCode::QRCode.new(query_string)\n qrmodel.qrcode.attach(\n qrcode.as_png(\n resize_gte_to: false,\n resize_exactly_to: false,\n fill: 'white',\n color: 'black',\n size: 360,\n border_modules: 4,\n module_px_size: 6,\n file: Rails.root.join(\"tmp/#{SecureRandom.hex(2).parameterize}.png\")\n )\n )\n\n end", "def show\n require 'rqrcode'\n require 'rqrcode_png'\n require 'chunky_png' # to_data_urlはchunky_pngのメソッド\n\n content = 'Hello World'\n size = 3 # 1..40\n level = :h # l, m, q, h\n\n qr = RQRCode::QRCode.new(content, size: size, level: level)\n # png変換->リサイズ->base64エンコード\n @qr_base64 = qr.to_img.resize(200, 200).to_data_url\n end", "def embed_info(input_file, qr, label, x_coord, y_coord)\n img_template = ChunkyPNG::Image.from_file(input_file)\n img_label = ChunkyPNG::Image.from_file(label)\n img_template.compose!(qr, x_coord, y_coord)\n img_template.compose!(img_label, x_coord + 255, y_coord)\n rename_file = input_file[5..-1]\n img_template.save(\"./out-pdf\" + rename_file.gsub(\".png\", \"-e.png\"), :fast_rgba)\nend", "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 show\n @qrcode = Qrcode.find(params[:id])\n params[:quest_id]\n if @qrcode.imgloc == nil\n @qrcode.imgloc = request.protocol+request.host_with_port+request.fullpath+\".png\"\n @qrcode.save\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qrcode }\n format.png { render :qrcode => @qrcode.ref }\n end\n end", "def qrcode\n \"#{self.short_url}.qrcode\"\n end", "def photo_format; end", "def create_qrcode\n\t\t@qr = RQRCode::QRCode.new( qr_code_params[:text], size: 4)\n\t\tbyebug \n\tend", "def imagemagick7?; end", "def qrcode_exist?(format)\n qrcode_setup_if_not_exist\n \n qrcode_storage.file_exist?(format)\n end", "def qr!\n qr_private(true)\n end", "def show\n @geocach = Geocach.find(params[:id])\n qr_code = \"#{ENV['URL']}#{@geocach.random_code}\"\n @qr = RQRCode::QRCode.new( qr_code.to_s , :size => 10, :level => :h )\n\n \n @qr_code = \"#{ENV['URL']}#{@geocach.random_code}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @geocach }\n format.png { render :qrcode => qr_code, :size => 10, :level => :h }\n format.gif { render :qrcode => qr_code, :size => 10, :level => :h }\n format.jpeg { render :qrcode => qr_code, :size => 10, :level => :h }\n end\n end", "def to_png_header\n self\n end", "def gen_qr_code data\r\n begin\r\n # Form query\r\n query = \"#{URL}#{QUERY}#{data}\"\r\n # Write file to output path\r\n File.open(QR_OUTPUT_PATH, \"wb\") do |file| \r\n file.write HTTParty.get(URI.escape query).parsed_response\r\n end\r\n # Update UI\r\n @qr_img_label.set_pixmap(Qt::Pixmap.new(QR_OUTPUT_PATH))\r\n @qr_data_label.set_text(data)\r\n rescue => e\r\n puts e.inspect\r\n title = \"QR Error\"\r\n error = \"Error: \\\"#{data}\\\" could not be rendered as QR Code!\"\r\n build_message_box(title, error)\r\n end\r\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 imagemagick?; end", "def process_png(data)\n type = 'png'\n width = 0\n height = 0\n x_dpi = 96\n y_dpi = 96\n\n offset = 8\n data_length = data.size\n\n # Search through the image data to read the height and width in th the\n # IHDR element. Also read the DPI in the pHYs element.\n while offset < data_length\n\n length = data[offset + 0, 4].unpack1(\"N\")\n png_type = data[offset + 4, 4].unpack1(\"A4\")\n\n case png_type\n when \"IHDR\"\n width = data[offset + 8, 4].unpack1(\"N\")\n height = data[offset + 12, 4].unpack1(\"N\")\n when \"pHYs\"\n x_ppu = data[offset + 8, 4].unpack1(\"N\")\n y_ppu = data[offset + 12, 4].unpack1(\"N\")\n units = data[offset + 16, 1].unpack1(\"C\")\n\n if units == 1\n x_dpi = x_ppu * 0.0254\n y_dpi = y_ppu * 0.0254\n end\n end\n\n offset = offset + length + 12\n\n break if png_type == \"IEND\"\n end\n raise \"#{filename}: no size data found in png image.\\n\" unless height\n\n [type, width, height, x_dpi, y_dpi]\n end", "def format\n \"image/jpeg\"\n end", "def generate_qrcode_bak(page)\n url = get_site_url(page)\n return if url.blank?\n qr = RQRCode::QRCode.new( url, :size => 6, :level => :h )\n png = qr.to_img # returns an instance of ChunkyPNG\n\n qr_dir = File.join(Rails.root, 'public', 'qrcode')\n FileUtils.mkdir_p qr_dir\n png_path = File.join(qr_dir, \"#{page.id}.png\")\n if File.exist? png_path\n #FileUtils.rm png_path\n else\n png.resize(120, 120).save(png_path)\n end \n end", "def encode_png_str_scanline_none(stream, pos, prev_pos, line_width, pixel_size)\n # noop - this method shouldn't get called at all.\n end", "def can_use_png?\n return browser_version.to_i >= 7 if browser_name== 'ie'\n true\n end", "def image_png?(image_uri)\n File.extname(image_uri) == '.png'\n end", "def screenshot_as(format)\n case format\n when :base64\n bridge.element_screenshot @id\n when :png\n bridge.element_screenshot(@id).unpack('m')[0]\n else\n raise Core::Error::UnsupportedOperationError, \"unsupported format: #{format.inspect}\"\n end\n end", "def barcode_image_uri(data,symbology)\n\n # check to see if we don't already have this barcode image\n filename = CGI.escape(symbology) + '_' + CGI.escape(data) + '.png'\n fname = Rails.root.to_s + \"/public/Barcodes/\" + filename\n\n # if the barcode image doesn't already exist then generate and save it\n if ! File.exists?(fname)\n\n str = 'Barby::'+symbology+'.new(\"'+data+'\")'\n\n begin\n barcode = eval str\n rescue Exception => exc\n barcode = Barby::Code128B.new(data) # fall back to Code128 type B\n end\n\n File.open(fname, 'w') do |f|\n f.write barcode.to_png\n end\n\n end\n logger.info(\"#########{}\")\n \"#{filename}\"\n end", "def generate_qr_code_image(qrcode_matrix)\n\n\t\tsquare_width = @config[:square_size_px]\n\t\tsquare_height = @config[:square_size_px]\n\n\t\timage_width = qrcode_matrix.module_count * square_width\n\t\timage_height = image_width\n\n\t\t# Create a completely transparent image as a starting point\n\t\tqr_code_img = Image.new(image_width,image_height) { self.background_color = \"transparent\" }\n\n\t\t# Loop over every QR code square\n\t\tqrcode_matrix.modules.each_index do |row| \n\t\t\tqrcode_matrix.modules.each_index do |col| \n\n\t\t\t\t# create the black or white square image\n\t\t\t\tif qrcode_matrix.dark?(row,col)\n\t\t\t\t\tbgcolor = self.get_dark_square_color(row,col)\n\t\t\t\telse\n\t\t\t\t\tbgcolor = \"white\"\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\tsquare_img = Image.new(square_width,square_height) { self.background_color = bgcolor }\n\t\t\t\tsquare_img_pixels = square_img.get_pixels(0,0,square_width,square_height)\n\n\t\t\t\t# draw the square into the qr_code_img result\n\t\t\t\ty = row * square_height \n\t\t\t\tx = col * square_width\n\t\t\t\tqr_code_img.store_pixels(x,y,square_width,square_height,square_img_pixels)\n\n\t\t\tend\n\t\tend\n\n\t\tif @config[:debug] # debugging\n\t\t\tdebug_image_name = \"../testdata/qr_code_image_before_overlay.png\" \n\t\t\tqr_code_img.write(debug_image_name)\n\t\t\tputs \"Writing debug image: #{debug_image_name}\" \n\t\tend\n\n\t\treturn qr_code_img\n\n\tend", "def to_png(*a)\n to_image(*a).to_blob{|i| i.format ='png' }\n end", "def create\n @check_in_out = CheckInOut.new(check_in_out_params)\n\n qrcode = RQRCode::QRCode.new(@check_in_out.check_in_no.to_s)\n # With default options specified explicitly\n png = qrcode.as_png(\n resize_gte_to: false,\n resize_exactly_to: false,\n fill: 'white',\n color: 'black',\n size: 120,\n border_modules: 4,\n module_px_size: 6,\n file: './app/assets/images/Check_in_out_QrCode/'+@check_in_out.check_in_no.to_s+'.png' # path to write\n )\n\n respond_to do |format|\n if @check_in_out.save\n\n NewCheckInMailer.notify_check_in(@check_in_out).deliver\n\n format.html { redirect_to check_in_outs_path, notice: 'Check in out was successfully created.' }\n format.json { render :show, status: :created, location: @check_in_out }\n else\n format.html { render :new }\n format.json { render json: @check_in_out.errors, status: :unprocessable_entity }\n end\n end\n end", "def render_ansi\n qrcode.as_ansi if valid?\n end", "def png(level = nil)\n size = FFI::MemoryPointer.new(:pointer)\n ptr = ::GD2::GD2FFI.send(:gdImagePngPtrEx, image_ptr, size, level.to_i || -1)\n ptr.get_bytes(0, size.get_int(0))\n ensure\n ::GD2::GD2FFI.send(:gdFree, ptr)\n end", "def png\n @driver.screenshot_as(:png)\n end", "def qrcode\n @qr = RQRCode::QRCode.new(\"http://0.0.0.0:3000/visit/#{self.tag}\", :size => 6)\n return @qr\n end", "def png(file)\n file.write PNG_HEADER\n\n # Make sure IEND is actually at the end (Ruby 1.9).\n iend = @chunks.delete 'IEND'\n @chunks['IEND'] = iend\n\n @chunks.each do |type, data|\n data.each do |data_part|\n file.write [data_part.length, type].pack('NA*')\n file.write data_part\n file.write [Zlib::crc32(type + data_part)].pack('N')\n end\n end\n end", "def initialize(qrcode, options={})\n @points = qrcode.points\n @background = options[:transparent] ? 0 : 1\n \n @height = qrcode.height\n @width = qrcode.width\n\n end", "def image; end", "def render_qr_code(qr_code, **options)\n renderer = Renderer.new(qr_code, **options)\n renderer.render(self)\n end", "def image_formats\n format_from_name = self.class.name.downcase[/gif|jpeg|png|svg/]\n unless format_from_name\n fail \"#{self.class}: can't guess applicable format from worker name\"\n end\n\n [format_from_name.to_sym]\n end", "def fetch_qr\n qrcode = RQRCode::QRCode.new(current_user.provisioning_uri, size: 10, level: :h )\n png = qrcode.as_png(bit_depth: 1, border_modules: 4, color_mode: ChunkyPNG::COLOR_GRAYSCALE, color: 'black', file: nil, fill: 'white', module_px_size: 6, resize_exactly_to: false, resize_gte_to: false)\n user_id = current_user.id\n image_path = Rails.root.join(\"public/#{user_id}.png\")\n File.open(image_path, 'wb'){|image_file| image_file.write png }\n image = Cloudinary::Uploader.upload(image_path)\n File.delete(\"./public/#{user_id}.png\")\n qrcode = image.as_json(only: [\"public_id\", \"url\"])\n render json: {status: 200, message: \"QR fetched\", qr: qrcode}\n end", "def to_png(*a)\n to_blob('png', *a)\n end", "def to_png_header(header)\n h = header\n Imgrb::Headers::PngHeader.new(@width, @height, h.bit_depth, 0,\n h.image_type, 0, 0)\n end", "def to_pixel(**options) = convert_to('pixel', **options)", "def generate_qrcode_matrix(qrstring)\n\n\t\tqrcode_matrix = RQRCode::QRCode.new(qrstring, :level => :h )\n\n\t\tif @config[:debug] # debugging\n\t\t\tdebug_image_name = \"../testdata/qr_code_image_before_modification.png\" \n\t\t\tqr_code_image = self.generate_qr_code_image(qrcode_matrix)\n\t\t\tqr_code_image.write(debug_image_name)\n\t\t\tputs \"Writing debug image: #{debug_image_name}\" \n\t\tend\n\n\t\treturn qrcode_matrix\n\n\tend", "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 format_icon_path format\n return 'icons/'.concat(format).concat('.png')\n end", "def icon_magic(r, icon_field = 'icon_path', height = nil, opts = {} )\n height ||= ICON_PATH_HEIGHT\n begin\n paz = r.send(icon_field) # || \"nil.png\"\n return link_google_images(r) if paz.nil?\n return '(empty)' if paz == ''\n # se non contiene slash devo aggiungeregli il modello\n if (paz =~ /\\// )\n iconpaz = paz # tengo http://whatever or \"/icons/sodoveandare/immagine.png\"\n else # locale ci prependo il 'apps/' o whatever\n iconpaz = \"/images/#{r.class.to_s.tableize}/#{paz}\"\n end\n link_path = opts[:link] || iconpaz\n return link_to( image_tag(iconpaz , :height => height , :border => 0), link_path ) \n rescue\n \"IconMagic Err w/ photo (model=#{r.class},field=#{icon_field}): #{$!}\"\n end\n end", "def check_image_format(img_header)\n hstr = img_header.unpack(\"H*\").first\n mime = { \"unk\" => \"application/octet-stream\",\n \"jpg\" => \"image/jpeg\",\n \"png\" => \"image/png\",\n \"gif\" => \"image/gif\",\n \"bmp\" => \"image/x-bmp\",\n \"pic\" => \"image/pict\",\n \"tif\" => \"image/tiff\" \n }\n \n result = \"unk\"\n result = \"jpg\" if hstr[0, 4] == \"ffd8\"\n result = \"png\" if hstr == \"89504e47\"\n result = \"gif\" if hstr == \"47494638\"\n resutl = \"bmp\" if hstr[0, 4] == \"424d\"\n result = \"pic\" if hstr[0, 6] == \"504943\"\n result = \"tif\" if hstr[0, 4] == \"4949\" || hstr[0, 4] == \"4d4d\"\n return result, mime[result]\n end", "def image_string_creator\r\n n = []\r\n n << \"src:\".ljust(TO_S_SIZE) + self.src.to_s\r\n n << \"file date:\".ljust(TO_S_SIZE) + self.fileCreatedDate.to_s\r\n n << \"file size:\".ljust(TO_S_SIZE) + self.fileSize.to_s\r\n n << \"width:\".ljust(TO_S_SIZE) + self.width.to_s\r\n n << \"height:\".ljust(TO_S_SIZE) + self.height.to_s\r\n n << \"alt:\".ljust(TO_S_SIZE) + self.alt.to_s\r\n return n\r\n end", "def png_chunk(signature, data)\n\t[data.length, signature, data, Zlib::crc32(signature + data)].pack(\"NA4A*N\")\nend", "def png(*args)\n PNG.write(@source, *args)\n end", "def upcoming_appointment_qrcode\n @patient = Patient.first\n upcoming_appointment = @patient.upcoming_appointment\n if upcoming_appointment\n url = \"https://www.mdme.us/clinics/#{upcoming_appointment.checkin_key}/checkin\"\n @qrcode = RQRCode::QRCode.new(url)\n respond_to do |format|\n format.png { send_data @qrcode.as_png(color: '#0097A7', size: 800), disposition: 'inline' }\n end\n end\n end", "def formats; end", "def formats; end", "def show\n #setup_reporting_fields\n rqrcode\n end", "def random_uri_with_resolution( width, height )\n svg = random_pattern.to_svg\n png = svg_to_png( svg, width, height )\n return encode64( png )\n end", "def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end", "def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPEG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end", "def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPEG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end", "def encode_png_str_scanline_paeth(stream, pos, prev_pos, line_width, pixel_size)\n line_width.downto(1) do |i|\n a = i > pixel_size ? stream.getbyte(pos + i - pixel_size) : 0\n b = prev_pos ? stream.getbyte(prev_pos + i) : 0\n c = prev_pos && i > pixel_size ? stream.getbyte(prev_pos + i - pixel_size) : 0\n p = a + b - c\n pa = (p - a).abs\n pb = (p - b).abs\n pc = (p - c).abs\n pr = if pa <= pb && pa <= pc\n a\n else\n pb <= pc ? b : c\n end\n\n stream.setbyte(pos + i, (stream.getbyte(pos + i) - pr) & 0xff)\n end\n stream.setbyte(pos, ChunkyPNG::FILTER_PAETH)\n end", "def to_image(opts={})\n with_options opts do\n canvas = Magick::Image.new(full_width, full_height)\n bars = Magick::Draw.new\n\n x1 = margin\n y1 = margin\n\n if barcode.two_dimensional?\n encoding.each do |line|\n line.split(//).map{|c| c == '1' }.each do |bar|\n if bar\n x2 = x1+(xdim-1)\n y2 = y1+(ydim-1)\n # For single pixels use point\n if x1 == x2 && y1 == y2\n bars.point(x1,y1)\n else\n bars.rectangle(x1, y1, x2, y2)\n end\n end\n x1 += xdim\n end\n x1 = margin\n y1 += ydim\n end\n else\n booleans.each do |bar|\n if bar\n x2 = x1+(xdim-1)\n y2 = y1+(height-1)\n bars.rectangle(x1, y1, x2, y2)\n end\n x1 += xdim\n end\n end\n\n bars.draw(canvas)\n\n canvas\n end\n end", "def screenshot_as(format, full_page: T.unsafe(nil)); end", "def process_png(data)\n @type = 6 # Excel Blip type (MSOBLIPTYPE).\n @width = data[16, 4].unpack(\"N\")[0]\n @height = data[20, 4].unpack(\"N\")[0]\n end", "def to_s\n return \"{ image_type: #{image_type},\"\\\n \" image_width: #{self[:image_width]},\"\\\n \" image_height: #{self[:image_height]},\"\\\n \" image_depth: #{self[:image_depth]},\"\\\n \" image_array_size: #{self[:image_array_size]},\"\\\n \" image_row_pitch: #{self[:image_row_pitch]},\"\\\n \" image_slice_pitch: #{self[:image_slice_pitch]},\"\\\n \" num_mip_levels: #{self[:num_mip_levels]},\"\\\n \" num_samples: #{self[:num_samples]},\"\\\n \" buffer: #{self[:buffer].to_i.to_s(16)} }\"\n end", "def create\n @bar_code = BarCode.new(bar_code_params)\n gen = Barby::Code128B.new(@bar_code.text)\n send_data gen.to_png(:height => 50), :type => \"image/png\", :disposition => \"inline\"\n\n @bar_code.save\n\n\n\n end", "def image_formats\n format_from_name = self.class.name.downcase[/gif|jpeg|png/]\n raise \"#{self.class}: can't guess applicable format from worker name\" unless format_from_name\n [format_from_name.to_sym]\n end", "def generate_png\n img = IMGKit.new(url).to_png\n file = File.new(\"#{id}-full.png\", \"w\", :encoding => 'ascii-8bit')\n file.write(img)\n return file.path\n end", "def generate_png\n command = \"python #{Rails.root}/lib/webkit2png --transparent -F -o #{id} -D #{Rails.root}/tmp #{url} \"\n system command\n return \"#{Rails.root}/tmp/#{id}-full.png\"\n end", "def format\n open{ |f| ImageSize.new(f) }.format\n end", "def format\n open{ |f| ImageSize.new(f) }.format\n end", "def exportImage(options={})\n if self.datatype.name!=\"image\"\n raise \"instancevalue has wrong data type\"\n end\n if self.data_binary.blank?\n raise \"no image data found\"\n end\n localOptions={:withColorPalette=>false}\n localOptions.merge!(options)\n imageBlob=trimBlob(self.data_binary)\n begin\n myImage=Magick::Image.from_blob(imageBlob)[0]\n rescue Magick::ImageMagickError\n raise \"instancevalue contains invalid image data\"\n end\n case localOptions[:exportFormat]\n when '1'\n exportFormat='BMP'\n when '2'\n exportFormat='TIF'\n when '3'\n exportFormat='JPG'\n when '4'\n exportFormat='PNG'\n when '5'\n exportFormat='GIF'\n when '6'\n exportFormat='TXT'\n else\n exportFormat='PNG'\n end\n if localOptions[:withColorPalette]\n paletteImg=Magick::Image.read(Rails.root.to_s+\"/app/assets/images/Rainbow.png\")\n myImage=myImage.clut_channel(paletteImg[0])\n end\n sendImage=myImage.to_blob { self.format=exportFormat }\n instanceName=self.instancevalueset.instance.name\n shotNr=self.instancevalueset.shot_id\n fileName=instanceName+'_'+shotNr.to_s+'.'+exportFormat.downcase\n return {:content=>sendImage, :format=>'image/'+exportFormat, :filename=>fileName}\n end", "def to_png\n return @png_data if !@png_data.nil?\n image = minimagick_image\n image.resize '16x16!'\n image.format 'png'\n image.strip\n @png_data = image.to_blob\n raise FaviconParty::InvalidData.new(\"Empty png\") if @png_data.empty?\n @png_data\n end", "def save(data, path, format=nil)\n \t\tformat ||= get_format(path)\n\n\t\t\tinit_encoder(data)\n\n \t\tcase format.to_sym\n \t\t\twhen :jpg, :jpeg\n \t\t\t\tres = save_as_jpeg(path)\n \t\t\twhen :png\n \t\t\t\tres = save_as_png(path)\n \t\t\twhen :tiff, :tif\n \t\t\t\tres = save_as_tiff(path)\n \t\t\twhen :eps\n \t\t\t\tres = save_as_eps(path)\n \t\t\telse\n \t\t\t close; raise RQR::FormatNotFoundException.new(\"invalid format! #{format}\")\n \t\tend\n \n close\n \n if res != 0\n raise RQR::ImageException.new(\"qrcode image error! #{path} wasn't created.\")\n \t\tend\n \tend", "def make_png(ui_image)\n\t\timg = UIImagePNGRepresentation(image)\n\t\treturn img\n\tend", "def png_transformer(type_s, out_options={}, &block)\n orig_out_options = out_options[:size]\n if type_s == 'png'\n png_output = true\n type_s = 'svg'\n if out_options[:size]\n unless out_options[:size].to_s =~ /x/i\n out_options[:size] = out_options[:size].to_s + 'x' + out_options[:size].to_s\n end\n end\n else\n if out_options[:size].is_a?(String) && (out_options[:size] =~ /x/i)\n warn 'can only use the width dimension for this format'\n out_options[:size] = out_options[:size].split(/x/i).first\n end\n end\n image_blob = block.call(type_s, out_options)\n if png_output\n st = StringIO.new\n image = MiniMagick::Image.read(image_blob, 'svg')\n image.format('png')\n # would like to resize as an svg, then output the png of proper\n # granularity...\n image.resize(out_options[:size]) if out_options[:size]\n image_blob = image.write(st).string\n end\n out_options[:size] = orig_out_options\n image_blob\n end", "def test_png_size_determined_correctly\n assert_equal [120, 175], @page.get_png_size(@test_png)\n end", "def to_png_header\n PngHeader.new(@width, @height, @bit_depth, 0, @image_type, 0, 0)\n end", "def createAscii(options = {})\n if @status == true\n options = {\"width\" => 90, \"color\" => true}.merge(options)\n\t img = Magick::Image.from_blob(@data).first\n\t width = options[\"width\"]\n\t scale = (width.to_f / img.columns)\n\t \n\t height = ((img.rows * scale) / 2).to_i\n\t # puts height\n\t if height >= 100\n\t \theight = 80\n\t end\n\n\t border = \"+#{'-' * width}+\\n\"\n\t output = border.dup\n\n\t img.resize!(width, height)\n\t color_image = img.dup if options[\"color\"]\n\t img = img.quantize(@image_chars.length, Magick::GRAYColorspace).normalize\n\t quantum_calc = Magick::QuantumRange / (@image_chars.length - 1)\n\n\t \n\t img.view(0, 0, width, height) do |view|\n\t \n\t height.times do |i|\n\t \n\t output << '|'\n\t width.times do |j|\n\n\t character = @image_chars[view[i][j].red/quantum_calc] \n\n\t if options[\"color\"]\n\t pix = color_image.pixel_color(j,i)\n\t character = character.color(unified_rgb_value(pix.red), unified_rgb_value(pix.green), unified_rgb_value(pix.blue))\n\t end\n\n\t output << character\n\t end\n\n\t output << \"|\\n\"\n\t end\n\t end\n\n\n\t output << border\n\t return output\n end\n end", "def is_format?(); @type == GRT_FORMAT; end", "def test_png_text_metadata\n\n keywords = [\"Title\", \"Author\", \"Copyright\", \"Description\", \"Software\", \"Disclaimer\"]\n\n each_file_with_updated_info do\n |file_path|\n\n #Valid png with text metadata\n if @test_feature == \"c\" && @parameter[0] == \"t\"\n\n img = Imgrb::Image.new(file_path, :only_metadata)\n\n text_type = @parameter[1]\n if text_type == \"0\"\n assert img.texts.empty?, \"Image does not contain text metadata, but img.texts is not empty!\"\n elsif text_type == \"1\" || text_type == \"z\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert keywords.include? txt.keyword\n assert txt.text.length > 0\n end\n #img.texts.each{|txt| txt.report}\n elsif text_type == \"e\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"en\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert_equal txt.translated_keyword, txt.keyword\n assert txt.text.length > 0\n end\n elsif text_type == \"f\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"fi\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert txt.translated_keyword.length > 0\n assert txt.text.length > 0\n end\n elsif text_type == \"g\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"el\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert txt.translated_keyword.length > 0\n assert txt.text.length > 0\n end\n elsif text_type == \"h\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"hi\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert txt.translated_keyword.length > 0\n assert txt.text.length > 0\n end\n elsif text_type == \"j\"\n assert_equal 6, img.texts.size\n img.texts.each do\n |txt|\n assert txt.international?\n assert_equal \"ja\".force_encoding(\"646\"), txt.language\n assert keywords.include? txt.keyword\n assert txt.translated_keyword.length > 0\n assert txt.text.length > 0\n end\n end\n end\n end\n\n end", "def inspect\n out = \"\"\n self.each_pair do |k ,v|\n out << \"%-40s\" % k.to_s.yellow unless [:header, :item, :magic].include? k\n case k\n when :image_format then out << \"0x%03x\\n\" % v\n when :header\n v.each_pair do |i, j|\n out << \"%-40s%s\\n\" % [i.to_s.yellow, j] if i == :item_count\n out << \"%-40s%d MB\\n\" % [i.to_s.yellow, j>> 20] if i == :len_low\n # out \"res:\" << reserved.inspect if i == :reserved\n end\n when :item\n out << \"Items\\n\".light_blue\n v.each { |it| out << it.inspect << \"\\n\" }\n end\n end\n out\n end", "def encode64( png )\n return Base64.encode64(png)\n end", "def path_my_qrcode\n #require 'ActionDispatch'\n file = File.join(Rails.root.join, \"app\", \"assets\", \"images\", \"#{self.phone}.svg\")\n # puts \"#{request.host}file\" request.host | request.domaine | request.base_url\n # read de file\n if File.exists?(file)\n return file\n else\n return false, \"Fichier inexistant\"\n puts false\n end\n end", "def determine_image_type_from_ext(ext)\n case ext\n when 'jpg' then RGB\n else ARGB\n end\n end", "def to_s(format=:css)\n case format\n when :css\n \"#%.2x%.2x%.2x\" % [r, g, b]\n when :css_rgb\n \"rgb(%.2f,%.2f,%.2f)\" % [r, g, b]\n when :rgb\n \"%.3f, %.3f, %.3f\" % [r / 255, g / 255, b / 255]\n end\n end", "def test_refute_png_equal_with_different_image\n refute_png_equal(comparison_png(0), comparison_png(1))\n end", "def graphicsmagick?; end", "def optimize_format(requested_format)\n requested_png = requested_format.to_s.casecmp?(FORMAT_PNG)\n\n if requested_png && optimization_enabled? && can_process_images?\n FORMAT_ZIP\n else\n requested_format\n end\n end", "def to_s\r\n assert_exists\r\n super({\"src\" => \"src\",\"width\" => \"width\",\"height\" => \"height\",\"alt\" => \"alt\"})\r\n end", "def to_png(*a)\n PNG.new(to_canvas(*a)).to_blob\n end", "def path_to_image(source, options = T.unsafe(nil)); end", "def get_default_qr(subscriber = nil)\n if !subscriber.nil? && !subscriber.broker.nil? && !subscriber.broker.firstname.nil?\n broker_name = subscriber.broker.firstname\n else\n broker_name = \"Conseiller\"\n end\n qr = [{\n \"type\": \"flow\",\n \"caption\": \"🏠 5 biens\",\n \"target\": ENV[\"QR_ADS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"🔍 Critères\",\n \"target\": ENV[\"QR_CRITERIA\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"👨‍💼 Mes pros\",\n \"target\": ENV[\"QR_PROS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"❤️ Favoris\",\n \"target\": ENV[\"QR_FAVORITES\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"🔑 Outils\",\n \"target\": ENV[\"QR_TOOLS\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"💬 Ding Dong\",\n \"target\": ENV[\"QR_DING_DONG\"],\n },\n {\n \"type\": \"flow\",\n \"caption\": \"⛔ Stop\",\n \"target\": ENV[\"QR_STOP\"],\n }]\n return qr\n end" ]
[ "0.7304352", "0.63814193", "0.6361944", "0.6309719", "0.627624", "0.62594956", "0.6193855", "0.61348987", "0.6073656", "0.60207593", "0.6010622", "0.59499043", "0.59071636", "0.5876007", "0.58601093", "0.5725574", "0.57152325", "0.5713905", "0.56694376", "0.5660416", "0.56595474", "0.56282955", "0.55696404", "0.55671877", "0.5558454", "0.54829305", "0.54577297", "0.5453816", "0.54458976", "0.54144984", "0.54132533", "0.5405008", "0.539006", "0.5376435", "0.53740567", "0.5365089", "0.53630686", "0.53627026", "0.53089213", "0.52855873", "0.52801824", "0.5267926", "0.5261963", "0.52384704", "0.5236719", "0.5209177", "0.520861", "0.5197465", "0.51911086", "0.5187659", "0.51799744", "0.51786745", "0.5176786", "0.5174752", "0.5170336", "0.51652", "0.5164897", "0.5157624", "0.5149324", "0.5148994", "0.5144339", "0.5144339", "0.5143064", "0.5142951", "0.5138549", "0.51335895", "0.51335895", "0.51066166", "0.5105286", "0.51031846", "0.50923926", "0.50897396", "0.5083977", "0.5082488", "0.5081589", "0.50795555", "0.5079378", "0.5079378", "0.5068352", "0.50636125", "0.5061702", "0.5059709", "0.5054207", "0.50523114", "0.5048999", "0.5035812", "0.50297284", "0.5025783", "0.50244737", "0.5018923", "0.5015922", "0.498888", "0.49864164", "0.49833322", "0.49802786", "0.4979457", "0.49734393", "0.49645838", "0.49556795", "0.4954954" ]
0.5438848
29
def check_role return if current_user.admin? flash[:danger] = "You can not access this page" redirect_to "/" end
def check_logged_in return if current_user.present? redirect_to new_session_path and return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_role\n if current_user && current_user.has_role?(:admin)\n return\n else\n flash[:notice]= \"You are not authorised to access the page you sought.\"\n redirect_to root_path\n end\n end", "def check_admin_account\n if current_user.role != User::ROLES[:admin]\n flash[:alert]= \"Only admin can access\"\n return redirect_back fallback_location: 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 check_Admin\n\t\tif current_user.role != \"admin\"\n\t\t\tredirect_to('/')\n\t\tend\n\tend", "def check_admin\n redirect_to root_path unless current_user.has_role? :admin\n end", "def check_admin\n if !current_user.admin?\n flash[:error] = \"You dont have access to this Page!!!!!\"\n redirect_to root_path\n end\n end", "def check_authorization\n unless @user and @user.role.name == 'admin'\n flash[:notice] = \"Not authorized!\"\n redirect_to root_path\n end\n end", "def verify_admin\n redirect_to root_url unless current_user.role_id == 1 || current_user.role_id == 2\n end", "def check_user_role \t \n redirect_to root_path unless current_user.roles.first.name == \"empleado\" or current_user.roles.first.name == \"supervisor\"or current_user.roles.first.name == \"admin\" \n end", "def check_role\n unless current_user.has_role?(:admin)\n redirect_to admin_registrations_path, notice: 'You are not allowed to perform this action.'\n end\n end", "def check_role\n redirect_to(root_url) unless check_role?(\"News Editor\") or check_role?(\"Site Admin\")\n end", "def check_role\n redirect_to(root_url) unless check_role?(\"News Editor\") or check_role?(\"Site Admin\")\n end", "def admin_user\n redirect_to(root_url) unless logged_in?&&current_user.user_role\n end", "def check_admin_rights\n unless logged_in? and current_user.is_admin?\n flash[:error] = \"Permiso denegado\"\n redirect_to '/'\n end\n end", "def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end", "def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end", "def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end", "def is_admin?\n redirect_to home_index_path, alert: '请以管理员身份登陆后进行操作!' unless user_signed_in?&&current_user.admin?\n end", "def is_admin?\n redirect_to home_index_path, alert: '请以管理员身份登陆后进行操作!' unless user_signed_in?&&current_user.admin?\n end", "def check_admin\n\t\tif current_user && current_user.role == 2\n\t\telsif current_user && current_user.role != 2\n\t\t\tredirect_to buildings_url, notice: 'You are not authorized'\n\t\telse\n\t\t\tredirect_to buildings_url, notice: 'You are not logged in'\n\t\tend\n\tend", "def check_role\n if signed_in? \n # if not admin, redirect to message index\n if current_user.role != \"admin\"\n redirect_to messages_path\n end\n # if not sign in, redirect to sign in form\n else\n redirect_to new_session_path\n end\n end", "def check_if_admin\n if !current_user.admin?\n flash[:alert] = 'Sorry, only admins allowed!'\n redirect_to root_path\n end\n end", "def i_am_admin\n unless current_user.is_admin?\n redirect_to :root \n flash[:error] = \"You haven't the rights to access the required page.\"\n end\n end", "def check_role\n if user_signed_in? && current_user.role_id ==nil\n redirect_to new_reg_path\n\n end\n end", "def admin_user\n unless current_user.admin?\n flash[:danger] = \"You do not have the permission to do that.\"\n redirect_to home_path\n end\n end", "def check_admin\n if !current_user.admin?\n return redirect_to '/messages/no_access'\n end\n end", "def check_admin\n return redirect_to user_dashboard_path unless current_user.is_admin?\n end", "def is_admin\n if !is_admin?\n flash[:danger] = \"Unauthorized. You are not an admin\"\n redirect_to home_path\n end\n end", "def required_admin_signin?\n unless current_user.try(:role)==\"admin\" || current_bus_owner\n flash[:error] = \"You are not admin\"\n redirect_to root_path\n end\n end", "def check_access_level(role)\n redirect_to root_path unless current_user && current_user.role?(role)\n end", "def check_user_access\n if !(user_signed_in? && current_user.has_role?(:admin))\n flash[:alert] = \"You are not authorised to access that page\"\n redirect_to root_path\n end\n end", "def checkauth?\n unless is_admin?\n flash[:privileges]=\"Not enough privileges\"\n redirect_to root_path\n end\n end", "def check_user_access\n if !(user_signed_in? && current_user.has_role?(:admin))\n flash[:alert] = \"You are not authorised to access that page\"\n redirect_to root_path\n end\n end", "def check_if_admin\n if(is_admin?)\n return true\n else\n flash[:notice] = 'You need to be signed in to perform that action'\n redirect_to :back\n end\n end", "def is_logged_in_and_admin\n unless current_user && current_user.admin? \n flash[:danger] = \"You do not have the ability to do that!\"\n redirect_to root_url\n end\n end", "def check_admin\n if not ensure_admin\n redirect_to root_url, alert: \"you are not authorized\"\n end # end if\n end", "def show\n if current_user.has_role?(:admin)\n else\n redirect_to root_path, alert: \"No tienes permiso para esta accion\"\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_admin\n redirect_to houses_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def require_admin\n if logged_in? and !current_user.admin?\n #flash[:danger] = 'Only admin users can perform that action'\n redirect_to root_path\n end\n end", "def logged_in_admin\n unless current_user && current_user.admin\n flash[:danger] = \"Please log in as admin.\"\n redirect_to '/home'\n end\n end", "def must_be_admin\n if current_user.is? \"EA\"\n return true\n else\n redirect_to root_path,:notice =>\"Access Denied...\"\n end\n end", "def authorize\n if current_user.role !='admin'\n redirect_to users_profile_path ,notice: 'You are not admin.'\n end\n end", "def is_admin\n if current_user && !((current_user.roles.first.name==\"Super Admin\" || current_user.roles.first.name==\"Department Admin\") && current_user.role_memberships.first.status==\"A\")\n redirect_to dashboard_index_path\n end\n end", "def is_admin?\n if !is_admin\n flash[:danger] = \"Only admins can do that\"\n redirect_to home_path\n end\n end", "def check_user\n if (user_signed_in? && !current_user.has_role?(:admin))\n flash[:alert] = \"You are not authorized to access that page\"\n redirect_to root_path\n end\n end", "def checkAdmin\n if !admin_signed_in?\n # if current user is not an admin then can't access the page like add teacher,department,college and new subject\n redirect_to root_path, notice: \"Only Admin Can Access This Page\"\n end\n end", "def require_admin\n #byebug\n redirect_to user_path(current_user) unless current_user.role === \"Admin\"\n end", "def check_role\n redirect_to root_path unless current_user && current_user.evo_team?\n end", "def verify_is_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end", "def is_admin\n \tif current_user != nil\n\t \t \tif !current_user.admin\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t \tend\n\t\t else\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t\t end\n \t\t\n\n end", "def only_admin\n if user_role == 'admin'\n else\n redirect_to clients_path, notice: \"У вас нет прав для просмотра даного раздела, или редактирования информации\"\n end\n end", "def authorize_admin\n redirect_to root_path, flash: {:error => \"User don't have admin privileges\"} unless isAdmin?\n end", "def admin_access\n if current_user.access? :admin\n return true\n elsif current_user\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to nationalities_path\n else\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to login_path\n end\n end", "def admin_only\n @user = current_user\n if @user.role != \"admin\"\n redirect_to root_path\n end\n end", "def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end", "def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end", "def require_admin\n if logged_in? and !current_user\n flash[:danger] = \"Only admin users can perform that action.\"\n redirect_to root_path\n end\n end", "def check_if_admin\n redirect_to root_path unless @current_user.present? && @current_user.admin?\n end", "def admin_user?\n unless (current_user && current_user.admin?)\n flash[:danger] = \"You are not an admin. You can not do that\"\n redirect_to :action => 'index'\n end\n end", "def facility_admin\n facility_controller_check\n unless current_user.role == \"site_admin\" || (@facility_role_access.present? && current_user.role == \"facility_admin\")\n flash[:error] = 'You are not authorized. Please request access from your manager'\n redirect_to root_url\n end\n end", "def check_user_role\n if current_user&.has_role? :denied\n session.delete(:user_id)\n redirect_to root_path, flash: { alert: I18n.t(\"registration.banned.fail\") }\n elsif current_user&.has_role? :pending\n session.delete(:user_id)\n redirect_to root_path, flash: { alert: I18n.t(\"registration.approval.fail\") }\n end\n end", "def verify_admin?\n return if current_user.admin?\n\n flash[:alert] = \"Sorry, only admins allowed to view the dashboard.\"\n redirect_to :root\n end", "def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end", "def show\n if current_user.role == 'admin'\n redirect_to '/'\n end\n end", "def require_admin_or_correct_user\n @user = User.find(params[:id])\n flash[:error] = \"Access Denied\"\n redirect_to(root_url) unless (current_user.id == @user.id || is_admin?)\n end", "def show\n unless current_user.has_role? :admin\n flash[:alert] = \"Access To Logs Denied\"\n redirect_to root_path\n end\n end", "def authorise_admin\n redirect_to root_path, alert: \"You are not authorised to access that page\" if current_user.try(:admin?) != true\n end", "def restrict_user_by_role\n unless current_user and current_user.admin?\n redirect_to root_path # change this to your 404 page if needed\n end\n end", "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "def check_if_admin\n unless current_user.admin\n redirect_to \"/login\"\n end\n end", "def restrict_user_by_role\n unless current_user.has_role_in_roles_list?(ADMINISTRATION_ROLES)\n flash[:error] = 'You do not have permission to view this page'\n redirect_to root_path\n end\n end", "def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end", "def admin\n unless current_user.admin?\n redirect_to root_url\n flash[:danger] = \"You have no access here\"\n end\n end", "def check_admin\n redirect_to new_admin_session_path unless is_admin?\n end", "def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end", "def admin_user\n if logged_in?\n redirect_to root_url unless current_user.admin?\n elsif\n #flash[:failure] = \"Invalid Request\"\n redirect_to(root_url)\n end\n end", "def checker\n if spree_current_user.spree_roles.all.first.nil?\n redirect_to('/')\n end\n end", "def is_admin\n if current_user\n unless current_user.admin?\n flash[:danger] = \"Only the administrators can access it\"\n redirect_to tasks_path\n end \n else\n redirect_to new_session_path\n end\n end", "def redirect_if_not_an_admin\n return if current_user.admin?\n flash[:danger] = 'Access denied.'\n redirect_to root_path\n end", "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "def req_admin\n unless curr_user.admin\n flash[:danger] = \"You must be admin to go there!\"\n redirect_to root_url\n end\n end", "def require_admin!\n return if user_signed_in? && current_user.admin?\n\n flash[:error] = \"Sorry, you don't have permission to do that\"\n\n redirect_to root_path\n end", "def authenticate_admin!\n unless current_user.admin?\n flash[:danger] = \"Sorry, you don't have premissions for this action.\"\n redirect_to root_path\n else\n true\n end\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 check_admin\n @user = find_current_user\n\n unless @user.present? and @user.is_admin?\n redirect_to root_path\n end\n end", "def admin_user\n \n unless current_user.admin?\n \tflash[:danger] = \"Please log in with the correct user name.\"\n \tredirect_to(root_url)\n end\n end", "def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end", "def authenticate_staff_activity\n if not (current_user.role?(\"staff\") || current_user.role?(\"admin\"))\n flash[:notice] = \"对不起,您没有权限访问该网址!\"\n redirect_to root_url\n end\nend", "def require_admin\n unless current_user.admin\n flash[:notice] = \"Need admin account.\"\n redirect_to(\"/login\")\n end\n end", "def admin_required\n if current_user && current_user.admin\n return\n end\n redirect_to \"/login\", notice: 'Logga in som administratör.'\n end", "def check_authentication\n redirect_to root_path, notice: \"You don't have access permission for this page!\" unless current_user.has_role?(:admin)\n end", "def authorize\n if !current_user.has_role? :admin\n render text:\"No Access For You!!!\"\n end\n end", "def admin_permission\n if session[:position].to_s == \"Secretary\" or\n session[:position].to_s == \"Treasurer\" or\n session[:position].to_s == \"Chairman\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n position: session[:position]\n return false\n end\n\n end", "def is_admin?\n @user = User.find(params[:id])\n if !current_user.admin?\n flash[:danger] = \"Only admins can do that\"\n redirect_to home_path\n end\n end", "def admin_user\n unless ( logged_in? && current_user.admin? )\n store_location\n flash[:danger] = \"У Вас недостаточно прав для выполнения этой операции.\"\n redirect_to root_url\n end \n # redirect_to(root_url) unless current_user.admin?\n end", "def admin?\n if (User.find session[:user_id]).role == \"Admin\"\n true\n end\n end" ]
[ "0.9101603", "0.88891053", "0.8680809", "0.8555592", "0.8486647", "0.84440166", "0.8439981", "0.84281206", "0.84140724", "0.83931994", "0.8388361", "0.8388361", "0.83513", "0.83427006", "0.82368946", "0.82358104", "0.8231629", "0.8231629", "0.8220099", "0.8172039", "0.8172039", "0.814523", "0.8135605", "0.8106544", "0.8097981", "0.8086314", "0.8084969", "0.8079539", "0.8073276", "0.8051568", "0.8048045", "0.80468994", "0.8029173", "0.8017512", "0.80064154", "0.7965337", "0.7963783", "0.79597515", "0.7950887", "0.7948318", "0.79401463", "0.7936686", "0.7935594", "0.7929816", "0.7928868", "0.7911115", "0.7908719", "0.7896364", "0.7872897", "0.78690076", "0.7866937", "0.7866693", "0.7864515", "0.7862316", "0.7843971", "0.7826204", "0.78219396", "0.7817181", "0.78150827", "0.78150827", "0.7810914", "0.7804305", "0.7803644", "0.7802577", "0.77897817", "0.7784777", "0.7783124", "0.7766115", "0.7761981", "0.77609235", "0.7759128", "0.7756929", "0.775653", "0.775653", "0.7746175", "0.7743986", "0.7731733", "0.7731519", "0.7730427", "0.77304065", "0.77304065", "0.7728888", "0.7727427", "0.77248746", "0.7715396", "0.7714574", "0.7706256", "0.7706207", "0.7701022", "0.77009255", "0.7700492", "0.7700048", "0.7694304", "0.7677937", "0.76721126", "0.76670265", "0.76541597", "0.7647264", "0.76417124", "0.7637578", "0.76327807" ]
0.0
-1
Write a method that can rotate the last n digits of a number. For example: input two integers : one integer to be rotated, and other is the number of digits output integer format string, array algorithm convert input num to string then to array of characters partition the array into two normal part and part to be rotated slice rot_array from second character to end add the second char to the back of slice above join the updated rot array to the non rot partition join the characters and convert to integers
def rotate_array(array) array.drop(1) + array.take(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_rightmost_digits(array, n)\n input_array = array.to_s.chars\n start_index = input_array.length - n\n sub_array = input_array[start_index..-1]\n sub_array_rotated = rotate_array(sub_array)\n output = input_array[0...start_index] + sub_array_rotated\n output.join(\"\").to_i\nend", "def rotate_rightmost_digits(number, n)\np all_digits = number.to_s.chars\n# all_digits[-n..-1] = rotate_array(all_digits[-n..-1])\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", "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 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(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 rotate_rightmost_digits(num, n)\n arr = num.to_s.chars\n arr[-n..-1] = arr[-n..-1].rotate\n arr.join.to_i\nend", "def rotate_rightmost_digits(num, n)\n num = num.digits.reverse\n rotators = num.pop(n)\n result = num + rotate_array(rotators)\n result.join.to_i\nend", "def rotate_rightmost_digits(num, n)\n arr = num.digits.reverse\n rotate_arr = rotate_array(arr.pop(n))\n (arr + rotate_arr).join.to_i\nend", "def rotate_rightmost_digits(number, slice)\n digits = number.to_s.chars\n digits[-slice..-1] = rotate_array(digits[-slice..-1])\n digits.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(num, n)\n [num.to_s[0..-(n+1)],rotate_array(num.to_s[-n..-1])].flatten.join('').to_i\nend", "def max_rotation(num)\n arr = num.digits.reverse\n 0.upto(arr.size - 1) do |i|\n sub_arr = arr[i..-1]\n rot_arr = sub_arr[1..-1] + [sub_arr[0]]\n arr[i..-1] = rot_arr\n end\n arr.join.to_i\nend", "def rotate_rightmost_digits(number, times)\n rotated_number = number.to_s.split('')\n rotated_number[(times * -1)..-1] = rotate_array(rotated_number[times*-1..-1])\n\n rotated_number.join('').to_i\nend", "def max_rotation(number)\n number_digits = number.to_s.length\n number = number.to_s.chars\n\n number_digits.times do |n|\n number[n-1..number_digits] = rotate_array(number[n-1..number_digits])\n end\n\n number.join('').to_i\nend", "def rotations(num)\n output = [num]\n digits = num.to_s.chars\n x = digits.count - 1\n x.times do\n first = digits.shift\n rotation = digits.push(first).join(\"\").to_i\n output << rotation\n end\n output\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(number, position)\n num_array = number.to_s.chars\n remainder_digits = num_array.delete_at(-position) # delete_at is a mutating method - original object changes\n num_array << remainder_digits\n num_array.join.to_i\nend", "def max_rotation(num)\n arr_num = num.digits.reverse\n arr_size = arr_num.size\n counter = 0\n while counter < arr_size - 1\n curr = arr_num[counter]\n arr_num.delete_at(counter)\n arr_num << curr\n counter += 1\n end\n arr_num.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 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, rotate)\n rotate = rotate * -1\n num_array = num.to_s.split(//)\n rotated_arr = []\n if num_array.length > 1\n num_array.each_index do |index|\n next if num_array[index] == num_array[rotate]\n rotated_arr.push(num_array[index])\n end\n end\n rotated_arr.push(num_array[rotate])\n rotated_arr.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(long_number, n)\n return long_number if n == 1\n arr = long_number.to_s\n (arr[0...-n] + arr[-n+1..-1] + arr[-n]).to_i\nend", "def max_rotation(num)\n arr = num.to_s.split(\"\")\n first_rotation = arr[1..-1] + [arr[0]]\n result = first_rotation\n if arr.size == 1\n return num\n elsif arr.size == 2\n return first_rotation.join.to_i\n else\n rotation_times = first_rotation.size - 2\n\n 1.upto(rotation_times) do |i|\n rotating_digit = result.delete_at(i)\n result.push(rotating_digit)\n end\n end\n return result.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(num, n)\n digits = num.to_s.chars\n digits << digits.delete_at(-n)\n digits.join.to_i\nend", "def max_rotation(num)\n arr = num.digits.reverse\n arrdup = arr.dup # this code works without reduces whats deleted/pushed in.\n arrdup.each_with_index do |_, idx|\n arr << arr.delete_at(idx) \n end\n arr.join.to_i\nend", "def max_rotation(nums)\n digits = nums.digits.reverse\n n = 0\n digits.size.times do\n rotated_num = digits[n..-1].shift\n digits.delete_at(n)\n digits = digits.push(rotated_num)\n n += 1\n end\n digits.join.to_i\nend", "def max_rotation(num)\n arr = num.digits.reverse\n 0.upto(num.digits.size - 1) do |idx|\n arr << arr.delete_at(idx)\n end\n arr.join.to_i\nend", "def max_rotation int\n final_string = ''\n string_digits = int.to_s.chars\n loop do\n string_digits = rotate_arr(string_digits)\n final_string << string_digits.shift\n break if string_digits.size < 1\n end\n final_string.to_i\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 rotate_rightmost_digits(num, digits)\n left, right = num.divmod(10**digits)\n [[left], rotate_array(right.to_s.chars)].join.to_i\nend", "def rotate_rightmost_digits(number, rotation_digit)\n new_number = [] # hold new digit order; join; to_i\n counter = 0 # loop through digits as array of strings\n loop do\n # loop through number add all but string at rotation_digit (as number from end)\n unless number.to_s.chars[-rotation_digit].to_i == number.to_s.chars[counter].to_i\n new_number << number.to_s.chars[counter].to_i\n end\n counter += 1\n break if new_number.size == number.to_s.chars.size - 1\n end\n number.to_s.chars.select { |n| new_number << n.to_i if n == number.to_s.chars[-rotation_digit] }\n new_number.join.to_i\nend", "def max_rotation(int)\n arr = int.digits.reverse\n arrdup = arr.dup # this code works without reduces whats deleted/pushed in.\n result = []\n arrdup.each.with_index do |_,idx|\n arr << arr[idx]\n arr.delete_at(idx)\n result = arr\n end\n result.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 max_rotation(num)\n digits = num.to_s.chars\n\n (digits.length - 1).times do |idx|\n digits << digits.delete_at(idx)\n end\n\n digits.join.to_i\nend", "def max_rotation(int)\n arr = int.to_s.chars\n\n arr.length.times do |i|\n arr << arr[i]\n arr.delete_at(i)\n end\n arr.join(\"\").to_i\nend", "def rotate_rightmost_digits(number, digit)\n string_number = number.to_s\n sliced_num = string_number[-digit]\n string_number.delete!(sliced_num)\n (string_number << sliced_num).to_i\nend", "def max_rotation(original_num)\ncount = original_num.to_s.size\ncount.downto(2) do |num|\noriginal_num = rotate_rightmost_digits(original_num, num)\nend\noriginal_num\nend", "def max_rotation(int)\n arr_size = int.digits.size\n max_rotations = arr_size - 1\n counter = 0\n while counter < max_rotations\n position = arr_size - counter\n int = rotate_rightmost_digits(int, position)\n counter += 1\n end\n int\nend", "def max_rotation(num)\n arr_size = num.digits.size\n arr_size.times do |idx|\n sign_idx = arr_size.odd? ? idx : -idx\n num = rotate_rightmost_digits(num, sign_idx)\n end\n num\nend", "def rotate_integer(integer)\n integer.to_s.chars.rotate.join.to_i\nend", "def max_rotation(number)\n num_length = number.to_s.length\n\n while num_length > 0\n number = rotate_rightmost_digits(number, num_length)\n num_length -= 1\n end\n\n number\nend", "def max_rotation(num)\n number_string = num.to_s\n\n number_string.size.downto(2) do |i|\n num = rotate_rightmost_digits(num, i)\n end\n num\nend", "def max_rotation(number)\n starting_num = number.to_s.length\n starting_num.downto(2) do |digits|\n number = rotate_rightmost_digits(number, digits)\n end\n number\nend", "def max_rot(n)\n count = n.to_s.chars.count\n i = 0\n arr = []\n arr.push(n)\n \n until i == count - 1\n n = n.to_s.chars\n n = (n[0...i] + n[i..-1].rotate).join.to_i\n arr.push(n)\n i += 1\n end\n \n arr.max\nend", "def max_rotation(number)\n number_digits = number.to_s.size\n number_digits.downto(2) do |n|\n number = rotate_rightmost_digits(number, n)\n end\n number\nend", "def max_rotation(number)\n number_digits = number.to_s.size\n number_digits.downto(2) do |n|\n number = rotate_rightmost_digits(number, n)\n end\n number\nend", "def max_rotation(int)\n rotated = int\n count = int.digits.size\n\n until count < 2\n rotated = rotate_rightmost_digits(rotated, count)\n count -= 1\n end\n rotated\nend", "def max_rotation(num)\n num.to_s.size.downto(2) do |rotators|\n num = rotate_rightmost_digits(num, rotators)\n end\n num\nend", "def max_rot(n)\n result = n\n n = n.to_s.chars\n len = n.length - 1\n n.each.with_index do |_value, i|\n n.push(n[i])\n n.delete_at(i)\n temp = n.join('').to_i\n if temp > result\n result = temp\n elsif i == len\n puts result\n return result\n end\n end\nend", "def max_rotation(int)\n int_digits = int.to_s.length\n rotation_iterations = int_digits - 1\n rotated_number = int\n rotation_iterations.times { |iteration| rotated_number = rotate_rightmost_digits(rotated_number, int_digits - iteration) }\n rotated_number\nend", "def max_rotation(num)\n num_out = num\n num.to_s.length.downto(1) {|n|\n num_out = rotate_rightmost_digits(num_out, n)\n }\n num_out.to_i\nend", "def max_rotation(i)\n i_out = 0\n list = []\n while i > 0 \n list.unshift(i%10)\n i /= 10\n end\n it = list.length \n list.each{|n| i += n ; i *= 10}\n i /= 10\n while it > 0\n i_out *= 10 # add decimal place to output\n if i / (10 ** (it-1)) == 0 # determines leading zero\n i *= 10 \n it-=1 # leading zero handling\n next \n end\n i = rotate_rightmost_digits(i,it) \n i_out += i / (10 ** (it-1)) # add first digit of i to output\n i %= 10 ** (it-1)\n it -= 1 \n end\n i_out\nend", "def max_rotation(number)\n num_array = number.to_s.split(//)\n rotation = num_array.length\n loop do\n break if rotation == 1\n number = rotate_rightmost_digits(number, rotation)\n rotation -= 1\n end\n number\nend", "def rotate_digits2(n, pos, excluded = [])\n a = n % 10**(pos + 1)\n r = n % 10**(pos)\n 0.upto(9) do |d|\n if excluded.first == d\n excluded.shift\n next\n end\n t = n - a\n t += d* 10**(pos)\n t += r\n yield t\n end\nend", "def RotateNumber (input)\n\tfirst = input[0]\n\tinput[0] = ''\n\tinput += first\nend", "def rotate_integer(integer)\n string = integer.to_s\n integer = rotate_string(string)\n integer.join.to_i # 'join' to join integers and to_i to convert string to int.\nend", "def rotate_array_fe(input)\n if input.is_a?(String)\n rotate_array(input.chars).join\n elsif input.is_a?(Integer)\n rotate_array(input.to_s.chars).join.to_i\n else \n rotate_array(input)\n end\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 max_rot(n)\n count = 1\n n_array = [n]\n n_chars = n.to_s.chars\n while count <= (n_chars.length - 1)\n n_chars.each_with_index do |char, index|\n n_chars.push(n_chars[index])\n n_chars.delete_at(index)\n n_array << n_chars.join.to_i\n count += 1\n end\n end\n return n_array.uniq.max\nend", "def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend", "def rotate3(num)\n length = num.inspect.length\n max_rotate = rotate2(num, length)\n loop do \n length -= 1\n max_rotate = rotate2(max_rotate, length)\n break if length == 0\n end\n max_rotate\nend", "def revrot(str, sz)\n return '' if sz <= 0\n chunks = str.scan(/.{#{sz}}/)\n chunks.map do |chunk|\n digits = chunk.chars\n sum = digits.map { |x| x.to_i ** 3 }.inject(:+)\n sum.even? ? digits.reverse : digits.rotate\n end.join\nend", "def circular_rotations(number)\n rotations = []\n if number.to_s.size == 1\n return rotations\n end\n digits = number.to_s.split(\"\").map { |x| x.to_i }\n (number.to_s.size-1).times {\n digits << digits.shift\n rotations << digits.to_s.to_i\n }\n return rotations\nend", "def max_rot(n)\n answer = Array.new\n rotation = 1\n index = 0\n answer << n\n loop do\n n = (n.to_s[0, index] + (n.to_s.split(\"\").pop(n.to_s.length - rotation).join) + n.to_s[index]).to_i\n answer << n\n rotation += 1\n index += 1\n if rotation >= n.to_s.length\n break\n end\n end\n return answer.max\nend", "def max_rot(num)\n numbers = []\n array = num.to_s.split('').map! {|x|x.to_i}\n i = 0\n while i < num.to_s.length\n array.insert(-1, array.delete_at(i))\n numbers << array.join('').to_i\n i+=1\n end\n numbers << num\n # numbers.uniq!.max\nend", "def rotate(array, number)\n\t#put the strings we want to move into a new string\n\tnewArray = array.shift\n\t#subtract the number\n\tnumber-=1\n\t#push the strings to the back of the array\n\tarray.push(newArray)\n\t#keep doing this until our number is 0\n\trotate(array, number) unless number ==0\nend", "def rotate(nums, k)\n right_part = nums.slice(nums.length - k, k)\n left_part = nums.slice(0, nums.length - k)\n\n return right_part + left_part\n\nend", "def rotate(n)\n self[n..-1].concat(self[0...n])\n end", "def rotate(unrotated)\n return '' if unrotated.empty?\n unrotated[1..-1] + unrotated[0]\nend", "def rotate(n=1)\n n.times {@rotor_array << @rotor_array.shift}\n end", "def array_rotation(arr, num)\n\tarr.rotate(num)\nend", "def rotate_array(numbers)\n numbers[1..-1] + [numbers[0]]\nend", "def rotate_array(numbers)\n numbers[1..-1] + [numbers[0]]\nend", "def rotate(n=1)\n if n == 1\n @position += 1\n @rotor_array << @rotor_array.shift\n else\n n.times do\n @position += 1\n @rotor_array << @rotor_array.shift\n end\n end\n end", "def rotate_array(arr, num)\n j = 0\n max = num\n len = arr.length - 1\n\n while j < max\n arr.unshift(arr[len])\n arr.pop()\n j += 1\n end\n return arr\n\nend", "def rotate(input)\n input[1..-1] << input[0]\nend", "def revrot(str, sz)\n return \"\" if sz == 0 || sz > str.length\n out = \"\"\n str.split(\"\").each_slice(sz).to_a.each do |i|\n return out if i.length < sz\n if i.reduce(0){ |sum,e| sum + (e.to_i)**3 } % 2 == 0 \n out += i.reverse!.join\n else\n out += i.rotate!.join\n end\n end\n out\nend", "def max_rotation(number)\n result = []\n current_number = number\n 5.times do |_|\n current_number = rotate_one_number(current_number)\n result << current_number\n end\n result\nend", "def rotate_array(array, number)\n number.times{array.unshift(array.pop)}\n array\nend", "def rotate(arr, n)\n curr_i = new_i = 0\n temp = new_val = arr[curr_i]; \n i = 0\n while (i < arr.length)\n curr_i = new_i\n\n #compute the new index for current value \n new_i = (arr.length - (n % arr.length) + curr_i) % arr.length; \n\n #take backup of new index value \n temp = arr[new_i]\n\n #assign the value to the new index \n arr[new_i] = new_val \n\n new_val = temp\n i+=1\n end\n arr\nend", "def revrot(str, sz)\n return \"\" if sz > str.length || sz <= 0 || str.length < 1\n\n chunk_arr = []\n transformed_chunks = []\n\n input_str_arr = str.chars\n\n until input_str_arr.length < sz\n chunk_arr << input_str_arr.shift(sz)\n end\n \n chunk_arr.each do |subarray|\n cube_arr = []\n subarray.each do |digit|\n cube_arr << digit.to_i ** 3\n end\n \n if cube_arr.sum % 2 == 0\n transformed_chunks << subarray.reverse\n else\n subarray.push(subarray.shift)\n transformed_chunks << subarray\n end\n \n end\n transformed_chunks.flatten.join('')\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 rotate(n)\n result = Octal.new\n result.size = size\n bits = 3 * size\n bit_mask = 2 ** bits - 1\n if n.value < 0\n result.value = ((value >> -n.value) | (value << (bits + n.value))) & bit_mask\n else\n result.value = ((value << n.value) | (value >> (bits - n.value))) & bit_mask\n end\n result\n end", "def rotations(x)\n\t digits = x.to_s.chars\n\t digits.map do\n\t digits.rotate!.join.to_i\n\t end\n\tend", "def rotate(list, n)\n head, tail = split(list, n >= 0 ? n % list.length : list.length + n)\n return tail + head\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 rotations(string)\n #array = string.split(//)\n #array2 = array.map {|element| }\n\n return (0...string.length).map { |i| (string * 2)[i, string.length] }\n\nend", "def rotate_array(numbers)\n new_numbers = []\n new_numbers << numbers[1,numbers.size] << numbers[0]\n new_numbers.flatten\nend", "def revrot(str, sz)\n return '' if sz <= 0\n # 文字数を指定して、文字列を分割する\n chunks = str.scan(/.{#{sz}}/)\n # 分割した文字列ごとに各数値の3乗の合計を計算し、偶数か奇数を判定する\n chunks.map do |chunk|\n digits = chunk.chars\n sum = digits.map {|x| x.to_i ** 3 }.inject(:+)\n sum.even? ? digits.reverse : digits.rotate\n end.join\nend", "def rotate_string(str)\n arr = str.chars\n rotate_array(arr).join\nend", "def reverse!(array)\n n = array.length\n p array.rotate(n)\nend", "def rotate_string(string)\n arr = string.chars\n str = rotate_array(arr).join\nend", "def rotate(nums, k)\n result = []\n len = nums.length\n for i in (len-k)...len\n result << nums[i]\n end\n \n for i in (0...len-k)\n result << nums[i]\n end\n \n result.each_with_index do |n, j|\n nums[j] = result[j]\n end\nend", "def rotate_string(str)\n rotate_array(str.chars).join\nend", "def rotate_string(str)\n rotate_array(str.chars).join\nend", "def rotate_string(str)\n rotate_array(str.chars).join\nend", "def digitize(n)\n split_array_numbers = n.to_s.split(//).map { |x| x.to_i}.reverse\nend" ]
[ "0.849868", "0.83939755", "0.8272897", "0.8267768", "0.8226593", "0.8161139", "0.8154906", "0.8150445", "0.8144105", "0.807286", "0.8058883", "0.80575687", "0.80546373", "0.8018729", "0.7981977", "0.78909534", "0.7873332", "0.7853329", "0.78415793", "0.7829765", "0.7808221", "0.7808221", "0.78054583", "0.77905256", "0.77783686", "0.77600145", "0.7680513", "0.76612073", "0.7655154", "0.7644009", "0.7643711", "0.75944376", "0.75862396", "0.7584742", "0.75667965", "0.7476056", "0.7475177", "0.74548763", "0.74531204", "0.7387427", "0.7326616", "0.7303745", "0.726989", "0.72581303", "0.7240548", "0.7225116", "0.7156829", "0.71560305", "0.7108902", "0.7108902", "0.70925456", "0.70764107", "0.70460945", "0.70169514", "0.69968456", "0.69863445", "0.6983696", "0.69784325", "0.6932399", "0.69072413", "0.6845333", "0.68393433", "0.6817518", "0.6748305", "0.665355", "0.66427803", "0.66404766", "0.6632671", "0.66249406", "0.6604441", "0.6603984", "0.6590147", "0.64826536", "0.647979", "0.64763075", "0.64408165", "0.64408165", "0.64315325", "0.6412715", "0.6410237", "0.63938934", "0.63931006", "0.63863134", "0.6383232", "0.6334151", "0.63326025", "0.63267", "0.6312207", "0.63105613", "0.630174", "0.6300819", "0.62908214", "0.6289952", "0.6288238", "0.6257476", "0.6252174", "0.62484354", "0.62410104", "0.62410104", "0.62410104", "0.6234968" ]
0.0
-1
Example: 34,592,129,909 => [3,4,5,9,2,1,2,9,9,0,9]
def num_to_array num array = [] div = 100000 while div >= 1 if (num / div) > 0 digit = num / div array << digit num = num - (div * digit) end div = div / 10 end return array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digit_list(num)\n arr = []\n divisor = 10**((num.to_s.length) - 1)\n \n while divisor >= 1\n digit = num/divisor\n arr << (num / divisor)\n num -= digit*divisor\n\n divisor = divisor / 10\n end\n \n arr\nend", "def given\n [6,5,3,1,8,7,2,3]\nend", "def cracklepop_numbers(from, to)\n (from..to).to_a.map { |n| cracklepop_number(n) }\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 split_number(start)\r\r\n number = []\r\r\n number[0] = start / 1000 / 1000\r\r\n number[1] = start / 1000 % 1000\r\r\n number[2] = start % 1000\r\r\n return number\r\r\n end", "def digit_list(num)\n result = []\n\n until num.zero?\n num, remainder = num.divmod(10)\n result.unshift(remainder)\n end\n result\nend", "def digit_list(num)\n int_array = []\n digit_array = num.to_s.split(//)\n digit_array.each do |numb|\n int_array += [numb.to_i]\n end\n int_array\nend", "def split_number(start)\n number = []\n number[0] = start / 1000 / 1000\n number[1] = start / 1000 % 1000\n number[2] = start % 1000\n return number\n end", "def digitArray(num)\n\tdigs = []\n\twhile num > 9\n\t\tnum, last_digit = num.divmod(10)\n\t\tdigs << last_digit\n\tend\n\tdigs << num\n\tdigs\nend", "def splitNumber(val)\n\tresArr = []\n\twhile(val >= 1)\n\t\tresArr.push(val % 10)\n\t\tval = val / 10\n\tend\n\tresArr\nend", "def list_of_nums(num)\n num.to_s.split('').map! {|n| n.to_i}\nend", "def digit_list(number)\r\n digits = []\r\n loop do\r\n number, remainder = number.divmod(10)\r\n digits.unshift(remainder)\r\n break if number == 0\r\n end\r\n digits\r\nend", "def digit_list(number)\n digits = number.to_s.split('')\n digits = digits.map { |digit| digit.to_i }\n digits\nend", "def digit_list(number)\n return number.abs.to_s.split('').map(&:to_i)\nend", "def digit_list(n)\n list = n.to_s\n list = list.split('')\n list = list.map do |i|\n i.to_i\n end\n return list\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 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 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 digit_list(number)\n digits = []\n\n loop do\n number, rem = number.divmod(10)\n digits.unshift(rem)\n\n break if number == 0\n end\n\n digits\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 digit_list(num)\n string = num.to_s\n array = string.split('')\n array.map {|num| num.to_i}\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 digitize(n)\n number_array =[] #convert n into a string to use split. Map lets us create a new array but we must convert back into int\n number_array = n.to_s.split(\" \").map(&:to_i) # SPLIT divided strings into substrings\n return number_array\n\nend", "def digit_list(num)\n digits = []\n\n loop do\n number, remainder = number.divmod(10)\n digits.unshift(remainder)\n break if number == 0\n end\n\n digits\nend", "def to_a (num)\n arr = []\n for i in Math.log10(num).floor.downto(0) # Range for separating each digit\n arr.push((num/10**i).floor - (num/10**(i+1)).floor * 10 )\n end\n return arr\nend", "def digit_list(num)\n num.to_s.chars.map {|val| val.to_i}\nend", "def wtf_nums()\r\n\tthe_wtf_num = [37107287533902102798797998220837590246510135740250, 46376937677490009712648124896970078050417018260538,\r\n\t\t\t\t\t74324986199524741059474233309513058123726617309629, 91942213363574161572522430563301811072406154908250,\r\n\t\t\t\t\t23067588207539346171171980310421047513778063246676, 89261670696623633820136378418383684178734361726757,\r\n\t\t\t\t\t28112879812849979408065481931592621691275889832738, 44274228917432520321923589422876796487670272189318,\r\n\t\t\t\t\t47451445736001306439091167216856844588711603153276, 70386486105843025439939619828917593665686757934951,\r\n\t\t\t\t\t62176457141856560629502157223196586755079324193331, 64906352462741904929101432445813822663347944758178,\r\n\t\t\t\t\t92575867718337217661963751590579239728245598838407, 58203565325359399008402633568948830189458628227828,\r\n\t\t\t\t\t80181199384826282014278194139940567587151170094390, 35398664372827112653829987240784473053190104293586,\r\n\t\t\t\t\t86515506006295864861532075273371959191420517255829, 71693888707715466499115593487603532921714970056938,\r\n\t\t\t\t\t54370070576826684624621495650076471787294438377604, 53282654108756828443191190634694037855217779295145,\r\n\t\t\t\t\t36123272525000296071075082563815656710885258350721, 45876576172410976447339110607218265236877223636045,\r\n\t\t\t\t\t17423706905851860660448207621209813287860733969412, 81142660418086830619328460811191061556940512689692,\r\n\t\t\t\t\t51934325451728388641918047049293215058642563049483, 62467221648435076201727918039944693004732956340691,\r\n\t\t\t\t\t15732444386908125794514089057706229429197107928209, 55037687525678773091862540744969844508330393682126,\r\n\t\t\t\t\t18336384825330154686196124348767681297534375946515, 80386287592878490201521685554828717201219257766954,\r\n\t\t\t\t\t78182833757993103614740356856449095527097864797581, 16726320100436897842553539920931837441497806860984,\r\n\t\t\t\t\t48403098129077791799088218795327364475675590848030, 87086987551392711854517078544161852424320693150332,\r\n\t\t\t\t\t59959406895756536782107074926966537676326235447210, 69793950679652694742597709739166693763042633987085,\r\n\t\t\t\t\t41052684708299085211399427365734116182760315001271, 65378607361501080857009149939512557028198746004375,\r\n\t\t\t\t\t35829035317434717326932123578154982629742552737307, 94953759765105305946966067683156574377167401875275,\r\n\t\t\t\t\t88902802571733229619176668713819931811048770190271, 25267680276078003013678680992525463401061632866526,\r\n\t\t\t\t\t36270218540497705585629946580636237993140746255962, 24074486908231174977792365466257246923322810917141,\r\n\t\t\t\t\t91430288197103288597806669760892938638285025333403, 34413065578016127815921815005561868836468420090470,\r\n\t\t\t\t\t23053081172816430487623791969842487255036638784583, 11487696932154902810424020138335124462181441773470,\r\n\t\t\t\t\t63783299490636259666498587618221225225512486764533, 67720186971698544312419572409913959008952310058822,\r\n\t\t\t\t\t95548255300263520781532296796249481641953868218774, 76085327132285723110424803456124867697064507995236,\r\n\t\t\t\t\t37774242535411291684276865538926205024910326572967, 23701913275725675285653248258265463092207058596522,\r\n\t\t\t\t\t29798860272258331913126375147341994889534765745501, 18495701454879288984856827726077713721403798879715,\r\n\t\t\t\t\t38298203783031473527721580348144513491373226651381, 34829543829199918180278916522431027392251122869539,\r\n\t\t\t\t\t40957953066405232632538044100059654939159879593635, 29746152185502371307642255121183693803580388584903,\r\n\t\t\t\t\t41698116222072977186158236678424689157993532961922, 62467957194401269043877107275048102390895523597457,\r\n\t\t\t\t\t23189706772547915061505504953922979530901129967519, 86188088225875314529584099251203829009407770775672,\r\n\t\t\t\t\t11306739708304724483816533873502340845647058077308, 82959174767140363198008187129011875491310547126581,\r\n\t\t\t\t\t97623331044818386269515456334926366572897563400500, 42846280183517070527831839425882145521227251250327,\r\n\t\t\t\t\t55121603546981200581762165212827652751691296897789, 32238195734329339946437501907836945765883352399886,\r\n\t\t\t\t\t75506164965184775180738168837861091527357929701337, 62177842752192623401942399639168044983993173312731,\r\n\t\t\t\t\t32924185707147349566916674687634660915035914677504, 99518671430235219628894890102423325116913619626622,\r\n\t\t\t\t\t73267460800591547471830798392868535206946944540724, 76841822524674417161514036427982273348055556214818,\r\n\t\t\t\t\t97142617910342598647204516893989422179826088076852, 87783646182799346313767754307809363333018982642090,\r\n\t\t\t\t\t10848802521674670883215120185883543223812876952786, 71329612474782464538636993009049310363619763878039,\r\n\t\t\t\t\t62184073572399794223406235393808339651327408011116, 66627891981488087797941876876144230030984490851411,\r\n\t\t\t\t\t60661826293682836764744779239180335110989069790714, 85786944089552990653640447425576083659976645795096,\r\n\t\t\t\t\t66024396409905389607120198219976047599490197230297, 64913982680032973156037120041377903785566085089252,\r\n\t\t\t\t\t16730939319872750275468906903707539413042652315011, 94809377245048795150954100921645863754710598436791,\r\n\t\t\t\t\t78639167021187492431995700641917969777599028300699, 15368713711936614952811305876380278410754449733078,\r\n\t\t\t\t\t40789923115535562561142322423255033685442488917353, 44889911501440648020369068063960672322193204149535,\r\n\t\t\t\t\t41503128880339536053299340368006977710650566631954, 81234880673210146739058568557934581403627822703280,\r\n\t\t\t\t\t82616570773948327592232845941706525094512325230608, 22918802058777319719839450180888072429661980811197,\r\n\t\t\t\t\t77158542502016545090413245809786882778948721859617, 72107838435069186155435662884062257473692284509516,\r\n\t\t\t\t\t20849603980134001723930671666823555245252804609722, 53503534226472524250874054075591789781264330331690]\r\n\t# try\r\n\treturn the_wtf_num.inject(0){ |sum, i| sum + i }\r\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_array(card_number)\n card_number.to_s.gsub(/ +/, '').reverse.split(//).map{|digit| digit.to_i}\n end", "def digit_list(num)\n num.to_s.split(//).map(&:to_i)\nend", "def digit_list(num)\n num.to_s.split(//).map(&:to_i)\nend", "def digit_list(number)\n list = number.to_s.split('').map { |i| i.to_i }\nend", "def digit_list(number)\n digits = []\n\n loop do\n break if number == 0\n\n digit = number % 10\n digits.unshift(digit)\n\n number = number / 10\n end\n\n digits\nend", "def unused_digits *integer_array\n remaining_nums = Array(0..9) - integer_array.flatten.join.scan(/\\d/).sort.map(&:to_i)\n remaining_nums.join.to_s\nend", "def substract_9_if_necessary(array)\n return array.map do |digit|\n if digit > 9\n digit - 9\n else\n digit\n end\n end\n end", "def split_to_array(number)\n number.to_s.chars.map(&:to_i)\n end", "def break_numbers_into_digits_into_array(number)\n array = number.to_s.split('').collect{|x| x.to_i} #changes string to int another way number.to_s.split('').map(&:to_i)\n return array\n end", "def digit_list(number)\n digits = []\n\n until number == 0 do\n digits.unshift(number % 10)\n number /= 10\n end\n\n digits\nend", "def populate_array(n)\n nums = []\n\n until n.zero?\n a = n % 10\n nums.push(a)\n n /= 10\n end\n\n nums\nend", "def digit_list(number)\n list = number.to_s.split('')\n list.map{ |item| item.to_i }\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 digit_list(num)\n num.to_s.chars.map(&:to_i)\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 digit_list(int)\r\n int.to_s.chars.map{|x| x.to_i }\r\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 find_uocs a\n\tarray = []\n\t(1..a).each_with_index do |i|\n\t\tif a%i == 0\n\t\t\tarray << i\n\t\tend\n\tend\n\tarray\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 digit_list(num)\n array = []\n \n num.to_s.each_char do |c| \n array.push(c.to_i)\n end\n array\nend", "def digit_list(number)\n number.to_s.chars.map { |char| char.to_i }\nend", "def digit_list(input)\n\n new_arr = input.to_s.chars\n \n new_arr.map {|element| element = element.to_i }\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 digit_list(int)\n string_ints = int.to_s\n array_string_ints = string_ints.split(//)\n ints = Array.new\n array_string_ints.each do |string|\n ints << string.to_i\n end\n return ints\nend", "def digitize(n)\n split_array_numbers = n.to_s.split(//).map { |x| x.to_i}.reverse\nend", "def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend", "def repeated_number_ranges(arr)\n\n\nend", "def digit_list(integer)\n integer.to_s.chars.map(&:to_i)\nend", "def numbers_array\n num_array = Array.new\n input_as_array.each { |n| num_array << get_number(n) }\n\n return num_array\n end", "def digit_list(number)\n string_array = number.to_s.split(\"\")\n string_array.map { |n| n.to_i }\nend", "def digit_list(num)\n if num < 10\n [num % 10]\n else\n num, digit = num.divmod(10)\n digit_list(num).push(digit)\n end\nend", "def digit_list(num)\n str = num.to_s\n nums = str.split(//)\n nums.map{|char| char.to_i}\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 digit_list(int)\n int.to_s.chars.map { |n| n.to_i }\nend", "def digit_list(integer)\n integer.digits.reverse\nend", "def p13\n\tnumbers = [\n\t\t37107287533902102798797998220837590246510135740250,\n\t\t46376937677490009712648124896970078050417018260538,\n\t\t74324986199524741059474233309513058123726617309629,\n\t\t91942213363574161572522430563301811072406154908250,\n\t\t23067588207539346171171980310421047513778063246676,\n\t\t89261670696623633820136378418383684178734361726757,\n\t\t28112879812849979408065481931592621691275889832738,\n\t\t44274228917432520321923589422876796487670272189318,\n\t\t47451445736001306439091167216856844588711603153276,\n\t\t70386486105843025439939619828917593665686757934951,\n\t\t62176457141856560629502157223196586755079324193331,\n\t\t64906352462741904929101432445813822663347944758178,\n\t\t92575867718337217661963751590579239728245598838407,\n\t\t58203565325359399008402633568948830189458628227828,\n\t\t80181199384826282014278194139940567587151170094390,\n\t\t35398664372827112653829987240784473053190104293586,\n\t\t86515506006295864861532075273371959191420517255829,\n\t\t71693888707715466499115593487603532921714970056938,\n\t\t54370070576826684624621495650076471787294438377604,\n\t\t53282654108756828443191190634694037855217779295145,\n\t\t36123272525000296071075082563815656710885258350721,\n\t\t45876576172410976447339110607218265236877223636045,\n\t\t17423706905851860660448207621209813287860733969412,\n\t\t81142660418086830619328460811191061556940512689692,\n\t\t51934325451728388641918047049293215058642563049483,\n\t\t62467221648435076201727918039944693004732956340691,\n\t\t15732444386908125794514089057706229429197107928209,\n\t\t55037687525678773091862540744969844508330393682126,\n\t\t18336384825330154686196124348767681297534375946515,\n\t\t80386287592878490201521685554828717201219257766954,\n\t\t78182833757993103614740356856449095527097864797581,\n\t\t16726320100436897842553539920931837441497806860984,\n\t\t48403098129077791799088218795327364475675590848030,\n\t\t87086987551392711854517078544161852424320693150332,\n\t\t59959406895756536782107074926966537676326235447210,\n\t\t69793950679652694742597709739166693763042633987085,\n\t\t41052684708299085211399427365734116182760315001271,\n\t\t65378607361501080857009149939512557028198746004375,\n\t\t35829035317434717326932123578154982629742552737307,\n\t\t94953759765105305946966067683156574377167401875275,\n\t\t88902802571733229619176668713819931811048770190271,\n\t\t25267680276078003013678680992525463401061632866526,\n\t\t36270218540497705585629946580636237993140746255962,\n\t\t24074486908231174977792365466257246923322810917141,\n\t\t91430288197103288597806669760892938638285025333403,\n\t\t34413065578016127815921815005561868836468420090470,\n\t\t23053081172816430487623791969842487255036638784583,\n\t\t11487696932154902810424020138335124462181441773470,\n\t\t63783299490636259666498587618221225225512486764533,\n\t\t67720186971698544312419572409913959008952310058822,\n\t\t95548255300263520781532296796249481641953868218774,\n\t\t76085327132285723110424803456124867697064507995236,\n\t\t37774242535411291684276865538926205024910326572967,\n\t\t23701913275725675285653248258265463092207058596522,\n\t\t29798860272258331913126375147341994889534765745501,\n\t\t18495701454879288984856827726077713721403798879715,\n\t\t38298203783031473527721580348144513491373226651381,\n\t\t34829543829199918180278916522431027392251122869539,\n\t\t40957953066405232632538044100059654939159879593635,\n\t\t29746152185502371307642255121183693803580388584903,\n\t\t41698116222072977186158236678424689157993532961922,\n\t\t62467957194401269043877107275048102390895523597457,\n\t\t23189706772547915061505504953922979530901129967519,\n\t\t86188088225875314529584099251203829009407770775672,\n\t\t11306739708304724483816533873502340845647058077308,\n\t\t82959174767140363198008187129011875491310547126581,\n\t\t97623331044818386269515456334926366572897563400500,\n\t\t42846280183517070527831839425882145521227251250327,\n\t\t55121603546981200581762165212827652751691296897789,\n\t\t32238195734329339946437501907836945765883352399886,\n\t\t75506164965184775180738168837861091527357929701337,\n\t\t62177842752192623401942399639168044983993173312731,\n\t\t32924185707147349566916674687634660915035914677504,\n\t\t99518671430235219628894890102423325116913619626622,\n\t\t73267460800591547471830798392868535206946944540724,\n\t\t76841822524674417161514036427982273348055556214818,\n\t\t97142617910342598647204516893989422179826088076852,\n\t\t87783646182799346313767754307809363333018982642090,\n\t\t10848802521674670883215120185883543223812876952786,\n\t\t71329612474782464538636993009049310363619763878039,\n\t\t62184073572399794223406235393808339651327408011116,\n\t\t66627891981488087797941876876144230030984490851411,\n\t\t60661826293682836764744779239180335110989069790714,\n\t\t85786944089552990653640447425576083659976645795096,\n\t\t66024396409905389607120198219976047599490197230297,\n\t\t64913982680032973156037120041377903785566085089252,\n\t\t16730939319872750275468906903707539413042652315011,\n\t\t94809377245048795150954100921645863754710598436791,\n\t\t78639167021187492431995700641917969777599028300699,\n\t\t15368713711936614952811305876380278410754449733078,\n\t\t40789923115535562561142322423255033685442488917353,\n\t\t44889911501440648020369068063960672322193204149535,\n\t\t41503128880339536053299340368006977710650566631954,\n\t\t81234880673210146739058568557934581403627822703280,\n\t\t82616570773948327592232845941706525094512325230608,\n\t\t22918802058777319719839450180888072429661980811197,\n\t\t77158542502016545090413245809786882778948721859617,\n\t\t72107838435069186155435662884062257473692284509516,\n\t\t20849603980134001723930671666823555245252804609722,\n\t\t53503534226472524250874054075591789781264330331690,\n\t]\n\n\tsum = numbers.reduce(:+)\n\tsum.to_s[0..9].to_i\nend", "def doubler(numbers)\n new_arr = []\n i = 0\n while i < numbers.length\n old_numbers = numbers[i]\n new_numbers = old_numbers * 2\n new_arr << new_numbers\n i += 1\n end\n return new_arr\nend", "def number_to_digit_array(number, max_size=0)\n array = []\n while number != 0\n array << number % 10\n number /= 10\n end\n (0..((max_size)-(array.length)-1)).each do |x|\n array << 0\n end\n array.reverse\n end", "def get_digits(num)\n digits = []\n result = num \n first_iter_flag = true\n while(result != 0)\n result = result/10 if(!first_iter_flag)\n first_iter_flag = false if(first_iter_flag)\n digits.unshift result%10 if(result != 0)\n end\n digits\nend", "def counting_sort(input_arr, exp = 0)\n count_arr = Array.new(10, 0)\n result = Array.new(input_arr.size)\n \n m = 10**(exp+1)\n n = 10**exp \n \n #count occurence of currently significant digit\n #if exp == 0 than 5 is the currently significant digit in 135\n input_arr.each do |item|\n signif_number = (item%m)/n\n count_arr[signif_number] += 1\n end\n\n #modify count_arr to show actual index\n for i in 1...10 \n count_arr[i] = count_arr[i-1] + count_arr[i]\n end\n \n #creat output array\n i = input_arr.size - 1\n until i < 0 do\n item = input_arr[i]\n signif_number = (item%m)/n\n count_arr[signif_number] -= 1\n result[count_arr[signif_number]] = item\n i -= 1\n end\n result\nend", "def num_array(num)\n arr = Array.new\n \n until num <= 0\n arr.push(num % 10)\n num = num / 10\n end\n\n until arr.length == 4\n arr.push(0)\n end\n arr\nend", "def dig_number(number)\n arr_dig = number.to_s.chars\n count = arr_dig.size\n arr_dig.map {|dig| dig.to_i ** count} \nend", "def offbyonenumber(my_number, bash_numbers)\n\tcounter = 0\n\tx = 0\n\tarr1 = []\n\tmy_number.each do |num|\n\t\tbash_numbers.each do |bash|\n\t\t\tnum.length.times do\n\t\t\t\tif bash[x] == num[x]\n\t\t\t\t\t\tcounter += 1\n\t\t\t\t\tif counter == num.length - 1\n\t\t\t\t\t\tarr1<< num\n\t\t\t\t\t\tcounter = 0\n\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\t\tx += 1\n\t\t\tend\n\t\tend\n\tend\n\tarr1.uniq!\n\tp arr1\n\treturn arr1\nend", "def counter_effect(hit_count)\n hits = []\n digits = hit_count.split(\"\").map {|num| num.to_i}\n digits.each do |digit|\n \tcurrent_values = []\n \tfor num in 0..digit\n \t\tcurrent_values.push(num)\n \tend\n \thits.push(current_values)\n end\n return hits\nend", "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 lister(int)\n\tint.to_s.split('').map { |element| element.to_i }\nend", "def double_digits\n times_by_2.map do |number|\n if number > 9\n number - 9\n else\n number\n end\n end\nend", "def get_divisors(number)\n\tresult = []\n\n \tfor counter in 1..number / 2\n \tresult.push(counter) if number % counter == 0\n \tend\n\n \tresult.push(number)\n \tresult\nend", "def digit_list(integer)\n integer.digits.reverse\nend", "def find_relative_ranks(nums)\n output = Array.new(nums.length, nil)\n sorted_nums = nums.sort\n rank = nums.length\n \n sorted_nums.each do |n|\n idx = nums.find_index(n)\n \n ranking = case rank\n when 1\n \"Gold Medal\"\n when 2\n \"Silver Medal\"\n when 3\n \"Bronze Medal\"\n else\n rank.to_s\n end\n \n output[idx] = ranking\n rank -= 1\n end\n output\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 doubler(numbers)\n new_numbers = []\n # numbers.each { |num| new_numbers << num * 2 }\n numbers.each { |num| new_numbers.push(num * 2) }\n new_numbers\nend", "def element_times_index(numbers)\n \n i = 0 # i represents to the index current index always\n \n new_array = []\n \n while i < numbers.length # We cant do less than or equal to here\n \n new_array << numbers[i] * i # You can shovel directly into a new array\n i += 1\n end\n return new_array\nend", "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 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 count_to(num)\n arr = []\n num = num.to_int\n num > 0 ? 0.upto(num){|i| arr.push(i)} : 0.upto(-num){|i| arr.push(-i)}\n return arr\n end", "def num_cycler\n\tproducts = []\n\n\t999.times do |z|\n\t\tx = 999 - z\n\t\ty = 999\n\t\tnext if (x < 100)\n\t\twhile (y > 99)\n\t\t\tif (palindrome_check(x * y))\n\t\t\t\tputs 'x=' + x.to_s + ' y=' + y.to_s\n\t\t\t\tproducts.push(x * y)\n\t\t\tend\n\t\t\ty -= 1\n\t\tend\n\tend\n\treturn products.sort.last\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 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 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 input_as_array\n array = number.split('')\n\n return array.collect! { |x| x.to_i }\n end", "def straight_values_from(from)\n (from.to_i...from.to_i + 5).to_a\n end", "def element_times_index(numbers)\n multiplied_numbers = []\n \n i = 0\n while i < numbers.length\n multiplied_numbers << numbers[i] * i\n \n i += 1\n end\n \n return multiplied_numbers\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 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 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 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 slices(n)\n digits.each_cons(n).to_a\n end" ]
[ "0.6796014", "0.67468256", "0.66053814", "0.658939", "0.65767604", "0.6517231", "0.6487109", "0.6483543", "0.64770216", "0.6473975", "0.64121974", "0.64044446", "0.6392021", "0.6385052", "0.6381544", "0.6380667", "0.63645804", "0.63514507", "0.63497907", "0.6341346", "0.63396055", "0.6321637", "0.6320431", "0.6317512", "0.63111657", "0.63098216", "0.6309245", "0.62954146", "0.62954146", "0.62954146", "0.62954146", "0.62954146", "0.6278462", "0.6269175", "0.6269175", "0.6268178", "0.626157", "0.62431747", "0.6237277", "0.62348765", "0.6233999", "0.62317455", "0.6220654", "0.62188214", "0.62150675", "0.6209625", "0.6207323", "0.62049145", "0.62037474", "0.62028474", "0.6202082", "0.6197134", "0.619134", "0.61791825", "0.6178926", "0.61557996", "0.6155576", "0.61436176", "0.6123973", "0.6116355", "0.6114448", "0.6112947", "0.6098898", "0.6096496", "0.6093981", "0.60809046", "0.60783714", "0.6071799", "0.60638285", "0.6061424", "0.6055185", "0.6042602", "0.60345364", "0.60261506", "0.6022334", "0.60190827", "0.6017719", "0.5999373", "0.5993898", "0.5986939", "0.5981499", "0.59809124", "0.5977669", "0.5975572", "0.5975345", "0.5974924", "0.59713405", "0.59705824", "0.5967261", "0.5965753", "0.5965576", "0.59641737", "0.5959426", "0.59532976", "0.5945879", "0.59441817", "0.5942093", "0.5941679", "0.5936168", "0.59359205" ]
0.67473537
1
Creates a new GetDecksResponse
def initialize(response) handle_errors(response) JSON.parse(response.body).each do |key, value| if key == 'decks' # Keep the API response count, it will differ when invalid decks are stripped @decks_count = value.size instance_variable_set( "@#{key}".to_sym, value.map { |deck| ZombieBattleground::Api::Models::Deck.new(deck) } ) else instance_variable_set("@#{key}".to_sym, value) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend", "def create_response(request)\n response = Response.new\n end", "def initialize(response)\n handle_errors(response)\n\n @deck = ZombieBattleground::Api::Models::Deck.new(JSON.parse(response.body))\n end", "def stub_new_dataset\n deposition_id = rand.to_s[2..8].to_i\n simple = simple_body(deposition_id: deposition_id)\n stub_request(:post, 'https://sandbox.zenodo.org/api/deposit/depositions?access_token=ThisIsAFakeToken')\n .with(headers: { 'Content-Type' => 'application/json' })\n .to_return(status: 200,\n body: simple.merge(state: 'unsubmitted').to_json,\n headers: { 'Content-Type' => 'application/json' })\n [deposition_id, simple[:links][:bucket]]\n end", "def make_stock_card_deck\n self.stock_cards = StockCard.all\n end", "def respond(request_type='', options={})\n opts = {'apiKey' => @api_key, 'trackingId' => @tracking_id}\n options.each do |key, value|\n opts[key.to_s.camelize(:lower)] = value\n end\n\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] #{opts.inspect}\"\n\n base_url = (@sandbox ? 'http://sandbox.api.shopping.com/publisher/3.0/rest' : 'http://publisher.usb.api.shopping.com/publisher/3.0/rest')\n target_url = \"#{base_url}/#{request_type}\"\n\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] Target URL: #{target_url}\"\n\n response = HTTParty.get(target_url, :query=>opts)\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] #{response.inspect}\"\n\n target_key = ''\n response.parsed_response.each_key do |key|\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] KEY: #{key}\"\n target_key = key\n end\n\n # now we decide what kind of response object gets returned\n # invoke the correct constructor based on the value of target_key\n response_class = SDC.const_get(\"#{target_key}\")\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] FOO: #{response_class.class.name}\"\n# puts \"#{__FILE__}:#{__LINE__} [#{__method__}] FOO: #{response_class.new(response)}\"\n\n\n response_class.new(response)\n end", "def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end", "def show\n @response = Response.new\n @responses = @ticket.responses\n end", "def request_get(token)\n url = \"https://api.spotify.com/v1/browse/new-releases?limit=2\"\n\n options = {\n headers: {\n \"Content-Type\": 'application/json',\n \"Accept\": 'application/json',\n \"Authorization\": \"Bearer #{token}\"\n }\n }\n\n return my_request = HTTParty.get(url, options)\nend", "def response(arguments = {})\n Response.new(self, arguments)\n end", "def response(url)\n space_fix_encoder = AssignFast::SpaceFixEncoder.new\n Faraday.get(url) do |req|\n req.options.params_encoder = space_fix_encoder\n req.headers['Accept'] = 'application/json'\n end\n end", "def create(options)\n API::request(:post, 'close_offering_requests', options)\n end", "def get(url, query = {})\n query[:format] ||= @format\n OEmbed::Response.create_for(raw(url, query), self, url, query[:format].to_s)\n end", "def stock_dividends_with_http_info(symbol, from, to, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stock_dividends ...'\n end\n # verify the required parameter 'symbol' is set\n if @api_client.config.client_side_validation && symbol.nil?\n fail ArgumentError, \"Missing the required parameter 'symbol' when calling DefaultApi.stock_dividends\"\n end\n # verify the required parameter 'from' is set\n if @api_client.config.client_side_validation && from.nil?\n fail ArgumentError, \"Missing the required parameter 'from' when calling DefaultApi.stock_dividends\"\n end\n # verify the required parameter 'to' is set\n if @api_client.config.client_side_validation && to.nil?\n fail ArgumentError, \"Missing the required parameter 'to' when calling DefaultApi.stock_dividends\"\n end\n # resource path\n local_var_path = '/stock/dividend'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'symbol'] = symbol\n query_params[:'from'] = from\n query_params[:'to'] = to\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Dividends>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#stock_dividends\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_deck\r\n session[:deck] || Deck.new(:title => \"untitled deck\")\r\n end", "def create\n @deck = Deck.new_from_api\n\n respond_to do |format|\n if @deck.save\n format.html { redirect_to @deck, notice: 'Deck was successfully created.' }\n format.json { render :show, status: :created, location: @deck }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(data)\n @response = data\n @id = data[\"id\"]\n @name = data[\"name\"]\n @market = data[\"market\"]\n @alias = data[\"alias\"]\n @reference = data[\"reference\"]\n @efficiency = data[\"efficiency\"]\n @first_downs = data[\"first_downs\"]\n @interceptions = data[\"interceptions\"]\n @touchdowns = data[\"touchdowns\"]\n @possession_time = data.dig('summary', \"possession_time\")\n @avg_gain = data.dig('summary', \"avg_gain\")\n @safeties = data.dig('summary', \"safeties\")\n @turnovers = data.dig('summary', \"turnovers\")\n @play_count = data.dig('summary', \"play_count\")\n @rush_plays = data.dig('summary', \"rush_plays\")\n @total_yards = data.dig('summary', \"total_yards\")\n @lost_fumbles = data.dig('summary', \"lost_fumbles\")\n @penalty_yards = data.dig('summary', \"penalty_yards\")\n @return_yards = data.dig('summary', \"return_yards\")\n end", "def new\n @card = @deck.cards.new\n @decks = Deck.all(:order => 'title')\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @card }\n end\n end", "def index\n uri = URI(\"http://107.170.7.58:4567/api/department\")\n parameters = {\"ext\" => \"json\", \"count\" => \"1000\"}\n response = Net::HTTP.post_form(uri, parameters)\n\n list = JSON.parse(response.body)\n @departments = Array.new\n list.each do |department|\n @departments.push Department.new(department['data'])\n end\n\n page = params[:page]\n offset = page.to_s+\"0\"\n @prevPage = page.to_i-1\n @nextPage = page.to_i+1\n\n if params[:department]\n department = params[:department]\n @departmentName = @departments[department.to_i-1].name\n\n parameters = {\"ext\" => \"json\", \"count\" => \"10\", \"offset\" => offset, \"department_id\" => department}\n else\n parameters = {\"ext\" => \"json\", \"count\" => \"10\", \"offset\" => offset}\n end\n\n uri = URI(\"http://107.170.7.58:4567/api/sell\")\n response = Net::HTTP.post_form(uri, parameters)\n\n list = JSON.parse(response.body)\n\n @sells = Array.new\n @books = Array.new\n list.each do |listing|\n if listing[\"kind\"].eql? \"sell\"\n @sells.push Sell.new(listing[\"data\"])\n else if listing[\"kind\"].eql? \"book\"\n @books[listing[\"data\"][\"id\"]] = Edition.new(listing[\"data\"])\n end\n end\n end\n end", "def new\n @deck = Deck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deck }\n end\n end", "def new\n @deck = Deck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deck }\n end\n end", "def response\n @response ||= self.class.get(@events_url, @options)\n end", "def make_eds_response(data, params = nil)\n docs = eds_documents(data)\n params ||= {}\n options = { documents: docs, blacklight_config: blacklight_config }\n blacklight_config.response_model.new(data, params, options)\n end", "def empty_response\n rates = Rates.new([], [], [])\n ParsedEntries.new(\"\", \"\", \"\", \"\", [], rates, [])\n end", "def index\n @decks = current_user.decks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def get(options = {})\n @response_xml = options[:cache_file] ? File.read(options[:cache_file]) : http_get(options)\n response = Response.parse(response_xml, options) do | inner_response, elements |\n parse_reports(inner_response, elements)\n end\n response.response_items.first # there is is only one\n end", "def show\n @item_response = Hash.new \n @item_response[:item] = Array.new \n\n temp_item = Hash.new\n temp_item[:title] = @item.title\n temp_item[:description] = @item.description\n temp_item[:price] = @item.price\n temp_item[:status] = @item.status\n unless @item.status.eql?('banned')\n temp_item[:published_date] = @item.published_date\n temp_item[:Seller_Name] = Seller.find(@item.seller_id).name\n end\n @item_response[:item] << temp_item\n \n render json: {response: @item_response, count: @item_response[:item].count }, status: :ok\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def index\n @decks = Deck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decks }\n end\n end", "def to_response\n []\n end", "def build_response\n { status: :success, data: {} }\n end", "def create_deck(num_decks)\n ## Initializing the card deck\n @num_decks = num_decks\n @cards = SUITE * @num_decks * 4 ## replicate the suite 4 times to form 1 deck, and replicate 1 dec num times to form num decks in the shoe\n @max_deck_mod = @max_deck_mod * @num_decks ## figure out the max modulo, in this impl , i will just repeat cards from 0 ... modulo-1 , 0 ...\n 10.times {@cards.shuffle! } ## Shuffle the shoe 10 times\n @deck_index = 0\n end", "def new\n @bid = @swarm_request.bids.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end", "def build_response!\n Accounts::TransactionsSerializer.new(account_model!, scope: transactions_count)\n end", "def get_products_by_department\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def getDeck(name = @cur_deck_name)\n\n end", "def to_response\n slice(:id, :username, :cash, :referrals).to_json\n end", "def new\n @deck = Deck.new\n end", "def get_department\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def build_response\n enrich_object(fawry_api_response)\n end", "def [](value)\n data = super\n if data.is_a?(Hash)\n SportsApiResponse.new(data)\n elsif data.is_a?(Array)\n data.collect { |entry| SportsApiResponse.new(entry) }\n else\n data\n end\n end", "def createDeck\n deck = []\n for suit in @@cardSuits\n for symbol in @@symbolVals.keys\n if symbol != \"AA\"\n deck << Card.new(symbol, suit)\n end\n end\n end\n\n return deck\n end", "def response(url)\n Faraday.get(url) { |req| req.headers['Accept'] = 'application/json' }\n end", "def response(url)\n Faraday.get(url) { |req| req.headers['Accept'] = 'application/json' }\n end", "def query_depts\n { 'respDepartment' => Newspilot.configuration.departments }\n end", "def new\n @response_format = ResponseFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @response_format }\n end\n end", "def avaiable_decks\n Deck.all.map { |d| [d.name, d.id] }\n end", "def stub_responses\n Creditsafe::Api::DummyResponse.new\n end", "def show\n @company = Company.find(params[:id])\n @company_offers = @company.offers.order(:close_date)\n @company_deals = @company.deals.order(:close_date)\n respond_with(@company)\n end", "def create\n deck_name = params[:name]\n @deck = Deck.create(:name => deck_name)\n\n SUITS.each do |suit| \n VALUES.each do |value| \n Card.create(:deck_id => @deck.id, :suit => suit, :value => value)\n end\n end\n\n render json: [@deck, @deck.cards] \n end", "def response #:nodoc:\n current_params = request.params\n @response ||= {}\n return @response[current_params] if @response.has_key? current_params\n response_object = Response.new self\n response_object.load_data\n @response[current_params] = response_object\n end", "def new\n @symbol_bank = SymbolBank.new\n respond_with @symbol_bank\n end", "def new\n @decklist = Decklist.new\n end", "def get\n res = connection.get url.to_s\n Response.const_get(class_basename).new res.body, res.status\n end", "def search\n Response::Response.new(self)\n end", "def get(url, options={})\n resp = RestClient.get url, rest_client_options(options)\n Representation.new self, MultiJson.load(resp)\n end", "def show\n @response = Response.new\n end", "def raw_data_to_response_object(data)\n case data['status']\n when 'success'\n if data['flags']['paginated'] && data['data'].is_a?(Array)\n MoonropeClient::Responses::PaginatedCollection.new(self, data)\n else\n MoonropeClient::Responses::Success.new(self, data)\n end\n when 'parameter-error' then MoonropeClient::Responses::ParameterError.new(self, data)\n when 'access-denied' then MoonropeClient::Responses::AccessDenied.new(self, data)\n when 'validation-error' then MoonropeClient::Responses::ValidationError.new(self, data)\n else\n MoonropeClient::Response.new(self, data)\n end\n end", "def new\n @book = Book.new\n\n do_response @book\n end", "def card_deck\n CardDeck.new(card: @subject)\n end", "def cards\n @cards ||= EbanqApi::Cards.new(self)\n end", "def new\n @yahoo_deal = YahooDeal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yahoo_deal }\n end\n end", "def stock_symbols_with_http_info(exchange, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stock_symbols ...'\n end\n # verify the required parameter 'exchange' is set\n if @api_client.config.client_side_validation && exchange.nil?\n fail ArgumentError, \"Missing the required parameter 'exchange' when calling DefaultApi.stock_symbols\"\n end\n # resource path\n local_var_path = '/stock/symbol'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'exchange'] = exchange\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Stock>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#stock_symbols\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def downloads\n @downloads ||= ApiFactory.new 'Projects::Downloads'\n end", "def response(env)\n uid = env.params['uid']\n if uid.nil?\n [200, {}, erb(:default, :locals => {:uid => nil, :pub0 => nil, :page => nil})]\n else\n pub0 = env.params['pub0']\n page = env.params['page']\n begin\n\n offers = Application.offersService.getOffers(uid, pub0, page)\n [200, {}, erb(:offers, :locals => {:offers => offers, :uid => uid, :pub0 => pub0, :page => page})]\n rescue Exception => error\n [200, {}, erb(:error, :locals => {:errorMsg => error.message, :uid => uid, :pub0 => pub0, :page => page})]\n end\n end\n end", "def public_deck # Shows all public decks\n if params[:sort] == \"Number of Users\"\n @decks = Deck.most_users\n elsif params[:sort] == \"Newest Created\"\n @decks = Deck.newest_created\n elsif params[:sort] == \"Oldest Created\"\n @decks = Deck.oldest_created\n else \n @decks = Deck.newest_created\n end\n\n if params[:search]\n @decks = Deck.search(params[:search])\n end \n end", "def fetch(request) \n\t\ttable_name = @model.table_name\n\t\tdata = request.data\n\t\t# check the advanced cretira\n\t\tunless request.advancedCriteria.nil?\t\t\t\n\t\t\tquery = buildAdvancedCriteria(request, table_name)\n\t\t\t@obj_items = @model.find_by_sql(query) \n\t\telse\n\t\t\tunless request.data.empty?\n\t\t\t\tquery = buildStandardCriteria(request, table_name)\n\t\t\t\t@obj_items = @model.find_by_sql(query) \n\t\t\telse\n\t\t\t\t@obj_items = @model.find(:all) \n\t\t\tend\n\t\tend\t\t \n\t\tobjs_count = @obj_items.count\n\t\t# get the count of the obj_items \n\t\tendRow = (objs_count > 0)?objs_count - 1 : objs_count\n\n\t\t# make the Response result object \n\t\tresponse = DSResponse.new\n\t\tresponse.data = @obj_items\n\t\tresponse.startRow = 0\n\t\tresponse.endRow = endRow\n\t\tresponse.status = 0\n\t\tresponse.totalRow = objs_count \n\n\t\treturn response \n end", "def new\n @trackkr_module = TrackkrModule.new\n\n respond_with [@trackkr_module]\n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def department\n response = create_request(API_ENDPOINT, DEPARTMENTS_URI)\n arrange_response(response)\n end", "def get_response\n raise NotImplementedError.new(\"method not overriden\")\n end", "def new(options = {}, &block)\n respond_with(build_resource, options, &block)\n end", "def create_Found_Response(request_path)\n\tbody = File.read(request_path)\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(body)\n\tgeneric_Generate_Response(initial,headers,body)\nend", "def legacy_responses(options = {})\n raise :InvalidFormat unless [:xml, :csv, :html].member? format.to_sym\n format = options[:format].to_s.upcase\n\n get 'getLegacyResponseData', 'Format' => format\n end", "def call\n with(response: response)\n end", "def new\n @response = Response.find(params[:response_id])\n #@request_selection = @response.request_selections.build\n @request_selection = @response.build_request_selection\n #@request_selection = RequestSelection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request_selection }\n end\n end", "def cards\n # all_cards = {}\n object.stock_cards.map do |stock|\n {id: stock.id, user_id: stock.user_id, company: stock.company, buy_price: stock.buy_price, sell_price: stock.sell_price}\n end\n end", "def get_chart(options={})\n api_response = @api_client.make_api_request(:GET, \"artist/chart\", {}, options)\n @api_client.chart_item_digestor.list_from_xml(api_response.content.chart)\n end", "def prepare_result(response)\n stocks = []\n column_names = response['dataset']['column_names']\n\n response['dataset']['data'].each do |row|\n stock = Stock.new(associate_with_columns(column_names, row))\n stock.set_drawdown\n \n # API return sorted by date in descending order we need in asending order\n @stocks.prepend(stock)\n end\n\n @sorted_stocks = @stocks.sort { |a, b| a.drawdown <=> b.drawdown }\n end", "def create\n @deck = Deck.find_or_create_by_quizlet_id params[:deck][:quizlet_id]\n @deck.handle_id = params[:deck][:handle_id]\n\n require \"net/https\"\n require \"uri\"\n uri = URI.parse(\"https://api.quizlet.com/2.0/sets/#{@deck.quizlet_id}?client_id=ABPPhBBUAN&whitespace=1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n @qdeck = JSON.parse response.body\n\n @deck.save\n\n @group = Group.find_or_create_by_deck_id_and_default @deck.id, true\n @group.update_attributes :name => \"Default\"\n\n @deck.title = @qdeck['title']\n @qdeck['terms'].each do |t|\n card = Card.find_or_create_by_quizlet_id t['id']\n card.front = t['term']\n card.back = t['definition']\n @deck.cards << card\n @group.cards << card\n card.save\n end\n\n respond_to do |format|\n if @deck.save\n format.html { redirect_to edit_deck_path(@deck), notice: 'Deck was successfully created.' }\n format.json { render json: @deck, status: :created, location: @deck }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deck.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @purchased_stock = PurchasedStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchased_stock }\n end\n end", "def new\n @purchased_stock = PurchasedStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchased_stock }\n end\n end", "def create \n @cart = Cart.create({User_id: cart_params[\"id\"]})\n \n @response = {\n cart: @cart,\n items: Item.all\n }\n \n render json: @response.to_json\n end", "def new\n @chart = Chart.new\n respond_with(@chart)\n end", "def new\n @deck = current_user.decks.build\n @deck.name = \"#{current_user.decks.count + 1}. #{current_user.name}'s deck\"\n @deck.mainboard = '1;Black Lotus'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deck }\n end\n end", "def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end", "def index\n @decks = Deck.all\n end", "def index\n @decks = Deck.all\n end", "def index\n @decks = Deck.all\n end", "def index\n @decks = Deck.all\n end", "def get_response\n GopDataTrustAdapter::Response.new(self.api, get_response!)\n end", "def response_for_offer_create(params)\n {\"response\" => { \"status\" => 1, \"data\" => rand(1_000_000).to_s } }\n end", "def get_records\n return error_response unless is_get_records_request?\n as_json\n end", "def get_closed_prs(client)\n # search for GitHub issues and sort search results\n pull_requests = client.search_issues(\"state:closed author:santos22 type:pr\", options = {sort: \"created\", order: \"asc\"})\n\n result = pull_requests.to_h\n pr_info = result.to_json\n pr_arr = JSON.parse(pr_info)\n data = pr_arr['items'].map { |pr| PullRequest.new(pr['title'], pr['html_url'], format_date(pr['closed_at']) , pr['comments']) }\n\n # return response\n headers['Access-Control-Allow-Origin'] = '*'\n content_type :json\n data.to_json\nend", "def initialize\n\n response = list\n end", "def response\n @response ||= datasource_response['docs']\n end", "def returns\n election_uri = params[:election]\n return unless check_election(ClearElection.read(election_uri), now: :closed)\n\n ballot_records = BallotRecord.where(election_uri: election_uri)\n\n render json: {\n ballotsIssued: ballot_records.count,\n ballotsCast: ballot_records.where(cast: true).count,\n ballots: ballot_records.where(cast: true).order(:ballotId).pluck(:ballot_json, :demographic).map{|ballot_json, demographic| demographic ? ballot_json.merge(demographic: demographic) : ballot_json}\n }, status: 200\n\n end", "def create_deck\n @deck = CARDS.product(SUITS).shuffle\n end", "def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @response }\n end\n end", "def parse(data)\n WSDiscovery::Response.new(data)\n end" ]
[ "0.5612215", "0.5533734", "0.5371256", "0.52257246", "0.5163544", "0.515944", "0.51577", "0.5107998", "0.5074359", "0.50703037", "0.50401974", "0.50234216", "0.5021981", "0.4982436", "0.49554443", "0.49522188", "0.49125293", "0.49082685", "0.48954833", "0.4892001", "0.4892001", "0.48678428", "0.4851912", "0.4846921", "0.48399127", "0.48196232", "0.4814806", "0.48088458", "0.48088458", "0.4797934", "0.4797861", "0.4783919", "0.47839135", "0.4782802", "0.4779206", "0.4773239", "0.47712055", "0.47711048", "0.47370353", "0.47339836", "0.47252485", "0.47206426", "0.4716684", "0.4716684", "0.4713181", "0.47051528", "0.47009325", "0.46987894", "0.46966282", "0.46954387", "0.46909967", "0.46888864", "0.4683914", "0.46837673", "0.46776626", "0.46700537", "0.46565828", "0.46536136", "0.46479005", "0.46468607", "0.4646316", "0.46434718", "0.46386197", "0.46366704", "0.46353152", "0.4631666", "0.46304142", "0.46226266", "0.46167418", "0.46062303", "0.46051216", "0.46038", "0.46027386", "0.46025357", "0.4601371", "0.45990855", "0.4597835", "0.45966825", "0.4590201", "0.4586779", "0.45803636", "0.45803636", "0.457984", "0.45731467", "0.45715055", "0.4570135", "0.45697716", "0.45697716", "0.45697716", "0.45697716", "0.45648232", "0.4560914", "0.45575693", "0.45463225", "0.45435065", "0.45366853", "0.45331508", "0.45299494", "0.45290017", "0.45284623" ]
0.5753592
0
Validator for decks attribute
def decks_is_an_array_of_deck unless @decks.is_a?(Array) errors.add(:decks, 'Decks must be an array') return end if remove_invalid remove_invalid_decks else decks_contains_valid_decks end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_exclusion_of(attr); end", "def valid_attribute?( attroid )\n\t\treturn !self.valid_attribute_type( attroid ).nil?\n\tend", "def valid_attributes\n {:name => 'Test it!', \n :deck_id => 1}\n end", "def value_required?\n false\nend", "def is_attribute?; end", "def required_attribute(name, options={:level=>:error})\n\t\t\t\tvalidate(\"Macro '#{@name}' requires a '#{name}' attribute\", options) do\n\t\t\t\t\t!raw_attribute(name.to_sym).blank?\n\t\t\t\tend\n\t\t\tend", "def is_valid; end", "def check_required_attributes\n attributes = DSL.attributes.values.select(&:required?)\n attributes.each do |attr|\n value = spec.send(attr.name)\n unless value && (!value.respond_to?(:empty?) || !value.empty?)\n if attr.name == :license\n results.add_warning('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n else\n results.add_error('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n end\n end\n end\n end", "def attr_need_validation? attr\n return false unless required_attributes\n required_attributes.include?(attr)\n end", "def caprese_is_attribute?(attribute_name)\n false\n end", "def check_attribute!(attribute)\n raise \"Unexpected attribute #{attribute} used\" unless self.class.attributes && self.class.attributes.include?(attribute)\n end", "def check_attribute!(attribute)\n raise \"Unexpected attribute #{attribute} used\" unless self.class.attributes && self.class.attributes.include?(attribute)\n end", "def validated?; end", "def validate_required(model, key)\n if model.get_attribute(key).nil?\n [ :error, \"A value is required for attribute: '#{key}'\" ]\n else\n [ :ok, \"\" ]\n end\n end", "def required?(name); end", "def other_attributes_valid?(exclude_attribute)\n subject.valid?\n (attributes - [exclude_attribute]).all? do |attribute|\n subject.errors[attribute].empty?\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def validator; end", "def has_required?\n false\n end", "def attr_required?(klass, attribute)\n klass.validators_on(attribute).map(&:class).include?(\n ActiveModel::Validations::PresenceValidator)\n end", "def validate(value)\n if required? && (value == nil || value == \"\") && (default == nil || default == \"\")\n return \"#{name} is a required attribute\"\n end\n # TODO: add type validation here\n nil\n end", "def validate_required(model, key)\n if model.get_attribute(key).nil?\n [ :error, \"A value is required for attribute: '#{key}'\" ]\n else\n [ :ok, \"\" ]\n end\n end", "def missing_required(attr = 'name')\n fail MissingRequired, \"Cannot store data without a #{attr} attribute.\"\n end", "def mark_required(object, attribute) \n \"*\" if object.class.validators_on(attribute).map(&:class).include? ActiveModel::Validations::PresenceValidator \n end", "def read_attribute_for_validation(key)\n super\n end", "def read_attribute_for_validation(key)\n super\n end", "def validate\n true\n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def required\n { must_exclude_attrs: %i[] }\n end", "def has_required?; end", "def validate!\n true\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def validate_under_age\n self.is_under_age = (self.age < SADHAK_MIN_AGE)\n errors.empty?\n end", "def validators_for?(attribute)\n !validators_for(attribute).empty?\n end", "def validate_attributes!(attributes)\n return missing_required unless attributes.key?(:name)\n return missing_required unless defined_value?(attributes[:name])\n\n true\n end", "def validated?(name)\n true\n end", "def attribute_required?(attribute)\n validates_presence?(attribute) || validates_inclusion?(attribute)\n end", "def validate!\n required_attributes.each do |attribute|\n if form_data[attribute].nil? || form_data[attribute].empty?\n raise Adyen::REST::RequestValidationFailed, \"#{attribute} is empty, but required!\"\n end\n end\n end", "def invalid?(attribute)\n !@errors[attribute.to_s].nil?\n end", "def validate!\n # pass\n end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def validate_command_attrs\n self.class.validation_logics.each do |attr, logics|\n val = self.instance_variable_get(\"@#{attr}\".to_sym)\n logics.each do |l|\n unless l.call(self, attr, val)\n raise \"validation error : #{attr}=#{val} (#{self.class})\"\n end\n end\n end\n end", "def validate\n super \n end", "def validate\n if self.line_item_problem_type.form_tag == 'wrong_dvd' && self.wrong_copy_id.nil?\n errors.add_to_base(\"Barcode number is required\")\n end\n end", "def invalid?(attribute)\n !@errors[attribute.to_sym].nil?\n end", "def invalid?(attribute)\n !@errors[attribute.to_sym].nil?\n end", "def attribute?\n false\n end", "def is_valid\n\tend", "def is_valid\n\tend", "def guard_required!\n required.each do |key|\n raise ArgumentError, \"Missing required attribute #{key}\" if self[key].nil?\n end\n end", "def is_valid?\n end", "def validate\n raise NoMethodError, \"must define method 'validate'\"\n end", "def validate(spec)\n raise \"undefined method -- `validate'\"\n end", "def should_be_partially_valid_except(*attrs)\n invalid_attributes = []\n all_attrs = self.instance_variables.map {|iv| iv.gsub('@','')}\n # use the key names from @attributes for ActiveRecord objects\n all_attrs = self.attributes.keys if self.instance_variables.include?('attributes')\n attrs.each do |attr_name|\n invalid_attributes << attr_name.to_s\n end\n should_be_valid_on = all_attrs - invalid_attributes\n should_be_partially_valid_on(should_be_valid_on)\n end", "def invalid?(attribute)\n !@errors[attribute.to_s].nil?\n end", "def invalid?(attribute)\n !@errors[attribute.to_s].nil?\n end", "def validate_attribute(property_name)\n valid_properties = odata_service.properties_for_entity(odata_entity_set.type)\n unless valid_properties[property_name.to_s]\n raise ArgumentError, \"property #{property_name} does not exist for #{odata_entity_set.type} entity\"\n end\n end", "def validate\n end", "def validates_absence_of(*attr_names)\n validates_each(attr_names) do |record, attr_name, value|\n if record.send(attr_name)\n record.errors.add(\n attr_name,\n :invalid,\n :default => \"mistakenly tried to instantiate #{self.to_s} with attribute \\\"#{attr_name}\\\"\"\n )\n end\n end\n end", "def valid_attribute_type( attroid )\n\t\treturn self.valid_attribute_types.find {|attr_type| attr_type.valid_name?(attroid) }\n\tend", "def validate\r\n @invalid=false\r\n end", "def validate\n @invalid=false\n end", "def valid_attributes\n { :free => false,\n :details => nil,\n :expense_item_id => @exp.id\n }\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validation_default; false; end", "def valid_attributes\n {\n name: \"Unlimited\",\n award_title_name: \"10k Unlimited\",\n scoring_class: \"Freestyle\"\n }\n end", "def valid_attributes\n { \"name\" => \"Band\", \"creation_year\" => 2008 }\n end", "def validate\n fail 'sub class to implement'\n end", "def validate\n super\n end", "def validate!\n\t\t\t\treturn true\n\t\t\tend", "def attribute_parameter?(name)\n name.end_with?('_min') || name.end_with?('_max') || name.end_with?('_exclude')\n end", "def must_have_value?\n return false\n end", "def is_valid\n return true\n end", "def valid?(_) true end", "def valid?(_) true end", "def validate_item( x )\n fail 'not implemented!'\n end", "def validate_attrs!(attrs)\n raise error.new('The :_id must not be nil.') if attrs[:_id].nil?\n raise error.new('The :_client reference is missing.') if attrs[:_client].nil?\n end", "def validated; end", "def validate\n end", "def validate\n end", "def validate\n end", "def value_valid?\n return true\n end", "def check_option!(name, definition)\n case name\n when :values\n raise AttributorException, \"Allowed set of values requires an array. Got (#{definition})\" unless definition.is_a? ::Array\n when :default\n raise AttributorException, \"Default value doesn't have the correct attribute type. Got (#{definition.inspect})\" unless type.valid_type?(definition) || definition.is_a?(Proc)\n options[:default] = load(definition) unless definition.is_a?(Proc)\n when :description\n raise AttributorException, \"Description value must be a string. Got (#{definition})\" unless definition.is_a? ::String\n when :required\n raise AttributorException, 'Required must be a boolean' unless definition == true || definition == false\n raise AttributorException, 'Required cannot be enabled in combination with :default' if definition == true && options.key?(:default)\n when :required_if\n raise AttributorException, 'Required_if must be a String, a Hash definition or a Proc' unless definition.is_a?(::String) || definition.is_a?(::Hash) || definition.is_a?(::Proc)\n raise AttributorException, 'Required_if cannot be specified together with :required' if options[:required]\n when :example\n unless definition.is_a?(::Regexp) || definition.is_a?(::String) || definition.is_a?(::Array) || definition.is_a?(::Proc) || definition.nil? || type.valid_type?(definition)\n raise AttributorException, \"Invalid example type (got: #{definition.class.name}). It must always match the type of the attribute (except if passing Regex that is allowed for some types)\"\n end\n when :custom_data\n raise AttributorException, \"custom_data must be a Hash. Got (#{definition})\" unless definition.is_a?(::Hash)\n else\n return :unknown # unknown option\n end\n\n :ok # passes\n end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def supports_validate_constraints?\n false\n end", "def supports_validate_constraints?\n false\n end", "def skip_validations\n true\n end", "def subclass_validations ; true ; end", "def valid?\n !name.nil?\n end", "def valid?\n !name.nil?\n end", "def valid?\n !name.nil?\n end" ]
[ "0.7276079", "0.61786276", "0.6087367", "0.6049549", "0.604743", "0.597744", "0.59737676", "0.5950207", "0.59392685", "0.58715093", "0.5847882", "0.5847882", "0.58447707", "0.58327436", "0.5800344", "0.5771799", "0.57700604", "0.5767541", "0.57667875", "0.5763943", "0.57511395", "0.5745557", "0.574547", "0.5730115", "0.572041", "0.572041", "0.57200104", "0.5715026", "0.5702477", "0.56548136", "0.56279665", "0.56271374", "0.56261235", "0.5613164", "0.56081575", "0.560387", "0.5602716", "0.55986196", "0.55836874", "0.558323", "0.55793315", "0.5576966", "0.5574918", "0.55682176", "0.555918", "0.555918", "0.5549526", "0.5547663", "0.5547663", "0.5542639", "0.5542532", "0.55377346", "0.553154", "0.5526347", "0.55254567", "0.55254567", "0.5483852", "0.5483774", "0.548014", "0.5479979", "0.54760647", "0.5475348", "0.54737896", "0.5473398", "0.5473398", "0.5473398", "0.5467781", "0.5467781", "0.5467781", "0.5467781", "0.5465165", "0.545967", "0.5452218", "0.5450889", "0.54403925", "0.54399055", "0.5433835", "0.5430797", "0.54300755", "0.54258394", "0.54258394", "0.5424014", "0.54218304", "0.54031444", "0.5398361", "0.5398361", "0.5398361", "0.5397256", "0.53968763", "0.53963345", "0.53963345", "0.53963345", "0.53963345", "0.53963345", "0.5394777", "0.5394777", "0.5394149", "0.5392453", "0.5387455", "0.5387455", "0.5387455" ]
0.0
-1
Validator for decks in decks
def decks_contains_valid_decks @decks.each do |deck| next if deck.is_a?(ZombieBattleground::Api::Models::Deck) && deck.valid? && deck.errors.size.zero? errors.add(:decks, 'decks must be an array of Deck') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_invalid_decks\n @decks.select! do |deck|\n deck.is_a?(ZombieBattleground::Api::Models::Deck) &&\n deck.valid? &&\n deck.errors.size.zero?\n end\n end", "def decks_is_an_array_of_deck\n unless @decks.is_a?(Array)\n errors.add(:decks, 'Decks must be an array')\n return\n end\n\n if remove_invalid\n remove_invalid_decks\n else\n decks_contains_valid_decks\n end\n end", "def validate\n # valid if list of headers identical to list of drills and data items combined\n # except that there may be dummy units, algorithm columns\n headers.each do |header|\n if !(definition.drill.keys+definition.data.keys+['units','algorithm','default']).include?(header)\n raise \"Header missing from itemdef: #{header}, itemdef has: #{(definition.drill.keys+definition.data.keys+['units','algorithm','default']).join(',')}\"\n end\n end\n (definition.drill.keys+definition.data.keys+['units']).each do |key|\n raise \"Header missing from data table: #{key}\" if !headers.include?(key)\n end\n end", "def validate_empty\n if self.units.count > 0\n errors.add(:units, \"must not exist in order for a unit to be deleted\")\n throw(:abort)\n elsif self.collections.count > 0\n errors.add(:collections, \"must not exist in order for a unit to be deleted\")\n throw(:abort)\n end\n end", "def deck_is_a_deck\n return if @deck.is_a?(ZombieBattleground::Api::Models::Deck) &&\n @deck.valid? &&\n @deck.errors.size.zero?\n\n errors.add(:deck, 'deck must be a Deck')\n end", "def valid_sets; end", "def validate_suppliers!\n data.each do |supplier_name, config|\n REQUIRED_FIELDS.each do |field|\n result = config[field]\n raise MissingFieldError.new(supplier_name, field) if (result.nil? || result.to_s.empty?)\n end\n \n validate_workers!(supplier_name, config[\"workers\"])\n end\n end", "def valid?(set); end", "def validate!\n if identifier.to_s.empty?\n raise ValidationError.new(\"identifier is required\")\n else\n [image_changes.created,\n image_changes.updated,\n unit_changes.created,\n unit_changes.updated].each do |collection|\n collection.each(&:validate!)\n end\n\n true\n end\n end", "def validate_records\n have_enough_items_to_trade?\n end", "def has_invalid_items?\n unless @offer[:items].empty? || @offer[:items].select { |item_name|\n !Inventory.items_and_values.include?(item_name)}.empty?\n add_error(:offer, :items, \"There is an invalid item in the list\")\n error = true\n end\n unless @for[:items].empty? || @for[:items].select { |item_name|\n !Inventory.items_and_values.include?(item_name)}.empty?\n add_error(:for, :items, \"There is an invalid item in the list\")\n error = true\n end\n\n error ||= false\n end", "def validate!\n # Require that at least one field exist.\n if fields.length == 0\n raise SkyDB::Query::ValidationError.new(\"At least one selection field is required for #{self.inspect}.\")\n end\n\n fields.each do |field|\n field.validate!\n end\n\n groups.each do |group|\n group.validate!\n end\n end", "def validate_items\n not(empty_item_list? or has_invalid_items? ||\n has_different_point_values?) ? true : false\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:vessel_code => self.vessel_code}],self)\n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_vessel\n\t end\nend", "def satisfied?\n self.enrollments.group_by(&:quarter).map do |quarter, enrollments|\n units = enrollments.map(&:units).reduce(:+)\n unless MIN_UNITS <= units and MAX_UNITS >= units\n self.errors << quarter.to_s.bold + \" has \" + units.to_s.bold.red + \" units!\"\n end\n end\n self.errors.empty?\n end", "def check_items_balances\n details.select(&:marked_for_destruction?)\n .all?(&:valid_for_destruction?)\n end", "def require_quantities\n \tunless self.dishes.count > 0\n \t\terrors.add(:order, \"must have dishes\")\n \tend\n end", "def valid?\n validate_survivors and validate_items && validate_records\n end", "def valid_input?(id_list)\n return false if id_list.empty?\n id_list.each do |id, quan|\n return false unless Product.where(\"id =?\", id).first\n return false if (quan.nil? || quan <=0)\n end\n end", "def cards_validation\n if cards.any?(&:invalid?)\n errors[:base] << 'Wallet has an invalid card'\n end\n end", "def validate_items\n [buyer_items, seller_items].each do |items|\n fail InvalidItemsError unless items.kind_of?(Enumerable)\n end\n end", "def validate( list )\n # reuse the highline lambda to santize input\n return true if (@allow_empty_list && list.nil?)\n list = highline_question_type.call( list ) if !list.is_a? Array\n return false if !list.is_a?(Array)\n return false if (!@allow_empty_list && list.empty? )\n list.each{ |item|\n return false if !validate_item( item )\n }\n true\n end", "def validate_item( x )\n fail 'not implemented!'\n end", "def validate_buried\n if buried\n if units.where.not(buried: true).count > 0\n errors.add(:base, \"This unit cannot be deleted, as it contains at \"\\\n \"least one child unit.\")\n throw(:abort)\n elsif collections.where.not(buried: true).count > 0\n errors.add(:base, \"This unit cannot be deleted, as it contains at \"\\\n \"least one collection.\")\n throw(:abort)\n end\n end\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pack_material_product_code => self.pack_material_product_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_pack_material_product\n\t end\nend", "def validate \n #\tfirst check whether combo fields have been selected\n is_valid = true\n if is_valid\n is_valid = ModelHelper::Validations.validate_combos([{:qc_test_id => self.qc_test_id}],self) \n end\n # #now check whether fk combos combine to form valid foreign keys\n # if is_valid\n # is_valid = set_qc_test\n # end\n # if is_valid\n # is_valid = ModelHelper::Validations.validate_combos([{:qc_inspection_type_code => self.qc_inspection_type_code}],self) \n # end\n # #now check whether fk combos combine to form valid foreign keys\n # if is_valid\n # is_valid = set_qc_inspection_type\n # end\n end", "def validate\n if self.line_item_problem_type.form_tag == 'wrong_dvd' && self.wrong_copy_id.nil?\n errors.add_to_base(\"Barcode number is required\")\n end\n end", "def valid?\n @errors << :title if !@title.is_a?(String) || @title.empty?\n @errors << :author if !@author.is_a?(String) || @author.empty?\n @errors << :release_date unless @release_date.is_a?(Date)\n @errors << :publisher if !@publisher.is_a?(String) || @publisher.empty?\n @errors << :isbn unless @isbn.is_a?(Integer) && @isbn < 10**10 && @isbn >= 10**9\n \n @errors.empty?\n end", "def valid_group(cards)\n puts validate(cards)\nend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rmt_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def set_num_decks(num_decks)\n if (MIN_NUM_DECKS..MAX_NUM_DECKS ).member?(num_decks)\n @num_decks = num_decks\n return true\n else\n return false\n end\n end", "def is_valid\n for card in self\n if !card.is_valid\n return false\n end\n end\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:artist_name => self.artist_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_artist\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate\n errors.add_to_base \"Enter atleast one product\" if items.empty?\n end", "def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bck_[a-zA-Z0-9]+$/)\n return false if @auto_reorder.nil?\n return false if @threshold_amount.nil?\n return false if @url.nil?\n return false if @url.to_s.length > 2083\n return false if @url.to_s.length < 1\n return false if @raw_url.nil?\n return false if @raw_url.to_s.length > 2083\n return false if @raw_url.to_s.length < 1\n return false if @front_original_url.nil?\n return false if @front_original_url.to_s.length > 2083\n return false if @front_original_url.to_s.length < 1\n return false if @back_original_url.nil?\n return false if @back_original_url.to_s.length > 2083\n return false if @back_original_url.to_s.length < 1\n return false if @thumbnails.nil?\n return false if @available_quantity.nil?\n return false if @allocated_quantity.nil?\n return false if @onhand_quantity.nil?\n return false if @pending_quantity.nil?\n return false if @projected_quantity.nil?\n return false if @buckslip_orders.nil?\n return false if @buckslip_orders.length < 0\n return false if @stock.nil?\n stock_validator = EnumAttributeValidator.new('String', [\"text\", \"cover\"])\n return false unless stock_validator.valid?(@stock)\n return false if @weight.nil?\n weight_validator = EnumAttributeValidator.new('String', [\"80#\"])\n return false unless weight_validator.valid?(@weight)\n return false if @finish.nil?\n finish_validator = EnumAttributeValidator.new('String', [\"gloss\", \"matte\"])\n return false unless finish_validator.valid?(@finish)\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', [\"processed\", \"rendered\"])\n return false unless status_validator.valid?(@status)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"buckslip\"])\n return false unless object_validator.valid?(@object)\n return false if @description.to_s.length > 255\n size_validator = EnumAttributeValidator.new('String', [\"8.75x3.75\"])\n return false unless size_validator.valid?(@size)\n true\n end", "def validate_data\n inputs = Set.new(node.in_slots.map(&:carrier))\n effs = Set.new(dependencies)\n\n unless inputs.subset?(effs)\n # One or more efficiencies are missing.\n errors.add(:base, error_msg(:efficiencies, inputs, effs))\n end\n\n unless effs.subset?(inputs)\n # One or more input shares are missing.\n errors.add(:base, error_msg(:inputs, effs, inputs))\n end\n end", "def valid_subset?\n return true if self.class.subsets.keys.include?(subset.to_s.to_sym)\n errors.add(:subset, :invalid) if respond_to?(:errors)\n false\n end", "def valid_card_type\n return if self.card_type.blank? or not self.member\n if !(self.member.club.allowed_card_types.include?(self.card_type))\n errors.add(:kaarttype, \"wordt niet toegelaten door deze club\")\n end\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:report_type_code => self.report_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_report_type\n\t end\nend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rule_code => self.rule_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rule\n\t end\nend", "def validate\n # first check whether combo fields have been selected\n is_valid = true\n end", "def validate_unique_kit_per_group\n if self.class.exists?(:kit_id => kit_id, :group_id => group_id)\n errors.add :kit, 'already exists in this group'\n end\n end", "def flexible_budget_checker(budget, total)\n\nend", "def valid_subset?\n valid = true\n schema.traverse do |key_path, value|\n actual = self.ref(key_path)\n missing = actual.nil?\n valid = valid && !missing\n end\n valid\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t \n\t if is_valid\n\t is_valid = set_drench_concentrate_status\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:drench_line_type_code => self.drench_line_type_code}],self) \n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = set_drench_station\n#\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:concentrate_code => self.concentrate_code}],self) \n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = set_concentrate_product\n#\t end\nend", "def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end", "def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end", "def validate\n super\n errors.add(:name, \"can't be empty\") if name.blank?\n errors.add(:category_id, \"can't be empty\") if category_id.blank?\n errors.add(:price, \"can't be empty\") if price.blank?\n end", "def validate(*groceries)\n invalid_items = groceries - @inventory_items\n Response.new(data: groceries - invalid_items,\n errors: build_error_messages(invalid_items))\n end", "def valid?\n @errors = []\n \n # checks each field type and adds error messages if it does not meet requirements from the table\n validate_field_types\n \n \n if integer?(\"num_quarter_hours\")\n if num_quarter_hours < 1\n @errors << {message: \"Number of quarter hours must be greater than 0.\", variable: \"num_quarter_hours\"}\n end\n end\n \n @errors.empty?\n end", "def validate_line_items\n \n end", "def valid; end", "def validate_suit(c)\n Card::VALID_SUITS.include?(c)\n end", "def validate\n # add errors if not validate\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def invalid_items\n items.select { |item| item.errors.present? }\n end", "def validate\n errors.add_to_base(\"Your Volume is to long, can only store 4 characters!\") if self.volume.to_s.length > 4\n errors.add_to_base(\"Your Number is to long, can only store 3 characters!\")if self.number.to_s.length > 3\n errors.add_to_base(\"Your Semester is to long, can only store 6 characters!\")if self.semester.to_s.length > 6\n end", "def cards_has_required_count\n return if errors.messages.size.zero? &&\n cards.sum(&:amount) == DECK_REQUIRED_CARDS_COUNT\n\n errors.add(:cards, 'cards must add up to 30')\n end", "def validate(options); end", "def validate\n\t\tself.options.validate(self.datastore)\n\tend", "def validate(_options = 0)\n []\n end", "def control_sin_items_comprobantes\n if [detalles].any? {|detalle| detalle.any? }\n self.errors[:base] = \"error que queres hacer?\"\n return false\n end \n end", "def validate\n ModelHelper::Validations.validate_combos([{:grade_code => self.grade_code}],self,true) \n \n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t #is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t #is_valid = set_spray_program_result\n\t end\nend", "def valid?\n bag = BagIt::Bag.new @path\n bag.valid?\n end", "def combo_validation(combo)\n combo.each do |word|\n next if %w[yin yang].include?(word)\n raise TypeError, 'Combo have to be an Array of yin or yang values'\n end\n end", "def validate_inventory()\n validated = true\n line_item_total = 0\n line_item_hash = Hash.new \n self.line_items.each do |line_item|\n line_item_hash[line_item.variant_id] = line_item.quantity\n line_item_total += line_item.quantity\n end\n \n \n inventory_total = 0\n inventory_hash = Hash.new \n self.inventory_units.each do |unit|\n inventory_total += 1\n if inventory_hash.has_key?(unit.variant_id)\n inventory_hash[unit.variant_id] += 1\n else\n inventory_hash[unit.variant_id] = 1\n end \n end\n \n validated = false if (inventory_total != line_item_total)\n self.line_items.each do |line_item|\n validated = false if line_item_hash[line_item.variant_id] != inventory_hash[line_item.variant_id]\n break if !validated \n end\n \n raise \"inventory_units not matched with line item: \" + self.number if !validated\n\n\n shipping_events_total = 0\n shipping_events_hash = Hash.new\n self.shipments.first.shipping_events.each do |se|\n se.inventory_units.each do |unit|\n # puts se.id.to_s + \"#\" + unit.id.to_s\n # puts se.shipped_at\n # puts unit.state \n shipping_events_total += 1\n if se.is_shipped?\n validated = false if unit.state != 'returned' && unit.state != 'shipped' \n else\n validated = false if unit.state == 'shipped'\n end\n \n \n break if !validated \n end\n end\n \n \n raise \"inventory_units state not matched with shipping events: \" + self.number if !validated\n \n validated = false if (inventory_total != shipping_events_total)\n # puts inventory_total\n # puts shipping_events_total\n raise \"inventory_units total not matched with shipping events: \" + self.number if !validated\n \n return validated \n \n end", "def validate \n#\tfirst check whether combo fields have been selected\n is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:port_id => self.port_id}],self,nil,true)\n set_port if is_valid\n end\n\n\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:voyage_port_type_id => self.voyage_port_type_id}],self,nil,true)\n \n\n\t\nend", "def validate\n\t#first check whether combo fields have been selected\n\t is_valid = true\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:farm_code => self.farm_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rmt_variety_code => self.rmt_variety_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pack_material_product_code => self.pack_material_product_code}],self)\n\t end\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code}],self)\n\t end\n\n\t #now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_farm\n\t end\n\n\t if is_valid\n\t\t is_valid = set_rmt_variety\n\t end\n\n\t if is_valid\n\t\t is_valid = set_pack_material_product\n\t end\n\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n\n\t#validates uniqueness for this record\n#\t if self.new_record? && is_valid\n#\t\t validate_uniqueness\n#\t end\nend", "def validate_transferrable\n (buyer_items + seller_items).each do |item|\n fail NonTransferrableError unless item.kind_of?(Transferrable)\n end\n end", "def valid?\r\n (forcing && item) || subject.usable?(item)\r\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:mark_code => self.mark_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_mark\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def is_valid; end", "def validate_spec(ypath, spec, tree)\n nodes = select_nodes(ypath, tree)\n\n YES.constraints.each do |c|\n @checklist.concat(c.checklist(spec, tree, nodes))\n end\n end", "def valid?\n court_slots.any?\n end", "def empty_item_list?\n if @offer[:items] && @offer[:items].empty?\n error = true\n add_error(:offer, :items, \"Empty item-list is not allowed\")\n end\n\n if @for[:items] && @for[:items].empty?\n error = true\n add_error(:for, :items, \"Empty item-list is not allowed\")\n end\n\n error ||= false\n end", "def check_org_unit_data_validity(org_unit_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Type Name Code Parents),\n 'properties' => {\n 'Type' => { 'type' => 'integer' },\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'Parents' => {\n 'type' => 'array',\n 'items' => { 'type' => 'integer', 'minItems' => 1 }\n }\n }\n }\n JSON::Validator.validate!(schema, org_unit_data, validate_schema: true)\nend", "def assert_valid_fixture(items)\n assert items.map(&:valid?).all?, (items.reject(&:valid?).map { |c| (c.respond_to?(:name) ? \"#{c.name} \" : '') + c.errors.full_messages.to_sentence })\n end", "def accept_multiple_sets?\n return true\n end", "def validate\n !discount_code.nil? && discount.nil? ? raise(InvalidDiscountCode, \"There is no discount with that code\") : true\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def valid_attributes\n {:name => 'Test it!', \n :deck_id => 1}\n end", "def invalid_items\n @items.select { |item| item.valid == false }\n end", "def valid?(_) true end", "def valid?(_) true end", "def valid?(*args)\n valid = true\n @transformed_values.each do |sets| \n sets.each do |set| \n valid = false unless set.valid?\n end\n end\n valid\n end", "def validate( _x )\n msg = 'ERROR: Item.validate() not implemented!'\n msg += \"\\nTODO: cover common type-based validations?\"\n msg += \"\\nTODO: Offer validation objects?\"\n fail msg\n end", "def validate\n ensure_exclude_option_array_exists\n ensure_linter_section_exists\n ensure_linter_include_exclude_arrays_exist\n end", "def validate\n end", "def validate\n \n \n end", "def validate_card(card)\n\n rank = [2,3,4,5,6,7,8,9,10,11,12,13,14]\n name = ['2','3','4','5','6','7','8','9','10','Jack','Queen','King','Ace']\n suit = [:heart, :diamond, :spade, :club]\n\n suit.each do |suit|\n rank.each_with_index do |rank, nam|\n temp = [name[nam], suit, rank]\n @valid_cards << temp\n end\n end\n #require 'pry' ; binding.pry\n @valid_cards.index(card).nil?\n end", "def validate!\n validate_redis\n validate_workers\n validate_options\n end", "def validate\n valid?\n end", "def not_both_presets_and_subsections\n return unless rubric_preset.present? && subsections.present?\n\n errors.add(:subsections, 'must be empty if preset comments exist')\n errors.add(:rubric_preset, 'must be empty if subsections exist')\n end", "def validate!\n # pass\n end", "def valid?\n return false if @quantity.nil?\n return false if @unit_price.nil?\n true\n end", "def validate_all\n validate\n items.each do |item|\n definition.validate_item item\n end\n definition.validate_columns items\n end", "def schools_valid?\n valid = true\n self.schools.each do |school|\n unless school.qualifications_valid?\n self.errors.add(:school, \"'#{school.name}' does not have any qualifications\")\n valid = false\n end\n end\n valid\n end", "def valid?\n self.errors = []\n self.content_type.fields.each do |field|\n if field.required\n if self.dynamic_getter(field.name).blank?\n self.errors << field.name\n end\n end\n end\n self.errors.blank?\n end", "def have_enough_items_to_trade?\n fetch_inventory\n\n is_valid = true\n\n max_avaliable_quantity = @offer[:records].map {|x|\n [x.item_name.to_sym ,x.quantity]}.to_h\n\n @offer[:items].each do |item, quantity|\n if quantity > max_avaliable_quantity[item.to_sym]\n is_valid = false\n add_error(:offer, :items, {item.to_sym =>\n \"Not enough items, only #{max_avaliable_quantity[item.to_sym]} available\"})\n end\n end\n\n max_avaliable_quantity = @for[:records].map {|x|\n [x.item_name.to_sym ,x.quantity]}.to_h\n\n @for[:items].each do |item, quantity|\n if quantity > max_avaliable_quantity[item.to_sym]\n is_valid = false\n add_error(:for, :items, {item.to_sym =>\n \"Not enough items, only #{max_avaliable_quantity[item.to_sym]} available\"})\n end\n end\n is_valid\n end" ]
[ "0.6536624", "0.6467546", "0.6031117", "0.5980525", "0.57976454", "0.5779107", "0.57296395", "0.57295007", "0.5706486", "0.56935155", "0.56799835", "0.5678328", "0.56366324", "0.5572912", "0.553737", "0.55199265", "0.5515637", "0.5477121", "0.544545", "0.54299545", "0.5417221", "0.5416207", "0.541012", "0.5397859", "0.5390762", "0.53883183", "0.5386715", "0.53828675", "0.53794235", "0.53764737", "0.5366188", "0.5365479", "0.5363405", "0.5360199", "0.53588593", "0.5333429", "0.5328735", "0.53151715", "0.5311968", "0.53112286", "0.5310709", "0.53074974", "0.53014314", "0.5301065", "0.530025", "0.5297413", "0.5297413", "0.5295727", "0.52925235", "0.5290464", "0.5285291", "0.52611005", "0.5258817", "0.5257827", "0.5255319", "0.5253305", "0.52407265", "0.52402335", "0.5217462", "0.5211684", "0.5206554", "0.5200367", "0.51999795", "0.51981354", "0.5193989", "0.51840645", "0.5183097", "0.51818246", "0.5177434", "0.517719", "0.5177111", "0.51743716", "0.5171821", "0.51690936", "0.5168931", "0.5161073", "0.51603514", "0.51555353", "0.5150531", "0.5145375", "0.513523", "0.51346165", "0.513119", "0.51234335", "0.51234335", "0.51165676", "0.5114976", "0.5113437", "0.5111574", "0.51099855", "0.51088196", "0.5106337", "0.5099994", "0.5097103", "0.50943947", "0.5092216", "0.50918883", "0.5084538", "0.50816864", "0.5076609" ]
0.80109626
0
Removes invalid vards from deck
def remove_invalid_decks @decks.select! do |deck| deck.is_a?(ZombieBattleground::Api::Models::Deck) && deck.valid? && deck.errors.size.zero? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_invalid_codes(guess)\n @valid_codes.filter! { |code| code.check_code(guess) == [@black_pegs, @white_pegs] }\n puts \"#{@valid_codes.count} possible codes left\"\n end", "def find_unseen\n unseen.replace(full_deck)\n (my_hand + op_hand + my_lands.values +\n op_lands.values + discards.values).flatten.each do |c|\n i = unseen.index(c) or next\n unseen.delete_at(i)\n end\n end", "def clean_bad_data\n self.character_achievements.select{|ca| ca.achievement }.group_by{|ca| ca.achievement.armory_id }.each{|aid, cas|\n if cas.size > 1\n cas[1,1000].each{|c| c.destroy }\n end\n }\n end", "def discard_and_replace(number = 1)\n number = faceup.count if number > faceup.count\n gamefield.slice(0, number).each_with_index do |card, i|\n card.faceup_position = nil\n card.facedown_position = nil\n return false unless card.save\n end\n gamefield.each do |card|\n card.faceup_position = card.faceup_position - number\n return false unless card.save\n end\n deal number\n end", "def prepare_deck\n (1..104).each do |i|\n v = [1, 2, 3, 5, 7]\n if i == 55\n @deck[i] = v[4]\n elsif (i % 11 == 0.0) && i != 55\n @deck[i] = v[3]\n elsif (i % 10 == 0.0) && i != 55\n @deck[i] = v[2]\n elsif (i % 5 == 0.0) && i != 55\n @deck[i] = v[1]\n else\n @deck[i] = v[0]\n end\n end\n end", "def reset_discard_pile(deck)\n @cards = []\n @cards << deck.take_card\n while @cards[0].color == 'Wild' || @cards[0].number.is_a?(String)\n deck.cards.unshift(@cards.pop)\n @cards << deck.take_card\n end\n @cards\n end", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n end", "def discardHiddenTreasure(t)\n \n end", "def non_trump_cards\n @cards.select {|c| c.suit != @trump_suit}\n end", "def remove_card_from_deck (card)\n\t\t@deck -= [card]\n\tend", "def reset_unused!\n @cards += @used\n @used = []\n end", "def remove_cards\n\t\t@cards.slice!(0,2)\n\tend", "def remove_invalid_combs(board, hi, combs_pre)\n board_view = board_row_from_i(board, hi)\n r = combs_pre.select{ |c| validate_comb(board_view, c) }\n r\nend", "def undistinguished_vars\n @undistinguished ||= vars.vars.reject(&:distinguished?)\n end", "def available_cards(correct_card_ids)\n # Exclude cards that have already been successfully answered\n self.cards.reject do |card|\n puts \"correct_card_ids = #{correct_card_ids}\"\n correct_card_ids.include?(card.id)\n end\n end", "def clear_damage_values\n mrts_conditional_drops_clear_damage_values\n @element = 0\n end", "def scrubbed\n end", "def discardHiddenTreasures(t)\n \n t.each do |x|\n @currentPlayer.discardHiddenTreasure(x)\n @dealer.giveTreasureBack(x)\n \n end\n \n end", "def reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end", "def subtractSet(chosenCards)\n @cardsOnTable.each { |c|\n if c = chosenCards[0]\n @cardsOnTable.delete_at(0)\n elsif c = chosencards[1]\n @cardsOnTable.delete_at(1)\n elsif c = chosenCards[2]\n @cardsOnTable.delete_at(2)\n end\n }\n end", "def deal_a_card(from_the_deck)\n #delete any empty hashes from the deck array otherwise there will be an error because it will be picking a nil result\n if from_the_deck.include?({})\n from_the_deck.delete({})\n end\n \n deck_chosen_from = from_the_deck.sample\n key_chosen_from_deck = deck_chosen_from.keys.sample\n value_chosen_from_deck = deck_chosen_from[key_chosen_from_deck].sample\n \n remove_from_deck(deck_chosen_from, key_chosen_from_deck, value_chosen_from_deck)\n\n #delete any hash key with an empty array value otherwise there will be an error because it will be picking a nil result\n if deck_chosen_from[key_chosen_from_deck].empty?\n deck_chosen_from.delete(key_chosen_from_deck)\n end\n\n picked_card = [key_chosen_from_deck, value_chosen_from_deck]\nend", "def discard_bad_plates\n show do \n title \"Discard Plates\"\n \n discard_plate_ids = operations.select { |op| op.temporary[:delete] }.map { |op| op.input(\"Plate\").item.id }\n note \"Discard the following plates with 0 colonies: #{discard_plate_ids}\"\n end\n end", "def createDeck\n deck = []\n for suit in @@cardSuits\n for symbol in @@symbolVals.keys\n if symbol != \"AA\"\n deck << Card.new(symbol, suit)\n end\n end\n end\n\n return deck\n end", "def remove_cards_forAI(cardToRemove1, cardToRemove2, cardToRemove3)\n\t\t@board.delete(cardToRemove1)\n\t\t@board.delete(cardToRemove2)\n\t\t@board.delete(cardToRemove3)\n\tend", "def clean!\n time = Time.now\n \n instance_variables.select do |i|\n condition = false\n match = i.to_s.match(/\\A@exchange[^\\d]+\\d{4}_\\d{1,3}_?\\d{0,2}_(\\d{4})_(\\d{1,3})_?(\\d{1,2})?/)\n \n if match\n condition = match[1].to_i != time.year || match[2].to_i != time.yday\n condition = match[3].to_i != time.hour if match[3]\n end\n \n condition\n end.each do |i|\n remove_instance_variable i\n end\n end", "def discard_characters_for(player)\n player.characters.each do |c|\n self.discard_pile << c\n end\n end", "def summon_removal\n # remove all expired pets\n @pets.clone.each {|p| @pets.delete(p) if p.terminate}\n # remove all expired monsters\n @monsters.clone.each {|m| @monsters.delete(m) if m.terminate}\n end", "def convert_deck(arr_of_cards)\n arr_of_cards.each do |card|\n # Remove the \"Your Cards:\" from the first element\n if arr_of_cards.index(card) == 0\n card.slice!(0, 12)\n end\n end\n end", "def deal_card(deck,card_values)\n suites = deck.map {|k,v| k}\n suite_choice = suites[rand(0..3)]\n value = card_values[rand(0..12)]\n value_index = card_values.index(value)\n while deck[suite_choice].values_at(value_index).count(TAKEN_MARKER) == 1\n\n suite_choice = suites[rand(0..3)]\n value_index = card_values[rand(0..12)]\n end\n deck[suite_choice][value_index] = TAKEN_MARKER\n\n deck[suite_choice][value_index] = TAKEN_MARKER\nend", "def discardHiddenTreasure(t)\n @hiddenTreasures.delete(t)\n if (@pendingBadConsequence != nil) and !@pendingBadConsequence.isEmpty\n @pendingBadConsequence.substractHiddenTreasure(t)\n end\n dieIfNoTreasures\n \n end", "def deal_card\n @deck.remove(:front)\n end", "def test_reject\n assert_equal(%w[1 2 4 7 8 11 13 14],\n @ab.reject { |res| res.include?('Assign') || res.include?('Buzz') })\n end", "def reset!\n @hands.each(&:discard!)\n @cards += @used\n @used = []\n end", "def discardAllTreasures\n vT = Array.new(@visibleTreasures)\n vT.each {|treasure| discardVisibleTreasure(treasure)}\n hT = Array.new(@hiddenTreasures)\n hT.each {|treasure| discardHiddenTreasure(treasure)}\n \n end", "def clear_dead_pokemon\n dead_condition = proc { |pokemon| pokemon.hp <= 0 }\n # List all the items from dead Pokemon\n item_ids = $actors.select(&dead_condition).map(&:item_hold)\n # Add items back to the bag\n item_ids.each { |item_id| $bag.add_item(item_id, 1) if item_id >= 0 }\n # Storing Pokemon that are dead\n graveyard.concat($actors.select(&dead_condition))\n # Remove Pokemon from the party\n $actors.delete_if(&dead_condition)\n end", "def discardNecklaceIfVisible\n @visibleTreasures.each do |vt|\n if vt.kind == TreasureKind::NECKLACE\n CardDealer.instance.giveTreasureBack(vt)\n @visibleTreasures.delete(vt)\n break\n end\n end\n end", "def discard(card)\n discard_pile << card\n end", "def get_discard\n\t\tputs \"#{name}, what cards do you wish to discard?\" \n\t\t@hand.render\n\t\tputs \"Choose up to 3 (EX: 1 4). Press enter if you don't want to discard any.\"\n\t\tbegin\n\t\t\tinput = gets.chomp\n\t\t\traise BadInputError unless input.split.size <= 3 && input.split.all? do |num| \n\t\t\t\tnum =~ /^[1-5]$/\n\t\t\tend\n\t\trescue\n\t\t\tputs \"You must enter in numbers b/t 1 to 5 separated by spaces.\"\n\t\t\tretry\n\t\tend\n\t\t\n\t\tinput.split.map(&:to_i).map{ |i| i - 1 }\n\tend", "def decks_contains_valid_decks\n @decks.each do |deck|\n next if deck.is_a?(ZombieBattleground::Api::Models::Deck) &&\n deck.valid? &&\n deck.errors.size.zero?\n\n errors.add(:decks, 'decks must be an array of Deck')\n end\n end", "def rule_3 *cards\n if cards.all?(&:face?)\n puts \"Upping the anti! #{cards.map(&:face?)}\"\n cards.raw_integer_value + 50\n end\n end", "def val_remove_all()\n var=false\n loop {\n print \"Are you wish to remove all the items? (y/n) \"\n val=gets.chop\n if val==\"y\"\n var=true\n break\n elsif val==\"n\"\n var=false\n break\n else\n puts \"Please enter a correct option, try again.\"\n end\n }\n var\n end", "def destroy_deck\n [@heart, @club, @spade, @diamond].each do |suit|\n (2..10).each do |number|\n File.delete(Dir.pwd + \"/#{number}_#{suit}.txt\")\n end\n [\"J\", \"Q\", \"K\", \"A\"].each do |face|\n File.delete(Dir.pwd + \"/#{face}_#{suit}.txt\")\n end\n end\n [\"R\", \"B\"].each do |color|\n File.delete(Dir.pwd + \"/#{@joker}_#{color}.txt\")\n end\n end", "def discard(indexes)\n [indexes].flatten.sort.reverse.each do |card_index|\n @cards.delete_at(card_index)\n end\n end", "def discardVisibleTreasure(t)\n \n end", "def bad1 deck\n print \"\\t#{1}) %-39s \" % deck[34][4, 20]\n print \"\\t#{2}) %-39s \" % deck[46][4, 20]\n print \"\\t#{3}) %-39s \" % deck[43][4, 20]\n puts 'same color - same number - dif shape'\n puts 'BUT 1 and 3 are both solid, while 2 is striped.'\n puts 'NOT A SET!!'\n puts\nend", "def remove_invalid_reference_symbols_from(symbols)\n valid_referenced_symbols = []\n symbols.each do |s|\n if s\n valid_referenced_symbols << s\n else\n valid_referenced_symbols.pop\n valid_referenced_symbols << \"null\"\n end\n end\n valid_referenced_symbols\n end", "def discardVisibleTreasure(t)\n @visibleTreasures.delete(t)\n if (@pendingBadConsequence != nil) and !@pendingBadConsequence.isEmpty\n @pendingBadConsequence.substractVisibleTreasure(t)\n end\n dieIfNoTreasures\n \n end", "def unplayed_cards\n player_cards.select { |c| c.unplayed? }\n end", "def clear\n\t\t@save_time = 0.0\n\t\t@top_card = 0\n\t\t@number_of_hint = 0\n\t\t@number_of_correct = 0\n\t\t@number_of_wrong= 0\n\t\t@deck = []\n\t\t@hand = []\n\t\t@username = \"\"\n\t\t@total_hint=0\n\t\t@is_end=false\n\tend", "def unique_cards(game_deck, faces, suits)\n faces.each do |face|\n suits.each do |suit|\n c = Card.new(face,suit)\n card_value_determiner(c)\n game_deck.deck << c\n end\n end\nend", "def uncapturable_legal_moves(cords)\n capturable_legal_moves(cords).reject { |legal_move| attacked?(legal_move, color_of(cords)) }\n end", "def reset\n @cards = Card.suits.keys.map do |suit|\n Card.values.map {|i| Card.new(suit, i)}\n end.flatten\n @dealt = []\n self\n end", "def disenchantGoldens\n\t\tdust = 0\n\t\tn = 0\n\t\tfor card in @cards[TOTAL_UNIQUE_CARDS..2*TOTAL_UNIQUE_CARDS-1]\n\t\t\textras = card.removeAll\n\t\t\tdust += card.disenchant_value * extras\n\t\t\tn += extras\n\t\tend\n\t\treturn dust, n\n\tend", "def clean_all\n [@vc_primary, @vc_complement, @hc_between_strands].collect { |a| a.delete(nil); a.uniq!; a.sort! }\n end", "def zero_chips\n @player_positions.each do |player|\n @player_positions.delete(player) if player.chip_stack.zero?\n end\nend", "def check_discards_removed_from_hand?(player, turn, done)\n played_cards = all_discards(done)\n\n player_hand = player.player_hand.hand_to_list\n\n played_cards.each{|card|\n if player_hand.include?(card)\n raise Cheating, \"Player is not discarding the cards he/she is playing!\"\n end\n }\n true\n end", "def discardVisibleTreasures(t)\n \n t.each do |x|\n @currentPlayer.discardVisibleTreasure(x)\n @dealer.giveTreasureBack(x)\n end\n \n end", "def deal_cards(deck, playing_cards)\n return if deck.length == 0\n\n #initializing deck.\n if playing_cards.length == 0\n for count in 0...12\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n return\n end\n\n if (valid_table(playing_cards)).length == 0\n #continually adds cards until there is a set or there are no more cards.\n while ((valid_table(playing_cards)).length == 0) && deck.length > 0\n #print(\"\\n Empty: #{(valid_table(playingCards)).length == 0} \\n\")\n for count in 0...3\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n end\n elsif playing_cards.length < 12\n # Adds cards if there is a set but less than 12 playing cards.\n for count in 0...3\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n\n end\n\nend", "def cleanse\n select { |_k, v| v }\n end", "def discard\n\n # organize hand into sorted array of cards\n #### METHOD\n\n puts \"here is your hand #{hand}\"\n\n puts 'what cards? you can only discard 3.'\n\n #the player returns [2,3]\n ##### METHOD\n\n # find hand[2], hand[3] and remove from hand\n ##### METHOD\n\n # hand currently has 3 cards\n\n # hand << deck.deal(2)\n\n #RETURNS new hand\n\n\n #....player1.hand = the new hand\n end", "def set_initial_discards!\n @finisher = @temp_finisher\n @discard2 = @temp_discard2\n @discard1 = @temp_discard1\n (@temp_discard1 + @temp_discard2).each do |c|\n @hand.delete(c)\n end\n @special_action_available = true\n @temp_discard1 = nil\n @temp_discard2 = nil\n @temp_finisher = nil\n log_me!(\"discards #{@discard2.map(&:name).join(' ')} to discard 2.\")\n log_me!(\"discards #{@discard1.map(&:name).join(' ')} to discard 1.\")\n log_me!(\"selects #{@finisher.name} for their finisher.\")\n end", "def remove_set_from_hand(card)\n\t\t@cards.delete(card)\n\tend", "def test_remove_size3_1\n\t\tgame = SetGame.new\n\t\tactual_output = File.new 'update_output/actual_remove_output2.txt', 'w'\n\t\t$stdout = actual_output\n\t\tgame.deck = DECK\n\t\tgame.hand = [CARD1, CARD2, CARD3,CARD4, CARD5, CARD6,CARD7, CARD8, CARD9,CARD10, CARD11, CARD12]\n\t\tuser_input = [0, 3, 6]\n\t\tgame.top_card = 12\n\t\tgame.update user_input\n\t\tassert_equal 12, game.hand.size\n\t\tassert_equal 15, game.top_card\n\t\tactual_output.close\n\t\tassert_true FileUtils.compare_file('update_output/expected_remove_output2.txt', 'update_output/actual_remove_output2.txt')\n\t\tassert_equal CARD13, game.hand[0]\n\t\tassert_equal CARD2, game.hand[1]\n\t\tassert_equal CARD3, game.hand[2]\n\t\tassert_equal CARD14, game.hand[3]\n\t\tassert_equal CARD5, game.hand[4]\n\t\tassert_equal CARD6, game.hand[5]\n\t\tassert_equal CARD15, game.hand[6]\n\t\tassert_equal CARD8, game.hand[7]\n\t\tassert_equal CARD9, game.hand[8]\n\t\tassert_equal CARD10, game.hand[9]\n\t\tassert_equal CARD11, game.hand[10]\n\t\tassert_equal CARD12, game.hand[11]\n\t\tassert_equal false, game.is_end\n\tend", "def scrub_dictionary(dictionary)\n dictionary.each do |word|\n word.downcase\n unless word.length >= 5 && word.length <= 12\n dictionary.delete(word)\n end\n end\n end", "def eliminate_set(vars)\n\n # set of variable ids left to eliminate\n elim_vids = Set.new\n # map of known constraints to constraint references\n known_constraints = {}\n # set of unaffected constraints\n unaffected = Set.new\n # map from variable index to equalities/inequalities it is involved in\n eq_constraints, bound_constraints = {}, {}\n # equations that hold a variable to eliminate\n elim_eqs = RefSet.new\n\n # initialize set of variables to eliminate\n vars.each { |v|\n raise Exception.new(\"VariableElimination: variable #{v} has cost assigned and cannot be eliminated\") if @ilp.get_cost(v) > 0\n vid = @ilp.index(v)\n elim_vids.add(@ilp.index(v))\n eq_constraints[vid] = Set.new\n bound_constraints[vid] = Set.new\n }\n\n # setup initial constraints\n @ilp.constraints.each { |constr|\n cref = ConstraintRef.new(known_constraints.size, constr, elim_vids)\n known_constraints[constr] = cref\n if constr.lhs.all? { |v,c| ! elim_vids.include?(v) }\n unaffected.add(cref)\n else\n dict = (constr.op == \"equal\") ? eq_constraints : bound_constraints\n elimeq_list = []\n constr.lhs.each { |vid,c|\n dict[vid].add(cref) if dict[vid]\n }\n elim_eqs.add(cref) if constr.op == \"equal\" && cref.num_elim_vars > 0\n end\n }\n\n # eliminate all variables\n while ! elim_vids.empty?\n elimvar, elimeq = nil, nil\n while ! elim_eqs.empty?\n tmpeq = elim_eqs.pop\n if tmpeq.status == :active\n elimeq = tmpeq\n elimvar = elimeq.elim_vars.first\n break\n end\n end\n if ! elimvar\n elimvar = elim_vids.first\n end\n\n # \"Eliminating #{var_by_index(elimvar)}: #{eq_constraints[elimvar].size}/#{bound_constraints[elimvar].size}\"\n\n if elimeq # Substitution\n # mark equation as garbage and remove it from all eq_constraints\n elimeq.status = :garbage\n elimeq.elim_vars.each { |v|\n tmp = eq_constraints[v].delete(elimeq)\n raise Exception.new(\"Internal Error: inconstinstent eq_constraints dictionary\") unless tmp\n }\n\n # substitute in all constraints referenced by elimvar\n [eq_constraints,bound_constraints].each { |dict|\n dict[elimvar].each { |subst_constr|\n # mark old constraint as garbage and remove it from dict\n subst_constr.status = :garbage\n subst_constr.elim_vars.each { |v|\n tmp = dict[v].delete(subst_constr)\n raise Exception.new(\"Internal Error: inconsistent constraint dictionary\") unless tmp\n }\n\n # substitute\n @elim_steps += 1\n neweq = constraint_substitution(elimvar, elimeq.constraint, subst_constr.constraint)\n\n # create new constraint reference, if necessary\n if neweq && ! known_constraints[neweq]\n cref = known_constraints[neweq] = ConstraintRef.new(known_constraints.size, neweq, elim_vids)\n cref.elim_vars.each { |v|\n dict[v].add(cref)\n }\n elim_eqs.add(cref) if neweq.op == \"equal\" && cref.num_elim_vars > 0\n end\n }\n }\n else # FM elimination\n raise Exception.new(\"Internal error: equations left\") unless eq_constraints[elimvar].empty?\n l, u = [], []\n bound_constraints[elimvar].each { |cref|\n coeff = cref.constraint.get_coeff(elimvar)\n if coeff < 0\n l.push(cref)\n else\n u.push(cref)\n end\n cref.status = :garbage\n # remove from all bound_constraints\n cref.elim_vars.each { |v|\n tmp = bound_constraints[v].delete(cref)\n raise Exception.new(\"Internal Error: inconstinstent bound_constraints dictionary\") unless tmp\n }\n }\n l.each do |l_constr|\n u.each do |u_constr|\n @elim_steps += 1\n newconstr = transitive_constraint(elimvar, l_constr.constraint, u_constr.constraint)\n if newconstr && ! known_constraints[newconstr]\n cref = known_constraints[newconstr] = ConstraintRef.new(known_constraints.size, newconstr, elim_vids)\n cref.elim_vars.each { |v|\n bound_constraints[v].add(cref)\n }\n end\n end\n end\n end\n elim_vids.delete(elimvar)\n end\n new_constraints = []\n known_constraints.values.select { |cref|\n cref.status != :garbage\n }.map { |cref|\n cref.constraint\n }\n end", "def remove_invalid_questionnaires(rubrics_list)\n rubrics_list.delete('TeammateReviewQuestionnaire') if @assignment_form.assignment.max_team_size == 1\n rubrics_list.delete('MetareviewQuestionnaire') unless @metareview_allowed\n rubrics_list.delete('BookmarkRatingQuestionnaire') unless @assignment_form.assignment.use_bookmark\n end", "def clean_up_arrays\n self.likes.reject! {|l| l.empty? } if self.likes\n self.outdoor_activities.reject! {|l| l.empty? } if self.outdoor_activities\n self.nightlife.reject! {|l| l.empty? } if self.nightlife\n end", "def remove_set(pos)\n\n #enough invalid inputs makes the game end\n unless valid?(pos)\n if @user_mistakes < @user_warnings.length\n puts @user_warnings[@user_mistakes]\n @user_mistakes += 1\n return false\n else\n abort(\"Seriously Man?\")\n end\n end\n\n #return 0 if not a set\n unless check_set(pos[0], pos[1], pos[2])\n puts \"Not a set!\"\n return false\n end\n pos.sort #makes sure to delete in descending order\n pos.reverse!\n for i in 0..2\n @cards_showing.delete_at(pos[i])\n end\n @table_size -= 3\n puts \"That was a set!\"\n\n return true\n end", "def check_fields(stats, fields)\n temp = Array.new(fields)\n\ttemp.each { |x| temp.delete(x) if stats[\"#{x}\"] == \"\" }\nend", "def clear\n @card1 = nil\n @card2 = nil\n @card3 = nil\n end", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n complement_squads = player.player_hand.complementable\n wildcards = player.player_hand.wildcards\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n complement_squads = player.remove_used_squads(complement_squads, list_of_allies, list_of_axis)\n\n # Look through complement squadrons and go ahead and add\n # WildCards to them. If we don't have enough WildCards, well then\n # just make some up.\n complement_squads.each{|squadron|\n if wildcards.size > 0\n if wildcards.size >= 2 && squadron.list_of_cards.size == 1\n squadron.push!(wildcards.shift)\n squadron.push!(wildcards.shift)\n elsif wildcards.size > 1 && squadron.list_of_cards.size == 2\n squadron.push!(wildcards.shift)\n else\n squadron.push!(Keepem.new(Image.new(\"keepem.gif\"), rand(5)+1))\n end\n end\n }\n \n # Combine the two lists of Squadrons\n all_squads = complete_squads.dup.concat(complement_squads)\n\n # Now we go through and make sure all the Squadrons\n # are complete.\n all_squads.find_all {|squadron| squadron.squadron_complete? }\n end", "def factors\n reject_values(*Daru::MISSING_VALUES).uniq.reset_index!\n end", "def clean(options)\n options[:softbin] ||= options.delete(:sbin) || options.delete(:soft_bin)\n options[:number] ||= options.delete(:test_number) || options.delete(:tnum) ||\n options.delete(:testnumber)\n options[:name] ||= options.delete(:tname) || options.delete(:testname) ||\n options.delete(:test_name)\n options[:index] ||= options.delete(:ix)\n end", "def clean dirty_atts\n clean_atts = cartridge_cleaning_code(dirty_atts, 'Ink Grabber', false)\n clean_atts['mpn'] = clean_atts['item_number'] if clean_atts['real'] == false \n clean_atts['yield'] = parse_yield(clean_atts['title']) if clean_atts['yield'].nil?\n clean_atts['toolow'] = false\n clean_atts['retailer_id'] = 18 \n clean_atts['instock'] = clean_atts['stock'] = case dirty_atts['availability'] \n when \"/stock.gif\"\n true\n when \"/oostock.gif\" \n false\n end\n clean_atts['availability'] = nil\n \n return clean_atts\n end", "def fix_up_controlled_vocabs\n sample_attributes.each do |attribute|\n unless attribute.sample_attribute_type.controlled_vocab?\n attribute.sample_controlled_vocab = nil\n end\n end\n end", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n complement_squads = player.player_hand.complementable\n wildcards = player.player_hand.wildcards\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n complement_squads = player.remove_used_squads(complement_squads, list_of_allies, list_of_axis)\n\n # Look through complement squadrons and go ahead and add\n # WildCards to them.\n complement_squads.each{|squadron|\n if wildcards.size > 0\n if wildcards.size >= 2 && squadron.list_of_cards.size == 1\n squadron.push!(wildcards.shift)\n squadron.push!(wildcards.shift)\n else\n squadron.push!(wildcards.shift)\n end\n end\n }\n \n # Combine the two lists of Squadrons\n all_squads = complete_squads.dup.concat(complement_squads)\n\n # Now we go through and make sure all the Squadrons\n # are complete.\n all_squads.find_all {|squadron| squadron.squadron_complete? }\n end", "def clean_card\n @card.fail_count = 0\n @card.review_count = 1\n @card.set_review_date\n end", "def validate_card(card)\n\n rank = [2,3,4,5,6,7,8,9,10,11,12,13,14]\n name = ['2','3','4','5','6','7','8','9','10','Jack','Queen','King','Ace']\n suit = [:heart, :diamond, :spade, :club]\n\n suit.each do |suit|\n rank.each_with_index do |rank, nam|\n temp = [name[nam], suit, rank]\n @valid_cards << temp\n end\n end\n #require 'pry' ; binding.pry\n @valid_cards.index(card).nil?\n end", "def free_fields\n free_pieses(@battle_field) + free_pieses(@battle_field.transpose)\n end", "def dont_be_in_check(final_spots,current_king)\n invalid = []\n final_spots.each do |spot|\n y = spot[0]\n x = spot[1]\n\n play_board = Marshal.load(Marshal.dump(@board))\n play_board[@piece.y_position][@piece.x_position] = 0\n play_board[y][x] = @piece.player_id\n\n if @piece.type == \"King\"\n invalid << spot if current_king.if_king_move_in_check?(play_board,y,x).length > 0\n else\n invalid << spot if current_king.if_check?(play_board).length > 0\n end\n end\n return final_spots - invalid\n end", "def hit(deck)\n rand_card = deck.sample # pulls a random card from the playing deck.\n deck.delete(rand_card)\nend", "def deal\n # pack cards past the default 12 into the begining\n if @cards.length > 12\n # cards still in play past the standard 12 positions\n extra = @cards.last(@cards.length - 12).compact\n # move what can be moved into the standard 12 positions\n @cards = @cards.take(12).map! { |c| c || extra.pop }\n # hopefully extra is empty now, but maybe not\n @cards += extra\n end\n\n # sets is still valid as we haven't modified the combinaion of cards in play\n # do we need to expand the cards in play?\n if(@sets && @sets.none?)\n @cards += Array.new(3)\n end\n \n ## fill any gaps from the deck\n @cards.map! { |x| x || @deck.pop }\n\n # recompute sets\n #@sets = []\n @sets = IsASet.sets @cards.compact\n end", "def create_deck\n suit_counter = 0\n value_counter = 0\n deck =[]\n until deck.count == (@valid_suits.count * @valid_values.count)\n deck << Card.new(@valid_suits[suit_counter], @valid_values[value_counter])\n value_counter += 1\n value_counter = 0 if (value_counter == @valid_values.count)\n suit_counter += 1 if (deck.count == (suit_counter + 1) * (@valid_values.count))\n end\n deck\n end", "def discard_card(player)\n if player.player_hand.size == 0\n nil\n else\n rand_index = rand(5)\n rand_index += 1\n Keepem.new(Image.new(\"keepem.gif\"), rand_index)\n end\n end", "def wrong_guess(letter)\n @possible_letters.delete(letter)\n @dictionary.reject_words_that_contain(letter)\n end", "def remove_pieces\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n @pieces[x][y].remove unless @pieces[x][y].nil?\n end\n end\nend", "def discardable\n []\n end", "def remove_falsy_values list\n\n list.compact!\n\n list.each do |x|\n if x == false\n y = list.find_index(x)\n list.slice!(y)\n end\n end\n\nend", "def make_discards(player, list_of_allies, list_of_axis)\n complete_squads = player.player_hand.completes\n complement_squads = player.player_hand.complementable\n wildcards = player.player_hand.wildcards\n\n # We need to make sure that we don't make attacks with squadrons that have already been used\n complete_squads = player.remove_used_squads(complete_squads, list_of_allies, list_of_axis)\n complement_squads = player.remove_used_squads(complement_squads, list_of_allies, list_of_axis)\n\n # Look through complement squadrons and go ahead and add\n # WildCards to them.\n complement_squads.each{|squadron|\n if wildcards.size > 0\n if wildcards.size >= 2 && squadron.list_of_cards.size == 1\n squadron.push!(wildcards.shift)\n squadron.push!(wildcards.shift)\n else\n squadron.push!(wildcards.shift)\n end\n end\n }\n \n # Combine the two lists of Squadrons\n all_squads = complete_squads.dup.concat(complement_squads)\n\n # Now we go through and make sure all the Squadrons\n # are complete and are bombers.\n all_squads.find_all {|squadron| squadron.squadron_complete? && squadron.squadron_bomber? }\n end", "def initialize_deck\n VALUES.product(SUITS).shuffle\nend", "def remove_all_vlans\n remove_all_bridge_domains\n remove_all_svis\n Vlan.vlans.each do |vlan, obj|\n # skip reserved vlan\n next if vlan == '1'\n next if node.product_id[/N5K|N6K|N7K/] && (1002..1005).include?(vlan.to_i)\n obj.destroy\n end\n end", "def remove_invalid_combs(board, hi, combs_pre)\n board_view = board_row_from_i(board, hi)\n\n # Examples of board_view:\n # [[6], [2], [7], [3], [1], [5], [4]]\n # [[5], [3], [1, 2], [1, 2], [6], [4], [7]]\n # [[4], [6], [3], [1, 2, 3], [2], [7], [5]]\n\n fbv = board_view.flatten\n if fbv.length == SIZE\n return [fbv]\n elsif fbv.length == SIZE * SIZE\n return combs_pre\n end\n\n combs_pre.select do |c|\n board_view[0].include?( c[0] ) && board_view[1].include?( c[1] ) && board_view[2].include?( c[2] ) && board_view[3].include?( c[3] ) && board_view[4].include?( c[4] ) && board_view[5].include?( c[5] ) && board_view[6].include?( c[6] )\n end\n\n #pp '---'\n #pp board_view\n #pp '--'\n\n ##r = combs_pre.select{ |c| validate_comb(board_view, c) }\n ##r\nend", "def cleanUpMountedItems\n # Filtering weapons\n @weapons = @weapons.select { |weapon| weapon.uses > 0 }\n\n # Filtering shields\n @shieldBoosters = @shieldBoosters.select { |shield| shield.uses > 0 }\n end", "def throw(choices)\n\n #TODO return unless state_index = 1?\n\n (0..3).each do |i|\n if i < 2\n @crib << @p1_cards.delete_at(choices[i])\n else\n @crib << @p2_cards.delete_at(choices[i])\n end\n end\n @state_index += 1\n\n end", "def cleanup(isbn_)\n isbn_.gsub(/[^0-9xX]/,'').gsub(/x/,'X') unless isbn_.nil? or isbn_.scan(/([xX])/).length > 1\n end", "def remove_test_bugs\n [Hive::Color[:white],Hive::Color[:black]].collect.each{|color|\n $game.bugs[color].each{|bug| \n bug.sides.each{|side|\n # Make any bugs that touched the Hive::Tester forget it ever existed.\n side.bug = false if side.bug.class.name == 'Hive::Tester'\n }\n # Delete the Hive::Tester bug itself.\n bug = false if bug.class.name == 'Hive::Tester'\n }\n }\n end", "def clean_board\n\t\t@cases.map! { |c| c = \" \"}\n\tend", "def all_not_wild\n result = []\n for card in @cards\n result << card unless card.wild? \n end\n return result\n end", "def uses_available_letters?(input, letters_in_hand)\n\n input_array = input.upcase.chars\n\n letters_in_hand.each do |letter|\n\n if input_array.include? letter\n index = input_array.index(letter)\n input_array.delete_at(index)\n end\n end\n\n return input_array.length == 0\n\nend", "def deal_cards\n if @deck.length != 0\n puts \"Dealt 3 more cards\"\n for i in 0...3\n r = rand(0...@deck.length)\n @cards_in_play.append(@deck[r])\n @deck.delete_at(r)\n end\n else\n puts \"There are no more cards in the deck!\"\n end\nend" ]
[ "0.61292017", "0.6067254", "0.60121524", "0.5808344", "0.5545818", "0.5521131", "0.5516175", "0.55056226", "0.5500904", "0.5476033", "0.54756474", "0.5460172", "0.5446137", "0.5412514", "0.5403982", "0.53832686", "0.53735137", "0.5367933", "0.5349089", "0.5344778", "0.5327373", "0.53034514", "0.52923447", "0.5279193", "0.52710164", "0.52578425", "0.5248851", "0.5247276", "0.52412474", "0.52411807", "0.5236804", "0.521359", "0.5197177", "0.5194708", "0.51682115", "0.51680887", "0.51634026", "0.51629174", "0.5161007", "0.5148685", "0.5148563", "0.51472133", "0.5135547", "0.5131405", "0.5124097", "0.51227266", "0.51204824", "0.5120176", "0.5118757", "0.5112856", "0.51097625", "0.51064646", "0.510401", "0.5097141", "0.5094308", "0.50762266", "0.50753796", "0.50729775", "0.5070188", "0.50701684", "0.5058509", "0.5056033", "0.5054914", "0.5049854", "0.5048989", "0.5039437", "0.5026006", "0.5024322", "0.50193256", "0.50144607", "0.50117886", "0.5006235", "0.5005992", "0.49853638", "0.49762663", "0.49673468", "0.49659044", "0.49647108", "0.49626932", "0.49610084", "0.49591357", "0.495902", "0.49547195", "0.49522793", "0.49428052", "0.49411136", "0.49390885", "0.4936598", "0.4931725", "0.49159485", "0.4913109", "0.49088144", "0.4906776", "0.49044317", "0.48977324", "0.48957843", "0.4895484", "0.48950103", "0.4894814", "0.489476" ]
0.6802469
0
get every test to pass before coding runner below
def runner welcome total = initial_round until (total > 21) do total=hit?(total) display_card_total(total) end end_game(total) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def test_all\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING NO-SERVICE TEST\"\n passed << one_test(@config['init_scenario'])\n # Stop testing if our initial test fails.\n unless passed.first == true\n @log.error \"Initial setup failed.. sleeping 60 seconds for debugging.\"\n sleep 60\n stop_vm() if @options[:vmm_enabled]\n return passed\n end\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING TESTS\"\n scenarios = get_scenarios\n test_counter = 0\n scenarios.each do |scenario|\n test_counter += 1\n @log.info \"Running test for #{scenario} - #{test_counter} of #{scenarios.size}\"\n passed << one_test(scenario)\n end\n stop_vm() if @config[:vmm_enabled]\n all_passed = passed.select{|p| p == false}.size == 0\n @log.info \"Number of tests run : #{passed.size}\"\n @log.info \"Result of ALL tests: Passed? #{all_passed}\"\n @results['test_stop'] = Time.now()\n @results['elapsed_time'] = @results['test_stop'] - @results['test_start']\n return all_passed\n end", "def test_cases; end", "def passed_tests\n self.tests.select do |test|\n test.status == 'passed'\n end\n end", "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end", "def run_tests\n tests_passed = true\n %w(desktop mobile kc_dm).each do |profile|\n tests_passed &= execute_test(profile)\n end\n tests_passed\n end", "def running_test_case; end", "def all_tests_pass\n cucumber_guard = ::Guard.guards({ :name => 'cucumber', :group => 'puppet_tests'}).first\n cucumber_passed = cucumber_guard.instance_variable_get(\"@failed_paths\").empty?\n rspec_guard = ::Guard.guards({ :name => 'rspec', :group => 'puppet_tests'}).first\n rspec_passed = rspec_guard.instance_variable_get(\"@failed_paths\").empty?\n return rspec_passed && cucumber_passed\nend", "def my_tests\n end", "def tests; end", "def tests; end", "def passed_checks\n all_checks_which_pass\n end", "def passes\n count - failures - errors - skips\n end", "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend", "def all_external_test_runs_passed?(test_types = nil)\n external_tests_blocking(test_types).empty?\n end", "def doTests( *tests )\n tests.find_all {|name,data|\n ! doTest(name)\n }\nend", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def test_steps; end", "def test_steps; end", "def uninit_ok_tests\n if (!@num_tests_run.nil? && !@num_tests_failed.nil?)\n @num_tests_ok += @num_tests_run - @num_tests_failed\n end\n end", "def before_test(test); end", "def before_test(test); end", "def generate_alltest\n\n end", "def running_test_step; end", "def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end", "def testing_begin(files)\n end", "def unitTests\n\t\ttotalTests = 12\n\t\ttotalFailed = 0\n\t\toutput = \"\"\n\t\t@debug = true\n\n\t\t#CLEAR DB BEFORE RUNNING TEST. DEFINITELY CRUDE BUT THE ONLY THING I COULD GET WORKING\n\t\tself.TESTAPI_resetFixture\n\n\t\t#Test1: \"Does not allow a non-registered user login\"\n\t\tresponse = self.login(\"NonUser\",\"pass0\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test1\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test2: \"Allows a user that supplies no password get added\"\n\t\tresponse = self.add(\"user2\",\"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test2\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test3: \"Allows a user with a username and password get added\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test3\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test4: \"Doesn't allow an already added user get added again\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test4\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test5: \"Doesn't allow a blank username get added\"\n\t\tresponse = self.add(\"\",\"pass5\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test5\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test6: \"It allows a username and password of 128 characters to get added\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test6\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test7: \"Does not allow a username greater than 128 characters\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"pass7\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test7\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test8: \"Does not allow a password greater than 128 characters\"\n\t\tresponse = self.add(\"user8\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -4\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test8\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test9: \"Allows a registered user with a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user3\", \"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test9\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test10: \"Allows a registered user without a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user2\", \"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test10\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test11: \"Doesn't allow a user with wrong password to login\"\n\t\tresponse = self.login(\"user3\", \"pass2\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test11\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test12: \"Sucessfully Deletes the DB with call to TESTAPI_reset_fixture\"\n\t\tresponse = self.TESTAPI_resetFixture\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test12\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t@debug = false\n\t\trender json: {:totalTests => totalTests, :nrFailed => totalFailed, :output => output}\n\t\t\n\tend", "def run\n test_using_random_sample\n test_using_first_of\n end", "def done\n puts 'Done running tests'\n end", "def all_failing\n all(\"#qunit-tests .fail\")\n end", "def passing_tests\n return self.product_tests.includes(:test_executions).select do |test|\n test.execution_state == :passed\n end\n end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend", "def init_tests\n unless @init_tests\n @test_duration = 0\n @num_tests_run = 0\n @num_tests_failed = 0\n @num_tests_ok = 0\n @num_tests_skipped = 0\n @init_tests = true\n end\n end", "def before_test_case(*args)\n @test_steps =[]\n @scenario_tags = []\n @failed_step = {}\n end", "def test_step; end", "def scenarios\n @runner.done_scenarios\n end", "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end", "def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end", "def test_passed(array)\n last_item = array.length - 1\n test_name = array[last_item - 1]\n test_suite_verify(array[@class_name])\n printf \"%-40s PASS\\n\", test_name\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\"/>'\n end", "def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end", "def call(*tests, env:)\n summary = execute_all(tests, env)\n List.new(\n List.new(Symbol.new(\"success\"), List.new(*summary[:success])),\n List.new(Symbol.new(\"failures\"), List.new(*summary[:failures]))\n )\n end", "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend", "def failures; end", "def failures; end", "def failures; end", "def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend", "def run\n\t\t @stats.tests += 1\n\t\t\tputs \"Testi: #{@name}\"\n\t\t\tctx = Context.new\n\t\t\tbegin\n\t\t\t\tctx.instance_eval(&@block)\n\t\t\trescue TestAbort # we don't really care if it aborts.\n\t\t\trescue Exception => ex\n\t\t\t\tctx.fail\n\t\t\t\t@stats.failed += 1\n\t\t\t\tputs ex.inspect\n\t\t\t\tputs ex.backtrace.join(\"\\n\")\n\t\t\tend\n\t\t\tif ctx.failed?\n\t\t\t\tputs \" # FAIL!!! ############\"\n\t\t\t\t@stats.failed += 1\n\t\t\telsif ctx.skipped?\n\t\t\t\tputs \" = skipped ============\"\n\t\t\t\t@stats.skipped += 1\n\t\t\telse\n\t\t\t\tputs \" - ok.\"\n\t\t\t\t@stats.passed += 1\n\t\t\tend\n\t\t\tputs\n\t\tend", "def test_case; end", "def print_results\n if !@failures.empty?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend", "def test_contains_13_eachsuit\n assert true == false\n end", "def test_runnable_methods_random\n @assertion_count = 0\n\n random_tests_1 = sample_test_case 42\n random_tests_2 = sample_test_case 42\n random_tests_3 = sample_test_case 1_000\n\n assert_equal random_tests_1, random_tests_2\n refute_equal random_tests_1, random_tests_3\n end", "def compare_tests(test_a, test_b); end", "def compare_tests(test_a, test_b); end", "def test_setup\r\n \r\n end", "def test_truth\n end", "def start_tests(files)\n end", "def run(selected_tests)\n # Test names (ordered) to be performed in game, per tests suite\n # Hash< Symbol, Array<String> >\n in_game_tests = {}\n selected_tests.each do |tests_suite, suite_selected_tests|\n if @tests_suites[tests_suite].respond_to?(:run_test)\n # Simple synchronous tests\n suite_selected_tests.each do |test_name|\n # Store statuses after each test just in case of crash\n set_statuses_for(tests_suite, [[test_name, @tests_suites[tests_suite].run_test(test_name)]])\n end\n end\n # We run the tests from the game itself.\n in_game_tests[tests_suite] = suite_selected_tests if @tests_suites[tests_suite].respond_to?(:in_game_tests_for)\n end\n return if in_game_tests.empty?\n\n # Keep track of the mapping between tests suites and in-game tests, per in-game tests suite.\n # Associated info is:\n # * *tests_suite* (Symbol): The tests suite that has subscribed to the statuses of some in-game tests of the in-game tests suite.\n # * *in_game_tests* (Array<String>): List of in-game tests that the tests suite is interested in.\n # * *selected_tests* (Array<String>): List of selected tests for which in-game tests are useful.\n # Hash< Symbol, Array< Hash< Symbol, Object > > >\n in_game_tests_subscriptions = {}\n # List of all in-game tests to perform, per in-game tests suite\n # Hash< Symbol, Array< String > >\n merged_in_game_tests = {}\n # Get the list of in-game tests we have to run and that we will monitor\n in_game_tests.each do |tests_suite, suite_selected_tests|\n in_game_tests_to_subscribe = @tests_suites[tests_suite].in_game_tests_for(suite_selected_tests)\n in_game_tests_to_subscribe.each do |in_game_tests_suite, selected_in_game_tests|\n selected_in_game_tests_downcase = selected_in_game_tests.map(&:downcase)\n in_game_tests_subscriptions[in_game_tests_suite] = [] unless in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite] << {\n tests_suite: tests_suite,\n in_game_tests: selected_in_game_tests_downcase,\n selected_tests: suite_selected_tests\n }\n merged_in_game_tests[in_game_tests_suite] = [] unless merged_in_game_tests.key?(in_game_tests_suite)\n merged_in_game_tests[in_game_tests_suite] = (merged_in_game_tests[in_game_tests_suite] + selected_in_game_tests_downcase).uniq\n end\n end\n in_game_tests_runner = InGameTestsRunner.new(@config, @game)\n in_game_tests_runner.run(merged_in_game_tests) do |in_game_tests_suite, in_game_tests_statuses|\n # This is a callback called for each in-game test status change.\n # Update the tests results based on what has been run in-game.\n # Find all tests suites that are subscribed to those in-game tests.\n # Be careful that updates can be given for in-game tests suites we were not expecting\n if in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite].each do |tests_suite_subscription|\n selected_in_game_tests_statuses = in_game_tests_statuses.slice(*tests_suite_subscription[:in_game_tests])\n next if selected_in_game_tests_statuses.empty?\n\n tests_suite = @tests_suites[tests_suite_subscription[:tests_suite]]\n tests_suite.statuses = tests_suite.\n parse_auto_tests_statuses_for(tests_suite_subscription[:selected_tests], { in_game_tests_suite => selected_in_game_tests_statuses }).\n select { |(test_name, _test_status)| tests_suite_subscription[:selected_tests].include?(test_name) }\n end\n end\n end\n end", "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end", "def test_contains_four_eachface\n assert true == false\n end", "def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end", "def runTest(browser)\n puts \"Step 2: At step description here\"\n #Do shit here\n #....\n puts \"Step 3: ....\"\n #Do more shit here\n #....\n\n puts \"Expected Result:\"\n puts \"Result that we expect to happen.\"\n\n if true #Test passed condition here\n self.passed = true\n puts \"TEST PASSED. Add some description/details here\"\n else #Test failed condition here\n self.passed = false\n puts \"TEST FAILED. Show what we have screwed up\"\n end\n end", "def testcase_processed\n\t\n\t\tcontinue = true\n\n\t\tthread = ::Thread.new do\n\t\t\n\t\t\tkill_browser\n\n\t\t\tcase @current_pass\n\t\t\t\twhen 1\n\t\t\t\t\t# Initial verification\n\t\t\t\t\t@genopts.keep\n\t\t\t\twhen 2\n\t\t\t\t\t# Reducing elements\n\t\t\t\t\t@elems.keep\n\t\t\t\twhen 3\n\t\t\t\t\t# Reducing idx's\n\t\t\t\t\t@idxs.keep\n\t\t\t\twhen 4\n\t\t\t\t\t# Final verification\n\t\t\t\t\t# booo, pass 4 has failed!?!.\n\t\t\t\t\tcontinue = false\n\t\t\t\telse\n\t\t\t\t\tcontinue = false\n\t\t\tend\n\n\t\t\t# while we still have testcases to generate...\n\t\t\tif( continue )\n\t\t\t\t# we go again an try the next testcase in a new browser instance\n\t\t\t\tspawn_browser\n\t\t\telse\n\t\t\t\t@reduction_server.stop\n\t\t\t\t::Thread.current.kill\n\t\t\tend\n\t\tend\n\t\t\n\t\tthread.join\n\t\t\n\t\treturn continue\n\tend", "def passes; end", "def passes; end", "def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end", "def test_checklist_status_values_not_started\n test = @product.product_tests.checklist_tests.first\n passing, failing, not_started, total = checklist_status_values(test)\n\n assert_equal 0, passing\n assert_equal 0, failing\n assert_equal 1, not_started\n assert_equal 1, total\n end", "def test\n\n puts \"Performing test tasks:\"\n\n puts \"Test 1 \" + (generate_intcode([1, 0, 0, 0, 99]) === [2, 0, 0, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 2 \" + (generate_intcode([2, 3, 0, 3, 99]) === [2, 3, 0, 6, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 3 \" + (generate_intcode([2, 4, 4, 5, 99, 0]) === [2, 4, 4, 5, 99, 9801] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 4 \" + (generate_intcode([1, 1, 1, 4, 99, 5, 6, 0, 99]) === [30, 1, 1, 4, 2, 5, 6, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n\nend", "def run_all\n run_suite(@suite)\n end", "def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def check_all_here\n end", "def final_test_methods\n return []\n end", "def run_all\n @last_run_states = @persistence ? @persistence.read('final_states', {}) : {}\n @skipped = {}\n run_suite(@suite)\n @persistence.store('final_states', @last_run_states) if @persistence\n end", "def run(selected_tests)\n unknown_tests_suites = selected_tests.keys - @available_tests_suites\n log \"[ In-game testing #{@game.name} ] - !!! The following in-game tests suites are not supported: #{unknown_tests_suites.join(', ')}\" unless unknown_tests_suites.empty?\n tests_to_run = selected_tests.reject { |tests_suite, _tests| unknown_tests_suites.include?(tests_suite) }\n return if tests_to_run.empty?\n\n FileUtils.mkdir_p \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData\"\n tests_to_run.each do |tests_suite, tests|\n # Write the JSON file that contains the list of tests to run\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Run.json\",\n JSON.pretty_generate(\n 'stringList' => {\n 'tests_to_run' => tests\n }\n )\n )\n # Clear the AutoTest test statuses that we are going to run\n statuses_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json\"\n next unless File.exist?(statuses_file)\n\n File.write(\n statuses_file,\n JSON.pretty_generate('string' => JSON.parse(File.read(statuses_file))['string'].delete_if { |test_name, _test_status| tests.include?(test_name) })\n )\n end\n auto_test_config_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_Config.json\"\n # Write the JSON file that contains the configuration of the AutoTest tests runner\n File.write(\n auto_test_config_file,\n JSON.pretty_generate(\n 'string' => {\n 'on_start' => 'run',\n 'on_stop' => 'exit'\n }\n )\n )\n out ''\n out '=========================================='\n out '= In-game tests are about to be launched ='\n out '=========================================='\n out ''\n out 'Here is what you need to do once the game will be launched (don\\'t launch it by yourself, the test framework will launch it for you):'\n out '* Load the game save you want to test (or start a new game).'\n out ''\n out 'This will execute all in-game tests automatically.'\n out ''\n out 'It is possible that the game crashes during tests:'\n out '* That\\'s a normal situation, as tests don\\'t mimick a realistic gaming experience, and the Bethesda engine is not meant to be stressed like that.'\n out '* In case of game crash (CTD), the Modsvaskr test framework will relaunch it automatically and resume testing from when it crashed.'\n out '* In case of repeated CTD on the same test, the Modsvaskr test framework will detect it and skip the crashing test automatically.'\n out '* In case of a game freeze without CTD, the Modsvaskr test framework will detect it after a few minutes and automatically kill the game before re-launching it to resume testing.'\n out ''\n out 'If you want to interrupt in-game testing: invoke the console with ~ key and type stop_tests followed by Enter.'\n out ''\n out 'Press enter to start in-game testing (this will lauch your game automatically)...'\n wait_for_user_enter\n last_time_tests_changed = nil\n with_auto_test_monitoring(\n on_auto_test_statuses_diffs: proc do |in_game_tests_suite, in_game_tests_statuses|\n yield in_game_tests_suite, in_game_tests_statuses\n last_time_tests_changed = Time.now\n end\n ) do\n # Loop on (re-)launching the game when we still have tests to perform\n idx_launch = 0\n loop do\n # Check which test is supposed to run first, as it will help in knowing if it fails or not.\n first_tests_suite_to_run = nil\n first_test_to_run = nil\n current_tests_statuses = check_auto_test_statuses\n @available_tests_suites.each do |tests_suite|\n next unless tests_to_run.key?(tests_suite)\n\n found_test_ok =\n if current_tests_statuses.key?(tests_suite)\n # Find the first test that would be run (meaning the first one having no status, or status 'started')\n tests_to_run[tests_suite].find do |test_name|\n found_test_name, found_test_status = current_tests_statuses[tests_suite].find { |(current_test_name, _current_test_status)| current_test_name == test_name }\n found_test_name.nil? || found_test_status == 'started'\n end\n else\n # For sure the first test of this suite will be the first one to run\n tests_to_run[tests_suite].first\n end\n next unless found_test_ok\n\n first_tests_suite_to_run = tests_suite\n first_test_to_run = found_test_ok\n break\n end\n if first_tests_suite_to_run.nil?\n log \"[ In-game testing #{@game.name} ] - No more test to be run.\"\n break\n else\n log \"[ In-game testing #{@game.name} ] - First test to run should be #{first_tests_suite_to_run} / #{first_test_to_run}.\"\n # Launch the game to execute AutoTest\n @game.launch(autoload: idx_launch.zero? ? false : 'auto_test')\n idx_launch += 1\n log \"[ In-game testing #{@game.name} ] - Start monitoring in-game testing...\"\n last_time_tests_changed = Time.now\n while @game.running?\n check_auto_test_statuses\n # If the tests haven't changed for too long, consider the game has frozen, but not crashed. So kill it.\n if Time.now - last_time_tests_changed > @game.timeout_frozen_tests_secs\n log \"[ In-game testing #{@game.name} ] - Last time in-game tests statuses have changed is #{last_time_tests_changed.strftime('%F %T')}. Consider the game is frozen, so kill it.\"\n @game.kill\n else\n sleep @game.tests_poll_secs\n end\n end\n last_test_statuses = check_auto_test_statuses\n # Log latest statuses\n log \"[ In-game testing #{@game.name} ] - End monitoring in-game testing. In-game test statuses after game run:\"\n last_test_statuses.each do |tests_suite, statuses_for_type|\n log \"[ In-game testing #{@game.name} ] - [ #{tests_suite} ] - #{statuses_for_type.select { |(_name, status)| status == 'ok' }.size} / #{statuses_for_type.size}\"\n end\n # Check for which reason the game has stopped, and eventually end the testing session.\n # Careful as this JSON file can be written by Papyrus that treat strings as case insensitive.\n # cf. https://github.com/xanderdunn/skaar/wiki/Common-Tasks\n auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].map { |key, value| [key.downcase, value.downcase] }.to_h\n if auto_test_config['stopped_by'] == 'user'\n log \"[ In-game testing #{@game.name} ] - Tests have been stopped by user.\"\n break\n end\n if auto_test_config['tests_execution'] == 'end'\n log \"[ In-game testing #{@game.name} ] - Tests have finished running.\"\n break\n end\n # From here we know that the game has either crashed or has been killed.\n # This is an abnormal termination of the game.\n # We have to know if this is due to a specific test that fails deterministically, or if it is the engine being unstable.\n # Check the status of the first test that should have been run to know about it.\n first_test_status = nil\n _found_test_name, first_test_status = last_test_statuses[first_tests_suite_to_run].find { |(current_test_name, _current_test_status)| current_test_name == first_test_to_run } if last_test_statuses.key?(first_tests_suite_to_run)\n if first_test_status == 'ok'\n # It's not necessarily deterministic.\n # We just have to go on executing next tests.\n log \"[ In-game testing #{@game.name} ] - Tests session has finished in error, certainly due to the game's normal instability. Will resume testing.\"\n else\n # The first test doesn't pass.\n # We need to mark it as failed, then remove it from the runs.\n log \"[ In-game testing #{@game.name} ] - First test #{first_tests_suite_to_run} / #{first_test_to_run} is in error status: #{first_test_status}. Consider it failed and skip it for next run.\"\n # If the test was started but failed before setting its status to something else then change the test status in the JSON file directly so that AutoTest does not try to re-run it.\n if first_test_status == 'started' || first_test_status == '' || first_test_status.nil?\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{first_tests_suite_to_run}_Statuses.json\",\n JSON.pretty_generate(\n 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).map do |(test_name, test_status)|\n [\n test_name,\n test_name == first_test_to_run ? 'failed_ctd' : test_status\n ]\n end.to_h\n )\n )\n # Notify the callbacks updating test statuses\n check_auto_test_statuses\n end\n end\n # We will start again. Leave some time to interrupt if we want.\n if @config.no_prompt\n out 'Start again automatically as no_prompt has been set.'\n else\n # First, flush stdin of any pending character\n $stdin.getc until select([$stdin], nil, nil, 2).nil?\n out \"We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it.\"\n key_pressed =\n begin\n Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }\n rescue Timeout::Error\n nil\n end\n if key_pressed\n log \"[ In-game testing #{@game.name} ] - Run interrupted by user.\"\n # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.\n break\n end\n end\n end\n end\n end\n end", "def querytests(binaries)\n # There are no test cases -- inconclusive.\n return 0 if binaries.empty?\n\n # If there are test cases, and _at least_ one of them managed to\n # _pass_, we assume the function is implemented.\n binaries.each { |b|\n f = File.new(\"#{b[0]}/log.passed\", 'r')\n while (line = f.gets)\n return 1 if line.include? b[1]\n end\n f.close\n }\n\n # Require at least 2 failing test cases.\n # XXX: Increase this to eliminate false positive results.\n return 0 if binaries.size < 2\n\n # The function is not implemented.\n return -1\nend", "def testloop\n \n end", "def test test_cases, f\n test_cases.each do |s, l, e|\n a = send(f, s, l)\n print \"#{f} #{s}, #{l} = #{a} ... \"\n if a == e\n puts 'PASS'\n else\n puts 'FAIL'\n end\n end\nend", "def integration_test()\n return [\"all\"]\n end", "def save_tests\n filtered_builds.each do |build|\n tests = test_failures(build['build_num'])\n tests.each do |test|\n save_test(test, build['build_num'])\n end\n end\n end", "def failed_checks\n all_checks_which_pass(false)\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def testing\n # ...\n end", "def passed?\n return @test_passed\n end", "def run\n checks.each(&:run)\n end", "def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def report_from(tests)\n tests.map do |test|\n report = [test.name, test.executed?]\n report << test.platform.name unless test.platform.nil?\n report << test.node unless test.node.nil?\n # Only report the first line of the error messages, as some contain callstacks\n report << test.errors.map { |error| error.split(\"\\n\").first } unless test.errors.empty?\n report\n end\n end", "def run_all\n UI.info \"Running all tests...\"\n _really_run(Util.xcodebuild_command(options))\n end", "def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end", "def test_run_completed(test_run)\n report_results test_run\n end", "def run_fe_tests\n end", "def run_all\n passed = @runner.run_all!\n\n throw :task_has_failed unless passed\n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end" ]
[ "0.7274132", "0.7200911", "0.71905994", "0.7134598", "0.7127439", "0.70358455", "0.6860759", "0.68229115", "0.68049264", "0.6790065", "0.6790065", "0.6768047", "0.65728307", "0.65551996", "0.65487796", "0.65460235", "0.65293026", "0.64595217", "0.6447049", "0.6447049", "0.6441135", "0.64316434", "0.64316434", "0.642825", "0.63923085", "0.636345", "0.6343057", "0.63372016", "0.63203555", "0.6299623", "0.6284468", "0.62774086", "0.62632114", "0.6259585", "0.62464374", "0.6235319", "0.62153786", "0.62005377", "0.6199617", "0.6199139", "0.61982924", "0.6195854", "0.61939454", "0.6193542", "0.6192025", "0.6192025", "0.6192025", "0.61888516", "0.6185608", "0.6170051", "0.61620754", "0.6158359", "0.61409265", "0.61348844", "0.61348844", "0.61343503", "0.61328936", "0.61303157", "0.6121021", "0.6111094", "0.6106691", "0.60886276", "0.6087629", "0.6087446", "0.60841537", "0.60841537", "0.60830265", "0.60774684", "0.60764015", "0.6075713", "0.6073246", "0.6063769", "0.6051214", "0.6050966", "0.6042158", "0.60243255", "0.60241014", "0.6019627", "0.6019041", "0.60136944", "0.60131127", "0.6006864", "0.6000295", "0.6000295", "0.6000057", "0.5990331", "0.5990331", "0.5990331", "0.5983938", "0.5971915", "0.5969684", "0.59696263", "0.5965452", "0.5955056", "0.59545577", "0.59439194", "0.594306", "0.5942392", "0.5942066", "0.5933383", "0.59289336" ]
0.0
-1
Creates a thumbnail of the specified width. If you want to add a border later on, you want to pass in a slightly smaller width to accomodate that.
def thumbnail(width, input, output) profile_normalization_args=["--eprofile", srgb_profile_path, "--delete"] vips_jpg_params="[Q=#{@jpeg_q },interlace,optimize_coding,strip]" args = if width # The image will be resized to fit within a box # which is `width` wide and very, very very tall. # See: # https://github.com/libvips/libvips/issues/781 # https://github.com/libvips/ruby-vips/issues/150 [ vips_thumbnail_command, input.path, *profile_normalization_args, "--size", "#{width}x1000000", "-o", "#{output.path}#{vips_jpg_params}" ] else [ vips_command, "copy", input.path, *profile_normalization_args, "#{output.path}#{vips_jpg_params}" ] end @cmd.run(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_thumbnail\n return create_resized_pic(THUMBNAIL_HEIGHT, THUMBNAIL_WIDTH, SIZE_THUMBNAIL)\n end", "def create_thumbnail\n image = Image.from_blob(self.photo_image).first\n thumbnail = image.resize_to_fill(320,240, gravity=CenterGravity)\n thumbnail.to_blob\n end", "def create_thumbnail\n ImageGeneratingService.new(self, 'Thumbnail.png', 'image/png').generate_resized(120)\n end", "def thumbnail(size); end", "def generate_thumbnail path, img\n img = img.resize_to_fit 200,200\n img.write path\n end", "def create_thumbnail(source, target)\n command_exec(:create_thumbnail, [quote(source), quote(target)])\n end", "def create_thumbnail(image)\n thumb = ( image.gsub /^#{@dirname}/, \"#{@thumbs}\" ) + @thumbext\n system(\"convert #{image} -thumbnail '#{@size}>' -#{@action} '#{@size}' -background white -quality 60 -gravity center -extent #{@size} #{thumb}\")\n end", "def custom_thumbnail_image_for(drive_thumbnail_link, custom_width)\n file_url, current_width = drive_thumbnail_link.split(/=s/)\n \"#{ file_url }=s#{ custom_width }\"\n end", "def public_url_custom_thumbnail_from(title, custom_width)\n metadata_or_default_img_from(title) do |metadata|\n custom_thumbnail_image_for(metadata.thumbnail_link, custom_width)\n end\n end", "def generate_thumbnail(image_path, commit_id)\n thumb_size = Glitter::Application.config.thumbnail_geometry\n image = Magick::Image.read(\n \"#{satellitedir}/#{image_path}\"\n ).first\n image.scale(\n thumb_size[0],\n thumb_size[1]\n ).write thumbnail_for(commit_id, true)\n end", "def quick_thumbnail(how, what)\n if how == :pos\n if what.is_a? Fixnum\n what = [0, what]\n end\n end\n QuickThumbnail.new(self, how, what, parent_widget, window_id, :thumbnail)\n end", "def thumbnail(options = {})\n return if !readable? || !thumbnailable?\n\n size = options[:size].to_i\n if size > 0\n # Limit the number of thumbnails per image\n size = (size / 50.0).ceil * 50\n # Maximum thumbnail size\n size = 800 if size > 800\n else\n size = Setting.thumbnails_size.to_i\n end\n size = 100 unless size > 0\n target = thumbnail_path(size)\n\n diskfile_s3 = diskfile\n begin\n Redmine::Thumbnail.generate(diskfile_s3, target, size, is_pdf?)\n rescue => e\n Rails.logger.error \"An error occured while generating thumbnail for #{diskfile_s3} to #{target}\\nException was: #{e.message}\"\n return\n end\n end", "def resize_to_width(width)\n manipulate! do |img|\n img.resize \"#{width}>\"\n img = yield(img) if block_given?\n img\n end\n end", "def generate_thumbnail(image_path, commit_id)\n Gg::ImageProcessing.new(\"#{satellitedir}/#{image_path}\")\n .generate(image_for(commit_id, 'thumbnails'), 'thumbnail')\n end", "def cropped_thumbnail(size) # :yields: image\n w, h = width, height\n l, t, r, b, half = 0, 0, w, h, (w - h).abs / 2\n\n l, r = half, half + h if w > h\n t, b = half, half + w if h > w\n\n with_crop(l, t, r, b) do |img|\n img.thumbnail(size) do |thumb|\n yield thumb\n end\n end\n end", "def sized(width, height)\n\t\t\t@sized_thumb = @template\n\t\t\t@sized_thumb.sub! \"{width}\", width.to_s\n\t\t\t@sized_thumb.sub! \"{height}\", height.to_s\n\t\tend", "def create_homepage_thumbnail\n image = Image.from_blob(self.photo_image).first\n thumbnail = image.resize_to_fill(320,240, gravity=CenterGravity)\n thumbnail.to_blob\n end", "def create_thumb(filename, height = 130)\n convert_cmd = `which convert`.strip\n \n output_filename = filename.gsub(\".png\", \"\") + \"-thumb-height-#{height}.png\"\n \n if !system(\"#{convert_cmd} -resize 'x#{height}' \\\"#{filename}\\\" \\\"#{output_filename}\\\" 2>&1\")\n @convert_errors.push(\"Errors during running convert utility (thumbnailing) on file '#{filename}'\")\n end\n \n output_filename\n end", "def create_medium\n return create_resized_pic(MEDIUM_HEIGHT, MEDIUM_WIDTH, SIZE_MEDIUM)\n end", "def via_memory(filename, thumbnail_width)\n data = IO.binread(filename)\n\n thumb = Vips::Image.thumbnail_buffer data, thumbnail_width, crop: \"centre\"\n\n thumb.write_to_buffer \".jpg\"\nend", "def resize_and_pad(width, height, background=:transparent, gravity='Center')\n manipulate! do |img|\n opt={}\n opt[:thumbnail] = \"#{width}x#{height}>\"\n background == :transparent ? opt[:background] = \"rgba(255, 255, 255, 0.0)\" : opt[:background] = background\n opt[:gravity] = gravity\n opt[:extent] = \"#{width}x#{height}\"\n img.manipulate!(opt)\n img = yield(img) if block_given?\n img\n end\n end", "def image_as_medium_thumbnail\n image.variant(resize_to_fill: [350, 350]).processed\n end", "def product_thumbnail(product, width = nil, height = nil)\n\t\twidth ||= @design_config[:sizes][:category_page_thumbnail_width]\n\t\theight ||= @design_config[:sizes][:category_page_thumbnail_height]\n\n\t\tif product.image\n\t\t\talt_text = product.image_alt_tag || product.image.caption\n\t\t\timage_tag(\"/product_images/thumbnail/#{product.image.id}/#{width}/#{height}\", :class => \"thumbnail\", :size => \"#{width}x#{height}\", :alt => alt_text, :title => product.name)\n\t\telse\n\t\t\t\"<table class=\\\"no-image\\\"><tr><td style=\\\"width: #{width - 2}px; height: #{height - 2}px;\\\">(No image available)</td></tr></table>\"\n\t\tend\n\tend", "def thumbnail!\n image.recreate_versions! if thumbnail_coordinates_changed?\n end", "def thumbnail(geometry)\n \t mogrify(:thumbnail, geometry)\n \t self\n end", "def cropped_thumbnail(geometry)\n ow,oh = @original_width,@original_height\n \t w,h = geometry.strip.split('x').map{|n|n.to_i}\n\n \t\tif (ow.to_f / oh) < (w.to_f / h)\n \t\t\t# narrow aspect ratio, width is the priority\n \t\t\tresized_w = w\n \t\t\tresized_h = ((w.to_f / ow) * oh).round # scale height to same ratio as width\n \t\telse\n \t\t\t# wide or square aspect ratio, height is the priority\n \t\t\tresized_h = h\n \t\t\tresized_w = ((h.to_f / oh) * ow).round # scale width to the same ratio as height\n \t\tend\n \t\tresize_to = [resized_w,resized_h].max\n\n thumbnail(\"#{resize_to}x#{resize_to}\")\n crop(geometry)\n \t\tself\n \tend", "def via_files(filename, thumbnail_width)\n thumb = Vips::Image.thumbnail filename, thumbnail_width, crop: \"centre\"\n\n thumb.write_to_buffer \".jpg\"\nend", "def cut_to_fit(options)\n %Q{-thumbnail #{options.width}x#{options.height}^ \\\n -gravity #{options.gravity} \\\n -unsharp 0x.5 \\\n -auto-orient \\\n -extent #{options.width}x#{options.height}}\n end", "def resize_to_width(width)\n manipulate! do |image|\n resize_image image, width, image.y_size\n end\n self\n end", "def thumb(w_x_h, quality: 90, immediate: false)\n fail_for_non_images\n return thumb_in_test_env(w_x_h, quality: quality) if Rails.env.test?\n\n if thumbnail_sizes[w_x_h] && thumbnail_sizes[w_x_h][:uid]\n ret = OpenStruct.new(thumbnail_sizes[w_x_h])\n ret.url = Dragonfly.app.remote_url_for(ret.uid)\n ret\n else\n if svg?\n url = file.remote_url\n width = file_width\n height = file_height\n else\n if immediate || self.class.immediate_thumbnails\n image = Folio::GenerateThumbnailJob.perform_now(self, w_x_h, quality)\n ret = OpenStruct.new(image.thumbnail_sizes[w_x_h])\n ret.url = Dragonfly.app.remote_url_for(ret.uid)\n return ret\n else\n Folio::GenerateThumbnailJob.perform_later(self, w_x_h, quality)\n url = temporary_url(w_x_h)\n end\n width, height = w_x_h.split('x').map(&:to_i)\n end\n OpenStruct.new(\n uid: nil,\n signature: nil,\n url: url,\n width: width,\n height: height,\n quality: quality\n )\n end\n end", "def thumb_width\n width * thumb_height / height\n end", "def create_thumbnail(image)\n #FIXME - make the path consistent with working tree files.\n # the current proess relies on Glimage paths which we don't have.\n geo = Rails.application.config.thumbnail_geometry.nil? ? \"100\" : Rails.application.config.thumbnail_geometry\n cmd = Escape.shell_command [\"convert\", image.filepath, '-thumbnail', geo, image.thumbnail('filepath')]\n logger.debug \"Command: #{cmd}\"\n output = `#{cmd}`\n logger.debug \"output #{output}\"\n logger.debug \"result #{$?.success?}\"\n end", "def create_thumbnail(image, mime_type, temp_file)\n return if self.content.content.nil?\n if [\"application/pdf\"].include? mime_type\n nil # create_pdf_thumbnail\n elsif [\"image/png\",\"image/jpeg\", \"image/gif\", \"image/tif\", \"image/jp2\"].include? mime_type\n create_scaled_image(image, 200, temp_file)\n else\n nil\n end\n end", "def extract_thumb(input, output, width, height)\n Image::Editing::ResizeToFill.new(input, output, width, height).run\n end", "def create\n @thumbnail = Thumbnail.new(thumbnail_params)\n\n respond_to do |format|\n if @thumbnail.save\n format.html { redirect_to @thumbnail, notice: 'Thumbnail was successfully created.' }\n format.json { render :show, status: :created, location: @thumbnail }\n else\n format.html { render :new }\n format.json { render json: @thumbnail.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_thumbnail(server, id, width, height, method = 'scale')\n make_request(\n :get,\n \"/thumbnail/#{server}/#{id}\",\n headers: { 'Accept' => 'image/jpeg, image/png' },\n params: { width: width, height: height, method: method },\n base: @media_uri\n )\n end", "def thumbnail(image_options = {})\n return super if block_given?\n return @thumbnail if @thumbnail\n\n return if @show\n\n component = @thumbnail_component || presenter.view_config.thumbnail_component\n render(component.new(presenter: presenter, counter: @counter, image_options: image_options))\n end", "def thumbnail_image\n end", "def resize_to_limit(width, height)\n manipulate! do |img|\n img.resize \"#{width}x#{height}>\"\n img = yield(img) if block_given?\n img\n end\n end", "def create_thumbnail\n #create the subfolder if it doesn't exist\n return false if !subdir_is_writable?\n \n if File.exists?(thumbnail_path)\n logger.warn(\"Not creating thumbnail for movie #{self} because it already exists\")\n return\n end\n \n #generate a thumbnail and put it inside that subfolder\n thumbnail_command = \"#{RmedialSetting.default.path_to_ffmpeg} -i \\\"#{file_name}\\\" -s #{THUMBNAIL_W}x#{THUMBNAIL_H} -an -ss 3 -t 00:00:03 -f mjpeg -y \\\"#{thumbnail_path}\\\"\"\n if !system(thumbnail_command)\n logger.error(\"Unable to create thumbnail for #{self}: #{$!}. Ran command: #{thumbnail_command}\")\n else\n logger.debug(\"Created thumbnail fine for #{self}\")\n end\n end", "def regenerate_thumbnail(size = nil,\n clear_rot_tag = false,\n only_upright = false)\n option = \"-rgt\"\n option << size unless size.nil?\n option << \" -norot\" if clear_rotation_tag\n option << \" -orp\" if only_upright\n Jhead.call(option, @match, @pattern)\n end", "def thumb_for(document, size)\n image_tag document.thumb(size, self)\n end", "def thumbnail(sid, opts={})\r\n\r\n maxwidth\t= (opts[:maxwidth] || 128).to_f\r\n maxheight\t= (opts[:maxheight] || 128).to_f\r\n aspectratio\t= maxwidth / maxheight\r\n path\t\t= nil\r\n dest_path\t= nil\r\n pic\t\t= nil\r\n case sid.to_sym\r\n when :photo\r\n path\t\t= self.photo__path\r\n dest_path\t= self.photo__thumb_path\r\n end\r\n pic\t = path ? Magick::Image.read(path).first : Magick::Image.from_blob(pic).first\r\n imgwidth = pic.columns\r\n imgheight = pic.rows\r\n imgratio = imgwidth.to_f / imgheight.to_f\r\n scaleratio= imgratio > aspectratio ? maxwidth / imgwidth : maxheight / imgheight\r\n thumb\t = pic.thumbnail(scaleratio)\r\n thumb.write(dest_path) if dest_path\r\n return thumb.to_blob\r\n end", "def resize_to_limit(width, height)\n manipulate! do |img|\n img.manipulate!(:resize => \"#{width}x#{height}>\")\n img = yield(img) if block_given?\n img\n end\n end", "def fake_thumbnail(commit_id)\n src = File.join(Rails.public_path, 'mini_dir.png')\n FileUtils.ln_s src, image_for(commit_id, 'thumbnails')\n end", "def thumbnail_builder\n ::ManifestBuilder::ThumbnailBuilder\n end", "def image_width(image_width)\n end", "def get_thumbnail(input)\n puts \"getting thumbnail of #{input}\"\n out = File.join(File.dirname(input),File.basename(input,File.extname(input)) + \"-%d.jpg\")\n FFmpeg.encode do |ff| \n ff.input = input\n ff.record_start_time = 0\n ff.record_for = 0.001\n ff.video_frames = 1\n ff.video_frame_size = '200x150'\n ff.output = out\n end\n end", "def resize\n if size.max > 1024\n res = %x( #{magick_bin_name(\"convert\")} -auto-orient -resize 1024x768 #{Shellwords.shellescape path} #{Shellwords.shellescape path})\n Rails.logger.info res\n end\n unless has_thumbnail?\n unless File.exists? path.gsub(/(.+)\\/.+/, '\\1/thumbs')\n Dir.mkdir path.gsub(/(.+)\\/.+/, '\\1/thumbs')\n end\n ## that's a bit broken on windows - why?\n res = %x( #{magick_bin_name(\"convert\")} -verbose -auto-orient -strip -thumbnail 300x160 #{Shellwords.shellescape path} #{Shellwords.shellescape path.gsub(/(.+)\\/(.+)/, '\\1/thumbs/\\2')})\n Rails.logger.info res\n end\n end", "def thumbnail(data, options = {})\n source_info = info data\n \n opts = {\n :width => source_info.width,\n :height => source_info.height,\n :preserve_aspect_ratio => true,\n :format => :png\n }.merge(options)\n \n width, height = calculate_aspect_ratio source_info, opts\n \n # Set res so we can assign it within the SmartImage.new block\n res = nil\n \n SmartImage.new(width, height) do |image|\n image.composite data, :width => width,\n :height => height,\n :preserve_aspect_ratio => false\n \n res = image.encode opts[:format]\n end\n \n res\n end", "def make_thumbnails\n return true unless defined?(IMAGEMAGICK_CONVERT) && is_local?\n system(\"#{IMAGEMAGICK_CONVERT} -resize #{THUMBNAIL_SIZE} #{filename} #{filename('s')}\")\n true\n end", "def thumbnail_url\n @thubnail_url ||= url_for_format('thumbnail', 'png')\n end", "def add_border(options = {})\n border_width = options[:width].to_i || 2\n color = hex_to_color(options[:color]) || hex_to_color(\"000000\")\n style = options[:style]\n style = nil if style.to_sym == :plain\n new_width, new_height = width + 2*border_width, height + 2*border_width\n target = paint(BufferedImage.new(new_width, new_height, color_type)) do |g|\n g.color = color\n if style\n raised = style.to_sym == :raised ? true : false\n g.fill3DRect(0, 0, new_width, new_height, raised)\n else\n g.fill_rect(0, 0, new_width, new_height)\n end\n g.draw_image(@src, nil, border_width, border_width)\n end\n block_given? ? yield(target) : target\n end", "def image_new(width, height)\n Magick::Image.new(width, height)\n end", "def width(val); @width = val; self; end", "def create_thumbnail\n return unless self.content.has_content?\n\n if video?\n create_video_thumbnail\n elsif pdf?\n create_pdf_thumbnail\n else\n create_derivatives\n end\n self.save\n end", "def resize_to_limit(width, height)\n width = dimension_from width\n height = dimension_from height\n manipulate! do |img|\n geometry = Magick::Geometry.new(width, height, 0, 0, Magick::GreaterGeometry)\n new_img = img.change_geometry(geometry) do |new_width, new_height|\n img.resize(new_width, new_height)\n end\n destroy_image(img)\n new_img = yield(new_img) if block_given?\n new_img\n end\n end", "def scale_to(new_size, background:background)\n new_size = SugarCube::CoreGraphics::Size(new_size)\n\n image_size = self.size\n\n if CGSizeEqualToSize(image_size, new_size)\n return self\n end\n\n new_image = nil\n width = image_size.width\n height = image_size.height\n\n target_width = new_size.width\n target_height = new_size.height\n\n scale_factor = 0.0\n scaled_width = target_width\n scaled_height = target_height\n\n thumbnail_point = CGPoint.new(0.0, 0.0)\n width_factor = target_width / width\n height_factor = target_height / height\n\n if width_factor < height_factor\n scale_factor = width_factor\n else\n scale_factor = height_factor\n end\n\n scaled_width = width * scale_factor\n scaled_height = height * scale_factor\n\n # center the image\n\n if width_factor < height_factor\n thumbnail_point.y = (target_height - scaled_height) * 0.5\n elsif width_factor > height_factor\n thumbnail_point.x = (target_width - scaled_width) * 0.5\n end\n\n # this is actually the interesting part:\n\n UIGraphicsBeginImageContextWithOptions(new_size, false, self.scale)\n\n if background\n background = background.uicolor\n context = UIGraphicsGetCurrentContext()\n background.setFill\n CGContextAddRect(context, [[0, 0], new_size])\n CGContextDrawPath(context, KCGPathFill)\n end\n\n thumbnail_rect = CGRectZero\n thumbnail_rect.origin = thumbnail_point\n thumbnail_rect.size.width = scaled_width\n thumbnail_rect.size.height = scaled_height\n\n self.drawInRect(thumbnail_rect)\n\n new_image = UIGraphicsGetImageFromCurrentImageContext()\n UIGraphicsEndImageContext()\n\n raise \"could not scale image\" unless new_image\n\n return new_image\n end", "def thumbnail(geometry = nil)\n if geometry.is_a?(Symbol) and Refinery::Images.user_image_sizes.keys.include?(geometry)\n geometry = Refinery::Images.user_image_sizes[geometry]\n end\n\n if geometry.present? && !geometry.is_a?(Symbol)\n image.thumb(geometry)\n else\n image\n end\n end", "def thumbnail\r\n\t\tbegin\r\n\t\t\t@image = Image.find(params[:id])\r\n\t\trescue ActiveRecord::RecordNotFound\r\n\t\t\trender :text => \"Image ##{params[:id].to_s} not found\"\r\n\t\telse\r\n\t\t\t# Can probably replace this with a call to to_sym(), but why fix what ain't broke?\r\n\t\t\tscaling_mode = case params[:mode]\r\n\t\t\twhen 'stretch' then :stretch\r\n\t\t\twhen 'fit' then :fit\r\n\t\t\twhen 'crop' then :crop\r\n\t\t\telse :fit\r\n\t\t\tend\r\n\t\t\t@thumbnail = @image.thumbnail(params[:width], params[:height], scaling_mode)\r\n\t\t\tif @thumbnail.kind_of? Thumbnail\r\n\t\t\t\tsend_data(@thumbnail.data,\r\n\t\t\t\t\t:filename => @thumbnail.filename,\r\n\t\t\t\t\t:type => @thumbnail.content_type,\r\n\t\t\t\t\t:disposition => 'inline')\r\n\t\t\telse\r\n\t\t\t\trender :text => @thumbnail.inspect\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def thumbnail_width\n\t\t\t@data[\"thumbnail\"][\"width\"] if @data[\"thumbnail\"]\n\t\tend", "def thumbnail\n \"template_\" + self.template.stylesheets + \".png\"\n end", "def spacer(width = 10)\n image_tag \"1x1.gif\", :width => width, :height => 1, :alt => nil\n end", "def thumbnail_path\n \"t_\" + image_path\n end", "def clubthumbnail_tag(club)\n image_tag(club.clubavatar.thumbnail_url, :border => 0)\n end", "def create_resized_image\n create_image do |xfrm|\n if size\n xfrm.flatten\n xfrm.resize(size)\n end\n end\n end", "def fake_thumbnail(commit_id)\n src = File.join(Rails.public_path, 'mini_dir.png')\n FileUtils.ln_s src, thumbnail_for(commit_id)\n end", "def thumbnail_impl(from_path, size='large') # :nodoc:\n from_path = format_path(from_path, false)\n\n raise DropboxError.new(\"size must be small medium or large. (not '#{size})\") unless ['small','medium','large'].include?(size)\n\n params = {\n \"size\" => size\n }\n\n url = build_url(\"/thumbnails/#{@root}#{from_path}\", params, content_server=true)\n\n @session.do_get url\n end", "def thumbnail(command)\n path = '/' + clean_up(command[1])\n dst = command[2]\n out, metadata = @client.files.thumbnail(path)\n pp metadata\n open(dest, 'w') { |f| f.puts out }\n puts \"wrote thumbnail #{ dst }.\"\n end", "def resize_to(width, height); end", "def generate_video_thumbnail file\n FileUtils.rm(\"tmp/thumb.jpg\") if File.exists?(\"tmp/thumb.jpg\")\n begin\n `ffmpegthumbnailer -i #{file} -o tmp/thumb.jpg /dev/null 2>&1`\n File.new(\"tmp/thumb.jpg\").size > 0 ? true : false\n rescue => e\n logger.info e.inspect\n return false\n end\n end", "def thumbnail_url\n @thumbnail_url ||= Thumbnail.new(self).url\n end", "def set_thumbnail\n @thumbnail = Thumbnail.find(params[:id])\n end", "def thumb\n File.join folder, 'thumbs', file_path\n end", "def thumb\n File.join folder, 'thumbs', file_path\n end", "def thumbnail\n feedItem = FeedItem.where(\"id = ?\", params[:id]).limit(1).first rescue nil\n\n if (feedItem)\n # Generate a thumbnail image if none exists\n feedItem.generate_thumbnail if feedItem.image.blank?\n\n if feedItem.image.blank?\n return redirect_to \"file:///\" \n else\n return redirect_to feedItem.image\n end\n else\n return redirect_to \"file:///\"\n end\n end", "def getthumbnail\n @trek = Trek.find params[:id]\n if @trek.nil?\n redirect_to treks_path, :alert => \"Trek not found.\"\n end\n fname = params[\"name\"]+\".\"+params[\"format\"]\n thumb_path = @trek.get_thumbnail(fname)\n if thumb_path.nil?\n img = Magick::Image.read(@trek.get_img_path(fname)).first\n thumb = img.resize_to_fill(75, 75)\n thumb.write(@trek.get_processed_path + \"/\" + fname)\n send_data thumb.to_blob, :type => \"image/jpeg\", :disposition => \"inline\"\n else\n send_file thumb_path, :type => \"image/jpeg\", :disposition => \"inline\"\n end\n end", "def create_image\r\n if @max_width\r\n @image = Gosu::Image.from_text($window, @text, @font, @size, @line_spacing, @max_width, @align)\r\n else\r\n @image = Gosu::Image.from_text($window, @text, @font, @size)\r\n end\r\n end", "def thumbnail_width\n\t\t\t@data[\"thumbnail\"][\"width\"]\n\t\tend", "def thumb (size = '80x80#')\n if web_image?\n # Although Dragonfly is not thread-safe, since this operation likely has\n # no side-effects, we don't place it within a critical section.\n # TODO Ensure Dragonfly processing works with multiple threads\n Dragonfly.app.fetch_url(access_url).thumb(size).url\n else\n 'http://placehold.it/40?text=No+Image';\n end\n end", "def resize_to_limit(new_width, new_height)\n manipulate! do |image|\n image = resize_image(image,new_width,new_height) if new_width < image.width || new_height < image.height\n image\n end\n end", "def generate_thumb(tmp_file_path)\n %x(convert #{tmp_file_path}.pdf[0-#{@num_thumb_pages}] -thumbnail x640 #{tmp_file_path}.png)\n stripped_file_names = (0...@num_thumb_pages).to_a.map { |i| \"#{tmp_file_path}-#{i}.png\" }.join(\" \")\n output_path = \"#{tmp_file_path}_merged.jpg\"\n %x(montage #{stripped_file_names} -mode concatenate -quality 80 -tile x1 #{output_path})\n\n output_path\n end", "def my_resize(width, height)\n manipulate! do |img|\n img.resize \"#{width}x#{height}!\"\n img\n end\n end", "def thumb_url(size)\n image.file.thumb(size).url\n end", "def vimeo_thumbnail(format='small')\n thumbnail_id = case format.to_s\n when 'small' then 0\n when 'medium' then 1\n when 'large' then 2\n else 0\n end\n vimeo_info[\"thumbnails\"][\"thumbnail\"][thumbnail_id]\n end", "def user_thumbnail(user)\n if user.thumbnail.present?\n image_tag(user.thumbnail, border: 0)\n else\n image_tag('assets/images/default_image.jpg', border: 0)\n end\n end", "def make_responsive(img,width)\n [\n [\"-resize 'x#{width}>'\", \"-#{width}.webp\"],\n [\"-resize 'x#{width * 2}>'\", \"-#{width}@2x.webp\"],\n ].each do |i|\n convert(img, i.first, i.last)\n end\nend", "def thumb_url\n image.url(:thumbnail)\n end", "def thumb_url\n image.url(:thumbnail)\n end", "def add_border(size=3,r=0,g=0,b=0)\n width = @x_size+2*size\n height = @y_size+2*size\n resampled = image_create_true_color(width,height)\n image_filled_rectangle(resampled,0,0,width,height, r, g, b)\n image_copy(@picture,resampled,size,size,0,0,@x_size,@y_size)\n image_destroy(@picture)\n @x_size = width\n @y_size = height\n @picture = image_create_true_color(@x_size,@y_size)\n image_filled_rectangle(@picture,0,0,@x_size,@y_size,255,255,255)\n image_color_transparent(@picture,255,255,255)\n image_copy(resampled,@picture,0,0,0,0,@x_size,@y_size)\n end", "def thumbnail(pathtype)\n filename = file.delete \".\"\n path = File.dirname(send(pathtype))\n File.join path, \"#{filename}_thumb.png\"\n end", "def startIndivThumbnail image\n return \"\n <li class='span3'>\n <div class='thumbnail'>\n <img id='peopleImg' src= #{image} >\n <div class='caption'> \"\n end", "def createThumbnail(blob, contenttype, device )\n\n\n thumb_path = \"public/thumbnails/#{device.id}/\"\n \n thumb_name = blob.blob_hash.to_s+\".png\"\n\n if contenttype == \"image/jpeg\" or contenttype == \"image/png\" or contenttype == \"image/gif\"\n data = getBlobById(blob.blob_hash)\n createIcon(data, thumb_name, thumb_path)\n blob.update_attribute(:thumbnail_name, thumb_name)\n return thumb_name\n \n elsif contenttype == \"video/x-msvideo\" or contenttype == \"video/msvideo\"\n format = blob.devfile.name.split(\".\").last\n if format == 'avi'\n vR_default_thumbnail_file = \"vR_avi.png\"\n elsif format == 'mov'\n vR_default_thumbnail_file = \"vR_mov.png\"\n end\n \n elsif contenttype == \"application/mswordapplication/x-mswordapplication/x-wordapplication/wordtext/plain\"\n vR_default_thumbnail_file = \"vR_doc.png\"\n elsif contenttype == \"application/x-ruby\"\n vR_default_thumbnail_file = \"vR_ruby.png\"\n elsif contenttype == \"text/plain\"\n vR_default_thumbnail_file = \"vR_txt.png\"\n else\n puts \"Unknown Filetype: #{contenttype.to_s}\".background(:red)\n vR_default_thumbnail_file = \"vR_unknown.png\"\n end\n \n # create dir if it does not exist\n if not (File.exists?(thumb_path) && File.directory?(thumb_path))\n FileUtils.mkdir_p(thumb_path)\n end\n \n # Copy default thumbnail to file\n from = \"public/thumbnails/vR_default_thumbnails/\" + vR_default_thumbnail_file\n to = thumb_path+thumb_name\n # ftools (ruby 1.8.7)\n #File.copy(from, to )\n \n # fileutils (ruby 1.9.2)\n FileUtils.cp(from, to )\n \n \n blob.update_attribute(:thumbnail_name, thumb_name)\n return thumb_name\n end", "def create\n\n return unless parent.preview.exists?\n\n self.thumbs.each_pair do |name, thumb|\n thumb.create\n end\n end", "def initialize(picture_name, width_slide, width_plain)\n super('')\n @picture_name = picture_name\n @width_slide = width_slide\n @width_plain = width_plain\n end", "def on_demand(width, height)\n dims = \"#{width}x#{height}\"\n\n public_path = self.public_path(dims)\n output_path = self.output_path(dims)\n\n if File.exists?(output_path)\n logger.info \"[iphoto library] Thumbnail hit at #{public_path}\"\n else\n FileUtils.mkdir_p(File.dirname(output_path))\n\n unless defined? MiniMagick\n logger.debug \"[iphoto library] Requiring MiniMagick\"\n require 'mini_magick'\n end\n\n image = MiniMagick::Image.from_file(image_path(true))\n image.resize dims\n image.write(output_path)\n FileUtils.chmod 0755, output_path\n\n logger.info \"[iphoto library] Created thumbnail at #{output_path}\"\n end\n\n public_path\n end", "def thumbnail\n\n image = Rails.cache.fetch(\"/image_thumbnail/#{params[:id]}\", :expires_in => 10.minutes) do\n puts \"miss!\"\n user_client.thumbnail(params[:id], min_height: 256, min_width: 256)\n end\n\n send_data image, :type => 'image/png', :disposition => 'inline'\n end", "def thumbnail(input = 0)\n return self.uploads[input].variant(resize: '1000x1000').processed\n end", "def width=(value)\n # if width had changed\n if @width != value\n # delete old bitmap\n @background.bitmap.dispose if @background.bitmap != nil\n @width = value\n # create new background bitmap\n create_background_bitmap\n end\n end", "def resize_pic(filename,resizewidth,out_path)\n nw = resizewidth\n n = File.basename(filename)\n i = QuickMagick::Image.read(filename).first\n w = i.width.to_f # Retrieves width in pixels\n h = i.height.to_f # Retrieves height in pixels\n pr = w/h\n nh = nw/pr \n i.resize \"#{nw}x#{nh}!\"\n i.save \"#{out_path}/#{n}\"\nend" ]
[ "0.748874", "0.6964323", "0.6913624", "0.6889628", "0.6693401", "0.65814626", "0.6438554", "0.64294255", "0.6373394", "0.628498", "0.6252689", "0.61509806", "0.61287034", "0.60934186", "0.608831", "0.60692656", "0.6039962", "0.6027294", "0.5983646", "0.59438753", "0.59370196", "0.5928119", "0.5881869", "0.5868114", "0.5862909", "0.5853369", "0.5836664", "0.58203304", "0.57707375", "0.57641864", "0.57636344", "0.576272", "0.5757208", "0.56415766", "0.5584315", "0.5556204", "0.5553776", "0.55531466", "0.55530894", "0.552171", "0.55159575", "0.551083", "0.5502682", "0.5502413", "0.5500793", "0.54925644", "0.5460433", "0.5448034", "0.544602", "0.5404047", "0.5402762", "0.53768456", "0.53683335", "0.5367474", "0.5341643", "0.5341217", "0.5293896", "0.52921605", "0.5283069", "0.52729577", "0.52720475", "0.52562726", "0.52525693", "0.5240893", "0.52367514", "0.5230956", "0.5225429", "0.5217878", "0.5208865", "0.5207055", "0.5192271", "0.51821643", "0.51814497", "0.5166189", "0.5166189", "0.5157587", "0.5153502", "0.5148597", "0.5142958", "0.5142788", "0.5104634", "0.5103001", "0.50974804", "0.50973076", "0.5095644", "0.5094323", "0.5089675", "0.5083168", "0.5083168", "0.5079227", "0.507003", "0.50690675", "0.5068517", "0.5063842", "0.50613856", "0.50517863", "0.504344", "0.50432205", "0.50179887", "0.5014279" ]
0.6541785
6
Sharpen a thumbnail. A full description of the paramaters below can be found at
def sharpen(width, input, output) args = [ vips_command, "sharpen", input.path, output.path, "--sigma", ((width > 150) ? 3 : 1).to_s, "--x1", "2" , "--y2", "10" , # (don't brighten by more than 10 L*) "--y3", "10" , # (can darken by up to 20 L*) "--m1", "0" , # (no sharpening in flat areas) "--m2", "3" , # (some sharpening in jaggy areas) ] @cmd.run(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sharpen\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.sharpen(0.0, 1.0)\n img.write('public' + @photo.attachment_url)\n end", "def sharpen(h = {})\n params[:name] ||= @pictureName.gsub('.png', 'Sharpened.png')\n params[:save] ||= @picturePath\n \n sharpenFilter = [\n [-1, -1, -1], \n [-1, 9, -1], \n [-1, -1, -1]\n ]\n \n height, width = @height-2, @width-2\n sharpen = dup\n \n (1..height).each do |j|\n (1..width).each do |i|\n pixel = calculate_pixel_value_with_filter3(sharpenFilter, @picture, i, j, false)\n sharpen[i, j] = ChunkyPNG::Color.rgb(pixel[0], pixel[1], pixel[2])\n end\n end\n \n sharpen.pictureName, sharpen.picturePath = params[:name], params[:save]\n sharpen\n end", "def thumbnail!\n image.recreate_versions! if thumbnail_coordinates_changed?\n end", "def thumbnail(size); end", "def extract_thumb(input, output, width, height)\n Image::Editing::ResizeToFill.new(input, output, width, height).run\n end", "def cropped_thumbnail(size) # :yields: image\n w, h = width, height\n l, t, r, b, half = 0, 0, w, h, (w - h).abs / 2\n\n l, r = half, half + h if w > h\n t, b = half, half + w if h > w\n\n with_crop(l, t, r, b) do |img|\n img.thumbnail(size) do |thumb|\n yield thumb\n end\n end\n end", "def thumbnail(width, input, output)\n profile_normalization_args=[\"--eprofile\", srgb_profile_path, \"--delete\"]\n vips_jpg_params=\"[Q=#{@jpeg_q },interlace,optimize_coding,strip]\"\n args = if width\n # The image will be resized to fit within a box\n # which is `width` wide and very, very very tall.\n # See:\n # https://github.com/libvips/libvips/issues/781\n # https://github.com/libvips/ruby-vips/issues/150\n [\n vips_thumbnail_command, input.path,\n *profile_normalization_args,\n \"--size\", \"#{width}x1000000\",\n \"-o\", \"#{output.path}#{vips_jpg_params}\"\n ]\n else\n [ vips_command, \"copy\", input.path,\n *profile_normalization_args,\n \"#{output.path}#{vips_jpg_params}\"\n ]\n end\n @cmd.run(*args)\n end", "def quality_and_strip(percentage)\n manipulate! do |img|\n img.format('jpg') # We want to enforce jpeg so we can use good compression.\n img.strip # Do not store EXIF data in the thumb to save space\n img.quality(percentage.to_s)\n img = yield(img) if block_given?\n img\n end\n end", "def image_as_medium_thumbnail\n image.variant(resize_to_fill: [350, 350]).processed\n end", "def process_image(path)\n picture_name = File.basename(path)\n thumbnail_dir = File.join(File.dirname(path), \"thumbnails\")\n thumbnail_path = File.join(thumbnail_dir, \"#{File.basename(picture_name, File.extname(picture_name))}.jpg\")\n Dir.mkdir(thumbnail_dir) unless File.exist?(thumbnail_dir)\n\n image_optim = ImageOptim.new\n\n image = MiniMagick::Image.open(path)\n image_prop = {\n \"name\" => picture_name,\n \"thumb\" => \"thumbnails/#{picture_name}\",\n \"height\" => image.height,\n \"width\" => image.width\n }\n\n return image_prop if File.exist?(thumbnail_path)\n\n# -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB\n\n image.format \"jpeg\" unless File.extname(picture_name) == \"jpg\"\n image.combine_options do |b|\n b.resize \"#{MAX_DIMENSION}>\"\n b.sampling_factor \"4:2:0\"\n b.strip\n b.interlace \"JPEG\"\n b.colorspace \"RGB\"\n b.quality 85\n end\n image.write thumbnail_path\n\n image_optim.optimize_image!(path)\n image_optim.optimize_image!(thumbnail_path)\n\n image_prop\nend", "def scale_to_cover(new_width, new_height, &block)\n raise ArgumentError, \"must supply the width and/or height\" if new_width.nil? && new_height.nil?\n if new_height.nil? || (!new_width.nil? && height*new_width > width*new_height)\n squish(new_width, height*new_width/width, &block)\n else\n squish(width*new_height/height, new_height, &block)\n end\n end", "def thumbnail_image\n end", "def generate_thumbnail(image_path, commit_id)\n thumb_size = Glitter::Application.config.thumbnail_geometry\n image = Magick::Image.read(\n \"#{satellitedir}/#{image_path}\"\n ).first\n image.scale(\n thumb_size[0],\n thumb_size[1]\n ).write thumbnail_for(commit_id, true)\n end", "def sharpen(_pct)\n self\n end", "def thumbnail(sid, opts={})\r\n\r\n maxwidth\t= (opts[:maxwidth] || 128).to_f\r\n maxheight\t= (opts[:maxheight] || 128).to_f\r\n aspectratio\t= maxwidth / maxheight\r\n path\t\t= nil\r\n dest_path\t= nil\r\n pic\t\t= nil\r\n case sid.to_sym\r\n when :photo\r\n path\t\t= self.photo__path\r\n dest_path\t= self.photo__thumb_path\r\n end\r\n pic\t = path ? Magick::Image.read(path).first : Magick::Image.from_blob(pic).first\r\n imgwidth = pic.columns\r\n imgheight = pic.rows\r\n imgratio = imgwidth.to_f / imgheight.to_f\r\n scaleratio= imgratio > aspectratio ? maxwidth / imgwidth : maxheight / imgheight\r\n thumb\t = pic.thumbnail(scaleratio)\r\n thumb.write(dest_path) if dest_path\r\n return thumb.to_blob\r\n end", "def cut_to_fit(options)\n %Q{-thumbnail #{options.width}x#{options.height}^ \\\n -gravity #{options.gravity} \\\n -unsharp 0x.5 \\\n -auto-orient \\\n -extent #{options.width}x#{options.height}}\n end", "def create_thumbnail\n image = Image.from_blob(self.photo_image).first\n thumbnail = image.resize_to_fill(320,240, gravity=CenterGravity)\n thumbnail.to_blob\n end", "def cut_image(source, width, height, dest = nil)\r\n dest ||= default_dest(source, \"cut\")\r\n image = MiniMagick::Image.from_file(source)\r\n image.crop \"#{width}x#{height}+0+0\"\r\n image.write dest\r\n dest\r\n end", "def generate_thumbnail path, img\n img = img.resize_to_fit 200,200\n img.write path\n end", "def thumbnail(options = {})\n return if !readable? || !thumbnailable?\n\n size = options[:size].to_i\n if size > 0\n # Limit the number of thumbnails per image\n size = (size / 50.0).ceil * 50\n # Maximum thumbnail size\n size = 800 if size > 800\n else\n size = Setting.thumbnails_size.to_i\n end\n size = 100 unless size > 0\n target = thumbnail_path(size)\n\n diskfile_s3 = diskfile\n begin\n Redmine::Thumbnail.generate(diskfile_s3, target, size, is_pdf?)\n rescue => e\n Rails.logger.error \"An error occured while generating thumbnail for #{diskfile_s3} to #{target}\\nException was: #{e.message}\"\n return\n end\n end", "def small_image_url\n self.small_image.convert('-resize 50%').url\n end", "def fake_thumbnail(commit_id)\n src = File.join(Rails.public_path, 'mini_dir.png')\n FileUtils.ln_s src, image_for(commit_id, 'thumbnails')\n end", "def scale_to(new_size, background:background)\n new_size = SugarCube::CoreGraphics::Size(new_size)\n\n image_size = self.size\n\n if CGSizeEqualToSize(image_size, new_size)\n return self\n end\n\n new_image = nil\n width = image_size.width\n height = image_size.height\n\n target_width = new_size.width\n target_height = new_size.height\n\n scale_factor = 0.0\n scaled_width = target_width\n scaled_height = target_height\n\n thumbnail_point = CGPoint.new(0.0, 0.0)\n width_factor = target_width / width\n height_factor = target_height / height\n\n if width_factor < height_factor\n scale_factor = width_factor\n else\n scale_factor = height_factor\n end\n\n scaled_width = width * scale_factor\n scaled_height = height * scale_factor\n\n # center the image\n\n if width_factor < height_factor\n thumbnail_point.y = (target_height - scaled_height) * 0.5\n elsif width_factor > height_factor\n thumbnail_point.x = (target_width - scaled_width) * 0.5\n end\n\n # this is actually the interesting part:\n\n UIGraphicsBeginImageContextWithOptions(new_size, false, self.scale)\n\n if background\n background = background.uicolor\n context = UIGraphicsGetCurrentContext()\n background.setFill\n CGContextAddRect(context, [[0, 0], new_size])\n CGContextDrawPath(context, KCGPathFill)\n end\n\n thumbnail_rect = CGRectZero\n thumbnail_rect.origin = thumbnail_point\n thumbnail_rect.size.width = scaled_width\n thumbnail_rect.size.height = scaled_height\n\n self.drawInRect(thumbnail_rect)\n\n new_image = UIGraphicsGetImageFromCurrentImageContext()\n UIGraphicsEndImageContext()\n\n raise \"could not scale image\" unless new_image\n\n return new_image\n end", "def quick_thumbnail(how, what)\n if how == :pos\n if what.is_a? Fixnum\n what = [0, what]\n end\n end\n QuickThumbnail.new(self, how, what, parent_widget, window_id, :thumbnail)\n end", "def process_small_image\n small_image.encode!(:png).convert!('-resize 50x50 -gravity center -background none -extent 50x50')\n end", "def fake_thumbnail(commit_id)\n src = File.join(Rails.public_path, 'mini_dir.png')\n FileUtils.ln_s src, thumbnail_for(commit_id)\n end", "def create_thumbnail\n return create_resized_pic(THUMBNAIL_HEIGHT, THUMBNAIL_WIDTH, SIZE_THUMBNAIL)\n end", "def thumbnail(data, options = {})\n source_info = info data\n \n opts = {\n :width => source_info.width,\n :height => source_info.height,\n :preserve_aspect_ratio => true,\n :format => :png\n }.merge(options)\n \n width, height = calculate_aspect_ratio source_info, opts\n \n # Set res so we can assign it within the SmartImage.new block\n res = nil\n \n SmartImage.new(width, height) do |image|\n image.composite data, :width => width,\n :height => height,\n :preserve_aspect_ratio => false\n \n res = image.encode opts[:format]\n end\n \n res\n end", "def small(input) # Method that returns the image\n self.images[input].variant(resize: \"300x300\").processed # Resizing the image and return it\n end", "def quality(percentage)\n manipulate! do |img|\n img.write(current_path){ self.quality = percentage }\n img = yield(img) if block_given?\n img\n end\nend", "def scale(width: @image.width, height: @image.height,\n algorithm: 'bilineal') # bilinear, nearest_neighbor\n if algorithm == 'nearest_neighbor'\n Image.new(@image.resample_nearest_neighbor(width, height), path)\n else\n Image.new(@image.resample_bilinear(width, height), path)\n end\n end", "def poster(input, output)\n \n input = input \n output = output \n \n scale(input, output)\n\n #Demonstrate the Image#polaroid method\n img = Magick::Image.read(output).first\n result = img.posterize\n \n #Write \n result.write(output)\n\nend", "def resize_and_crop(size) \n manipulate! do |image| \n if image[:width] < image[:height]\n remove = (image[:height] - 135).round \n image.shave(\"0x#{remove}\") \n elsif image[:width] > image[:height] \n remove = ((image[:width] - image[:height])/2).round\n image.shave(\"#{remove}x0\")\n end\n image.resize(\"#{size}\")\n image\n end\n end", "def process_image(src, dest, maxw, maxh)\n i = QuickMagick::Image.read(src).first\n # AMF - added quality setting to limit size of images (some sites had high quality jpeg, so files sizes were still big)\n i.quality = 75\n w, h = i.width, i.height\n extra = (w - h/(maxh.to_f/maxw.to_f)).to_i\n if extra > 0\n i.shave(\"#{extra>>1}x0\") if i.width > i.height\n w -= extra\n end\n if w > maxw or h > maxh\n i.resize(\"#{maxw}x#{maxh}\")\n end\n i.save(dest)\n end", "def create_thumbnail(source, target)\n command_exec(:create_thumbnail, [quote(source), quote(target)])\n end", "def uploadoriginal(file,path)\n\text = File.extname(file)\n \tif ext.upcase == \".JPG\"\n \t\textfinal = \".jpg\"\n \telsif ext.upcase == \".JPEG\"\n \t\textfinal = \".jpg\"\n \telsif ext.upcase == \".GIF\"\n \t\textfinal = \".gif\"\n \telsif ext.upcase == \".PNG\"\n \t\textfinal = \".png\"\n \tend\t\n\t\t\n\t\t\n \t#nombre original de la imagen\n \tfilename_orig = File.basename(file, '.*')\n\n \t#remove white space in image name\n \tfilename_orig = filename_orig.gsub(\" \",\"-\")\n\n \twidth = 800\n\n \timage = Magick::Image.read(file).first\n\n \twidthimage = image.columns\n \theightimage = image.rows\n \theight = (width * heightimage) / widthimage\n \tthumbnail = image.thumbnail(width, height)\n\n\n \tfinalname = path + \"800-\" + filename_orig + extfinal\n \tq=99\n \tthumbnail.write(finalname){ self.quality = q }\n return filename_orig + extfinal\n \nend", "def generate_thumbnail(image_path, commit_id)\n Gg::ImageProcessing.new(\"#{satellitedir}/#{image_path}\")\n .generate(image_for(commit_id, 'thumbnails'), 'thumbnail')\n end", "def cover_and_crop(new_width, new_height, &block)\n scale_to_cover(new_width, new_height) do |scaled|\n return block.call(scaled) if new_width == scaled.width && new_height == scaled.height\n scaled.crop_to(new_width || width, new_height || height, &block)\n end\n end", "def scale(w, h, method = :bilinear)\n @image.send(\"resample_#{method}!\", w, h)\n self\n end", "def scale\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.scale(1.5)\n img.write('public' + @photo.attachment_url)\n end", "def quality(percentage)\n manipulate! do |img|\n img.quality(percentage)\n img = yield(img) if block_given?\n img\n end\n end", "def resize_and_optimize(width, height)\n manipulate! do |img|\n img.format(\"jpg\") do |c|\n c.quality \"70\"\n c.resize \"#{width}x#{height}\"\n end\n\n img\n end\n end", "def create_thumbnail(image)\n thumb = ( image.gsub /^#{@dirname}/, \"#{@thumbs}\" ) + @thumbext\n system(\"convert #{image} -thumbnail '#{@size}>' -#{@action} '#{@size}' -background white -quality 60 -gravity center -extent #{@size} #{thumb}\")\n end", "def upload_thumb\n path = \"#{Rails.root}/tmp/#{id}_#{Process.pid}.png\"\n `convert #{@file.tempfile.path}[0] -scale 128x128 #{path}`\n\n if File.exists? path\n file_s3_obj_thumb.write(file: path, content_type: 'image/png')\n File.delete(path)\n end\n end", "def sharpen! (percent)\n @transforms << \"SH#{percent}\"\n self\n end", "def quality(percentage)\n manipulate! do |img|\n img.quality(percentage.to_s)\n img = yield(img) if block_given?\n img\n end\n end", "def black_and_white\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.quantize(256, Magick::GRAYColorspace)\n img.write('public' + @photo.attachment_url)\n end", "def stretch(&block)\n clone.stretch!(&block)\n end", "def thumbnail input\n return self.images[input].variant(resize: '300x300').processed\n end", "def cropped_thumb\r\n\t\tbegin\r\n\t\t\t@image = Image.find_by_product_id(params[:id])\r\n\r\n\t\t\tthe_width = 16\r\n\t\t\tthe_height = 20\r\n#\t\t\tif (params[:option_value])\r\n#\t\t\t\tthe_product = Product.find(params[:id])\r\n#\t\t\t\toption_values = the_product.option_values\r\n#\t\t\t\tif (option_values[0][:id] == params[:option_value].to_i)\r\n#\t\t\t\t\tthe_width = 17\r\n#\t\t\t\t\tthe_height = 22\r\n#\t\t\t\tend\r\n#\t\t\tend\r\n\r\n\t\trescue ActiveRecord::RecordNotFound\r\n\t\t\trender :text => \"Image ##{params[:id].to_s} not found\"\r\n\t\telse\r\n\t\t\t# Can probably replace this with a call to to_sym(), but why fix what ain't broke?\r\n\t\t\t@thumbnail = @image.cropped_thumbnail(the_width, the_height)\r\n\t\t\tif @thumbnail.kind_of? Thumbnail\r\n\t\t\t\tsend_data(@thumbnail.data,\r\n\t\t\t\t\t:filename => @thumbnail.filename,\r\n\t\t\t\t\t:type => @thumbnail.content_type,\r\n\t\t\t\t\t:disposition => 'inline')\r\n\t\t\telse\r\n\t\t\t\trender :text => @thumbnail.inspect\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def create_frame_and_thumbnail\n if (File.extname(self.image_sequence) == \".mha\")\n file_path = Rails.root.join(dir_path, self.image_sequence)\n result = system(Rails.root.join('scripts','mha_to_png','bin',\"MhaToPng #{file_path} 1\").to_s)\n base_name = File.basename(file_path, \".mha\")\n image = MiniMagick::Image.open(\"#{dir_path}/#{base_name}_frame.png\")\n image.resize \"200x200\"\n image.format \"png\"\n image.write \"#{dir_path}/#{base_name}_thumbnail.png\"\n File.chmod(0644, \"#{dir_path}/#{base_name}_thumbnail.png\")\n self.thumbnail = \"#{base_name}_thumbnail.png\"\n self.frame = \"#{base_name}_frame.png\"\n end\n end", "def resize_image uri, options = { }\n\n\t# parse id, mime type from image uri\n\tformat = uri.split('/').last.match(/\\.(.+)$/)[1]\n\tid = uri.split('/').last.sub(/\\..+$/, '').slugify\n\n\t# resize image and save to /tmp\n\timage = Image.read(uri)[0]\n\t\n\t# calculate width/height based on percentage of \n\t# difference of width from absolute value of 150\n\tif options[:width]\n\t\twidth = options[:width]\n\t\tscale = (image.page.width - width) / image.page.width.to_f\n\t\theight = image.page.height - (image.page.height * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-constrainedw.#{format}\"\n\t\t)\t\t\n\n\telsif options[:height]\n\t\theight = options[:height]\n\t\tscale = (image.page.height - height) / image.page.height.to_f\n\t\twidth = image.page.width - (image.page.width * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-thumbh.#{format}\"\n\t\t)\n\n\telse\n\t\twidth = 150\n\t\tscale = (image.page.width - width) / image.page.width.to_f\n\t\theight = image.page.height - (image.page.height * scale)\n\n\t\timage = image.thumbnail(width, height)\n\t\timage.write(\n\t\t\tpath = \"/tmp/#{id}-thumb.#{format}\"\n\t\t)\n\n\tend\n\n path\nend", "def optimize_cover(coverpath)\n puts 'Optimizing cover'\n `mogrify -resize 610 #{coverpath.shellescape}`\n `jpegoptim -m80 --strip-all #{coverpath.shellescape}`\n end", "def create_homepage_thumbnail\n image = Image.from_blob(self.photo_image).first\n thumbnail = image.resize_to_fill(320,240, gravity=CenterGravity)\n thumbnail.to_blob\n end", "def thumbnail(geometry)\n \t mogrify(:thumbnail, geometry)\n \t self\n end", "def resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n elsif size.is_a?(String) && size =~ /^b.*$/ # Resize w/border - example geometry string: b75x75\n dimensions = size[1..size.size].split(\"x\")\n img.change_geometry(dimensions.join(\"x\")) do |cols, rows, image| \n image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows ) \n end\n img.background_color = \"black\"\n x_offset = (img.columns - dimensions[0].to_i) / 2\n y_offset = (img.rows - dimensions[1].to_i) / 2\n img = img.extent(dimensions[0].to_i, dimensions[1].to_i, x_offset, y_offset)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n img.strip! unless attachment_options[:keep_profile]\n temp_paths.unshift write_to_temp_file(img.to_blob)\n end", "def quality(percentage)\n manipulate! do |img|\n img.quality(percentage.to_s)\n img = yield(img) if block_given?\n img\n end\n end", "def resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n elsif size.is_a?(String) && size =~ /^b.*$/ # Resize w/border - example geometry string: b75x75\n dimensions = size[1..size.size].split(\"x\")\n img.change_geometry(dimensions.join(\"x\")) do |cols, rows, image|\n image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows )\n end\n img.background_color = \"black\"\n x_offset = (img.columns - dimensions[0].to_i) / 2\n y_offset = (img.rows - dimensions[1].to_i) / 2\n img = img.extent(dimensions[0].to_i, dimensions[1].to_i, x_offset, y_offset)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n img.strip! unless attachment_options[:keep_profile]\n temp_paths.unshift write_to_temp_file(img.to_blob)\n end", "def thumbnail(input = 0)\n return self.uploads[input].variant(resize: '1000x1000').processed\n end", "def resize_and_crop(size)\n manipulate! do |image|\n Rails.logger.error '----------- image:'\n Rails.logger.error image.inspect\n\n if image[:width] < image[:height]\n remove = ((image[:height] - image[:width]) / 2).round\n image.shave(\"0x#{remove}\")\n elsif image[:width] > image[:height]\n remove = ((image[:width] - image[:height]) / 2).round\n image.shave(\"#{remove}x0\")\n end\n image.resize(\"#{size}x#{size}\")\n image\n end\n end", "def resize\n if size.max > 1024\n res = %x( #{magick_bin_name(\"convert\")} -auto-orient -resize 1024x768 #{Shellwords.shellescape path} #{Shellwords.shellescape path})\n Rails.logger.info res\n end\n unless has_thumbnail?\n unless File.exists? path.gsub(/(.+)\\/.+/, '\\1/thumbs')\n Dir.mkdir path.gsub(/(.+)\\/.+/, '\\1/thumbs')\n end\n ## that's a bit broken on windows - why?\n res = %x( #{magick_bin_name(\"convert\")} -verbose -auto-orient -strip -thumbnail 300x160 #{Shellwords.shellescape path} #{Shellwords.shellescape path.gsub(/(.+)\\/(.+)/, '\\1/thumbs/\\2')})\n Rails.logger.info res\n end\n end", "def thumb_url(size)\n image.file.thumb(size).url\n end", "def quality(percentage)\n manipulate! do |img|\n img.quality(percentage.to_s)\n img = yield(img) if block_given?\n img\n end\n end", "def square_image_crop\n if (self.crops)\n if !(self.crop_x.nil? || self.crop_y.nil? || self.crop_w.nil? || self.crop_h.nil?)\n @image = MiniMagick::Image.open(self.photo.url)\n # if image is larger than our max screen size, the cropped image will be incorrect (resizing)\n @image.sample(((700/@image[:width].to_f) * 100).to_s + \"%\") if @image[:width] > 700\n @image.crop(\"#{self.crop_w}x#{self.crop_h}+#{self.crop_x}+#{self.crop_y}\")\n @image.set(\"page\", \"#{self.crop_w}x#{self.crop_h}+#{self.crop_x}+#{self.crop_y}\") \n self.square_image = @image\n end\n end\n end", "def save_thumbnail(name)\n name = \"-\" if name == STDOUT\n Jhead.call(\"-st\", name.shellescape, @match, @pattern)\n end", "def resize_and_move_holst(holst, frame_width, frame_height)\n photo = Image.read(URI.decode('public' + holst.image.url))[0]\n move = translation_holst(holst.positions, photo, frame_width, frame_height)\n photo = resize_to_fill_holst(photo, frame_width, frame_height)\n photo_done = Image.new(frame_width, frame_height).composite!(photo, move[0], move[1], OverCompositeOp)\n end", "def do_resize(height = THUMBNAIL_HEIGHT, width = THUMBNAIL_WIDTH)\n #MES- Only do thumbnailing if the Image Magick library can be loaded.\n # This is to make setup easier for other developers- they are not\n # required to have Image Magick.\n # More information on Image Magick is available at \n # http://studio.imagemagick.org/RMagick/doc/usage.html\n if RMAGICK_SUPPORTED\n #MES- Turn the blob into an ImageMagick object\n img = Magick::Image.from_blob(data).first\n if img.nil?\n logger.info \"Failed to resize image #{self.name}- unable to create RMagick wrapper for image\"\n return nil\n end\n \n #MES- Shrink the image\n return img.crop_resized(width, height)\n else\n return nil\n end\n end", "def via_files(filename, thumbnail_width)\n thumb = Vips::Image.thumbnail filename, thumbnail_width, crop: \"centre\"\n\n thumb.write_to_buffer \".jpg\"\nend", "def create_thumbnail\n ImageGeneratingService.new(self, 'Thumbnail.png', 'image/png').generate_resized(120)\n end", "def resample!(image, width, height)\n with_minimagick(image) do |img|\n img.combine_options do |cmd|\n yield cmd if block_given?\n cmd.resample \"#{width}x#{height}\"\n end\n end\n end", "def shrink_to_one image, xpos, ypos, width, height\n# if @intermediate_images\n# tmp_image = \"vo-#{xpos}-#{ypos}\".to_sym\n# copy_subimage image, xpos, ypos, width, height, tmp_image\n# d_write_image(tmp_image)\n# end\n img = get_image(image)\n checkbox_pixels = img.excerpt(xpos, ypos, width, height)\n shrink_to_one = checkbox_pixels.scale(1,1)\n return shrink_to_one.get_pixels(0,0,1,1)[0].red\n end", "def generate_compressed path, img\n img.write(path) { self.quality = 70 }\n end", "def thumb (size = '80x80#')\n if web_image?\n # Although Dragonfly is not thread-safe, since this operation likely has\n # no side-effects, we don't place it within a critical section.\n # TODO Ensure Dragonfly processing works with multiple threads\n Dragonfly.app.fetch_url(access_url).thumb(size).url\n else\n 'http://placehold.it/40?text=No+Image';\n end\n end", "def copy_cheaty(src, srcId, dest, destId, origin, target)\n #We need the tile's offset within its block.\n destPt = [(destId%2)*32 , (destId/2)*32]\n\n #Now, copy it and magnify it.\n for x in (0...16)\n for y in (0...16)\n for iX in (0...2) \n for iY in (0...2)\n srcVal = src[origin[0]+x,origin[1]+y]\n destXY = [target[0]+destPt[0]+2*x+iX,target[1]+destPt[1]+2*y+iY]\n dest[destXY[0], destXY[1]] = srcVal\n end\n end\n end\n end\nend", "def cover_image\n end", "def quality(percentage)\n manipulate! do |img|\n img.write(current_path){ self.quality = percentage }\n img = yield(img) if block_given?\n img\n end\n end", "def draw_image_stretch(image, x1, y1, x2, y2, x3, y3, x4, y4, color)\n end", "def recreate_cropped_image\n if file.exists?\n img = ThumbMagick::Image.new(file.path('tocrop'))\n img.\n thumbnail(\"#{ (resize * 100).to_i }%\").\n crop(\"#{crop_w}x#{crop_h}\", crop_x, crop_y).\n write(file.path('cropped'))\n end \n end", "def sharp\n Sharp.new(self)\n end", "def blue_shift\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.blue_shift(2)\n img.write('public' + @photo.attachment_url)\n end", "def upRes(file_path)\t\n\t\toriginal_image = Magick::Image.read(file_path) { self.density = \"300.0x300.0\" }\n\t\toriginal_image.each do |image|\n\t\t\t image = image.resample(300.0, 300.0)\n\t\t\t image.write(file_path) { self.quality = 100 }\n\t\tend\n\tend", "def square_url\n thumb_url\n end", "def scale_by(width_factor, height_factor, &block)\n squish(width*width_factor, height*height_factor, &block)\n end", "def thumbnail\n \tobject.file.url(:thumb)\n end", "def thumb(w_x_h, quality: 90, immediate: false)\n fail_for_non_images\n return thumb_in_test_env(w_x_h, quality: quality) if Rails.env.test?\n\n if thumbnail_sizes[w_x_h] && thumbnail_sizes[w_x_h][:uid]\n ret = OpenStruct.new(thumbnail_sizes[w_x_h])\n ret.url = Dragonfly.app.remote_url_for(ret.uid)\n ret\n else\n if svg?\n url = file.remote_url\n width = file_width\n height = file_height\n else\n if immediate || self.class.immediate_thumbnails\n image = Folio::GenerateThumbnailJob.perform_now(self, w_x_h, quality)\n ret = OpenStruct.new(image.thumbnail_sizes[w_x_h])\n ret.url = Dragonfly.app.remote_url_for(ret.uid)\n return ret\n else\n Folio::GenerateThumbnailJob.perform_later(self, w_x_h, quality)\n url = temporary_url(w_x_h)\n end\n width, height = w_x_h.split('x').map(&:to_i)\n end\n OpenStruct.new(\n uid: nil,\n signature: nil,\n url: url,\n width: width,\n height: height,\n quality: quality\n )\n end\n end", "def host_blur\n self.is_processed = true\n\n # Create blurred thumbnail\n #\n image = MiniMagick::Image.open(square_url)\n\n image.combine_options do |canvas|\n canvas.blur \"2.5x2.5\"\n end\n\n FileSystem.store(\n blur_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.save!\n end", "def resize_thumb(sizestr)\n ret = nil\n if THUMB_SIZES.has_key?(sizestr)\n sw, sh = size(sizestr)\n img = Magick::Image.from_blob(data)[0]\n tw, th = size(thumb_l)\n img.crop!(thumb_x, thumb_y, tw, th)\n img.resize!(sw, sh)\n ret = img.to_blob\n else\n ret = data\n end\n GC.start\n ret\n end", "def target\n img = Magick::ImageList.new(TARGET_FILE_NAME + FILE_SUFFIX)\n img = img.resize(NEW_TARGET_SIDE_LENGTH, NEW_TARGET_SIDE_LENGTH)\n img = img.quantize(COLOR_VARIATION, Magick::GRAYColorspace)\n img.write(TARGET_FILE_NAME + NEW_TARGET_NAME_SUFFIX + FILE_SUFFIX)\n img.destroy!\n end", "def display_image \r\n self.image.variant(resize_to_limit: [1000, 1000]) \r\n end", "def cropped_thumbnail(geometry)\n ow,oh = @original_width,@original_height\n \t w,h = geometry.strip.split('x').map{|n|n.to_i}\n\n \t\tif (ow.to_f / oh) < (w.to_f / h)\n \t\t\t# narrow aspect ratio, width is the priority\n \t\t\tresized_w = w\n \t\t\tresized_h = ((w.to_f / ow) * oh).round # scale height to same ratio as width\n \t\telse\n \t\t\t# wide or square aspect ratio, height is the priority\n \t\t\tresized_h = h\n \t\t\tresized_w = ((h.to_f / oh) * ow).round # scale width to the same ratio as height\n \t\tend\n \t\tresize_to = [resized_w,resized_h].max\n\n thumbnail(\"#{resize_to}x#{resize_to}\")\n crop(geometry)\n \t\tself\n \tend", "def add_cover(original, format=nil, thumb=true)\n processor = Toastunes::ImageProcessor.new\n full_path = processor.save_cover(id, original, format)\n self.cover = File.basename(full_path)\n if thumb\n thumbnail_path = processor.write_thumbnail(self)\n self.thumbnail = File.basename(thumbnail_path)\n end\n end", "def on_demand(width, height)\n dims = \"#{width}x#{height}\"\n\n public_path = self.public_path(dims)\n output_path = self.output_path(dims)\n\n if File.exists?(output_path)\n logger.info \"[iphoto library] Thumbnail hit at #{public_path}\"\n else\n FileUtils.mkdir_p(File.dirname(output_path))\n\n unless defined? MiniMagick\n logger.debug \"[iphoto library] Requiring MiniMagick\"\n require 'mini_magick'\n end\n\n image = MiniMagick::Image.from_file(image_path(true))\n image.resize dims\n image.write(output_path)\n FileUtils.chmod 0755, output_path\n\n logger.info \"[iphoto library] Created thumbnail at #{output_path}\"\n end\n\n public_path\n end", "def regenerate_thumbnail(size = nil,\n clear_rot_tag = false,\n only_upright = false)\n option = \"-rgt\"\n option << size unless size.nil?\n option << \" -norot\" if clear_rotation_tag\n option << \" -orp\" if only_upright\n Jhead.call(option, @match, @pattern)\n end", "def get_thumbnail(input)\n puts \"getting thumbnail of #{input}\"\n out = File.join(File.dirname(input),File.basename(input,File.extname(input)) + \"-%d.jpg\")\n FFmpeg.encode do |ff| \n ff.input = input\n ff.record_start_time = 0\n ff.record_for = 0.001\n ff.video_frames = 1\n ff.video_frame_size = '200x150'\n ff.output = out\n end\n end", "def old_resize_image(img, size)\n size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)\n if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))\n size = [size, size] if size.is_a?(Fixnum)\n img.thumbnail!(*size)\n elsif size.is_a?(String) && size =~ /^c.*$/ # Image cropping - example geometry string: c75x75\n dimensions = size[1..size.size].split(\"x\")\n img.crop_resized!(dimensions[0].to_i, dimensions[1].to_i)\n else\n img.change_geometry(size.to_s) { |cols, rows, image| image.resize!(cols<1 ? 1 : cols, rows<1 ? 1 : rows) }\n end\n self.width = img.columns if respond_to?(:width)\n self.height = img.rows if respond_to?(:height)\n img.strip! unless attachment_options[:keep_profile]\n quality = img.format.to_s[/JPEG/] && get_jpeg_quality\n out_file = write_to_temp_file(img.to_blob { self.quality = quality if quality })\n temp_paths.unshift out_file\n self.size = File.size(self.temp_path)\n end", "def dup_src\n BufferedImage.new width, height, color_type\n end", "def thumb_url\n image.url(:thumbnail)\n end", "def thumb_url\n image.url(:thumbnail)\n end", "def mirror(params = {})\n params[:name] ||= @pictureName.gsub('.png', 'Mirrored.png')\n params[:save] ||= @picturePath\n \n mir = dup\n \n mirror_width = @width * 2\n mir.picture = ChunkyPNG::Image.new(mirror_width, @height)\n mir.height = @height\n mir.width = mirror_width\n \n mirror_width -= 1\n \n (0...@width).each do |i|\n (0...@height).each do |j|\n mir[i, j] = @picture[i, j]\n mir[mirror_width - i, j] = @picture[i, j]\n end\n end\n \n mir.pictureName, mir.picturePath = params[:name], params[:save]\n mir \n end", "def clipart\n output = get_working_image(@session_id)\n unless File.exist?(output)\n FileUtils.cp(\"#{Rails.root}/public/#{params[:src]}\", output)\n img = Image.read(output).first\n img = img.scale(params[:rs].to_f) unless params[:rs].blank?\n img = img.level_colors(params[:b] || \"\", params[:w] || \"\", true) if params[:b] || params[:w]\n img.background_color = \"none\"\n img.rotate!(params[:r].to_f) unless params[:r].blank?\n\n #For embroidery\n if params[:emb] == 'true'\n img = img.ordered_dither\n end\n #FLIP/FLOP/Transpose/Transverse\n if params[:ff] == 'flip'\n img.flip!\n elsif params[:ff] == 'flop'\n img.flop!\n elsif params[:ff] == 'transpose'\n img.transpose!\n elsif params[:ff] == 'transverse'\n img.transverse!\n end\n #Extracts a channel\n if params[:ec] == 'R'\n img = img.channel(Magick::RedChannel)\n elsif params[:ec] == 'G'\n img = img.channel(Magick::GreenChannel)\n elsif params[:ec] == 'B'\n img = img.channel(Magick::BlueChannel)\n end\n\n #Applies a special effect to the image - QuantumRange\n img = img.sepiatone(Magick::QuantumRange * params[:qr].to_f) unless params[:qr].blank?\n\n #Vignette (Shape Edge)\n if params[:vig] == 'true'\n img = img.vignette\n end\n\n #Wet Floor\n if params[:wf]\n img = img.wet_floor\n end\n img.write(output)\n end\n img = Image.read(output).first\n send_data img.to_blob, :disposition => 'inline', :type => 'image/png'\n end" ]
[ "0.7219838", "0.70544755", "0.629227", "0.62538886", "0.6026511", "0.6013358", "0.59702706", "0.5906047", "0.5893951", "0.58047897", "0.57572883", "0.57541084", "0.5736656", "0.5730796", "0.5662211", "0.56321853", "0.56083924", "0.5537284", "0.5532628", "0.5509152", "0.5506769", "0.5484402", "0.546055", "0.5453158", "0.5434953", "0.5426399", "0.54215634", "0.54130614", "0.5394328", "0.5391077", "0.5390178", "0.5366027", "0.5360065", "0.5356269", "0.534762", "0.53429025", "0.53409815", "0.5331579", "0.5328522", "0.53102213", "0.53024876", "0.5277719", "0.52774376", "0.5270149", "0.52694875", "0.5262423", "0.52606946", "0.52538824", "0.5249328", "0.5233072", "0.52171075", "0.52157956", "0.5202127", "0.51992124", "0.51859546", "0.51703894", "0.51428926", "0.5141067", "0.5136392", "0.5132618", "0.51290303", "0.5128682", "0.51262474", "0.51260006", "0.5124099", "0.5110205", "0.5107486", "0.51040894", "0.51031226", "0.50926113", "0.5069276", "0.5065544", "0.5064926", "0.5064188", "0.5057602", "0.5038597", "0.5032621", "0.50195944", "0.50191796", "0.5018042", "0.5013986", "0.5005308", "0.49926978", "0.49886608", "0.49803865", "0.4980109", "0.4975053", "0.49746424", "0.49707285", "0.49659625", "0.49638325", "0.49611965", "0.49532077", "0.49522072", "0.49442232", "0.49402332", "0.49392503", "0.49392503", "0.4932905", "0.4927691" ]
0.646944
2
Return the height of an image in pixels.
def image_height(image) args = [vips_header_command, '-f', 'Ysize', image.path] @cmd.run(*args).out.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height\n image.size\n end", "def height\n image_ptr[:sy]\n end", "def height\n @image.height\n end", "def height\n rmagick_image.rows\n end", "def image_height\n\t\t\t@data[\"image\"][\"height\"]\n\t\tend", "def image_height(image_handle)\n end", "def height\n Vips.vips_image_get_height self\n end", "def height\n @image.length\n end", "def image_height\n\t\t\t@data[\"originalimage\"][\"height\"] if @data[\"originalimage\"]\n\t\tend", "def image_height\n end", "def pixel_height\n @sensor_height / @height_in_pixels\n end", "def pixelheight\n end", "def height\n dimensions()[:y]\n end", "def screenshot_height_for(game)\n return 0 if game.nil? || game.image_height.nil?\n return game.image_height\n end", "def height\n @dimensions.y\n end", "def height\n (self.width.to_f * (9.to_f/16.to_f)).to_i\n end", "def getDimensions\r\n @imageheights = @image.length\r\n @imagewidth = @image[0].length\r\n puts \"image dimensions are #{@imagewidth} by #{@imageheights}\"\r\n end", "def frame_count\n image.get(\"height\") / size.y\n end", "def fullheight\n return self.bitmap.height.to_f * self.zoom_y\n end", "def height\n case target\n when :editable then height_for_editable_target\n when :cc, :kiddom, :qti, :schoology then image_height\n end\n end", "def height\n dimensions.last\n end", "def height\n bounds[:bottom] - bounds[:top]\n end", "def height\n bounds[:bottom] - bounds[:top]\n end", "def height(name)\n Tk.execute(:image, :height, name)\n end", "def height\n size_a[1]\n end", "def height\n return @height\n end", "def height\n barcode.two_dimensional? ? (ydim * encoding.length) : (@height || 100)\n end", "def height\n barcode.two_dimensional? ? (ydim * encoding.length) : (@height || 100)\n end", "def height\n metadata[:height] if valid?\n end", "def height\n TILE_BASE_HEIGHT\n end", "def height\n return nil unless @height\n if @height < 0\n return ((FFI::NCurses.LINES + @height) - self.row) + 1\n #return (FFI::NCurses.LINES + @height) \n end\n @height\n end", "def height\n return data.height\n end", "def pixels\n \n return width.to_i * height.to_i\n \n end", "def height\n\t\treturn @height\n\tend", "def height\n get_geometry if @height.nil?\n return @height\n end", "def height\n return 0 if @root == nil\n\n current = @root\n\n return height_helper(current, 1, 1)\n end", "def height\n size.first\n end", "def height\n size.first\n end", "def preview_max_height\n geometry = image_style_geometry\n geometry.present? ? geometry.height.to_i : 100\n end", "def height\n @maps[:background].size\n end", "def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end", "def image_size\n end", "def height\n # raise NotImplementedError\n # return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end", "def height\r\n assert_exists\r\n return @o.invoke(\"height\").to_s\r\n end", "def height\n return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end", "def height\n @rows * @block_size\n end", "def height\n return height_helper(@root, 0, 1)\n end", "def height\n return height_helper(@root, 0, 1)\n end", "def height\n features.intersection(Features::HEIGHT)\n end", "def height\n rows\n end", "def height\n count = 0\n if @root != nil\n count = height_helper(@root)\n end\n return count\n end", "def height(path)\n io_for(path).height\n end", "def height\n assert_exists\n driver.execute_script \"return arguments[0].height\", @element\n end", "def thumbnail_height\n\t\t\t@data[\"thumbnail\"][\"height\"]\n\t\tend", "def height\n top + bottom\n end", "def height\n current_node = @root\n\n return height_helper(current_node)\n end", "def height\n if @y_offset + @height > @source.height\n [@source.height - @y_offset, 0].max\n else\n @height\n end\n end", "def height\n return 0 if @root.nil?\n return hegiht_helper(@root)\n end", "def height\n attributes.map { |field| field.height }.max\n end", "def height\n if clear_border?\n geometry.height\n\n else\n border.height\n\n end\n end", "def height\n line_count = layout.line_count\n h = (line_count - 1) * layout.spacing\n line_count.times do |i|\n h += layout.get_line_bounds(i).height\n end\n h\n end", "def height; rect.height; end", "def height(style_name='original')\n geometry(style_name).height.to_i\n end", "def height\n lines.size\n end", "def height\n lines.size\n end", "def height\n content.size\n end", "def height\n return height_helper(@root, 0)\n end", "def height\n return height_helper(@root, 0)\n end", "def height\n attr('height')\n end", "def height\n memoized_info[:height]\n end", "def height\n @y1 - @y0\n end", "def thumbnail_height\n\t\t\t@data[\"thumbnail\"][\"height\"] if @data[\"thumbnail\"]\n\t\tend", "def height; end", "def height; end", "def image_width\n\t\t\t@data[\"image\"][\"width\"]\n\t\tend", "def image_size(path)\n magick = MiniMagick::Image.open path\n \"#{magick.width}x#{magick.height}\"\nend", "def height\n self.resolution.last unless self.resolution.nil? || many?\n end", "def width\n @image[0].length\n end", "def data_size\n @iplimage_struct.image_size\n end", "def pixel_size; size.x * size.y; end", "def height\r\n return (@y2-@y1).abs\r\n end", "def height\n return height_helper(@root)\n end", "def get_height(dta)\n get_dimension('height', dta)\n end", "def GetPageHeight()\n\t\treturn @h;\n\tend", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def height\n return self.src_rect.height\n end", "def height\n @source.height\n end", "def height(_data_length, _item_size, viewport)\n return viewport.rect.height\n end", "def height(pagenum=1)\n cgpdfpage = page(pagenum)\n mediabox = CGPDFPageGetBoxRect(cgpdfpage, KCGPDFMediaBox) # => CGRect\n height = mediabox.size.height # CGRectGetHeight(mediabox)\n height\n end", "def height\n @height || 100\n end", "def vh\n return (viewport == nil ? self.bitmap.height : viewport.rect.height)\n end", "def height\r\n @content[pn(:MediaBox)][3]\r\n end", "def contents_height\n Graphics.height\n end", "def height\n height_helper(@root, 0)\n end", "def height\n ['N', 'S'].include?(@orientation) ? @height : @width\n end", "def height()\n 0\n end", "def height\n @ole.Height\n end", "def height\n @ole.Height\n end" ]
[ "0.840538", "0.83588284", "0.82243884", "0.80493534", "0.78731966", "0.7872541", "0.78029954", "0.7714455", "0.77050024", "0.76361006", "0.73214", "0.7191762", "0.71430886", "0.71018845", "0.7077689", "0.7043093", "0.6975227", "0.69310594", "0.68702257", "0.6746428", "0.67160946", "0.66841495", "0.66841495", "0.6682325", "0.66758615", "0.6671268", "0.66420215", "0.66420215", "0.6626407", "0.6593488", "0.6591877", "0.6584165", "0.655874", "0.6542259", "0.6536608", "0.65279007", "0.65255517", "0.65255517", "0.65089715", "0.64957994", "0.6487485", "0.6482517", "0.6478849", "0.6475333", "0.64631224", "0.64540255", "0.6453602", "0.6453602", "0.6435975", "0.6425563", "0.6402138", "0.6397629", "0.63942105", "0.63848394", "0.6372623", "0.6369925", "0.6358647", "0.6353419", "0.6340456", "0.6337104", "0.6334413", "0.6312315", "0.63082075", "0.62951964", "0.62951964", "0.62903106", "0.62889963", "0.62889963", "0.6288732", "0.627618", "0.62543684", "0.6243807", "0.6224417", "0.6224417", "0.62145674", "0.6191631", "0.6191463", "0.6190003", "0.61758083", "0.61740917", "0.6172316", "0.61661005", "0.6157507", "0.6140417", "0.61370385", "0.61370385", "0.61370385", "0.6136512", "0.6123867", "0.6114004", "0.6113094", "0.6109153", "0.6108497", "0.61083835", "0.61044496", "0.60982394", "0.60952294", "0.6094298", "0.6081254", "0.6081254" ]
0.82509464
2
column no + 9. 9times == array
def boxes(cell_index) box_column_index = (cell_index % 9) / 3 box_row_index = cell_index / 27 box_first = box_row_index * 27 + box_column_index * 3 # sum = [box_first,1,1,7,1,1,7,1,1].map {|index| index + index} sum = [1,1,7,1,1,7,1,1].inject([box_first]) {|indexes, offset| indexes << offset + indexes.last} sum.map { |index| @grid[index] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_col_cells col\n\t\treturn (col...9 ** 2).step(9).to_a\n\tend", "def column_index(slot)\n slot % 9\n end", "def column_of(range); end", "def get_row_cells row\n\t\treturn (row * 9...row * 9 + 9).to_a\n\tend", "def _get_board_columns()\n column_index = 0\n array_of_columns = []\n until column_index == 9\n row_index = 0\n until row_index == 9\n array_of_columns << sudoku_board[row_index][column_index]\n row_index += 1\n end\n column_index += 1\n end\n array_of_columns.each_slice(9).to_a\n end", "def calculate_column(index)\n index % 9\n end", "def column(n)\n column = []\n each_row do |row|\n column << row[n]\n end\n return column\n end", "def board_column_values(board, column_number)\n column_values = []\n\n BOARD_HEIGHT.times do |i|\n column_values << board.values[column_number - 1 + BOARD_WIDTH * i]\n end\n column_values\nend", "def column(index)\n cells.each_with_index.map{|cell,i| cell if i%9==index}.compact\n end", "def columns=(integer); end", "def make_columns(rows)\n columns = Array.new(rows.size) { [] }\n # make an empty nested array to represent columns.\n # iterate through the rows, for each row...\n # place the number into the new nested array evenly across the subarrays\n rows.each do |row|\n row.each_with_index do |num, col_idx|\n columns[col_idx] << num\n end\n end\n columns\nend", "def get_col(n)\n\t\tprepare(@dim_i,@dim_j)\n\t\ttmpCol = Array.new\n\t\t@myTab.each do |row|\n\t\t\ttmpCol.push row[n]\n\t\tend\n\t\treturn tmpCol\n\tend", "def columnas(tablero)\r\n\t#Columnas0\r\n\t\te = 0\r\n\t\t@columna0 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna0 << tablero[e,0]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas1\r\n\t\te = 0\r\n\t\t@columna1 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna1 << tablero[e,1]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas2\r\n\t\te = 0\r\n\t\t@columna2 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna2 << tablero[e,2]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas3\r\n\t\te = 0\r\n\t\t@columna3 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna3 << tablero[e,3]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas4\r\n\t\te = 0\r\n\t\t@columna4 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna4 << tablero[e,4]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\r\n\t#Columnas5\r\n\t\te = 0\r\n\t\t@columna5 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna5 << tablero[e,5]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas6\r\n\t\te = 0\r\n\t\t@columna6 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna6 << tablero[e,6]\r\n\t\t\te += 1\r\n\t\tend\r\nend", "def column_peers(i)\n column_number = i % 9\n digits_on_positions(\n (0...9).map { |p| p * 9 + column_number },\n i\n )\n end", "def row(n)\n beginning_idx = 9 * n\n ending_idx = 9 * (n + 1) - 1\n s_to_a @board[beginning_idx..ending_idx]\n end", "def columns\n s = board_state\n 3.times.map{|n| s[n] + s[n + 3] + s[n + 6]}\n end", "def columns\n @cr[2] & 0x7f\n end", "def col_arrays\n #puts self.inspect\n cols = []\n (MIN_ROW_POSITION..MAX_ROW_POSITION).each do |i|\n cols[i] = []\n (MIN_COL_POSITION..MAX_COL_POSITION).each do |j|\n cols[i].push(@board[j][i])\n end\n end \n cols\n end", "def column(x)\n src.ysize.times.map { |y| src[x, y] }\n end", "def fixnums cols\n decode_values :fixnum, cols, true\n end", "def rowdigits(row)\n # Extract the subarray that represents the row and remove all zeros.\n # Array subtraction is set difference, with duplicate removal.\n @grid[row*9,9] - [0] \n end", "def print_out_column_v1(board, number)\n\n\t\tcolumn_array = []\n\n\t\tnum_of_rows = board.length - 1\n\t\tcolumn_num_choosen = number - 1\n\n\t\tfor num in (0..num_of_rows)\n\t\t\trow_array = board[num]\n\t\t\tcolumn_array << row_array[column_num_choosen]\n\t\tend\n\t\tprint column_array\n\t\treturn column_array\n\tend", "def fixnum cols\n decode_values :fixnum, cols\n end", "def get_array_by_col()\n\t\tprepare(@dim_i,@dim_j)\n\t\ttmpTab = Array.new\n\t\tfor j in 0..@dim_j-1\n\t\t\ttmpTab.push get_col(j)\n\t\tend\n\t\treturn tmpTab\n\tend", "def tile_board\n @board_array.each_with_index do |row_array, row|\n 10.times{|column| row_array << Tile.new(row,column)}\n end\n end", "def row index\n rows[index / 9]\n end", "def repeat_in_col(col)\n sub_sudoku = []\n @width.times do |index|\n sub_sudoku << @sudoku[index*@width + col].to_i\n end\n result = []\n @width.times do |row|\n if sub_sudoku.count(row+1) > 1\n sub_sudoku.each_with_index do |element, index|\n result << index*@width + col if element == row+1\n end\n return result\n end\n end\n nil\n end", "def get_col(col)\n\tcol_array = []\n\t$boggle_board.length.times do |row|\n\t\tcol_array << $boggle_board[row][col]\n\t\trow+=1\n\tend\n\tcol_array\nend", "def cols\n count == 0 ? Array.new(@order) :\n first.inject([]) { |arr, item| \n arr << map { |row| row[arr.count] }; arr }\n end", "def split_rows\n\t\t@board.values.each_slice(15).to_a\n\tend", "def columns\n @board.transpose\n end", "def [](row, col)\n #convert row values by * by 9\n @grid[row * 9 + col]\n end", "def nest_array(board)\n nested_board = []\n 9.times { nested_board << board.slice!(0..8)}\n return nested_board\nend", "def board\n @sudoku_board.each_slice(9) {|row| puts row.join}\n\n end", "def row(dash_index)\n row = []\n @board_array.each_with_index do |number, index|\n if index % 9 == dash_index\n row << number\n end\n end\n row\n end", "def col(num)\n \"#{27.chr}[3#{num.to_s}m\"\nend", "def col; reshape(length, 1); end", "def rows\n 3.times.map{|n| board_state[n * 3, 3]}\n end", "def columns; end", "def get_columns\n column_lines = []\n 0.upto(@@width - 1) do |column|\n column_line = \"\"\n 0.upto(@@height - 1) do |row|\n column_line << @board[row][column]\n end\n column_lines << column_line\n end\n column_lines\n end", "def inject_col(n_times, from_col, src_array, direction)\n case direction\n when 0\n add_col(1, from_col, src_array, -1)\n add_col(n_times-1, from_col, src_array, 0) unless n_times-1 > 0\n when -1\n add_col(1, from_col, src_array, 0)\n add_col(n_times-1, from_col, src_array, -1) unless n_times-1 > 0\n else\n raise ArgumentError, 'Argument number (#{args.size}) is wrong'\n end\n end", "def cols\n # remove the nils\n cols = (Array.new(@size) { Array.new(@size) }).map { |col| col.select { |el| el != nil} }\n \n @rows.each do |row|\n row.each_with_index do |mark, col_idx|\n cols[col_idx] << mark\n end\n end\n \n cols\n end", "def column_for_position(position); end", "def column_for_position(position); end", "def column_for_position(position); end", "def rows\n @cr[3] >> 1 & 0x3f\n end", "def pattern\n @nz.map { |nz_cell| nz_cell[0..1] }\n end", "def create_board\n cols = Array.new(7) { Array.new(6, 0) }\n cols\n end", "def board_2d\n # slice the array into groups of 4 to create 2d-array\n @board.enum_slice(4).to_a\n end", "def create_game_field_array\r\n\t\r\n\t\ti=0\r\n\t\twhile i < 8 do\r\n\t\t\tj=0\r\n\t\t\t\r\n\t\t\twhile j < 8 do\r\n\t\t\t #Copy the \".\" object in the actual Position of the 2 dimensional Array \r\n\t \t @nha[i][j] =\".\"\t\t\r\n\t\t\t\tj+=1\t\t\r\n\t\t\tend\r\n\t\t\ti+=1\r\n\t\tend\r\n\t\treturn true\r\n\tend", "def columns\n puzzle.transpose\n end", "def col; end", "def to_columns(data)\n col_arr = []\n data.split(\"\\n\").each do |row|\n row.split(' ').each_with_index do |num, ind|\n if col_arr[ind] == nil\n col_arr << [num.to_i]\n else\n col_arr[ind] << num.to_i\n end\n end\n #col_arr = [[1], [2], [3]]\n end\n col_arr\n end", "def cols\n directions.count('r') + 1\n end", "def row_index(slot)\n slot / 9\n end", "def grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend", "def input_to_row(row)\n 8 - row.to_i\n end", "def cell_columns\n cells = []\n # for each column\n 1.upto(3).each do |column|\n grid = []\n\n # for each row\n 1.upto(3).each do |row|\n grid << get_cell_value(row, column)\n end\n\n cells << grid\n end\n\n cells\n end", "def col_max; 1; end", "def insert_columns( before, number=1 )\n a = Array.new( number, nil )\n before = col_index( before ) - 1\n @data.map! { |row| row.insert( before, *a ) }\n calc_dimensions\n end", "def print_in_cols a, noc=nil\n unless noc\n noc = 3\n if a.size < 7\n noc = 1\n elsif a.size < 15\n noc = 2\n end\n end\n\n x = noc - 1\n cols = a.each_slice((a.size+x)/noc).to_a\n # todo width should be determined based on COLS of screen, and width of data\n cols.first.zip( *cols[1..-1] ).each{|row| puts row.map{|e| e ? '%-30s' % e : ' '}.join(\" \") }\nend", "def yale_nd_row_as_array i\n yale_nd_row(i, :array)\n end", "def num_cols()\n return self[0].length\n end", "def columns\n cols = []\n (0...size).each do |i|\n vals = []\n (0...size).each do |j|\n vals.push(get_square({:column => i, :row => j}))\n end\n cols.push(Row.new(size, {:vals => vals}))\n end\n cols\n end", "def get_column_from_board_with_col_number(board, col_number)\n board.transpose[column_number-1]\n # column = []\n board.map { |row| row[col_number - 1] }\n # column\nend", "def get_col_from_index(index)\n index % 8 == 0 ? 8 : index % 8\n end", "def columnate ary, sz\n buff=Array.new\n return buff if ary.nil? || ary.size == 0\n \n # ix refers to the index in the complete file list, wherease we only show 60 at a time\n ix=0\n while true\n ## ctr refers to the index in the column\n ctr=0\n while ctr < sz\n\n f = ary[ix]\n # deleted truncate and pad part since we expect cols to be sized same\n\n if buff[ctr]\n buff[ctr] += f\n else\n buff[ctr] = f\n end\n\n ctr+=1\n ix+=1\n break if ix >= ary.size\n end\n break if ix >= ary.size\n end\n return buff\nend", "def calculate_row(index)\n index/9\n end", "def build_array_of_cols_and_vals( num )\n cols = [:my_name, :description]\n value_sets = []\n num.times { |i| value_sets << [\"My Name #{i}\", \"My Description #{i}\"] }\n [cols, value_sets]\n end", "def new_board\n (\"1\"..\"7\").to_a.each_with_object({}) do |key, hash|\n hash[key] = Array.new(6) { |i| (i + 1).to_s }\n end\n end", "def exercise_1113 (matrix)\n end", "def effective_column(range); end", "def create_work_matrix(array)\n array[1..-2].each_with_object([]) do |line, arr|\n line.gsub!(/\\s/, '0')\n arr << line[1..-2].chars\n end.to_a\n end", "def square_arrays\n squares = []\n org_row = 0\n org_col = 0\n (0..8).each do |i|\n squares[i] = []\n (org_row..org_row+2).each do |k|\n (org_col..org_col+2).each do |j|\n squares[i].push(@board[k][j])\n end \n end\n if org_row == 6\n org_col += 3 \n org_row = 0\n else\n org_row += 3 \n end\n end \n squares\n end", "def gen_board\n\n (\"A\"..\"I\").each do |row|\n (0..8).each_with_index { |column, value| @board.merge!( { \"#{row}#{column}\".to_sym => @board_array.shift.to_i } ) }\n end\n return @board\n end", "def array_nl()\n #This is a stub, used for indexing\n end", "def board\n @board_string = @board_string.to_s.split(//).each_slice(9).to_a.map!{|array| array.map!{|string| string.to_i}}\n\n end", "def col_targets(column)\n row = 0\n until row == 8\n @targets << [row, column]\n row += 1\n end\n end", "def create_row(r)\n row = Array.new\n self.board.each { |a|\n row << a[r]\n }\n row\n end", "def initialize\n flat_array = Array.new(9){ ' ' }\n # it will be easier to put X's and O's on the board\n # if I let @spaces be an array of arrays.\n @spaces = flat_array.each_slice(3).to_a\n # that was the old #rows method. \n end", "def get_column(col_num)\n column = []\n @grid.each do |row|\n column << row[col_num]\n end\n column\n end", "def get_col(col)\n boggle_board = [\n\t \t\t\t\t[\"b\", \"r\", \"a\", \"e\"],\n\t [\"i\", \"o\", \"d\", \"t\"],\n\t [\"e\", \"c\", \"l\", \"r\"],\n\t [\"t\", \"a\", \"k\", \"e\"]\n\t \t\t\t\t\t\t\t]\ncol_arr = []\nrow_num = boggle_board.length\nrow_num.times do |row| \n\tcol_arr << boggle_board[row][col-1]\n\trow+=1\n end\ncol_arr\nend", "def columns\r\n # TODO: transpose possibly doesn't work for rectangular (non-square) maps\r\n @all_columns ||= rows.transpose\r\n end", "def call\n @size.times.flat_map do |row|\n @size.times.map do |col|\n @cells.include?(\"#{row}-#{col}\") ? \"1\" : \"0\"\n end\n end.join\n end", "def right(r, sc, ec, array, final_array) #r for row, sc start column, end column\n (sc..ec).each do |num|\n final_array << array[r][num]\n end\nend", "def generate_matrix\n [].tap { |a| 25.times { a << 'X' } }.each_slice(5).to_a\n end", "def to_row(row)\n 7 - row\n end", "def col_max\n return 3\n end", "def col_max\n return 3\n end", "def box_column_index\n\t\t\tcolumn_value / 3 #3 is number of columns in a box\n\t\tend", "def columnify col_count, enum\n @cols = [{}] * col_count\n @col_count = col_count\n @col_ids = Array(col_count.times)\n enum = Array(enum)\n item_count = enum.count\n row_count = item_count / col_count\n rest = item_count % col_count\n row_count += 1 if rest > 0\n row_count.times do |r|\n row Array(col_count.times.map { |i| enum[r * col_count + i] || \"\" })\n end\n end", "def generate_grid(board_string) current_grid = Array.new(3, Array.new(3) {\n[\"-\", \"X\"].sample })\n\n parse_char = board_string.split('')\n parse_count = 0\n\n test = current_grid.length\n\n 3.times do |row|\n 3.times do |idx|\n current_grid[row][idx] = parse_char[parse_count]\n parse_count += 1\n end\n end\n\n return current_grid\nend", "def grid(n, m)\n Array.new(n) { Array.new(n) } # If you attempted to write this as Array.new(n, Array.new(m)) the contents would be repeated for each array rather\nend", "def column_size; end", "def get_col_contents(col)\n column_string = \"\"\n\n (0..8).each do |row|\n column_string << @board.slice(row * 9 + col,1)\n end\n\n column_string\n end", "def calcularFilCol(numElem)\r\n\t\t\r\n\t\ti = 0\r\n\t\tnum = 0\r\n\t\t\r\n\t\twhile i < @fil\r\n\t\t\t\r\n\t\t\tj = 0\r\n\t\t\t\r\n\t\t\twhile j < @col\r\n\t\t\t\t\r\n\t\t\t\tif (num == numElem)\r\n\t\t\t\t\t\r\n\t\t\t\t\t@filM.push(i)\r\n\t\t\t\t\t@colM.push(j)\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tnum += 1\r\n\t\t\t\tj += 1\r\n\t\t\t\t\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\ti += 1\r\n\t\t\t\r\n\t\tend\r\n\t\t\r\n\tend", "def fill_array rows, cols, num, val\n num = 0 if num < 0\n array = Array.new(rows) { Array.new(cols) { -1 } }\n (0...num).each { |i|\n row = (i / cols).floor\n col = i % cols\n array[row][col] = val\n }\n array\n end", "def get_col_from_index(index)\n if index % 8 == 0\n return 8\n else\n return index % 8\n end\n end", "def initialize\n @cells = Array.new(9,\" \")\n end", "def columns=(n)\n @columns = n\n end", "def rows\n @columns.each do |column|\n @rows << Array.new(@columns.size) do |i|\n \"#{column}#{i + 1}\"\n end\n end\n @rows\n end" ]
[ "0.70424986", "0.66484493", "0.6530665", "0.6526589", "0.63949686", "0.63226736", "0.6296218", "0.62741035", "0.6255498", "0.6239319", "0.6210454", "0.6151495", "0.6115818", "0.60251474", "0.59775597", "0.59335655", "0.5925241", "0.59169173", "0.59075546", "0.58862156", "0.5863606", "0.58612573", "0.58559453", "0.5849402", "0.584002", "0.58360463", "0.5830989", "0.5812589", "0.5800838", "0.57927865", "0.5756189", "0.57459104", "0.57313555", "0.5728064", "0.5715917", "0.56994104", "0.5699405", "0.56961995", "0.5693313", "0.5659097", "0.56553113", "0.5651263", "0.56405437", "0.56405437", "0.56405437", "0.5638986", "0.5632539", "0.56224054", "0.56147885", "0.56105494", "0.56047374", "0.5596985", "0.55877423", "0.558372", "0.55825293", "0.5573876", "0.5566256", "0.55599475", "0.55538553", "0.5546831", "0.553903", "0.5534108", "0.55323297", "0.55235076", "0.55219877", "0.5520445", "0.5518156", "0.55142415", "0.551277", "0.55115914", "0.5510795", "0.54984426", "0.5495", "0.5492457", "0.54900014", "0.54845273", "0.5482392", "0.54812133", "0.5476934", "0.5472107", "0.54684544", "0.5467263", "0.5466829", "0.5461989", "0.5460643", "0.5459511", "0.54557776", "0.5453428", "0.5453428", "0.54515713", "0.5451489", "0.5448128", "0.54462576", "0.54408586", "0.54285204", "0.54244274", "0.5421066", "0.5419595", "0.54180205", "0.5413358", "0.5412262" ]
0.0
-1
True if the event has already passed
def has_passed? Time.zone.at(starttime) < Time.zone.now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event?\n @events_mutex.synchronize do\n !@events.empty?\n end\n end", "def eventless?\n ! @event\n end", "def evented\n @evented = true\n end", "def event_received(sequence)\n false # return true if we handled the event here\n end", "def performed?(event)\n @triggered.include?(event)\n end", "def performed?(event)\n @triggered.include?(event)\n end", "def event?\n !! @event\n end", "def next_event?\n !@next_event.blank?\n end", "def prev_event?\n !@prev_event.blank?\n end", "def passed_event?\n date_time < Time.now.utc\n end", "def recording_events?\n false\n end", "def tb_event_still?\n !@tb_event || !@tb_event.move_route_forcing\n end", "def going?(event)\n attended_events.include?(event)\n end", "def attending?(event)\n events.include?(event)\n end", "def has_queued_events?\n !@propagation.empty?\n end", "def successful?\n a = any_args? ? [:any] : @args\n begin\n @recorder.event_raised?(@event_name, @mode, *a)\n rescue ArgumentError\n false\n end\n end", "def processed?\n !processed_events(event_id: id).empty?\n end", "def use_event_attributes?\n !skip_actions && !skip_after && actions.all? && actions.length == 1 && first.machine.action_hook?\n end", "def exist?\n !(@event.nil? || @event.empty?)\n end", "def time_passed?(_event, time)\n Time.now > time\n end", "def valid_event(event, args)\n true\n end", "def event? eve\n @_events.include? eve\n end", "def valid?\n return false if @event_time.nil?\n return true\n end", "def changed?\n self.event_state.include? :changed\n end", "def common_event_reserved?\r\n @common_event_id > 0\r\n end", "def has_run?\n @passed != nil\n end", "def common_event_reserved?\n !@reserved_common_events.empty?\n end", "def common_event_reserved?\n @common_event_id > 0\n end", "def passed_test?(event)\n event['event'] == 'test' && event['status'] == 'pass'\n end", "def valid_for_push?\n\t\t\t [:after_create].include? self.event.to_sym\n\t\t\tend", "def declined?(event)\n\t\tattended_events.declined.include?(event)\n\tend", "def event_running?\n @battle_event.active?\n end", "def received?\n received_event_parameters\n end", "def can_trigged?(event)\n false\n end", "def attending?(event)\n\t\tattended_events.accepted.include?(event)\n\tend", "def emits?(evt)\n self.class.emits?(evt)\n end", "def contains_event?(e)\n (e.time_from_start >= @start) && (e.time_from_start <= @end)\n end", "def attended?(event)\n !self.event_members.where(event_id: event.id).empty?\n end", "def has_pending_events?\n\t\treturn self.pending_event_count.nonzero? ? true : false\n\tend", "def event_running?\n get_scene.event_running?\n end", "def check_event_trigger_here(triggers)\n return false\n end", "def past_step_2?\n !spectator? && status_is_active?(\"events\")\n end", "def ready?\n running? && @event_received\n end", "def verify(event_data)\n true\n end", "def attending?(event)\n attended_events.include?(event)\n end", "def event?(state)\n @events.key?(state)\n end", "def done?\n re = pick_first? ? RegistryEvent.first : first_matching_tag\n return false unless re\n\n re.status.to_i == RegistryEvent.statuses[:done].to_i\n end", "def check_event_trigger_here(triggers)\n result = false\n return result\n end", "def second_shot_complete? frame\n frame.shot_2 != nil\n end", "def event?\n entry_type == :event\n end", "def is_used?\n !self.involvement_events.empty?\n end", "def event?(event)\n event_names.include?(event.to_s)\n end", "def save_event?(event)\n event.save\n end", "def check_event_trigger_there(triggers)\n return false\n end", "def blank?\n events.none?\n end", "def has_been_called?\n raise NeverHookedError unless @was_hooked\n calls.size > 0\n end", "def done?\n beam.empty?\n end", "def has_event?(event_model)\n\t bound_events.has_key?(event_model)\n\tend", "def check_event_trigger_there(triggers)\n result = false\n return result\n end", "def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end", "def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end", "def on_create_called?\n !!@on_create_called\n end", "def empty?\n @events.empty?\n end", "def is_future?\n is_event_future = false\n is_event_future = true if !is_past?\n return is_event_future\n end", "def event_passable_check?(new_x, new_y, z, game_map)\n game_map.events.each_value do |event|\n next unless event.contact?(new_x, new_y, z)\n next if event.through\n return false unless event.character_name.empty?\n end\n return true\n end", "def aligned?\n\t\treturn true if clear?\n\t\t\n\t\t!self.any? { |event_id, state|\n\t\t\tDungeon_Crawler.dungeon.event_hash[event_id].state != state\n\t\t}\n\tend", "def attended_event? event\n event_registration = event.events_registrations.find_by(registration: registrations)\n\n return false unless event_registration.present?\n\n event_registration.attended\n end", "def passed?(object)\n ! @seen_values.include?(object)\n end", "def can_event?(step)\n model_events.include? step&.to_sym\n end", "def repealed?\n !!repealed_on\n end", "def step_completed?\n !object.waiting_on.include?(scope)\n end", "def check_event_trigger_touch(x, y)\n result = false\n return result\n end", "def has_event?(event_model)\n bound_events.has_key?(event_model)\n end", "def private_began?\n @time_source.call >= @begin_time\n end", "def is_expected(event)\n # TODO Implement this\n end", "def state_changed?\n peek_state\n !@state_queue.empty?\n end", "def has_event?(name)\n return self.events(true).include? name.to_sym\n end", "def update?\n event == 'update'\n end", "def called?\n !!@called\n end", "def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end", "def new_msg?\n msg && !event[:subtype]\n end", "def event?(name)\n @events.keys.include?(name.to_sym)\n end", "def is_new_event(log_event) \n # we've seen no records at all\n if @min_time.nil?\n return true\n # the record is too old\n elsif log_event.timestamp < @min_time \n return false\n # so either the timestamp is new or the event is\n else \n if !@events_by_ms.key?(log_event.timestamp) \n return true\n else\n return !@events_by_ms[log_event.timestamp].include?( identify(log_event)) \n end\n end\n end", "def finished?\n true unless self.finished_on.nil?\n end", "def event?\n type == :event_id\n end", "def event?\n type == :event_id\n end", "def has_any_event\n include InstanceMethods unless @published_events\n @published_events = :any_event_is_ok\n end", "def finished?\n\tfinished_on.present? \n\tend", "def success?\n # if something # possibility of event interception?\n # self.activate\n # end\n if !@active\n return false\n end\n @active = false\n return true\n end", "def finished?\n !!self.ended_at\n end", "def valid?\n\t\t\t klass.respond_to?(event)\n\t\t\tend", "def signalled event\n @signalled_actions and @signalled_actions[event]\n end", "def video_ended(ref,event)\n return false unless ref\n return true if ref.video && !event.video\n return true if ref.video && ref.video != event.video\n false\n end", "def check_event_trigger_touch(x, y)\n return false\n end", "def valid_event?(event)\n return false unless event.livemode\n return false unless event.type == 'charge.succeeded'\n return false unless event.data.object.paid\n return false unless event.data.object.captured\n return false unless event.data.object.currency == 'usd'\n return false if event.data.object.refunded\n true\n end", "def validates_arity?(evt)\n emits?(evt) && emittable[evt.to_sym] > NO_CHECK_ARITY\n end", "def waiting_event?\r\n return false unless @move_route_waiting\r\n # If we're waiting for a specific event\r\n if @move_route_waiting_id\r\n return true if @move_route_waiting_id == 0 && $game_player.move_route_forcing\r\n wanted_event = $game_map.events[@move_route_waiting_id]\r\n return true if wanted_event&.move_route_forcing || wanted_event&.path\r\n @move_route_waiting = false\r\n @move_route_waiting_id = nil\r\n return false\r\n end\r\n # Otherwise we're waiting for all event\r\n return true if $game_player.move_route_forcing\r\n return true if $game_map.events.any? { |_, event| event.move_route_forcing }\r\n @move_route_waiting = false\r\n return false\r\n end", "def finished?\n\t\tfinished_on.present?\n\tend", "def finished?\n\t\tfinished_on.present?\n\tend", "def succeeded(event)\n @mutex.synchronize do\n succeeded_events << event\n all_events << event\n end\n end", "def private_done?\n @time_source.call > @end_time\n end" ]
[ "0.7440245", "0.73332983", "0.7303605", "0.7271702", "0.7242666", "0.7242666", "0.72190714", "0.72174686", "0.7198475", "0.7172934", "0.71527994", "0.71440494", "0.7077931", "0.6946691", "0.68673426", "0.68347204", "0.68183887", "0.68033457", "0.6778147", "0.6777544", "0.6738865", "0.6737496", "0.6724908", "0.6713741", "0.67053866", "0.6680347", "0.66798437", "0.6641799", "0.66411674", "0.6621085", "0.66059625", "0.65981334", "0.6573424", "0.6564752", "0.65555024", "0.6545664", "0.65372884", "0.65364337", "0.65200865", "0.6514893", "0.64849013", "0.6481865", "0.6461872", "0.6451732", "0.64395255", "0.6419738", "0.6393824", "0.63750714", "0.63352793", "0.63293964", "0.63290244", "0.6326264", "0.629827", "0.629759", "0.6297534", "0.62909716", "0.6290212", "0.6262789", "0.625895", "0.62588966", "0.62588966", "0.6217562", "0.62135077", "0.6207842", "0.62020266", "0.6190137", "0.6171984", "0.61637205", "0.6153642", "0.61535704", "0.61301994", "0.6123756", "0.61145604", "0.6093816", "0.6093539", "0.60860026", "0.60852176", "0.60799026", "0.6079229", "0.6071873", "0.6066731", "0.60572577", "0.6055351", "0.6054657", "0.60545796", "0.60545796", "0.605102", "0.6048255", "0.6043458", "0.60281867", "0.60261613", "0.6025108", "0.6022343", "0.6013487", "0.60039306", "0.6003121", "0.600195", "0.6001019", "0.6001019", "0.5998485", "0.5995507" ]
0.0
-1
GET /projects or /projects.json
def index @projects = current_user.projects.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n end", "def projects\n resource 'projects'\n end", "def get\n CircleCi.request(conf, '/projects').get\n end", "def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end", "def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end", "def index\n @projects = current_user.projects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.order_by_company_and_project.paginate(page: params[:page] || 1, per_page: helpers.pager_per_page)\n respond_to do |format|\n message = @projects.present? ? \"\" : \"There are no projects available at this time\"\n format.json do\n status = @projects.present? ? :ok : :not_found\n render json: { response: @projects, status: status, message: message }\n end\n format.html do\n # Only authorize html format, json is okay because we use it as\n # an api.\n authorize(:project)\n flash[:alert] = message unless message.blank?\n @projects\n end\n end\n end", "def get_projects\n me = request('/services/v5/me')\n me['projects']\n end", "def projects\n records \"project\", \"/project/list\"\n end", "def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def projects(options = {})\n get(\"projects\", options).projects\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectsApi.get_projects ...'\n end\n # resource path\n local_var_path = '/projects'\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 = ['Token']\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 => 'Projects')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @projects = Project.all\n render json: @projects, status: :ok\n end", "def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end", "def projects(params = {})\n fetch_all('projects', 'projects', params)\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end", "def list_projects\n handle_action_exceptions(__method__) do\n cmd_line = ['listprojects']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def index\n if signed_in?\n @projects = current_user.projects\n respond_to do |format|\n format.html { render 'projects/index' }\n format.json { render template: 'projects/index.json.jbuilder' }\n end\n else\n redirect_to :projects\n end\n end", "def projects(req_params = {})\n name = 'Projects'\n params = { req: req_params }\n\n data = endpoint(name: name, params: params).do_get\n\n collection name, data\n end", "def index\n @projects = Project.with_permissions_to(:read)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index \n\n @projects = Project.all\n respond_to do |format|\n format.html {render :template => \"projects/index\"}\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.includes(:user).all\n respond_with(@projects) do |format|\n format.json { render :json => {:list => @projects.as_json, :current_user => current_user.as_json} }\n format.html\n end\n end", "def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @projects = Project.all\n render json: @projects\n end", "def index\n @projects = Project.all_for_user(current_user.id)\n render json: @projects.to_json(include: :project_detail), status: 200\n end", "def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def project(project_id, query_params = nil)\n get(\"/projects/#{project_id}\", query_params)\n end", "def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end", "def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend", "def all_projects()\n @endpoint = \"/projects.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"projects\"].sort_by { |proj| proj[\"name\"] }\n end", "def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end", "def index\n\t\tif present_user.role? 'admin'\n\t\t\t@projects = Project.all\n\t\telse\n\t\t\t@projects = present_user.projects\n\t\tend\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @projects }\n\t\tend\n\tend", "def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def list\r\n @projects = Project.where(user:current_user).order(created_at: :desc).page(params[:page])\r\n respond_with(@projects)\r\n end", "def index\n @projects = Project.all\n render json: @projects, layout: false\n end", "def index\n @projects = Project.where user: current_user\n render json: @projects, each_serializer: Projects::IndexSerializer\n end", "def project(project_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end", "def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end", "def get_projects_of_user\n respond_to do |format|\n format.json {\n #param = params[:payload]\n #@user = User.find_by_id(param[:id])\n @projects = Project.where(:user_id => @current_user.id)\n if @projects\n render :json => @projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def listProjects \n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/projects')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\n\nend", "def projects\n @projects ||= Harvest::API::Projects.new(credentials)\n end", "def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.get_projects ...'\n end\n # resource path\n local_var_path = '/v1/project'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'excludeInactive'] = opts[:'exclude_inactive'] if !opts[:'exclude_inactive'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Project>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @projects = @client.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @projects }\n end\n end", "def show\n repo = ProjectRepo.new current_user\n @v_project = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_project }\n end\n end", "def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#get_projects ...\"\n end\n \n # resource path\n path = \"/Projects\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\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<APIProject>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def project\n request :project\n end", "def index\n if params.has_key?(:offered)\n # mapping for url : /api/version/users/1/projects\n @projects = @parent.offered_projects.all\n elsif params.has_key?(:contributed)\n @projects = @parent.contributed_projects\n else\n @projects = Project.all\n end\n\n respond_with @projects, :each_serializer => ProjectSerializer, status: :ok\n end", "def index\n @user = User.find_by_id(session[:userid])\n @projects = current_user_projects\n respond_to do |format|\n format.html # index.html.erb\n format.json\n end\n end", "def list_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.list_projects ...'\n end\n # resource path\n local_var_path = '/projects'\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] || 'Array<ProjectMetadata>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.list_projects\",\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: ProjectApi#list_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def projects\n @projects ||= begin\n http = Net::HTTP.new(API_HOST, API_PORT)\n http.use_ssl = true\n http.ca_file = (Twigg.root + 'files' + 'github.pem').to_s\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n uri = ORG_REPOS_ENDPOINT % Config.github.organization\n headers = { 'Authorization' => \"token #{Config.github.token}\" }\n\n [].tap do |names|\n begin # loop: page through project list\n request = Net::HTTP::Get.new(uri, headers)\n response = http.request(request)\n raise \"Bad response #{response.inspect}\" unless response.is_a?(Net::HTTPOK)\n names.concat JSON[response.body].map { |repo| repo['name'] }\n uri = parse_link(response['Link'])\n end until uri.nil?\n end\n end\n end", "def index\n @projects = @projects.includes(:latest_iteration).where(:tenant_id => current_user.tenant).order(\"name\").page(params[:page]).per(DEFAULT_ROWS_PER_PAGE)\n\n respond_with @projects\n end", "def show\n set_surrogate_key_header \"api/platforms/#{@platform.id}/projects\"\n set_cache_control_headers 3600\n end", "def projects_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectsApi.projects_list ...'\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'account_id'] = opts[:'account_id'] if !opts[:'account_id'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'filters'] = @api_client.build_collection_param(opts[:'filters'], :multi) if !opts[:'filters'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Project>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#projects_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "def show\n @projects = find_projects\n end", "def project(project_id)\n resource \"projects/#{project_id}\"\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def list_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: QcApi.list_projects ...\"\n end\n # resource path\n local_var_path = \"/projects.json\"\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 => 'Array<Project>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QcApi#list_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def project\n return forbidden unless current_account and params[:id] and (request.format.json? || request.format.js? || request.format.text?)\n project = Project.accessible(current_account).find(params[:id].to_i)\n return not_found unless project\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'project' => project.canonical(opts)}\n render_cross_origin_json\n end", "def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show_by_gitpath\n @project = Project.includes(:users).includes(:technos).find_by_gitpath(params[:gitpath])\n\n respond_to do |format|\n format.json { render json: @project, status: 200 }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n projects = current_user.admin_projects.paginate(:page => params[:page])\n render json: projects\n end", "def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end", "def query_projects(options = nil)\n require_relative 'telerivet/project'\n self.cursor(Project, get_base_api_path() + \"/projects\", options)\n end", "def user_teams_projects(team_id, project_id = nil)\n project_id.to_i.zero? ? get(\"/user_teams/#{team_id}/projects\") : get(\"/user_teams/#{team_id}/projects/#{project_id}\")\n end", "def index\n @user = get_user\n @projects = Project.all\n # render :inline => @projects.to_json\n end" ]
[ "0.8347259", "0.798982", "0.7920745", "0.7814874", "0.77544016", "0.770965", "0.74383014", "0.7373741", "0.7356232", "0.7333684", "0.73274547", "0.73206097", "0.7315391", "0.72966963", "0.72867036", "0.72863996", "0.72863996", "0.72863996", "0.72863996", "0.72863996", "0.72863996", "0.72863996", "0.7276382", "0.7267963", "0.7262301", "0.72604436", "0.72561425", "0.7240656", "0.7238376", "0.7235056", "0.7226634", "0.7214433", "0.7207687", "0.7204292", "0.71786547", "0.71741974", "0.7158739", "0.7152302", "0.71435004", "0.71348757", "0.7122295", "0.70998317", "0.70773023", "0.7070776", "0.70593035", "0.7051642", "0.70285004", "0.7021093", "0.7002722", "0.69976777", "0.6986439", "0.6981233", "0.6970595", "0.6963944", "0.6954621", "0.6952253", "0.69466686", "0.69322556", "0.6922186", "0.6920012", "0.6917724", "0.69106036", "0.6905798", "0.68908274", "0.68762684", "0.6854783", "0.68532693", "0.6848109", "0.68222547", "0.6819791", "0.6819791", "0.68178815", "0.68097", "0.6804851", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67942375", "0.67883426", "0.67882013", "0.6781408", "0.6775472", "0.67604166", "0.67530674", "0.67495763", "0.67476535", "0.67450815", "0.67416245", "0.67400634", "0.67370236" ]
0.0
-1
GET /projects/1 or /projects/1.json
def show project = Project.where(id: params[:id]).first if project.present? @tasks = project.tasks end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def get\n CircleCi.request(conf, '/projects').get\n end", "def projects\n request(method: 'getAllProjects')\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def projects\n resource 'projects'\n end", "def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n end", "def project(project_id, query_params = nil)\n get(\"/projects/#{project_id}\", query_params)\n end", "def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def project(project_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end", "def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectsApi.get_projects ...'\n end\n # resource path\n local_var_path = '/projects'\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 = ['Token']\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 => 'Projects')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def find_project(name)\n get(\"/projects/#{name}\")\n end", "def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end", "def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end", "def list_projects\n handle_action_exceptions(__method__) do\n cmd_line = ['listprojects']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def index\n @projects = Project.all\n render json: @projects, status: :ok\n end", "def project(project_id)\n resource \"projects/#{project_id}\"\n end", "def index \n\n @projects = Project.all\n respond_to do |format|\n format.html {render :template => \"projects/index\"}\n format.json { render json: @projects }\n end\n end", "def show\n repo = ProjectRepo.new current_user\n @v_project = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_project }\n end\n end", "def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.get_projects ...'\n end\n # resource path\n local_var_path = '/v1/project'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'excludeInactive'] = opts[:'exclude_inactive'] if !opts[:'exclude_inactive'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Project>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_project(project_id)\n http = Net::HTTP.new(@city_db_url, @port)\n http.read_timeout = 1000\n if @city_db_is_https\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n request = Net::HTTP::Get.new(\"/projects/#{project_id}.json\")\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.basic_auth(ENV['URBANOPT_USERNAME'], ENV['URBANOPT_PASSWORD'])\n\n response = http.request(request)\n if response.code != '200' # success\n @runner.registerError(\"Bad response #{response.code}\")\n @runner.registerError(response.body)\n @result = false\n return {}\n end\n\n result = JSON.parse(response.body, symbolize_names: true)\n return result\n end", "def projects(params = {})\n fetch_all('projects', 'projects', params)\n end", "def index\n @projects = Project.order_by_company_and_project.paginate(page: params[:page] || 1, per_page: helpers.pager_per_page)\n respond_to do |format|\n message = @projects.present? ? \"\" : \"There are no projects available at this time\"\n format.json do\n status = @projects.present? ? :ok : :not_found\n render json: { response: @projects, status: status, message: message }\n end\n format.html do\n # Only authorize html format, json is okay because we use it as\n # an api.\n authorize(:project)\n flash[:alert] = message unless message.blank?\n @projects\n end\n end\n end", "def list_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'ListProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :page\n\t\t\targs[:query]['Page'] = optional[:page]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :project_owner\n\t\t\targs[:query]['ProjectOwner'] = optional[:project_owner]\n\t\tend\n\t\tself.run(args)\n\tend", "def projects\n records \"project\", \"/project/list\"\n end", "def index\n @projects = current_user.projects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def get_project1_with_http_info(uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.get_project1 ...'\n end\n # verify the required parameter 'uuid' is set\n if @api_client.config.client_side_validation && uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'uuid' when calling ProjectApi.get_project1\"\n end\n # resource path\n local_var_path = '/v1/project/{uuid}'.sub('{' + 'uuid' + '}', CGI.escape(uuid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Project' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#get_project1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @projects = Project.with_permissions_to(:read)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n @projects = Project.all\n render json: @projects\n end", "def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end", "def show\n render json: Project.where(id: params.fetch(:id))\n end", "def get_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#get_projects ...\"\n end\n \n # resource path\n path = \"/Projects\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\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<APIProject>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @projects = Project.all_for_user(current_user.id)\n render json: @projects.to_json(include: :project_detail), status: 200\n end", "def show \n project= Project.find(params[:id])\n\n render json: project\n end", "def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end", "def projects_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectsApi.projects_list ...'\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'account_id'] = opts[:'account_id'] if !opts[:'account_id'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'filters'] = @api_client.build_collection_param(opts[:'filters'], :multi) if !opts[:'filters'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Project>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#projects_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "def project\n return forbidden unless current_account and params[:id] and (request.format.json? || request.format.js? || request.format.text?)\n project = Project.accessible(current_account).find(params[:id].to_i)\n return not_found unless project\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'project' => project.canonical(opts)}\n render_cross_origin_json\n end", "def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def show_by_gitpath\n @project = Project.includes(:users).includes(:technos).find_by_gitpath(params[:gitpath])\n\n respond_to do |format|\n format.json { render json: @project, status: 200 }\n end\n end", "def index\n @projects = @projects.includes(:latest_iteration).where(:tenant_id => current_user.tenant).order(\"name\").page(params[:page]).per(DEFAULT_ROWS_PER_PAGE)\n\n respond_with @projects\n end", "def project\n request :project\n end", "def get_projects\n me = request('/services/v5/me')\n me['projects']\n end", "def show\n @project = Project.find_by(id: params[:id])\n if @project\n render :json => @project\n else\n render :json => 422\n end\n end", "def project(options = {})\n raise Unfuddled::Error.new(\"No options given for project, cannot query\") if options == {}\n \n raise Unfuddled::Error.new(\"Can only supply one of :id and :name\") if options.keys.include?([:id , :name])\n \n url = \"/api/v1/projects/#{options[:id]}.json\" if options.keys.include?(:id)\n url = \"/api/v1/projects/by_short_name/#{options[:name]}.json\" if options.keys.include?(:name)\n\n Unfuddled::Project.from_response( send(:get , url)[:body] , self)\n end", "def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end", "def show\n set_surrogate_key_header \"api/platforms/#{@platform.id}/projects\"\n set_cache_control_headers 3600\n end", "def show \n respond_to do |format|\n format.json {\n\n @project = Project.find_by_id(params[:id])\n\n if @project\n render :json => @project\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def show\n @projectresource = Projectresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectresource }\n end\n end", "def list_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.list_projects ...'\n end\n # resource path\n local_var_path = '/projects'\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] || 'Array<ProjectMetadata>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.list_projects\",\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: ProjectApi#list_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n if signed_in?\n @projects = current_user.projects\n respond_to do |format|\n format.html { render 'projects/index' }\n format.json { render template: 'projects/index.json.jbuilder' }\n end\n else\n redirect_to :projects\n end\n end", "def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end", "def listProjects \n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/projects')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\n\nend", "def get_projects_of_user\n respond_to do |format|\n format.json {\n #param = params[:payload]\n #@user = User.find_by_id(param[:id])\n @projects = Project.where(:user_id => @current_user.id)\n if @projects\n render :json => @projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def index\n @projects = Project.all\n render json: @projects, layout: false\n end", "def projects(req_params = {})\n name = 'Projects'\n params = { req: req_params }\n\n data = endpoint(name: name, params: params).do_get\n\n collection name, data\n end", "def index\n @projects = Project.includes(:user).all\n respond_with(@projects) do |format|\n format.json { render :json => {:list => @projects.as_json, :current_user => current_user.as_json} }\n format.html\n end\n end", "def index\n @projects = Project.where user: current_user\n render json: @projects, each_serializer: Projects::IndexSerializer\n end", "def index\n @projects = @client.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @projects }\n end\n end", "def list_projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: QcApi.list_projects ...\"\n end\n # resource path\n local_var_path = \"/projects.json\"\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 => 'Array<Project>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QcApi#list_projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def all_projects()\n @endpoint = \"/projects.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"projects\"].sort_by { |proj| proj[\"name\"] }\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @ourproject = Ourproject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ourproject }\n end\n end", "def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end", "def show\n respond_with @project do |format|\n format.json do\n render json: @project.as_json.merge(\n commits_url: project_commits_url(@project, format: 'json'),\n commits: @project.commits.order('committed_at DESC').limit(10).map { |commit|\n commit.as_json.merge(\n percent_done: commit.fraction_done.nan? ? 0.0 : commit.fraction_done*100,\n translations_done: commit.translations_done,\n translations_total: commit.translations_total,\n strings_total: commit.strings_total,\n import_url: import_project_commit_url(@project, commit, format: 'json'),\n sync_url: sync_project_commit_url(@project, commit, format: 'json'),\n url: project_commit_url(@project, commit),\n status_url: project_commit_url(@project, commit),\n )\n }\n )\n end\n end\n end", "def index\n conditions = {}\n conditions[:status] = params[:status] if params[:status]\n @projects = Project.find(:all, :conditions => conditions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n format.json { render :json => @projects }\n end\n end", "def get(project_name)\n response = get_request(\"/projects/#{project_name}/\")\n TheShiningSource::Project.new(response)\n end", "def get_project_with_http_info(name, version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.get_project ...'\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling ProjectApi.get_project\"\n end\n # verify the required parameter 'version' is set\n if @api_client.config.client_side_validation && version.nil?\n fail ArgumentError, \"Missing the required parameter 'version' when calling ProjectApi.get_project\"\n end\n # resource path\n local_var_path = '/v1/project/lookup'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'name'] = name\n query_params[:'version'] = version\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Project' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#get_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end", "def index\n @projects = Project.all\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end" ]
[ "0.78086686", "0.75306284", "0.7333377", "0.7333045", "0.729723", "0.72843105", "0.72768533", "0.7254954", "0.7245274", "0.7242027", "0.72348636", "0.71435845", "0.71272165", "0.7118981", "0.71186686", "0.71186686", "0.71186686", "0.71186686", "0.71186686", "0.71186686", "0.71186686", "0.7099041", "0.70975184", "0.70896256", "0.7080773", "0.7080773", "0.7075834", "0.7062161", "0.7051438", "0.70294315", "0.7015382", "0.70141107", "0.6989989", "0.69670016", "0.6956718", "0.69563425", "0.69551426", "0.6939053", "0.69279224", "0.69277525", "0.69240135", "0.69156426", "0.6908201", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.69041574", "0.68975204", "0.6895072", "0.6891104", "0.6890732", "0.6889617", "0.6887331", "0.6849446", "0.68487847", "0.68265545", "0.68264484", "0.68197215", "0.6818015", "0.68128127", "0.6812537", "0.6805838", "0.6802845", "0.6792111", "0.67895174", "0.6788478", "0.6776522", "0.6772008", "0.6763829", "0.6761816", "0.67612875", "0.67574185", "0.6754322", "0.6750863", "0.6737872", "0.6735514", "0.6725771", "0.67230403", "0.6708795", "0.67082524", "0.6694586", "0.6693018", "0.66742176", "0.6671935", "0.6665105", "0.66643524", "0.66613233", "0.66600335", "0.6656167", "0.6655908" ]
0.0
-1
POST /projects or /projects.json
def create @project = current_user.projects.new(project_params) respond_to do |format| if @project.save format.html {redirect_to "/projects", notice: "Project was successfully created."} format.json {render :show, status: :created, location: @project} else format.html {render :new, status: :unprocessable_entity} format.json {render json: @project.errors, status: :unprocessable_entity} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n project = JSON.parse(response.body)\r\n check_new_project(project) \r\n end", "def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project] || JSON.parse(request.body.read))\n\n if (params[:id])\n @project.id = params[:id]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n format.json { render :json => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n format.json { render :text => \"error creating project via http/json\" }\n end\n end\n end", "def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end", "def projects\n resource 'projects'\n end", "def create\n\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def create\n @project = current_user.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if project.save\n format.html { redirect_to project, notice: 'Project was successfully created.' }\n format.json { render json: project, status: ':created', location: project }\n else\n format.html { render action: 'new' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end", "def post_project_with_http_info(project_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectsApi.post_project ...'\n end\n # verify the required parameter 'project_body' is set\n if @api_client.config.client_side_validation && project_body.nil?\n fail ArgumentError, \"Missing the required parameter 'project_body' when calling ProjectsApi.post_project\"\n end\n # resource path\n local_var_path = '/projects'\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 = @api_client.object_to_http_body(project_body)\n auth_names = ['Token']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Project')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#post_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: :created, location: @project }\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n format.html { render action: \"new\" }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.json { render :json => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @project = @client.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @client, notice: 'Project was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def projects\n records \"project\", \"/project/list\"\n end", "def create\n @api_project = Project.new(api_project_params)\n\n respond_to do |format|\n if @api_project.save\n format.html { redirect_to @api_project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @api_project }\n else\n format.html { render :new }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\t\t\t\t\t\t\t\t\t# Creates record in db and redirects (porbably to index)\n\t\t@project = Project.new(projects_params)\t# Passes only title and desc.\n\n \trespond_to do |format|\t\t\t\t\t# All this is doing is rendering stuff in case of json\n \t\tif @project.save\n \t\tformat.html { redirect_to @project, notice: 'Created a new project!' }\n \t\tformat.json { render :show, status: :created, location: @project }\n \t\telse\n \t\tformat.html { render :new }\n \t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend", "def create\n @projects = current_user.projects\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @projects << @project\n format.html { redirect_to user_projects_path(current_user), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end", "def project\n request :project\n end", "def create\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was successfully created.') }\n format.xml { render xml: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = current_user.projects.new(project_params)\n if @project.save\n render :show\n else\n render json: { errors: @project.errors }\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: t('models.project.create') }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def projects\n request(method: 'getAllProjects')\n end", "def create(attributes={})\n raw_response = post_request('projects', project: attributes)\n parse_response(raw_response, :project)\n end", "def create\n @client = Client.find(params[:client_id])\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully created.' }\n format.json { render json: client_projects_path(@client), status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_create_project_via_API_XML\r\n get \"/logout\"\r\n post \"/projects.xml\", :api_key=>'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_project_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Project'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.create_project\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: \"Project was successfully created.\" }\n User.find(current_user.id).projects << Project.find(@project.id)\n @projects_user = ProjectsUser.find_by(user_id: current_user.id, project_id: @project.id)\n format.json { render :show, status: :created, location: @project }\n\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n find_projects(params[:api_key])\n end", "def create\n @project = Project.new(project_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @project.save\n format.json { render :show, status: :created, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render action: 'show', status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def list\n get 'projects'\n end", "def create\n project_attrs = params[:project].merge(validate_repo_connectivity: true)\n @project = current_user.owned_projects.create(project_attrs, as: :owner)\n respond_with @project do |format|\n format.json do\n if @project.valid?\n render json: decorate(@project).to_json, status: :created\n else\n render json: {project: @project.errors.as_json}.to_json, status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.create(project_params)\n if @project.errors.blank?\n flash[:success] = t('controllers.projects.create.success', project: @project.name)\n else\n flash.now[:alert] = @project.errors.full_messages.unshift(t('controllers.projects.create.failure'))\n end\n respond_with @project, location: projects_url\n end", "def create\n @create_project = current_user.projects.build(params[:project])\n flash[:notice] = \"Project #{@create_project.description} successfully created\" if @create_project.save\n respond_with(@create_project, layout: !request.xhr?)\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n if @project.save\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n end", "def create\n @project = Project.new(project_params)\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, flash: {success: 'Project was successfully created.'} }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_project\n if current_admin.present? || current_client.present?\n @project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n else\n redirect_to new_admin_session_path and return\n end\n end", "def create\n @project = Project.new(project_params)\n @project.user_id = @user.id\n if @project.save\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @project = current_user.projects.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end", "def create\n @project = Project.create project_params\n current_user.memberships.create(\n project_id: @project.id,\n owner_at: Time.now\n )\n\n if @project.save\n render 'projects/create', status: 201\n else\n render 'projects/error', status: 422\n end\n end", "def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to root_path, notice: 'Enhorabuena! Tienes un nuevo proyecto. A trabajar!' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end", "def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n end", "def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end", "def create\n @project = Project.new(project_params)\n \n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # authenticate_user!\n @project = Project.new\n @project[:category] = params[:category]\n @project[:title] = params[:title]\n @project[:body] = params[:body]\n @project[:location] = params[:location]\n @project[:image_link] = params[:image_link]\n @project[:project_url] = params[:project_url]\n @project[:year] = params[:year]\n @project[:likes] = params[:likes]\n @project.save\n\n render json: @project\n end", "def create\n @project = Project.new(project_params)\n\n begin\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n rescue Exception => e\n @project.destroy\n respond_to do |format|\n format.html { render :new }\n format.json { render json: e.as_json, status: :service_unavailable }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to :projects, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html do\n @teams = Team.order(:name)\n render :new\n end\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/v1/project'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) \n\n # return_type\n return_type = opts[:return_type] || 'Project' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def project_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/projects.json\",\n body: project_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end", "def create\n @project = Project.new(project_params)\n\n if params[\"project\"][\"client_id\"] != \"\"\n @project.client = Client.find params[\"project\"][\"client_id\"]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Novo projeto cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end", "def create\n @project = Project.new(project_params)\n\n if is_organization_admin? and @project.save\n @project.team_members.create(user_id: @project.organization.owner_id)\n render json: {\n name: @project.name,\n organization: @project.organization.name,\n url: project_dashboard_path(@project.id)\n }\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def new\n @project = @client.projects.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @project }\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n @project.team.touch\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n render_errors(format, @project.errors, :new)\n end\n end\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n build_projects_user\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(:project_title => params[:project_title], :start_date => params[:startDate], :end_date => params[:endDate],\n :status => params[:project_status])\n\n @project.user_id = current_user.id\n\n\n respond_to do |format|\n if @project.save\n p \"pass on projects controller\"\n format.html { redirect_to @project}\n format.json { render json: \"ok\" }\n else\n p \"fail on projects controller\"\n end\n end\n\n\n end", "def index\n @projects = Project.all\n render json: @projects, status: :ok\n end" ]
[ "0.7134768", "0.71024853", "0.7024186", "0.7020876", "0.7006797", "0.69238055", "0.6899287", "0.68908757", "0.6807239", "0.6781449", "0.675678", "0.6754991", "0.675458", "0.6743632", "0.67409533", "0.67326033", "0.6710531", "0.6694772", "0.6690449", "0.6688386", "0.6681838", "0.6657058", "0.6647323", "0.66434294", "0.6642298", "0.6639339", "0.66381127", "0.66353196", "0.66301525", "0.6630104", "0.66201824", "0.66201824", "0.66201824", "0.66201824", "0.66201824", "0.66201824", "0.66201824", "0.66201824", "0.66201824", "0.6614586", "0.660488", "0.66026855", "0.65784", "0.6574509", "0.6561978", "0.6551254", "0.6549382", "0.65492815", "0.65480405", "0.65452415", "0.65446377", "0.65391695", "0.65272224", "0.6526933", "0.6519339", "0.6517504", "0.65153223", "0.6514025", "0.6512158", "0.650381", "0.65033865", "0.65031797", "0.6496122", "0.64875865", "0.64834905", "0.647781", "0.64751667", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6475047", "0.6470603", "0.6468614", "0.64645183", "0.6448102", "0.64440143", "0.64408326", "0.6436131", "0.64309776", "0.6429121", "0.64246136", "0.64176", "0.64116716", "0.6409313", "0.6406766", "0.6397998", "0.63971275", "0.63970983", "0.63970447" ]
0.6734336
15
PATCH/PUT /projects/1 or /projects/1.json
def update respond_to do |format| if @project.update(project_params) format.html {redirect_to @project, notice: "Project was successfully updated."} format.json {render :show, status: :ok, location: @project} else format.html {render :edit, status: :unprocessable_entity} format.json {render json: @project.errors, status: :unprocessable_entity} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def update\n @project = Project.find(params[:id])\n\n if params[:name] == \"project_name\"\n project_name = params[:value]\n @project.project_name = project_name\n end\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n\n @projects = Project.all\n format.html {\n render :action => \"index\"\n }\n format.json { render json: @project }\n else\n logMessage = self.class.to_s + \"#\" + __method__.to_s + \" \" + current_user.username + \" errors:\" + @project.errors.full_messages.to_s\n logger.info logMessage\n\n format.html {\n flash[:error] = 'Project was not successfully updated.'\n redirect_to action: \"index\"\n }\n errorMsg = @project.errors.full_messages.to_s.split(\"\\\"\")\n format.json { render json: errorMsg[1], status: 500 }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @project.update(project_params)\n\t\t\t\tformat.json { render :show, status: :ok }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, :notice => 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok, location: api_v1_project_url(@project)\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render :show, status: :ok, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\n render 'projects/error', status: 422\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\t\t\t\t\t\t\t\t\t# Actually modifies the data and redirects (probably to index or show? depends)\n\t\t#@project = Project.find(params[:id])\t# Taken out because of the before action GENIUS!\n\n\t\trespond_to do |format|\n \t\t if @project.update(projects_params)\n \t\tformat.html { redirect_to @project, notice: 'Project was successfully updated.' }\n \t\tformat.json { render :show, status: :ok, location: @project }\n \t\telse\n \t\tformat.html { render :edit }\n \t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend", "def update\n respond_to do |format|\n if project.update(project_params)\n format.html { redirect_to project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_project\n\t\t@project = Project.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @project.update_attributes(project_update_params)\n\t\t format.html { redirect_to(@project, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@project) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@project) }\n\t\t end\n\n \t end\n\tend", "def update\n @project = current_user.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = @client.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to([@client, @project], notice: 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n @main_projects = Project.roots.where(creator_id: @project.creator_id)\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@project = Project.find(params[:id])\n\t\tmake_breadcrumbs\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @project.update_attributes(params[:project])\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.updated') }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @api_project.update(api_project_params)\n format.html { redirect_to @api_project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_project }\n else\n format.html { render :edit }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @edit_project = Project.find(params[:id])\n\n respond_to do |format|\n if @edit_project.update_attributes(params[:project])\n format.html { redirect_to @edit_project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @edit_project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @project.update(project_params)\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to add_path(@project), notice: 'Project was successfully updated.' }\n format.json { render :add, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'UpdateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def update\n @client = Client.find(params[:client_id])\n @project = Project.find(params[:id])\n \n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: projects_path }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @project.update(project_params)\r\n format.html { redirect_to @project }\r\n format.json { respond_with_bip(@project) }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { respond_with_bip(@project) }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n \t\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render json: @project.as_json(:include => [:client, :project_participants ] ) }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @project\n if @project.update(project_params)\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n else\n render json: {error: \"Project does not exist\"} , status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: \"#{I18n.t 'project.project_updated'}\"}\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\n if @project.update(project_params)\n render :show, status: :ok, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: \"Project was successfully updated.\" }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n handle_params_categories\n add_http_if_necessary\n\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path() }\n format.xml { head :ok }\n else\n @edit_mode = true\n @tasks = Task.find_all_by_project_id(@project.id)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_url, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7226871", "0.7201011", "0.7144544", "0.71334213", "0.71198756", "0.71166897", "0.7107941", "0.71031785", "0.70998937", "0.70983905", "0.7094925", "0.70939213", "0.7086738", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7082901", "0.7076727", "0.7076727", "0.70665115", "0.70660746", "0.706154", "0.706154", "0.706154", "0.706154", "0.70462203", "0.70462203", "0.70266855", "0.7016999", "0.7016999", "0.7015028", "0.7006545", "0.70052755", "0.6985509", "0.6982628", "0.6975476", "0.69589496", "0.69589496", "0.6954268", "0.6946767", "0.6946698", "0.690021", "0.68997943", "0.6895181", "0.6891947", "0.6891947", "0.6884431", "0.6883964", "0.6879522", "0.6879522", "0.68754137", "0.6868102", "0.686674", "0.6866409", "0.68600315", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345", "0.6857345" ]
0.0
-1
DELETE /projects/1 or /projects/1.json
def destroy project=Project.find(params[:project_id]) project.destroy respond_to do |format| format.html {redirect_to projects_url, notice: "Project was successfully destroyed."} format.json {head :no_content} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(projects)\n project_ids = projects.collect { |project| project.id } \n args = {ids: project_ids.to_json}\n return @client.api_helper.command(args, \"project_delete\")\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'DeleteProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def delete_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"deleteproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end", "def delete\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = current_user.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @project.destroy\r\n respond_to do |format|\r\n format.html { redirect_to projects_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_projects_path }\n format.json { head :no_content }\n end\n end", "def destroy\n project = Project.find(params[:id])\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.delete\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def destroy\t\t\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Successfully deleted project.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:message=>\"OK\",:id=>@project.id}, :staus=>:ok}\n end\n end", "def destroy\n name = @project.name\n @project.destroy\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end", "def destroy\n @project = Project.find(params[:id])\n @project.status = 'deleted'\n @project.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: t('models.project.destroy') }\n format.json { head :no_content }\n end\n end", "def delete\r\n\t\t\trender json: Project.delete_by_id(params[:id])\r\n\t\tend", "def destroy\n @ourproject = Ourproject.find(params[:id])\n @ourproject.destroy\n\n respond_to do |format|\n format.html { redirect_to ourprojects_url }\n format.json { head :ok }\n end\n end", "def delete_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\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? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def destroy\n\t\t@project.destroy\n\t\trespond_to do |format|\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @project.destroy_all\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'The project was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n head :no_content\n end", "def destroy\n @project.destroy\n\n head :no_content\n end", "def destroy\n name = @project.name\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_path,\n :notice => t('general.deleted',\n :entity => t('project.entity_name'),\n :identifier => name)) }\n format.xml { head :ok }\n end\n end", "def delproject(project)\n post('delproject.json', project: project)\n end", "def destroy\n @project = Project.find_by_permalink(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_path, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = current_user.active_projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:valid => true} }\n end\n end", "def destroy\n @project = Admin::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = @client.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to @client }\n end\n end", "def destroy\n authenticate_user!\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n standard_destroy(Project, params[:id])\n end", "def destroy\n authorize! :destroy, @project\n @project.destroy\n\n head :no_content\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_project = FileProject.find(params[:id])\n @file_project.destroy\n\n respond_to do |format|\n format.html { redirect_to file_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @project\n @project.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end", "def destroy\n @api_project.destroy\n respond_to do |format|\n format.html { redirect_to api_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def backend_deleteProject(param) \n @Projects.delete(param) if @Projects.include? param \n end", "def destroy\n repo = ProjectRepo.new current_user\n repo.destroy params[:id]\n\n respond_to do |format|\n format.html { redirect_to v_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"#{I18n.t 'project.project_destoy'}\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find_by_slug(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def _project_delete(acronym)\n delete \"/projects/#{acronym}\"\n _response_status(204, last_response)\n end", "def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def delete(project_id)\n raw_response = delete_request(\"projects/#{project_id}\")\n parse_response(raw_response)\n end", "def delete(project_id)\n raw_response = delete_request(\"projects/#{project_id}\")\n parse_response(raw_response)\n end", "def destroy\n @project = Project.find(params[:id])\n employee_projects = EmployeesProjects.find EmployeesProjects.search_by(project_id: @project.key)\n employee_projects.map &:destroy\n @project.destroy\n respond_to do |format|\n if Project.list.blank?\n format.html { redirect_to startup_projects_path }\n else\n format.html { redirect_to learn_projects_path }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n @project.users.delete_all\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Rails.logger.info \"We are deleting project\"\n @todo_project.destroy\n respond_to do |format|\n format.html { redirect_to todo_projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Проект удален' }\n format.json { head :no_content }\n end\n end", "def destroy\n Project.destroy params[:id].split(',')\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Proyecto eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = @user.projects.find(params[:id])\n @project.remove!\n\n respond_to do |format|\n format.html { redirect_to(projects_url(:subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n @project.project_homepage_url ||= project_find_default_url\n format.html do\n redirect_to projects_url\n flash[:success] = 'Project was successfully deleted.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @project = @client.projects.find(params[:id])\n\n begin\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was deleted.') }\n format.xml { head :ok }\n end\n rescue ActiveRecord::DeleteRestrictionError\n redirect_to client_project_url(@client, @project), notice: \"Delete was restricted.\"\n end\n end", "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7736063", "0.76790005", "0.764256", "0.7580914", "0.75690496", "0.75549084", "0.7554458", "0.7554458", "0.7554458", "0.7554458", "0.7554458", "0.7552977", "0.75320613", "0.75320166", "0.7526476", "0.75191283", "0.75152", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.75062424", "0.7501397", "0.74979186", "0.74979186", "0.74979186", "0.74979186", "0.7472797", "0.746691", "0.7463608", "0.7452592", "0.7440051", "0.74161875", "0.7413813", "0.7410336", "0.73992187", "0.73942745", "0.7394194", "0.7387949", "0.73761314", "0.7369346", "0.73662245", "0.73577994", "0.7356351", "0.73438513", "0.73393834", "0.7330572", "0.7330098", "0.7326807", "0.73236", "0.73236", "0.7320179", "0.73182017", "0.7311771", "0.73117375", "0.731078", "0.7309432", "0.7294924", "0.7289343", "0.7283784", "0.7275642", "0.72755724", "0.7273293", "0.727304", "0.7270528", "0.7268562", "0.7267628", "0.72674215", "0.7259867", "0.7259867", "0.72437257", "0.72435844", "0.723994", "0.72388566", "0.72333056", "0.723135", "0.7230218", "0.72268707", "0.7222662", "0.72219276", "0.72202706", "0.7219591", "0.7218868" ]
0.72214997
97
Use callbacks to share common setup or constraints between actions.
def set_project @project = Project.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Only allow a list of trusted parameters through.
def project_params params.require(:project).permit(:name) 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
Problem 1 Return sum of subsequent sums of an array:
def sum_of_sums(numbers) sum = 0 numbers.size.times { |counter| sum += numbers[0..counter].sum } sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_sums(array)\n sum = 0\n array.length.times do |index|\n sum += array[0, index + 1].reduce(&:+)\n end\n sum\nend", "def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend", "def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend", "def sum_of_sums(array)\n supersum = 0\n array.each_with_index do |_, index|\n supersum += array[0, index + 1].inject(:+)\n end\n supersum\nend", "def sum_of_sums(array)\n results = []\n\n loop do \n break if array.empty?\n results << array.inject(:+)\n array.pop\n end\n\n results.inject(:+)\nend", "def sum_of_sums(array)\n total = 0\n until array.size == 0\n total += array.reduce(:+)\n array.pop\n end\n total\nend", "def sum_of_sums(array)\r\n total = array[0]\r\n new_arr = []\r\n array.each do |x|\r\n if new_arr.empty?\r\n new_arr << x\r\n else\r\n total += x\r\n new_arr << total\r\n end\r\n end\r\n new_arr.reduce(:+)\r\nend", "def sum_of_sums(array)\n sequence_total = 0\n sum = 0\n array.each do |n|\n sequence_total += n\n sum += sequence_total\n end\n sum\nend", "def sum_of_sums(arr)\n total_sum = 0\n dup_arr = arr.dup # make a copy to avoid mutating original array\n until dup_arr.empty?\n total_sum += dup_arr.reduce(:+)\n dup_arr.pop\n end\n total_sum\nend", "def sum_of_sums(array)\n sum = 0\n sum_array = array.map { |x| sum += x }\n sum_array.inject(:+)\nend", "def sum_of_sums(array)\r\nend", "def sum_of_sums(array)\n sums = []\n index = 0\n loop do\n (0..index).each {|index| sums << array[index]}\n index += 1\n break if index == array.size\n end\n sums.reduce(:+)\nend", "def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n elements = 1\n while elements - 1 < arr.size\n total_sum += arr.slice(idx, elements).reduce(:+)\n elements += 1\n end\n total_sum\nend", "def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend", "def sum_of_sums(array)\n total = 0\n loop do\n break if array.size == 0\n total += array.flatten.sum\n array.pop\n end\n total\nend", "def sum_array_rec(array_to_sum)\n if(array_to_sum.length > 0)\n sum = array_to_sum[0]\n sum += sum_array_rec(array_to_sum[1..-1])\n else\n 0\n end\nend", "def sum_of_sums(array)\n\n sums_array = []\n\n sum = 0\n array.each do |value|\n sum += value\n sums_array << sum\n end\n \n sums_array.sum\nend", "def sum_of_sums(array)\n new_array = []\n array.size.times do |n|\n new_array << array[0..n]\n end\n new_array.flatten.reduce(:+)\nend", "def running_total3(array)\n sum = 0\n array.map do |num|\n sum = [sum, num].inject(:+)\n end\nend", "def sum_of_sums_2(array)\n total_sum = 0\n i = 0\n len = array.size\n \n while i < len\n total_sum += array[0..i].inject { |sum, j| sum + j }\n i += 1\n end\n total_sum\nend", "def sum_of_sums(array)\n result = 0\n array.each_index {|idx| result += array[0..idx].sum}\n result\nend", "def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n counter = -1\n while counter + 1 > -arr.size\n total_sum += arr.slice(idx..counter).reduce(:+)\n counter -= 1\n end\n total_sum\nend", "def sum_of_sums(arr)\n total = 0\n (0..(arr.size - 1)).each { |i| total += arr[0..i].reduce(:+) }\n total\nend", "def sum_of_sums(array)\n current_sum = 0\n counter = 0\n loop do\n current_sum += array[0..counter].sum\n counter +=1\n break if counter == array.size\n end\n current_sum\nend", "def sum(array)\n return 0 if array.empty?\n return array.first if array.length == 1\n\n array.inject(:+)\nend", "def sum_of_sums(arr)\n sum = 0\n index = arr.length\n while index >= 0\n sum += arr[0, index].sum\n index -= 1\n end\n sum\nend", "def sum(array)\n return 0 if array.empty?\n array.first + sum(array[1..-1])\nend", "def sum_of_sums(array)\n elements = 1\n sums = 0 \n \n array.each_with_index do |element, index| \n counter = 0\n inner_sum = 0\n (index + 1).times do\n inner_sum += array[counter]\n counter += 1\n end\n\n sums += inner_sum\n end\n\n sums\nend", "def sum_of_sums(arr)\n new_arr = []\n \n arr.each_with_index do |num, idx|\n new_arr << arr[0..idx].reduce(:+)\n end\n \n p new_arr.reduce(:+)\nend", "def sum(array)\n array.reduce(0, :+)\n=begin\n res =0\n array.each { |a| res += a }\n res.to_i\n=end\nend", "def reduce_to_total(source_array, starting_point = 0)\n #source_array.reduce(starting_point) {|sum, n| sum + n}\n i = 0\n sum = starting_point\n while i < source_array.length do\n sum = sum + source_array[i]\n i += 1\n end\n return sum\nend", "def array_pair_sums numbers\n numbers.sort[0..numbers.size-1].reduce &:+\nend", "def sum_of_sums(arr)\n sum = 0\n total = 0\n\n arr.each do |num|\n sum += num\n total += sum\n end\n total\nend", "def sum_of_sums(arr)\n sum = 0\n total = 0\n\n arr.each do |num|\n sum += num\n total += sum\n end\n total\nend", "def sum(array)\n array.reduce(0) {|sum, num| sum += num}\nend", "def sum (arr)\n\treturn arr.inject(0, :+)\nend", "def iterative_sum(array)\n sum = 0\n array.each do |ele|\n sum += ele\n end\n sum\nend", "def get_sum(array)\n return array.inject (0) { |sum, n| sum + n }\nend", "def total (array)\n\tarray.inject { |sum, n| sum + n }\nend", "def sum arr\n rtn = 0\n arr.each { |n| rtn += n }\n return rtn\nend", "def partial_sums(array)\n new_list = [0]\n array.each_with_index do |num, i|\n new_list.push(num + new_list[0 + i])\n end\n return new_list\nend", "def total(array)\n array[0..-1].reduce(:+)\nend", "def running_total(array)\n result = []\n\n array.inject(0) do |sum, num|\n result << sum += num\n sum # have to return sum\n end\n result\nend", "def sum(array)\n array.inject(0){|sum, n| sum + n}\n end", "def iterative_sum(array)\n sum = 0\n array.each do |ele|\n sum += ele\n end\n sum\nend", "def sum_upon_sums(array)\n\nend", "def array_sum(array)\r\n array.inject(0, :+)\r\nend", "def sum arr\n arr.inject(0,:+)\nend", "def sum arr\n arr.inject(0,:+)\nend", "def total(array)\n sum = 0\n array.inject(:+)\nend", "def total(array)\n sum = 0\n array.inject(:+)\nend", "def sum_of_sums(arr)\n counter = 1\n total = 0\n\n loop do\n break if counter > arr.size\n\n total += arr.take(counter).sum\n counter += 1\n end\n total\nend", "def simple_array_sum arr\n arr.reduce(:+)\n end", "def sum_array(array)\n array.inject { |sum, n| sum += n}\nend", "def partial_sums(arr)\n sums = [0]\n arr.inject(0) do |memo,x|\n sums.push(memo+x)\n memo+x\n end\n sums\nend", "def running_total(array)\n p array.each_with_index { |_, index| array[0..index].reduce(:+) }\nend", "def sum(array)\n return array.inject(0, &:+)\nend", "def sum_of_sums(arr)\n sum = 0\n arr.each_with_index { |elem, i| sum += (arr.size - i) * elem }\n sum\nend", "def sum_array(array)\n\tarray.inject { |sum, n| sum + n }\nend", "def total_of_array(array)\n array.inject(&:+)\nend", "def sub_sum2(array)\n arr = []\n sum = 0\n array.each do |el|\n arr << [el] \n end\n array.each do |el|\n array.shift\n arr << array\n end\n # p arr\n result = 0\n arr.each do |set|\n if set.reduce(:+) > result\n result = set.reduce(:+)\n end \n end \n result\nend", "def running_total(input_array)\n sum = 0 # => 0, 0, 0, 0\n new_array = input_array.map do |value| # => [2, 5, 13], [14, 11, 7, 15, 20], [3], []\n sum += value # => 2, 7, 20, 14, 25, 32, 47, 67, 3\n end # => [2, 7, 20], [14, 25, 32, 47, 67], [3], []\nend", "def sum(array)\n\tanswer = 0\n\tif array.length > 0 then\n\t\tarray.each {|x| answer += x}\n\telse\n\t\treturn 0\n\tend\n\treturn answer\nend", "def sum(array)\n return 0 if array.empty?\n sum(array.drop(1)) + array.first\nend", "def sum(array)\n return 0 if array.empty?\n sum(array.drop(1)) + array.first\nend", "def sum(arr)\n return 0 if arr.empty?\n el = arr.shift\n total = sum(arr)\n total + el\nend", "def sum arr\n return arr.inject(0, :+)\nend", "def sum_array(array)\n\tarray.inject do |sum, n| sum + n\n\tend\nend", "def sum_of(array)\n array.inject(0.0) { |sum, e| sum + e }\n end", "def sum(array)\n sum = 0\n array.each { |n| sum += n } \n sum\nend", "def total(array)\n\treturn array.inject { |sum, x| sum + x }\nend", "def sum_of_sums(arry)\n index = 1\n sum_of_arry = 0\n while index <= arry.size\n sum_of_arry = sum_of_arry + arry.take(index).sum\n index += 1\n end\n puts sum_of_arry\nend", "def running_total_with_reduce_2(array)\n array.map.with_index do |el, idx|\n array[0..idx].reduce(:+)\n end\nend", "def sum(array)\n sum = 0\n array.each do |a|\n sum += a\n end\n return sum\nend", "def total(array)\n array.inject { |sum, n| sum + n}\nend", "def total(array)\n\tsum = array.inject(0, :+)\nend", "def total(array)\n\tx = array.length\n\tsum = 0\n\t\twhile x > 0\n\t\t\tsum += array[x-1]\n\t\t\tx -= 1\n\t\tend\n\n\treturn sum\n\nend", "def my_sum(arr)\n accumulator = arr.first # store first element as accumulator\n\n arr.each_index do |idx|\n next if idx == 0 # skip first element: it's already the accumulator\n accumulator += arr[idx] # increment accumulator by current element\n end\n\n accumulator\nend", "def sum_array(array)\n sum = 0\n array.each do |x|\n sum += x\n end\n return sum\nend", "def sum(array)\n\treturn array.reduce(:+)\nend", "def total(array)\n\tarray.inject(:+)\nend", "def sum arr\n arr.inject(0) { |sum, x| sum += x}\nend", "def sum_array(array)\n return array.sum\n\n # sum_total_of_array = 0\n # for number in array\n # sum_total_of_array += number\n # end\n # return sum_total_of_array\nend", "def total(array)\n\tarray.inject { |sum, x| sum + x }\nend", "def total(array)\n sum = array.inject(:+)\n sum\nend", "def running_total(array)\n run_total = []\n \n index = 1\n while index <= array.length\n element = array.slice(0,index)\n run_total << element.inject(:+)\n index += 1\n end\n run_total\nend", "def sum_of_sums(int_arr)\n sum = 0\n current_numbers = []\n int_arr.each { |int|\n current_numbers << int\n sum += current_numbers.sum\n }\n sum\nend", "def running_total(array)\n # new_array = []\n sum = 0\n array.inject([]) do |arr, val| \n sum += val\n arr << sum \n arr\n end\nend", "def opposing_sums(array)\n\nend", "def parts_sums(input_array)\n total = input_array.sum\n output = [total]\n input_array.size.times do \n total = total - input_array.shift\n output << total\n end\n output\nend", "def a_very_big_sum arr\n arr.reduce(:+)\n end", "def sum_of_sums(array)\n size = array.size \n index = 0\n sum = 0\n \n while index < array.size\n sum += (array[index] * size)\n index += 1\n size -= 1\n end\n \nsum\n \nend", "def total(array)\n array.inject(:+)\nend", "def iterative_sum(arr)\n total = 0\n arr.each {|num| total += num}\n return total\nend", "def sum arr\n arr.inject(0, :+) \nend", "def total(array)\n\tarray.inject(0) {|sum, num| sum += num}\nend", "def total(array)\n sum = 0\n array.inject(0) {|sum, i|\n sum + i}\n end", "def total(array)\n\tarray.inject {|sum,n| sum + n}\n\tend", "def sum(array)\n s = 0\n\tarray.each {|x| s+= x}\n\ts\nend", "def total(array)\n \n len = array.length\n i = 0\n sum = 0\n \n while i < len do\n sum = sum + array[i]\n i = i + 1\n end\n return sum\nend", "def total(array)\n sum = 0\n array.each { |i| sum += i }\n return sum\nend" ]
[ "0.8281554", "0.82208693", "0.8166877", "0.81170225", "0.8106525", "0.80838555", "0.80736846", "0.802728", "0.79922116", "0.7982901", "0.7920427", "0.7884447", "0.7881639", "0.7822368", "0.7818045", "0.78155273", "0.7815257", "0.7804419", "0.7793377", "0.7789122", "0.77867985", "0.7776411", "0.7751609", "0.77463216", "0.7739464", "0.7736924", "0.7726162", "0.7686852", "0.7680827", "0.76724553", "0.76584", "0.7658296", "0.76285183", "0.76285183", "0.7622777", "0.7614744", "0.7603067", "0.7595964", "0.75938606", "0.75754064", "0.7561616", "0.7559328", "0.7558819", "0.75585806", "0.7556626", "0.75550383", "0.75538117", "0.7546508", "0.7546508", "0.75464034", "0.75464034", "0.7540249", "0.754012", "0.7540011", "0.7534743", "0.75346255", "0.7532012", "0.7531033", "0.7530908", "0.7528896", "0.7525216", "0.75251687", "0.75197875", "0.75188816", "0.75188816", "0.7518108", "0.75160104", "0.75078744", "0.7502627", "0.750207", "0.7496823", "0.74957436", "0.74950457", "0.74949425", "0.7493349", "0.74933267", "0.74847317", "0.74745613", "0.7473139", "0.74715716", "0.7468691", "0.7467123", "0.7466723", "0.74651885", "0.7464692", "0.74643314", "0.7459911", "0.74584365", "0.74577624", "0.74561197", "0.7452153", "0.74520224", "0.74505657", "0.7449103", "0.7447553", "0.744521", "0.7444167", "0.7443903", "0.744352", "0.7442527", "0.7441784" ]
0.0
-1
Problem 3 Returns an arrary of all substrings from the beginning:
def leading_substrings(str) result = [] str.size.times { |index| result << str[0..index] } result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substrings(str)\n str.chars.map.with_index do |subr,index|\n leading_substrings(str.slice(index..-1))\n end.flatten\nend", "def substrings(str)\n result = []\n 0.upto(str.size) do |number|\n result[number] = leading_substrings(str[number..str.size])\n end\n\n result.flatten\nend", "def substrings(str)\n return_arr = []\n\n str.length.times {|i| return_arr << substrings_at_start(str[i..-1])}\n return_arr.flatten\nend", "def leading_substrings(str)\n substr_arr = []\n \n (0...str.size).each do |index|\n substr_arr << str[0..index]\n end\n substr_arr\nend", "def substrings(string)\r\n new_array = []\r\n string.size.times do |index|\r\n new_array << leading_substrings(string[index..string.size])\r\n end\r\n new_array.flatten\r\nend", "def substrings(str)\n result = []\n str.size.times do |idx|\n result << leading_substrings(str[idx..-1])\n end\n result.flatten\nend", "def substrings_at_start(string)\n array = []\n for i in (0..string.length - 1)\n array << string[0..i]\n end\n array\nend", "def leading_substrings(str)\n substrings = []\n str.each_char.with_index do |char, idx|\n substrings << str[0..idx]\n end\n substrings\nend", "def substrings_at_start(string)\n string.size <= 1 ? [string] : [substrings_at_start(string.chop), string].flatten\nend", "def substrings_at_start(string)\n results = []\n\n string.length.times do\n results << string\n string = string.chop\n end\n\n results.sort\nend", "def substrings_at_start(str)\n counter = 1\n array = str.chars\n return_array = []\n\n loop do\n break if counter > array.size\n return_array << array.take(counter).join\n counter += 1\n end\n return_array\nend", "def leading_substrings(string) \n result = [] \n string.split(\"\").each_index {|i| result << string[0..i] }\n result\nend", "def substrings_at_start(string)\n sub_arr = []\n string.chars.each_index do |idx|\n sub_arr << string.slice(0, idx + 1)\n end\n sub_arr.sort\nend", "def substrings(str)\n str.split(//).map.with_index { |_, idx| substrings_at_start(str[idx..-1]) }.flatten\nend", "def leading_substrings(string)\n array = string.chars\n result = []\n loop do\n break if array.empty?\n result.unshift(array.join)\n array.pop\n end\n result\nend", "def substrings_at_start(string)\n result = []\n string = string.chars\n string.size.times do\n result << string.join('')\n string.pop\n end\n\n result.sort\nend", "def substrings_at_start(string)\n count = 0\n new_array = []\n while count < string.length\n new_array << string[0..count]\n count += 1\n end\n new_array\nend", "def substrings_at_start(string)\n count = 0\n new_array = []\n while count < string.length\n new_array << string[0..count]\n count += 1\n end\n new_array\nend", "def initial_substrings(word)\n (0...word.length).map { |index| word[0..index] }\nend", "def substrings_at_start(str)\n new_arr = []\n 0.upto(str.size) do |i|\n next if i == 0 \n new_arr << str.slice(0,i)\n end\n new_arr\nend", "def substrings(str)\n result = []\n count = 0\n\n until count == str.length\n result << substrings_at_start(str.slice(count..-1))\n count += 1\n end\n result.flatten\nend", "def leading_substrings(string)\n substrings = []\n string.each_char.with_index { |_, index| substrings << string[0..index] }\n substrings\nend", "def substrings(string)\n array = []\n\n string.length.times do |index|\n this_substring = string[index..-1]\n array << substrings_at_start(this_substring)\n end\n array.flatten\nend", "def substrings_at_start(str)\n\n results = []\n\n str.chars.each_with_index do |ss, idx|\n results << str.slice(0..idx)\n end\n\n results\n\nend", "def substrings_at_start(str)\n results = []\n substring = ''\n \n str.chars.each do |char|\n substring += char\n results << substring\n end\n \n results\nend", "def substrings_at_start(string)\n sub_arr = []\n start = 0\n while start < string.size\n string.chars.each_index do |idx|\n sub_arr << string.slice(start..idx)\n end\n start += 1\n end\n sub_arr.sort.reject(&:empty?)\nend", "def substrings(str)\n results = []\n (0..str.size).each do |start_index|\n this_substring = str[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def leading_substrings(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "def leading_substrings(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "def substrings_at_start(string)\n \n new_array = []\n string.size.times do |idx|\n new_array << string[0..idx]\n end\n new_array\nend", "def substrings_at_start(string)\n string_array = string.chars\n array_final = []\n\n 1.upto(string.size) do |count|\n array_final << string_array.slice(0, count).join\n end\n array_final\nend", "def leading_substrings(str)\n str_array = str.chars\n new_string = ''\n new_arr = []\n\n str_array.each do |char|\n new_string += char\n new_arr << new_string\n end\n new_arr\nend", "def substrings_at_start(str)\n result_arr = []\n 0.upto(str.size-1) do |num|\n result_arr << str[0..num]\n end\n result_arr\nend", "def substrings_at_start(string)\n array_of_strings = []\n count = 0\n\n loop do\n 0.upto(count) do |idx|\n array_of_strings[idx] = string[0..idx] \n end\n count += 1\n break if count == string.length\n end\n\n array_of_strings\nend", "def substrings_at_start(string)\n array_of_strings = []\n count = 0\n\n loop do\n 0.upto(count) do |idx|\n array_of_strings[idx] = string[0..idx] \n end\n count += 1\n break if count == string.length\n end\n\n array_of_strings\nend", "def substrings(string)\n string.chars.map.with_index { |_, idx| substrings_at_start(string[idx..-1]) }.flatten\nend", "def substrings(string)\n result = []\n string.size.times do |index|\n result << substrings_at_start(string[index..-1])\n end\n result.flatten\nend", "def leading_substrings(string)\n substring = []\n string.each_char.with_index { |_, index| substring << string[0..index] }\n substring\nend", "def substrings_at_start(string)\n string.size <= 1 ? [string] : [*substrings_at_start(string.chop), string] \nend", "def substrings_at_start(string)\n array_of_strings = []\n split_string = string.split('')\n substring = ''\n split_string.each_index do |position|\n substring += split_string[position]\n array_of_strings << substring\n end\n array_of_strings\nend", "def substrings_at_start(str)\n new_arr = []\n 1.upto(str.size) do |count| \n substring = ''\n substring += str.slice(0, count)\n new_arr << substring\n end\n new_arr\nend", "def substrings_at_start(string)\n result = []\n string.length.times { |idx| result << string[0..idx] }\n result\nend", "def leading_substrings(string)\n substring_arr = []\n counter = 0\n loop do\n substring_arr << string[0..counter]\n counter += 1\n break if counter == string.size\n end\n substring_arr\nend", "def substrings_at_start(string)\n substrings = []\n string.chars.each_with_index do | _, idx |\n substrings << string.slice(0..idx)\n end\n substrings\nend", "def substrings_at_start(string)\n result = []\n index = 0\n while index < string.size\n result << string[0..index]\n index += 1\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |index|\n result << string.slice(0, index)\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.length) { |n| result << string.slice(0, n) }\n result\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.length) { |n| result << string.slice(0, n) }\n result\nend", "def leading_substrings(string)\n str = string\n arr = []\n counter = 0\n\n loop do\n break if str.size == counter\n arr << str.slice(0..counter)\n counter += 1\n end\n \n arr\nend", "def substrings_at_start(str)\n result = []\n index = 0\n while index < str.size\n result << str[0..index]\n index += 1\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index|\n result << string[0..index]\n end\n result\nend", "def leading_substrings(string)\n substrings = []\n for num in 1..string.length\n substrings << string[0, num]\n end\n substrings\nend", "def leading_substrings(string)\n 0.upto(string.size - 1).map { |count| string[0..count] }\nend", "def substrings_at_start(string)\n result = []\n\n loop do\n break if string.empty?\n result << string\n string = string.chop\n end\n\n result.reverse\nend", "def substrings_at_start(string)\n results = []\n\n string.length.times do |count|\n results << string.slice(0, count +1)\n end\n results\nend", "def substrings_at_start(string)\n substrings = []\n string.length.times do |i|\n substrings.push(string[0..i])\n end\n\n substrings\nend", "def leading_substrings(str)\n index = 1\n arr = []\n loop do\n break if index > str.length\n arr << str[0, index]\n index += 1\n end\n arr\nend", "def substrings_at_start2(str)\n result = []\n (0..str.size - 1).each { |idx| result << str[0..idx] }\n result\nend", "def find_substrings_from_start(str)\n substrings = []\n str.size.times { |i| substrings << str[0..i] }\n substrings\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |idx|\n result << string[0..idx]\n end\n p result\nend", "def substrings_at_start(str)\n substr_arr = []\n 1.upto(str.length) do |n|\n substr_arr << str.slice(0, n)\n end\n substr_arr\nend", "def substrings_at_start(string)\n (0...string.size).map do |length|\n string[0..length]\n end\nend", "def substrings_at_start(string)\n results = []\n\n string.chars.each_with_index do |char, index|\n results << string.chars[0..index].inject(:+)\n end\n results\nend", "def substrings_at_start(string)\n leading_substrings = []\n 0.upto(string.size - 1) do |index|\n leading_substrings << string.slice(0..index)\n end\n \n leading_substrings\nend", "def substrings_at_start(string)\n results = []\n\n string.length.times do\n results << string\n string = string.chop\n end\n\n results.reverse\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend", "def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend", "def leading_substrings(string)\n result = ''\n string.chars.map { |char| result += char }\nend", "def substrings_at_start(string)\n substrings = []\n 1.upto(string.length) do |index|\n substrings << string.slice(0, index)\n end\n substrings\nend", "def leading_substrings(string)\n result = []\n (string.size).times do |sub_num|\n result << string[0..sub_num]\n end\n result\nend", "def substrings_at_start(string)\n result = []\n string.size.times do |index|\n result << string.split(//).slice(0, index + 1).join\n end\n result\nend", "def substrings_at_start(str)\n subs = []\n str.size.times { |i| subs << str[0..i] }\n subs\nend", "def leading_substrings(str)\n sub_strings = []\n\n str.split('').each_with_index { |_, index| sub_strings << str[0, index + 1] }\n\n sub_strings\nend", "def substrings_at_start(string)\n (1..string.size).map { |count| string[0, count] }\nend", "def substrings_at_start(str)\n str.chars.map.with_index do |_, i|\n str[0..i]\n end\nend", "def substrings(string)\n arr = []\n (0...string.length).each do |idx_1|\n (idx_1...string.length).each do |idx_2|\n arr << string[idx_1..idx_2]\n end\n end\n\n arr\nend", "def leading_substrings(string)\n substrings = []\n letters = string.chars\n\n 1.upto(string.size) do |sliced_length|\n substrings << letters.slice(0, sliced_length)\n end\n\n substrings.map do |sub_array|\n sub_array.join\n end\nend", "def substrings_at_start(string)\n string.chars.map.with_index { |_, index| string[0..index] }\nend", "def substrings_at_start(str)\n results = []\n count = 1\n \n str.size.times do\n results << str.slice(0, count)\n count += 1\n end\n results\nend", "def substrings_at_start(str)\n index = 0\n length = 1\n arry = []\n\n while length <= str.size\n arry << str[index, length]\n length += 1\n end\n arry\nend", "def substrings_at_start(str)\n index = 0\n length = 1\n arry = []\n\n while length <= str.size\n arry << str[index, length]\n length += 1\n end\n arry\nend", "def substrings_at_start(str)\n index = 0\n length = 1\n arry = []\n\n while length <= str.size\n arry << str[index, length]\n length += 1\n end\n arry\nend", "def substrings_at_start(str)\n subs = []\n str.chars.each_with_index do |ch, i|\n subs << str.slice(0..i)\n end \n subs.sort {|a, b| a.length <=> b.length} \nend", "def substrings_at_start(str)\r\n chars = str.chars\r\n chars.each_with_object([]).with_index { |(el,memo), idx| memo << chars.take(idx+1).join('').to_s }\r\nend", "def substrings(string)\n array = []\n (0..string.length).each do |i|\n ((i+1)..string.length).each do |j|\n array << string[i..(j-1)]\n end \n end \n array\nend", "def substrings_at_start(string)\n sub_strings = []\n 1.upto(string.size) do |count|\n sub_strings << string[0, count]\n end\n\n sub_strings\nend", "def arr_all_possible_substrings(str)\n substring_array = []\n i = 0\n while i < str.length\n j = 0\n while j < str.length\n substring_array << str[i, j]\n j += 1\n end \n i += 1\n end\n substring_array\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(substrings_at_start(this_substring))\n end\n results\nend", "def substrings_at_start(string)\n length = 0\n substrings = []\n while length < string.size\n substrings << string[0..length]\n length += 1\n end\n substrings\nend", "def substrings_at_start(string)\n result = []\n 0.upto(string.size - 1) do |index| # iterates from 0 to the string size.\n result << string[0..index] # iterates each index from 0..0 to 0..index, which is string size.\n end\n result\nend", "def substrings_at_start(string)\n string.split(\"\").map.with_index do |_, index|\n string[0..index]\n end\nend", "def substrings(string)\n start_counter = 0\n array = []\n\n until start_counter == string.size\n\n end_counter = start_counter + 1\n\n until end_counter == string.size\n array << substring(string, start_counter, end_counter)\n end_counter += 1\n end\n\n start_counter += 1\n end\n array\nend", "def substrings_at_start(string)\n string.size.times.with_object([]) { |idx, arr| arr << string[0..idx] }\nend", "def substrings(str)\n result = []\n 1.upto(str.size) do |idx|\n str.chars.each_cons(idx) do |subr|\n result << subr.join\n end\n end\n result.sort\nend", "def substrings_at_start(str)\n (1..str.length).map { |size| str[0, size] }\nend", "def substrings_at_start(str)\n (1..str.length).map { |size| str[0, size] }\nend" ]
[ "0.7873322", "0.7789378", "0.77858406", "0.77588797", "0.7748362", "0.7724487", "0.7709579", "0.7698712", "0.76482326", "0.76441306", "0.7643576", "0.7633522", "0.7619047", "0.76157546", "0.7615237", "0.7606005", "0.7603573", "0.7603573", "0.7601993", "0.7596238", "0.7583669", "0.75744236", "0.75720817", "0.7562284", "0.7559109", "0.7555064", "0.7552115", "0.75351995", "0.75351995", "0.75348693", "0.7530994", "0.75240415", "0.75124705", "0.75032204", "0.75032204", "0.7490665", "0.74810356", "0.74769485", "0.7469789", "0.7466779", "0.7464498", "0.74636775", "0.7459316", "0.7456756", "0.74503046", "0.7449166", "0.7445124", "0.7445124", "0.7439808", "0.7437403", "0.7429241", "0.7429241", "0.74287224", "0.7417799", "0.7411662", "0.7407778", "0.7406018", "0.73918545", "0.73877114", "0.7384053", "0.73824835", "0.73824835", "0.73824835", "0.73806596", "0.7378519", "0.7373846", "0.7369384", "0.7354343", "0.7350614", "0.73470265", "0.73470265", "0.73408633", "0.7322089", "0.7314367", "0.7287387", "0.72839016", "0.7281655", "0.72806466", "0.72743964", "0.7264665", "0.7254315", "0.7247654", "0.7243989", "0.72431105", "0.72431105", "0.72431105", "0.7239774", "0.7238029", "0.7228645", "0.7220888", "0.72035384", "0.71995807", "0.71881956", "0.7186192", "0.7181375", "0.71776426", "0.71760213", "0.7175552", "0.71749556", "0.71749556" ]
0.7352886
68
== ['x', 'xy', 'xyz', 'xyzz', 'xyzzy'] Problem 4 Returns an array of all possible substrings:
def substrings(str) result = [] until str.empty? str.size.times { |index| result << str[0..index] } str[0] = '' end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arr_all_possible_substrings(str)\n substring_array = []\n i = 0\n while i < str.length\n j = 0\n while j < str.length\n substring_array << str[i, j]\n j += 1\n end \n i += 1\n end\n substring_array\nend", "def substrings(str)\n return_arr = []\n\n str.length.times {|i| return_arr << substrings_at_start(str[i..-1])}\n return_arr.flatten\nend", "def substrings(string)\r\n new_array = []\r\n string.size.times do |index|\r\n new_array << leading_substrings(string[index..string.size])\r\n end\r\n new_array.flatten\r\nend", "def substrings(string)\n array = []\n\n string.length.times do |index|\n this_substring = string[index..-1]\n array << substrings_at_start(this_substring)\n end\n array.flatten\nend", "def substrings(str)\n result = []\n str.size.times do |idx|\n result << leading_substrings(str[idx..-1])\n end\n result.flatten\nend", "def substrings(str)\n result = []\n count = 0\n\n until count == str.length\n result << substrings_at_start(str.slice(count..-1))\n count += 1\n end\n result.flatten\nend", "def get_substrings str\n\t\t(0..string.length-1).flat_map do |i|\n\t\t (1..string.length-i).flat_map do |j|\n\t\t string[i,j]\n\t\t end\n\t \tend\n\tend", "def substrings(string)\n arr = []\n (0...string.length).each do |idx_1|\n (idx_1...string.length).each do |idx_2|\n arr << string[idx_1..idx_2]\n end\n end\n\n arr\nend", "def substrings(string)\n result = []\n string.size.times do |index|\n result << substrings_at_start(string[index..-1])\n end\n result.flatten\nend", "def substrings(string)\n array = []\n (0..string.length).each do |i|\n ((i+1)..string.length).each do |j|\n array << string[i..(j-1)]\n end \n end \n array\nend", "def substrings(str)\n results = []\n (0..str.size).each do |start_index|\n this_substring = str[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings(str)\n str.chars.map.with_index do |subr,index|\n leading_substrings(str.slice(index..-1))\n end.flatten\nend", "def substrings(str)\n result = []\n 1.upto(str.size) do |idx|\n str.chars.each_cons(idx) do |subr|\n result << subr.join\n end\n end\n result.sort\nend", "def substrings(str)\n result = []\n 0.upto(str.size) do |number|\n result[number] = leading_substrings(str[number..str.size])\n end\n\n result.flatten\nend", "def substrings(string)\n arr = []\n string.chars.each_with_index do |ch, idx|\n j = idx\n while j < string.length\n arr << string[idx..j]\n j += 1\n end\n end\n\n arr\nend", "def substrings(str)\n result_array = []\n 0.upto(str.size - 1) do |x|\n 1.upto(str.size - x) do |y|\n result_array << str[x, y]\n end\n end\n result_array\nend", "def substrings(string)\n substring_array = []\n string.each do |letter|\n \n end\n substring_array\nend", "def find_substrings(str)\n sub_str = []\n \n (0...str.size).each do |s_index|\n (s_index...str.size).each do |e_index|\n sub_str << str[s_index..e_index]\n end\n end\n sub_str.uniq\nend", "def substrings(str)\n i = 0\n j = 0\n subArr = []\n\n while i < str.length\n sub = \"\"\n j = i\n while j < str.length\n sub += str[j]\n subArr << sub\n j += 1\n end\n i += 1\n end\n return subArr\nend", "def substrings(string)\n arr = []\n string.each_char.with_index do |char1, idx1|\n arr << char1\n \n idx2 = idx1 + 1\n while idx2 < string.length\n arr << string[idx1..idx2]\n \n idx2 += 1\n end\n \n end\n\n arr\nend", "def substrings(string)\n start_counter = 0\n array = []\n\n until start_counter == string.size\n\n end_counter = start_counter + 1\n\n until end_counter == string.size\n array << substring(string, start_counter, end_counter)\n end_counter += 1\n end\n\n start_counter += 1\n end\n array\nend", "def substrings(str)\n subs = []\n\n (0...str.length).each do |start_idx|\n (start_idx...str.length).each do |end_idx|\n subs << str[start_idx..end_idx]\n end\n end\n\n subs\nend", "def substrings(str)\r\n result = []\r\n starting_index = 0\r\n num_chars = 2\r\nend", "def substrings(string)\n string.chars.map.with_index { |_, idx| substrings_at_start(string[idx..-1]) }.flatten\nend", "def find_subs(string)\n result = []\n arr = string.chars\n arr.each_index do |outer_idx|\n (arr.size - outer_idx).times do |inner_idx|\n result << arr[outer_idx..(inner_idx + outer_idx)].join\n end\n end\n result\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(leading_substrings(this_substring))\n end\n results\nend", "def all_substrings(string)\n substrings = []\n string_length = string.length\n (0...string_length).each do |index|\n substring_length = 2\n while index + substring_length <= string_length\n substrings << string.slice(index, substring_length)\n substring_length += 1\n end\n end\n substrings\nend", "def substrings(string)\n results = []\n iteration = 0\n string = string\n\n loop do\n current_iteration = string[iteration..-1]\n results << substrings_at_start(current_iteration)\n iteration += 1\n break if iteration == string.length\n end\n results.flatten\nend", "def substrings(string)\n arr = (0..string.chop.size).map do |idx|\n (idx..string.chop.size).map do |idx2|\n string[idx..idx2]\n end\n end\n arr.flatten\nend", "def substrings(string)\n substr_arr = []\n (0...string.size).each do |i|\n (0...string.size).each do |j|\n substr_arr << string[i..j] if j >= i\n end\n end\n substr_arr\nend", "def substrings(string)\n results = []\n (0...string.size).each do |start_index|\n this_substring = string[start_index..-1]\n results.concat(substrings_at_start(this_substring))\n end\n results\nend", "def substrings(str)\n chars = str.chars\n substrings = []\n loop do\n break if chars.empty?\n chars.size.times do |idx|\n substrings << chars[0..idx].join\n end\n chars.shift\n end\n substrings\nend", "def substrings_single_shot(str)\n (0..str.length - 1).each_with_object([]) do |idx1, arr|\n (idx1..str.length - 1).each do |idx2|\n arr << str[idx1..idx2]\n end\n end\nend", "def substrings(string)\n subs = []\n\n (0...string.length).each do |i|\n (i...string.length).each do |j|\n subs << string[i..j]\n end\n end\n subs.sort\nend", "def substrings(str)\n str.split(//).map.with_index { |_, idx| substrings_at_start(str[idx..-1]) }.flatten\nend", "def substrings(string)\n substring_array = []\n index1 = 0\n index2 = 0\n while index1 < string.length\n while index2 < string.length\n substring_array << string[index1..index2]\n index2 += 1\n end\n index1 += 1\n index2 = index1\n end\n substring_array\nend", "def find_substrings(string)\n result = []\n 0.upto(0) do |index|\n 1.upto(string.length - index) do |length|\n result << string[index, length]\n end\n end\n result\nend", "def substrings(string)\r\n subs = []\r\n i = 0\r\n while i < string.length - 1\r\n j = i\r\n while j < string.length - 1\r\n subs << string[i..j] unless subs.include? string[i..j]\r\n j += 1\r\n end\r\n i += 1\r\n end\r\n subs\r\nend", "def find_subs(str)\n result = []\n str.chars.each_index do |current_idx|\n (str.size - current_idx).times do |inner_idx|\n result << str[current_idx..(current_idx + inner_idx)]\n end\n end\n p result\nend", "def substrings(string)\n 0.upto(string.chop.size).with_object([]) do |idx, arr|\n arr.concat(subsubstrings(string[idx..-1]))\n end\nend", "def substrings(str)\n arr = []\n\n str.each_char.with_index do\n |char, i|\n\n arr << char\n\n next_i = i + 1\n while next_i < str.length\n char += str[next_i]\n arr << char\n next_i += 1\n end \n end\n\n arr\nend", "def initial_substrings(word)\n (0...word.length).map { |index| word[0..index] }\nend", "def substrings(str)\n results = []\n list_of_chars = str.chars\n next_index = 0\n\n loop do\n break if list_of_chars[next_index] == nil\n\n list_of_chars.each_with_index do |char, index|\n next if index < next_index\n results << list_of_chars.slice(next_index..index).join\n end\n\n next_index += 1\n end\n results\nend", "def array_of_2_char_substrings\n @array_of_2_char_substrings ||= array_of_single_char_substrings.map do |a|\n array_of_single_char_substrings.map {|b| \"#{a}#{b}\" }\n end.flatten\n end", "def array_of_3_char_substrings\n @array_of_3_char_substrings ||= array_of_2_char_substrings.map do |a|\n array_of_single_char_substrings.map {|b| \"#{a}#{b}\" }\n end#.flatten\n end", "def substrings(str)\n str_arr = []\n 0.upto(str.length - 2) do |index|\n index.upto(str.length - 1) do |sub_endpoint|\n str_arr << substring(str, index, sub_endpoint ) unless index == sub_endpoint\n end\n end\n str_arr\nend", "def substrings(str)\n result = []\n start_substring_idx = 0\n end_substring_idx = start_substring_idx + 1\n\n loop do \n break if start_substring_idx == (str.size - 1)\n\n loop do \n break if end_substring_idx == str.size\n result << str[start_substring_idx..end_substring_idx]\n end_substring_idx += 1\n end\n\n start_substring_idx += 1\n end_substring_idx = start_substring_idx + 1\n end\n\n result\nend", "def substrings(string)\n result = []\n 0.upto(string.size-1) do |index1|\n index1.upto(string.size-1) do |index2|\n result << string[index1..index2]\n end \n end\n result\nend", "def uniq_subs(string)\n # initialize Set\n set = Set.new\n # Get substrings\n cur_len = 0\n while cur_len < string.length\n string.each_char.with_index do |ch, i|\n break if i + cur_len > string.length\n set.add(string[i..i+cur_len])\n end\n cur_len += 1\n end\n set.to_a\nend", "def substrings(string)\n result = []\n 0.upto(string.length - 1) do |index|\n 1.upto(string.length - index) do |length|\n result << string[index,length]\n end\n end\n result\nend", "def substrings(string)\n substring_arr = []\n count = 0\n\n until count == string.size do\n count.upto(string.size - 1) do |index|\n substring_arr << string.slice(count..index)\n end\n count += 1\n end\n\n substring_arr\nend", "def substrings(string)\n substring_arr = []\n count = 0\n\n until count == string.size do\n count.upto(string.size - 1) do |index|\n substring_arr << string.slice(count..index)\n end\n count += 1\n end\n\n substring_arr\nend", "def get_substrings(string)\n substring_arr = []\n\n 0.upto(string.size - 2) do |start_index|\n (start_index+1).upto(string.size - 1) do |final_index|\n substring_arr << string[start_index..final_index].downcase\n end\n end\n\n substring_arr\nend", "def substrings(string)\n if string.size == 1\n [string]\n else\n [string] + (substrings(string[0...-1]) + substrings(string[1..-1])).uniq\n end\nend", "def substrings(str)\r\n result = []\r\n starting_index = 0;\r\n \r\n while (starting_index <= str.length - 2)\r\n num_chars = 2\r\n while (num_chars <= str.length - starting_index)\r\n substring = str.slice(starting_index, num_chars)\r\n result << substring\r\n num_chars += 1\r\n end\r\n starting_index += 1\r\n end\r\n result\r\nend", "def substrings(str)\r\n result = []\r\n starting_index = 0;\r\n \r\n while (starting_index <= str.length - 2)\r\n num_chars = 2\r\n while (num_chars <= str.length - starting_index)\r\n substring = str.slice(starting_index, num_chars)\r\n result << substring\r\n num_chars += 1\r\n end\r\n starting_index += 1\r\n end\r\n result\r\nend", "def subsubstrings(string)\n string.size <= 1 ? [string] : [*subsubstrings(string.chop), string]\nend", "def substrings_at_start(string)\n string_array = string.chars\n array_final = []\n\n 1.upto(string.size) do |count|\n array_final << string_array.slice(0, count).join\n end\n array_final\nend", "def substrings(str)\n index = 0\n substrings = []\n \n while index < (str.length - 1) # Index Loop\n size = 2\n while size <= (str.length - index) # String length loop\n substrings << str[index, size]\n size += 1\n end\n index += 1\n end\n\n substrings\nend", "def user_inputed_sub_strings(user_input)\n 0.upto(user_input.length - 1).flat_map do |start|\n 1.upto(user_input.length - start).map do |length|\n user_input[start, length]\n end\n end\nend", "def generate_substring(str)\n result_array = []\n req_len = 2\n while req_len <= str.length do\n result_array.concat(generate_substring_with_length(str, req_len))\n req_len += 1\n end\n result_array\nend", "def substrings(string)\n substrs = []\n string.size.times do |idx|\n string.size.times do |idx2|\n substrs << string[idx..idx2]\n end\n end\n substrs.delete('')\n substrs\nend", "def substrings_at_start(str)\n counter = 1\n array = str.chars\n return_array = []\n\n loop do\n break if counter > array.size\n return_array << array.take(counter).join\n counter += 1\n end\n return_array\nend", "def find_substrings_from_start(str)\n substrings = []\n str.size.times { |i| substrings << str[0..i] }\n substrings\nend", "def substrings_at_start(string)\n substrings = []\n string.length.times do |i|\n substrings.push(string[0..i])\n end\n\n substrings\nend", "def substrings_at_start(string)\n array = []\n for i in (0..string.length - 1)\n array << string[0..i]\n end\n array\nend", "def palindrome_substrings(str)\r\n result = []\r\n substrings_arr = substrings(str)\r\n substrings_arr.each do |substring|\r\n result << substring if is_palindrome?(substring)\r\n end\r\n result\r\nend", "def array_of_single_char_substrings\n @array_of_single_char_substrings ||= (97..122).map {|int| int.chr } << \"'\"\n end", "def substrings_at_start(string)\n results = []\n\n string.length.times do |count|\n results << string.slice(0, count +1)\n end\n results\nend", "def substrings_at_start2(str)\n result = []\n (0..str.size - 1).each { |idx| result << str[0..idx] }\n result\nend", "def substrings_at_start(str)\n results = []\n substring = ''\n \n str.chars.each do |char|\n substring += char\n results << substring\n end\n \n results\nend", "def palindrome_substrings(str)\n result = []\n substrings_arr = substrings(str)\n substrings_arr.each do |substring|\n result << substring if is_palindrome?(substring)\n end\n result\nend", "def substrings_at_start(string)\n sub_arr = []\n start = 0\n while start < string.size\n string.chars.each_index do |idx|\n sub_arr << string.slice(start..idx)\n end\n start += 1\n end\n sub_arr.sort.reject(&:empty?)\nend", "def substrings_at_start(str)\n new_arr = []\n 1.upto(str.size) do |count| \n substring = ''\n substring += str.slice(0, count)\n new_arr << substring\n end\n new_arr\nend", "def substrings_at_start(str)\n result_arr = []\n 0.upto(str.size-1) do |num|\n result_arr << str[0..num]\n end\n result_arr\nend", "def substrings_at_start(string)\n result = []\n string = string.chars\n string.size.times do\n result << string.join('')\n string.pop\n end\n\n result.sort\nend", "def substrings_at_start(string)\n count = 0\n new_array = []\n while count < string.length\n new_array << string[0..count]\n count += 1\n end\n new_array\nend", "def substrings_at_start(string)\n count = 0\n new_array = []\n while count < string.length\n new_array << string[0..count]\n count += 1\n end\n new_array\nend", "def sub_strings(string)\r\n blank = []\r\n idx = 0\r\n while idx < string.length\r\n length = 1\r\n while (idx + length) <= string.length\r\n blank << string.slice(idx, length)\r\n length += 1\r\n end\r\n idx += 1\r\n end\r\n return blank\r\nend", "def leading_substrings(str)\n substr_arr = []\n \n (0...str.size).each do |index|\n substr_arr << str[0..index]\n end\n substr_arr\nend", "def palindrome_substrings(str)\n result = []\n\n all_substrings = substrings(str)\n all_substrings.select {|substring| substring.length > 1 && palindrome?(substring)}\nend", "def substrings_at_start(string)\n array_of_strings = []\n count = 0\n\n loop do\n 0.upto(count) do |idx|\n array_of_strings[idx] = string[0..idx] \n end\n count += 1\n break if count == string.length\n end\n\n array_of_strings\nend", "def substrings_at_start(string)\n array_of_strings = []\n count = 0\n\n loop do\n 0.upto(count) do |idx|\n array_of_strings[idx] = string[0..idx] \n end\n count += 1\n break if count == string.length\n end\n\n array_of_strings\nend", "def substrings_at_start(string)\n results = []\n\n string.length.times do\n results << string\n string = string.chop\n end\n\n results.sort\nend", "def substrings_at_start(string)\n result = []\n string.length.times { |idx| result << string[0..idx] }\n result\nend", "def substrings_at_start(str)\n subs = []\n str.size.times { |i| subs << str[0..i] }\n subs\nend", "def substrings_at_start(str)\n substr_arr = []\n 1.upto(str.length) do |n|\n substr_arr << str.slice(0, n)\n end\n substr_arr\nend", "def getPermutations(s)\n result = []\n for i in 0..2\n substring = s[1..2]\n result.push(s[0] + substring)\n result.push(s[0] + substring.reverse)\n s = rotateChar(s)\n end\n\n return result\nend", "def substrings_at_start(string)\n string.size.times.with_object([]) { |idx, arr| arr << string.chars.take(idx + 1).join}\nend", "def substrings_at_start(string)\n \n new_array = []\n string.size.times do |idx|\n new_array << string[0..idx]\n end\n new_array\nend", "def unclean_find_permutations str\n # ArrayList<String> \n permutations = []\n permutations << \"\"\n\n# char [] \n strArray = str.chars\n\n# for (char c :\n strArray.each do |c|\n\n # ArrayList<String>\n tempList = []\n\n # for (String s :\n permutations.each do |s|\n # {\n for i in 0..s.length\n tempList << s[0...i] + c + s[i..s.length]\n\n # tempList << s+c\n end\n\n permutations = tempList\n # }\n end\n end\n\n # permutations.uniq\n permutations\nend", "def uniq_subs(str)\n subs = Set.new\n str.length.times do |i|\n (i..str.length-1).each do |j|\n subs.add(str[i..j])\n end\n end\n subs\nend", "def substrings(string_int)\n substrings = []\n \n 0.upto(string_int.length - 1) do |index|\n 1.upto(string_int.length - index) do |length|\n substrings << string_int[index, length]\n end\n end\n substrings\nend", "def substrings_at_start(string)\n results = []\n\n string.length.times do\n results << string\n string = string.chop\n end\n\n results.reverse\nend", "def str_palindromes(str)\n arr_palindromes = arr_all_possible_substrings(str).select { |substr| palindrome?(substr)}\nend", "def find_substrings(str)\n substrings = []\n\n (0...str.size).each do |start|\n (start...str.size).each do |end_idx|\n substrings << str[start..end_idx] if str[start..end_idx].chars.all? { |l| l =~ /[aeiou]/}\n end\n end\n substrings\nend", "def substrings_at_start(str)\n\n results = []\n\n str.chars.each_with_index do |ss, idx|\n results << str.slice(0..idx)\n end\n\n results\n\nend", "def palindrome_substrings(str)\n palSub = []\n subStr = substrings(str)\n\n subStr.each do |ele|\n if palindrome?(ele) && ele.length > 1\n palSub << ele\n end\n end\n\n return palSub\n\nend" ]
[ "0.83117604", "0.78214234", "0.7605888", "0.7602336", "0.75585425", "0.7551785", "0.7514731", "0.75125253", "0.750901", "0.75076646", "0.7482837", "0.74283814", "0.74197704", "0.7387275", "0.7381062", "0.73805225", "0.73743063", "0.7340027", "0.73298144", "0.7313307", "0.73056084", "0.7301932", "0.72927034", "0.7278014", "0.72660136", "0.7261931", "0.7261931", "0.7261931", "0.7248061", "0.7238237", "0.7213531", "0.72100824", "0.720522", "0.71962416", "0.7191143", "0.7154552", "0.71529704", "0.7113167", "0.7097494", "0.70948887", "0.70922315", "0.7074558", "0.7065593", "0.705948", "0.70591444", "0.7019161", "0.6975689", "0.69387543", "0.6909827", "0.6901968", "0.68956804", "0.6874818", "0.68744636", "0.68744636", "0.6856894", "0.68546516", "0.681718", "0.681718", "0.6809017", "0.6808395", "0.6806002", "0.680082", "0.67937094", "0.6758429", "0.67518026", "0.6737131", "0.6664436", "0.6655551", "0.6631072", "0.65981054", "0.6587265", "0.65569276", "0.65549743", "0.65547365", "0.6551113", "0.6545576", "0.6537118", "0.65243626", "0.6508674", "0.6508674", "0.6508574", "0.650788", "0.65017706", "0.64993465", "0.64993465", "0.6493426", "0.64926785", "0.6490048", "0.647665", "0.6472371", "0.6457908", "0.64531493", "0.64416677", "0.64394003", "0.64228815", "0.64191854", "0.64100844", "0.6397499", "0.6395654", "0.63915294" ]
0.70238173
45
Problem 5 Return an Array of all possible substrings that are full palindromes:
def palindrome?(str) matches = [] str.size.times { |index| matches << (str[index] == str[-(index+1)]) } matches.all?(true) && matches.size > 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindrome_substrings(str)\n palSub = []\n subStr = substrings(str)\n\n subStr.each do |ele|\n if palindrome?(ele) && ele.length > 1\n palSub << ele\n end\n end\n\n return palSub\n\nend", "def str_palindromes(str)\n arr_palindromes = arr_all_possible_substrings(str).select { |substr| palindrome?(substr)}\nend", "def palindrome_substrings(str)\r\n result = []\r\n substrings_arr = substrings(str)\r\n substrings_arr.each do |substring|\r\n result << substring if is_palindrome?(substring)\r\n end\r\n result\r\nend", "def palindromes(str)\n result = []\n array = substrings(str)\n array.each do |char|\n result << char if char.reverse == char && char.size > 1\n end\n result\nend", "def palindromes(string)\n result = []\n all_substrings = substrings(string)\n all_substrings.each do |item|\n result << item if item.size > 1 && item == item.reverse\n end\n result\nend", "def palindrome_substrings(str)\n result = []\n substrings_arr = substrings(str)\n substrings_arr.each do |substring|\n result << substring if is_palindrome?(substring)\n end\n result\nend", "def palindromes(string)\n all_substrings = all_substrings(string)\n palindromes = []\n all_substrings.each do |substring|\n palindromes << substring if substring == substring.reverse && substring.length > 1\n end\n palindromes\nend", "def palindromes(str)\n results = []\n 1.upto(str.length) do |idx|\n str.chars.each_cons(idx)\n .each {|subr| results << subr.join if subr.size > 1 && subr == subr.reverse}\n end\n results.sort \nend", "def palindromes(string)\n all_substrings = substrings(string)\n results = []\n all_substrings.each do |substring|\n results << substring if palindrome?(substring)\n end\n results\nend", "def palindrome_substrings(str)\n result = []\n\n all_substrings = substrings(str)\n all_substrings.select {|substring| substring.length > 1 && palindrome?(substring)}\nend", "def palindromes(str)\n palindromic_substrings = []\n\n substrings = substrings(str)\n puts substrings\n\n substrings.each do |substr|\n palindromic_substrings << str if str == str.reverse\n end\n\n puts palindromic_substrings\n palindromic_substrings\nend", "def palindrome_substrings(string)\n\nend", "def palindrome_substrings(string)\narray = substrings(string)\npalindromes = []\n\n array.each do |ele|\n if palindrome?(ele) == true && ele.length > 1\n palindromes << ele\n end\nend\npalindromes\nend", "def palindromes(string)\n array = substrings(string)\n array.select { |sub| sub == sub.reverse }\nend", "def palindrome_substrings(str)\n substrings(str).select {|sub| sub if sub.length > 1 && palindrome?(sub)}\nend", "def palindromes(str)\n evaluated_words = substrings(str)\n evaluated_words.select { |char| char.size > 1 && char == char.reverse }\nend", "def palindromes(str)\n substrings(str).select do |el|\n el == el.reverse && el.size > 1\n end\nend", "def palindrome(str)\n sub_arr = substrings(str)\n new_arr = []\n sub_arr.each do |word|\n new_arr << word if word == word.reverse\n end\n new_arr\nend", "def palindrome_substrings(string)\n ss = substrings(string)\n results = ss.select do |ele|\n palindrome?(ele) && ele.length > 1\n end \n results \nend", "def palindromes(str)\n substrings = substrings(str)\n substrings.select do |substring|\n palindrome?(substring)\n end\nend", "def palindromes(string)\n results = substrings(string)\n results.select {|substring| substring == substring.reverse && substring.length > 1}\nend", "def palindromes(string)\n substrings(string).select { |el| el.length > 1 && el == el.reverse && el.match(/[a-zA-Z1-9]/) }\nend", "def palindromes_further_explore(str)\n new_str = str.downcase.gsub(/[^a-z0-9]/,\"\")\n substrings(new_str).select do |el|\n el == el.reverse && el.size > 1\n end\nend", "def palindromes(word)\n substrings(word).select { |word| word == word.reverse && word.length > 1 }\nend", "def palindromes(string) \n test_substrings = substrings(string)\n test_substrings.select do |substring|\n substring.length > 1 && substring.downcase.gsub(/[^A-Z0-9]/i, '') == substring.downcase.gsub(/[^A-Z0-9]/i, '').reverse\n end\nend", "def palindromes(n)\n\n\tpalindromes = Array.new()\n\n\t(1..n).each do |elt|\n\t\tif elt.to_s == elt.to_s.reverse\n\t\t\tpalindromes.push(elt)\n\t\tend\n\n\tend\n\t\n\treturn palindromes\nend", "def palindrome_permutation(str)\n\nend", "def palindrome_permutation str\n str_1 = str.downcase.chars.sort.join\n str_2 = str.downcase.chars.sort.join.reverse\n length = str.length\n for i in 0..length/2\n return false if str_1[i] != str_2[length-i-1]\n end\n return true\nend", "def find_palindromes_right(s)\n outarray = []\n for x in (0..(s.length-1))\n outarray[x] = 1\n end\n for y in (s.length-1).downto(0)\n if matches = s.indexes(s[y])\n matches.each do |x|\n test_string = s[x..y]\n #puts \"x=#{x}, y=#{y}, substring = \\\"#{test_string}\\\"\"\n if test_string.palindrome?\n #puts \"Found palindrome: \\\"#{test_string}\\\"\"\n outarray[y] = test_string.length\n # Note that I will always find a palindrome at s[y..y] so x won't pass y\n break\n end\n end\n end\n end\n outarray\nend", "def find_palindromes_left(s)\n outarray = []\n for x in (0..(s.length-1))\n outarray[x] = 1\n end\n for x in (0..(s.length-1))\n if matches = s.indexes(s[x])\n matches.reverse.each do |y|\n test_string = s[x..y]\n #puts \"x=#{x}, y=#{y}, substring = \\\"#{test_string}\\\"\"\n if test_string.palindrome?\n #puts \"Found palindrome: \\\"#{test_string}\\\"\"\n outarray[x] = test_string.length\n # Note that I will always find a palindrome at s[x..x] so y won't pass x\n break\n end\n end\n end\n end\n outarray\nend", "def palindrome(string)\n result = Array.new\n\n new_string = string.chars\n string.size.times { result << new_string.delete_at(-1) }\n result.join\nend", "def palindrome?(str)\n new_arry = []\n index = 1\n while index <= str.size\n new_arry << str[-index]\n index += 1\n end\n new_arry.join == str\nend", "def palindrome?(str)\n new_arry = []\n index = 1\n while index <= str.size\n new_arry << str[-index]\n index += 1\n end\n new_arry.join == str\nend", "def palindromes\n max, min = (@max_factor**2).to_s, min = @min_factor.to_s\n result = (min..max).select { |elm| elm == elm.reverse }\n result.map { |num| num.to_i }\n end", "def palindrome(string)\n result = []\n new_string = string.chars\n\n loop do\n result << new_string.pop\n break if new_string.size == 0\n end\n result.join\nend", "def palindrome_rearranging(s)\n c = Hash.new(0)\n s.split('').each { |z| c[z] += 1}\n m = []\n n = []\n c.each_value { |i| m.push(i)}\n m.each do |i| \n i % 2 != 0 ? n.push(i) : ''\n end \n n.length > 1 ? false : true \nend", "def palindrome(string)\n result = Array.new\n\n new_string = string.chars\n string.size.times { result << new_string.pop }\n result.join\nend", "def palindrome?(str, len)\n pos = len - 1\n sequences = []\n while pos < str.length do\n chars = str[(pos - len + 1)..pos].chars\n j = 0\n palin = true\n while j < len / 2 do\n if chars[j] != chars[len - j - 1]\n palin = false\n break\n end\n j += 1\n end\n\n sequences << [chars.first, chars[1]] if palin && chars[0] != chars[1]\n pos += 1\n end\n sequences\n end", "def palindrome?(string)\n chars_arr = string.chars\n new_arr = []\n chars_arr.each { |substring| new_arr.prepend(substring) }\n new_arr.join == string\nend", "def longest_palindrome(s)\n result = ''\n \n for i in (0..s.length-1) do\n for j in (i..s.length-1) do \n result = s[i..j] if s[i..j].length > result.length && s[i..j] == s[i..j].reverse\n end\n end\n \n result\nend", "def palindrome_permutation(string)\n # new_string = string.gsub(/\\s+/, \"\")\n # p new_string.length\n # permutation = new_string.chars\n # p \n\n\n # if new_string.length % 2 != 0\n # puts \"True. permutation\"\n # end\n\n # pal_split = string.split\n\n # pal0_split = pal_split[0].chars\n # removed_last_letter = pal0_split.pop\n # word_one = pal0_split.join\n # if word_one == pal_split[1].reverse\n # puts \"True permutations \"\n # else\n # puts \"no\"\n # end\n\n new_string = string.gsub(/\\s+/, \"\")\n reversed_word = new_string.reverse\n if new_string == reversed_word\n puts \"true.\"\n else \n puts \"false\"\n end \nend", "def collect_palindromes(data)\n range = data.map{ |str| str.to_i}\n values = range[0]..range[1]\n strings = values.map{ |i| i.to_s}\n strings.select{ |str| add_palindrome(str)}\n @palindromes.count\n end", "def longest_palindrome(str)\n return 0 if str.empty?\n\n arr = str.chars\n substrings = []\n length = 1\n loop do\n arr.each_cons(length) { |set| substrings << set }\n length += 1\n break if length > arr.length\n end\n substrings.select { |set| set == set.reverse }.max_by(&:length).length\n p substrings\nend", "def shortest_palindrome(str)\n # find longest palindromic prefix\n n = str.size\n rev = str.reverse\n\n (0...n).each do |i|\n return rev[0...i] + str if str[0...(n - i)] == rev[i...n]\n end\n\n ''\nend", "def join_words_to_make_a_palindrome(words)\n (0...words.length).each do |i|\n \t\t(0...words.length).each do |j|\n\n if is_palindrome(words[i] + words[j])\n return [words[i], words[j]]\n end\n end\n end\n return nil\n\nend", "def check_palindrome(s)\n for i in 0...(s.length/2).floor\n if s[i] != s[s.length-i-1]\n return false\n end\n end\n return true\nend", "def palindrome?(word)\n counter = 0\n total = []\n word.size.times do\n result = word[counter] == word[-(counter + 1)]\n total << result if result == true\n end\n total.size == word.size ? true : false\nend", "def palindrome\n txt = 'ssiiss'\n length = txt.length\n i = 0\n j = length - 1\n flag = true\n while flag && i<=j do\n flag = txt[i] == txt[j] ? true : false\n i = i + 1\n j = j - 1\n end\n puts \"palindrome is #{flag}\"\nend", "def palindrome_string_arr(char)\n char[0..-1] == char[0..-1].reverse\nend", "def almost_palindrome_checker(string)\n p1 = 0\n p2 = string.length - 1\n array = string.split('')\n\n while p1 < p2\n return palindrome_checker(array, p1, p2 - 1) || palindrome_checker(array, p1 + 1, p2) if array[p1] != array[p2]\n\n p1 += 1\n p2 -= 1\n end\n\n true\nend", "def is_palindrome(string)\n\n concate_array = string.downcase.split(\"\")\n backwards = \"\"\n concate_array_no_punc = \"\"\n\n concate_array.length.times do |i|\n if [\":\",\",\",\" \"].include?(concate_array[-1-i])\n nil \n else \n backwards += concate_array[-1-i]\n end\n\n if [\":\",\",\",\" \"].include?(concate_array[i])\n nil \n else \n concate_array_no_punc += concate_array[i]\n end\n end\n\n if backwards == concate_array_no_punc\n return true\n else \n return false\n end\nend", "def count_substrings(s)\n size = s.size\n count = 0\n\n # the matrix represents substrings from one idx to another\n # we use the length of the string to determine the size\n # we start with all false values and update it to true when the substring is a palindrome\n\n dp = Array.new(size) { Array.new(size, false) }\n\n # substrings of one char are all palindromes\n\n (0...size).each do |idx|\n dp[idx][idx] = true\n count += 1\n end\n\n # check substrings of two chars\n # only if the 2 chars as the same will it be a palindrome\n\n (1...(size - 1)).each do |idx|\n if s[idx] == s[idx + 1]\n dp[idx][idx + 1] = true\n count += 1\n end\n end\n\n p dp\n\n # check longer substrings\n\n # this first loop represents the length of the substring, from 3 up to the total size of the original string\n\n (3..size).each do |length|\n # then we iterate according to index\n (0...(size - length)).each do |idx1|\n idx2 = (idx1 + length) - 1\n if dp[idx1 + 1][idx2 - 1] && (s[idx1] == s[idx2])\n dp[idx1][idx2] = true\n count += 1\n binding.pry\n end\n end\n end\n\n count\nend", "def check_palindrome(s)\n\n if s == nil\n return false\n end\n\n result = \"\"\n\n (s.length-1).downto(0).each do |l|\n result << s[l]\n end\n p result\n\n return result == s\n\nend", "def pals\n sum = 0\n\n 1.upto(1000000) do |num|\n n_array = num.to_s.split(\"\")\n \n next unless n_array == n_array.reverse\n\n b_array = num.to_s(2).split(\"\")\n\n next unless b_array == b_array.reverse\n\n puts \"#{num} is double base palindrome\"\n\n sum += num\n end\n sum\nend", "def longest_palindrome(string)\n\n palindromes = []\n\n (0...string.length).each do |i|\n (i+1...string.length).each do |j|\n sub = string[i..j]\n palindromes << sub if sub == sub.reverse\n end\n end\n\n palindromes.sort_by(&:length).last \n\nend", "def palindrome?(pal_str)\n char_list = pal_str.split\n reverse_list = Array.new\n char_list.length.times do\n reverse_list.push(char_list.pop) unless char_list == []\n end\n reversed_string = reverse_list.join('')\n true if pal_str == reversed_string\nend", "def is_palindrome(string)\n split_string_array = string.downcase.split(\"\")\n words_array = split_string_array.select{|letter| letter[/[a-z]/]}\n\n reverse_words_array = []\n x = 0\n length = words_array.length\n until words_array[x] == nil\n reverse_words_array << words_array[length -(x+1)]\n x += 1\n end\n\n return reverse_words_array == words_array ? true : false\n\nend", "def palindrome?(string)\n arr1 = string.chars\n arr2 = []\n arr1.each { |char| arr2.unshift(char) }\n arr2 == arr1\nend", "def longest_palindrome_subseq(s)\n length = s.size\n dp = []\n\n length.times do |i|\n dp[i]= Array.new(length).fill(0);\n dp[i][i] = 1\n end\n puts \"dp #{dp}\"\n (2..length).each do |len|\n puts \"len #{len}\"\n (0..(length - len)).each do |i|\n j = i + len - 1\n # puts \"j #{j} => i:#{i} + len:#{len} - 1\"\n\n if s[i] == s[j]\n dp[i][j] = 2 + (len == 2 ? 0 : dp[i+1][j-1])\n else\n dp[i][j] = [dp[i+1][j], dp[i][j-1]].max\n end\n puts \"dp #{dp}\"\n end\n end\n\n dp[0][length - 1]\nend", "def palindrome_permutation?(str)\n unpaired_characters = Set.new\n\n str.chars.each do |ch|\n if unpaired_characters.include?(ch)\n unpaired_characters.delete(ch)\n else\n unpaired_characters.add(ch)\n end\n end\n\n unpaired_characters.length <= 1\nend", "def longest_palindrome(s)\n return s if s.length == 1\n previous = s[0]\n\n all_same = true\n z = 0\n counter = 0\n while z < s.length\n if s[z] == previous\n counter += 1\n else\n tmp_longest = previous * counter\n longest = tmp_longest if tmp_longest.length > longest.length\n previous = s[z]\n counter = 1\n break if counter > s.length / 2\n end\n z += 1\n end\n return previous * counter if all_same || counter > s.length / 2\n\n longest = ''\n i = 0\n while i < s.length\n starting_letter = s[i]\n matching_hash = {}\n matching_hash[i] = starting_letter\n\n j = i + 1\n while j < s.length\n if s[j] == starting_letter\n matching_hash[j] = s[j]\n end\n j += 1\n end\n\n i += 1\n\n indices = matching_hash.keys\n next if indices.length == 1\n next if (indices[-1] - indices[0]) < longest.length\n\n first_index = matching_hash.first[0]\n\n k = 0\n valid_sequence = true\n while k < (indices.length / 2 - 1)\n first_dist = indices[k + 1] - indices[k]\n second_dist = indices[indices.length - 1 - k] - indices[indices.length - 2 - k]\n if first_dist != second_dist\n valid_sequence = false\n break\n end\n k += 1\n end\n\n next if !valid_sequence\n\n matching_hash.delete_if {|key,v| (key != first_index) && (key - first_index < longest.length)}\n indices = matching_hash.keys\n\n n = 1\n last_index = indices[-1]\n running_str = ''\n while first_index + n < ((last_index - first_index) / 2)\n matching_hash.each do |key, v|\n if key == first_index\n running_str = matching_hash[key] << s[key + n]\n else\n checking_str = matching_hash[key] << s[key - n]\n matching_hash.delete(key) if checking_str != running_str\n end\n end\n n +=1\n end\n\n matching_hash.values.each do |value|\n longest = value if value.length > longest.length\n end\n end\n puts \"longest: #{longest}\"\n return longest\nend", "def palindrome(string)\n word_array = string.split(\"\")\n\n word_array.each_with_index do |letter,index|\n if letter[index] == letter[-index]\n return true\n end\n end\n end", "def palindrome_permutation(str)\n # use set to keep track of lone characters\n lone_chars = Set.new()\n # add character to set if doesn't already exist, otherwise delete\n str.length.times do |c|\n lone_chars.include?(str[c]) ? lone_chars.delete(str[c]) : lone_chars.add(str[c])\n end\n # return true if set only contains one or no lone characters\n return lone_chars.length <= 1\nend", "def palindrome (word)\n word.length.times do |n|\n if (word[n] != word[word.length - n - 1]) \n return false\n end\n end\n return true\nend", "def palindrome_check(my_phrase)\r\n return my_phrase if my_phrase.length < 2\r\n\r\n i = 0\r\n\r\n while i < my_phrase.length/2\r\n return false if my_phrase[i] != my_phrase[my_phrase.length - i - 1]\r\n i += 1\r\n end\r\n\r\n return true\r\nend", "def shortest_palindrome_3(s)\n idx = 0\n front = 0\n back = 0\n pow = 1\n (0...s.size).each { |i|\n dijit = s[i].ord - 'a'.ord\n front = front * 27 + dijit\n back = back + dijit * pow\n pow *= 27\n idx = [idx, i].max if front == back\n }\n\n (s[idx + 1..-1] || \"\").reverse + s\nend", "def findWholePalindrome(str, center)\n if str[center] == str[center-1]\n i = center\n j = center-1\n else\n i = center+1\n j = center-1\n end\n until j < 0 || i > str.length || str[j] != str[i]\n j-=1\n i+=1\n end\n return str[j+1..i-1]\nend", "def palindromes(words)\n words_array = words.split\n result = []\n words_array.each do |word|\n result << word.downcase if word.reverse == word\n end\n result.sort!{|a,b| a.downcase <=> b.downcase}\n result.each do |item|\n p item\n end\n end", "def partition(s)\n palindrome = Array.new(s.size) {\n Array.new(s.size)\n }\n \n cuts = [[]]\n \n (0...s.size).each { |i|\n (0..i).each { |j|\n palindrome[j][i] = if i == j\n true\n elsif i == j + 1\n s[i] == s[j]\n else\n s[i] == s[j] && palindrome[j + 1][i - 1]\n end\n\n next if !palindrome[j][i] || cuts[j - 1].nil? && j > 1\n cuts[i] ||= []\n cuts[i] << cuts[j - 1].map { |x| x + [s[j..i]] }.flatten(1)\n }\n }\n \n puts \"#{cuts}\"\n cuts[s.size - 1]\nend", "def longest_palindrome(string)\n if string.length <= 1\n return string\n end\n\n i = 0\n string.length.downto(1).each do |length|\n # .. is inclusive\n (0..i).each do |start_index|\n if palindrome?(string.slice(start_index, length))\n return string.slice(start_index, length)\n end\n end\n\n i += 1\n end\n\n string[0]\nend", "def valid_palindrome(s)\n i,j = 0, s.length - 1\n \n while i < j\n if s[i] == s[j]\n i += 1\n j -= 1\n else\n return is_palindrome(s[0...i] + s[i+1..-1]) || is_palindrome(s[0...j] + s[j+1..-1])\n end\n end\n return true\nend", "def real_palindrome?(string)\n arr = []\n string.chars.each do |char| arr << char if ('a'..'z').include?(char) || ('A'..'Z').include?(char)\n end\n clean_str = arr.join\n clean_str.downcase == clean_str.downcase.reverse\nend", "def palindrome(s)\n result = true\n len = s.length\n s.delete! s[(len - 1) / 2] if len % 2 != 0\n len = s.length\n (0..(len / 2) - 1).each do |i|\n s[i] == s[len - 1 - i] ? next : result = false\n end\n result\nend", "def palindrome_check(my_phrase)\r\n string_fixed = my_phrase.split.join\r\n first_position = 0\r\n last_position = string_fixed.length - 1\r\n\r\n while first_position != last_position\r\n\r\n case\r\n when string_fixed[first_position] != string_fixed[last_position]\r\n return false\r\n exit\r\n when string_fixed[first_position] == string_fixed[last_position]\r\n first_position += 1\r\n last_position -= 1\r\n end\r\n return true\r\n end\r\nend", "def palindrome?(str)\n (str.length - 1).downto(0).map { |i| str[i] }.zip(str.chars).all? { |a, b| a == b }\nend", "def longest_palindrome(string)\n for substring_length in string.length...3\n for check in 0..(string.length - sub_string)\n possible_palindrome = string[check...check+substring_length]\n if palindrome(possible_palindrome)\n return possible_palindrome\n end\n end\n end\n return false \nend", "def palindrome?(str)\n n = str.size / 2\n (0..n).all? do |i|\n str[i] == str[str.size-1-i]\n end\nend", "def solve(words)\n x = 0\n while x < words.max.length\n equal = words.all? do |word|\n word[0..x] == words[0][0..x]\n end\n if equal == false\n return words[0][0...x]\n end\n x += 1\n end\nend", "def palindrome_permutation(str)\n hash = {}\n array = str.split(\"\")\n array.each do |el|\n if hash[el]\n hash[el] = hash[el] + 1\n elsif el == \" \"\n else\n hash[el] = 1\n end\n end\n\n odd_counter = 0\n even_counter = 0\n values = hash.values\n values.each do |el|\n if (el % 2 == 0)\n even_counter += 1\n else\n odd_counter += 1\n end\n end\n\n if (odd_counter > 2)\n return false\n end\n true\nend", "def p4\n\tarray = (800..999).to_a\n\tarray = array.map{|x| array.map{|y| x * y}}.flatten.uniq\n\tarray = array.select{|x| palindrome?(x)}\n\tarray.max\nend", "def check_palindrome_recursive(string)\n return true if string.length < 2\n return false if string[0] != string[-1]\n slice_first_last_character(string)\n check_palindrome_recursive(string)\n end", "def palindrome(str)\nend", "def shortest_palindrome(string)\n return string if palindrome?(string)\n\n for i in 0...string.length\n rev = string.length - i\n suffix = string[(rev - 1)...string.length]\n rev_suffix = suffix.reverse\n\n new_string = rev_suffix + string\n return new_string if palindrome?(new_string)\n end\nend", "def palindrome?(string)\n newRevString = \"\"\n idx = string.length-1\n while idx >= 0\n newRevString = newRevString + string[idx]\n idx = idx - 1\n end\n return newRevString==string\nend", "def palindrome?(*input)\n input.join.reverse == input.join\nend", "def shortest_palindrome_2(s)\n idx = 0\n front = \"\"\n back = \"\"\n (0...s.size).each { |i|\n front = front + s[i]\n back = s[i] + back\n idx = [idx, i].max if front == back\n }\n\n (s[idx + 1..-1] || \"\").reverse + s\nend", "def palindrome_permutation?(string)\n hash = {}\n count = 0\n\n if string.empty?\n return true\n end\n\n string.each_char do |i|\n if hash[i] == nil\n hash[i] = 1\n else\n hash[i] += 1\n end\n end\n\n string_array = hash.values\n string_array.each do |num|\n if num.odd? == true\n count += 1\n if count > 1\n return false\n end\n end\n end\n return true\n\n\nend", "def palidrome?(word)\n j = word.length - 1\n half_length = word.length / 2\n\n half_length.times do |i|\n if word[i] != word[j]\n return false\n end\n j -= 1\n end\n\n return true\nend", "def longest_palindrome(string)\n string.length.downto(3) do |length|\n string.chars.each_cons(length) do |substr_arr|\n return substr_arr.length if palindrome?(substr_arr.join)\n end\n end\n false\nend", "def palindrome?(word)\n array_of_letters = word.downcase.split(\"\")\n count_front = 0\n count_back = word.length - 1\n # Match the first letter with the last, if they are the same then step through the word\n while count_front < count_back\n if array_of_letters[count_front] == array_of_letters[count_back]\n count_front += 1\n count_back -= 1\n else\n return false\n end\n end\n return true\nend", "def palindrome_permutation?(string)\n char_array = string.split('')\n hash = {}\n \n char_array.each do |char|\n if hash[char]\n hash[char] += 1\n else\n hash[char] = 1\n end\n end\n\n values = hash.values\n amount_of_single_letters = 0\n\n values.each do |num|\n if num % 2 == 1\n amount_of_single_letters += 1\n end\n end\n\n if amount_of_single_letters <= 1\n return true\n else \n return false\n end\n \nend", "def longest_palindrome(str)\r\n pal = \"\"\r\n (0..str.size).each do |x|\r\n i = 1\r\n while (i < (str.size-x)) do\r\n\t if str[x,i].reverse == str[x,i]\r\n\t pal = str[x,i] if pal.size < str[x,i].size\r\n\t end\r\n\t i+= 1\r\n\tend\r\n end\r\n pal\r\nend", "def longest_palindrome(string)\n longest = \"\"\n len = 2\n \n while len < string.length\n i = 0\n while i+len <= string.length\n if is_palindrome?(string[i...i+len])\n longest = [i, i+len-1]\n end\n i += 1\n end\n len += 1\n end\n\n longest\nend", "def is_palindrome(string)\n array = string.gsub((/(?i)[^a-z]/),\"\").downcase.chars\n array_length = array.length - 1\n \n array.each_with_index do |letter,index|\n return false if letter != array[array_length - index]\n end\n\n return true\nend", "def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend", "def longest_palindrome(string)\n longest_palindrome = false\n i = 0\n\n while i < string.length - 1\n j = i + 1\n\n while j < string.length\n curr_string = string[i..j]\n len = curr_string.length\n\n if is_palindrome?(curr_string)\n longest_palindrome = len if !longest_palindrome || len > longest_palindrome\n end\n\n j += 1\n end\n\n i += 1\n end\n\n longest_palindrome\nend", "def longest_palindrome(string)\n longest_palindrome = false\n i = 0\n\n while i < string.length - 1\n j = i + 1\n\n while j < string.length\n curr_string = string[i..j]\n len = curr_string.length\n\n if is_palindrome?(curr_string)\n longest_palindrome = len if !longest_palindrome || len > longest_palindrome\n end\n\n j += 1\n end\n\n i += 1\n end\n\n longest_palindrome\nend", "def PalindromeSeq (str, index=0)\n str == str.reverse || str.length < 2 ? str.length : PalindromeSeq(str[(index+1)...str.length]) > PalindromeSeq(str[(index)...(str.length-1)]) ? PalindromeSeq(str[(index+1)...str.length]) : PalindromeSeq(str[(index)...(str.length-1)])\nend", "def longest_palindrome(string)\n longest = ''\n i = 0\n while i < string.length\n j = 1\n while (i + j) <= string.length\n x = string.slice(i, j)\n if (x == x.reverse) && (x.length > longest.length)\n longest = x\n end\n j += 1\n end\n i += 1\n end\n if longest.length == 1\n return false\n end\n longest.length\n\nend", "def longest_palindrome(string)\n best_palindrome_start = 0\n best_palindrome_len = 0\n\n 0.upto(string.length - 1).each do |start|\n # micro-optimization: don't look at substrings shorter than best\n # palindrome.\n len = best_palindrome_len + 1\n while start + len <= string.length\n if is_palindrome?(string, start, len)\n best_palindrome_start, best_palindrome_len = start, len\n end\n\n len += 1\n end\n end\n\n [best_palindrome_start, best_palindrome_start + best_palindrome_len - 1]\nend" ]
[ "0.804255", "0.80084914", "0.79666907", "0.79459494", "0.7927535", "0.79171115", "0.7913102", "0.79103935", "0.79059225", "0.78673655", "0.78275263", "0.7824925", "0.77850646", "0.7712527", "0.76719534", "0.76359624", "0.7621455", "0.75811666", "0.75699514", "0.74155515", "0.74081004", "0.73709124", "0.73530513", "0.73195595", "0.7313246", "0.7264171", "0.72095233", "0.72071993", "0.71939313", "0.71837586", "0.71325076", "0.7078283", "0.7078283", "0.7073376", "0.7009872", "0.7003785", "0.698911", "0.698536", "0.6956847", "0.6934522", "0.69010276", "0.6849148", "0.67947096", "0.67508715", "0.6747484", "0.6710158", "0.670492", "0.6674859", "0.6672888", "0.6672326", "0.6668034", "0.6650864", "0.66455585", "0.6614136", "0.6593564", "0.6580891", "0.6576197", "0.65755075", "0.65601164", "0.65461546", "0.654572", "0.6539461", "0.65362847", "0.65337527", "0.6526252", "0.6524111", "0.6495499", "0.6495374", "0.64939827", "0.6476763", "0.6471874", "0.6467409", "0.64620095", "0.6440897", "0.6433474", "0.6428884", "0.64080137", "0.6404263", "0.63893425", "0.6387477", "0.6383794", "0.6377809", "0.63623226", "0.635251", "0.6344559", "0.6333005", "0.63309044", "0.6328113", "0.63165313", "0.6308668", "0.630697", "0.630654", "0.6302376", "0.6297659", "0.62973154", "0.62958336", "0.62958336", "0.6292335", "0.6289933", "0.62803465" ]
0.6682646
47
Problem 7 Double every character in a string:
def repeater(string) result = '' string.each_char { |char| result << char * 2 } result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def double_characters(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char * 2\n end\n doubled_string\nend", "def crunch(double_string)\n current_character = ''\n new_string = ''\n double_string.each_char do |character|\n if character != current_character\n new_string += character\n current_character = character\n end\n end\n new_string\nend", "def double_char(str)\n str.chars.map{|e|e *2}.join\nend", "def double(string)\n result = []\n string.chars.each do |char|\n result << char * 2\n end\n result.join\nend", "def double_char(str)\n characters = []\n str.split(\"\").each do |x|\n characters << x*2\n end\n p characters.join\nend", "def double_char(str)\n str.chars.map { |letter| letter * 2 }.join\nend", "def double_char(str)\n str = \"String\"\n arr = str.split('')\n arr.map do |letter|\n letter * 2\n end.join\n \nend", "def double_consonants(str)\n str.chars.each_with_object('') do |c, double_str|\n if c =~ /[^(aeiouAEIOU)|\\W|\\d]/\n double_str << c * 2\n else\n double_str << c\n end\n end\nend", "def repeater(string)\n doubled = \"\"\n single_chars = string.chars\n single_chars.each do |char|\n doubled_char = char * 2\n doubled << doubled_char\n end\n doubled\nend", "def repeater(string)\n doubled_arr = []\n string.each_char{ |char| doubled_arr << char *= 2} \n p doubled_arr.join\nend", "def double_char(str)\n\tarr = str.split('')\n\tnew_arr = []\n\tarr.each do |i| \n\t\t2.times {new_arr.push(i)}\n\tend\n\tstr = new_arr.join()\n\treturn str;\nend", "def double_consonants(string)\n result = []\n string.each_char do |char|\n result << char_value(char)\n end\n p result.join\nend", "def repeater(string)\n doubled_string = []\n\n string.chars.each do |char|\n doubled_string << char * 2\n end\n\n doubled_string.join\nend", "def double_consonants(string)\n chars_array = string.chars.map do |x|\n if x =~ /[^AEIOUaeiou0-9\\W]/\n x*2\n else\n x\n end\n end\n \n chars_array.join\nend", "def double_consonants(string)\n final = string.chars.map do |el|\n if %w[a e i o u].include?(el)\n el\n elsif ('a'..'z').include?(el.downcase)\n el * 2\n else\n el\n end\n end\n final.join\nend", "def repeater(string)\r\n result = \"\"\r\n string.chars.each do |letter|\r\n result << letter * 2\r\n end\r\n result\r\nend", "def double_consonants(str)\n\n new_string = []\n\n str.chars.each do |char|\n if ('aeiouAEIOU').include?(char) == false\n new_string << char*2 \n else \n new_string << char\n end\n end\n\n new_string.join\nend", "def double_consonants(str)\n str.chars.each_with_object('') do |char, new_str|\n if char =~ /[^aeiou]/ && char =~ /[A-z]/\n new_str << char * 2\n else\n new_str << char\n end\n end\nend", "def repeater(string)\n double = \"\"\n for i in 0...string.length\n double << string[i] * 2\n end\n double\nend", "def double_consonants(str)\n results = \"\"\n str.each_char do |char| \n if char.downcase =~ /[a-z&&[^aeiou]]/\n results << char * 2 \n else\n results << char\n end\n end\n results\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |letter|\n (letter =~ /[b-df-hj-np-tv-z]/i) == 0 ? result_string << letter << letter : result_string << letter\n end\n result_string\nend", "def double_consonants(string)\n result = string.split(//).map do |char|\n char =~ /[b-df-hj-np-tv-z]/i ? char * 2 : char\n end\n result.join\nend", "def repeater(word)\n word.chars.map { |char| char * 2 }.join\nend", "def repeater(string)\n array = string.split('')\n array.map! do |char|\n char * 2\n end\n array.join\nend", "def double_consonants(string)\n output = \"\"\n single_chars = string.chars\n single_chars.each do |char|\n if char.match(/[[a-z]&&[^aeiou]]/i)\n output << char * 2\n else\n output << char \n end\n end\n output\nend", "def double_consonants(str)\n result = \"\"\n str.chars.each do |ch|\n result << if ch.downcase.match?(/[a-z&&[^aeiou]]/)\n ch * 2\n else\n ch\n end\n end\n result\nend", "def double_consonants(string)\n string.chars.map { |chr| chr.match(/[bcdfghj-np-tvwxyz]/i) ? chr * 2 : chr }.join\nend", "def repeater(string)\r\n new_string = \"\"\r\n string.each_char { |char| new_string << char*2 }\r\n new_string\r\nend", "def repeater(text)\n double_string = ''\n text.each_char { |char| double_string << char * 2 }\n double_string\nend", "def double_consonants(str)\n repeater_chars = str.chars.map do |char| \n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n char * 2\n else\n char\n end\n end\n repeater_chars.join\nend", "def repeater(string)\n string = string.split(\" \")\n\n string.map do |word|\n word = word.split('')\n word.map {|letter| letter * 2}.join('')\n end.join(' ')\nend", "def repeater(str)\n temp_arr = []\n str.chars do |letter|\n temp_arr << letter * 2\n end\n \n temp_arr.join('')\nend", "def repeater(str)\n\n str.chars.map {|char| char*2}.join\n\nend", "def repeater(string)\n string.chars.map! { |char| char * 2 }.join('')\nend", "def rule2(str = @word)\n newstr = str.chars\n newstr.each_index do |index|\n if (newstr[index..index+5].uniq.length==1)\n newstr[index..index+5] = newstr[index]\n end\n end\n newstr.join('').to_s.squeeze(\" \")\n end", "def repeater(str)\n new_str = ''\n str.chars.each do |char|\n new_str << char * 2\n end\n \n p new_str\nend", "def crunch(string)\n string.gsub(/(.)\\1+/, '\\1')\nend", "def solution(str)\n str << \"_\" if str.length % 2 != 0\n str.chars.each_slice(2).map(&:join)\nend", "def crunch(text)\n text.gsub(/(.)\\1+/, &:chr)\nend", "def repeater(string)\n doubled = ''\n characters = string.chars\n size = characters.size\n counter = 0\n\n while counter < size\n doubled = doubled + string[counter] + string[counter]\n\n counter += 1\n end\n\n doubled\nend", "def repeater(string)\n string.chars.map { |el| el * 2 }.join\nend", "def repeater(string)\n new_str = ''\n\n string.chars.each { |x| new_str << x * 2 }\n new_str\nend", "def double_consonants(string)\n doubled_chars = string.chars.map do |char|\n if char =~ /[A-Za-z]/ && !VOWELS.include?(char)\n char + char\n else\n char\n end\n end\n doubled_chars.join\nend", "def repeater(string)\n string.chars.map{ |char| char * 2 }.join\nend", "def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend", "def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend", "def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend", "def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend", "def repeater(str)\n str.chars.map { |char| char * 2 }.join\nend", "def double_consonants(string)\n string.gsub(/([b-df-hj-np-tv-z])/i, '\\1\\1')\nend", "def repeater(str)\n str.chars.map { |chr| chr * 2}.join\nend", "def double_consonants(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char\n doubled_string << char if consonant?(char.downcase)\n end\n\n doubled_string\nend", "def double_consonants(string)\n results = []\n\n string.chars.each do |char|\n if char =~ /[\"AEIOUaeiou\"]/ || \n char =~ /\\W/ ||\n char =~ /\\d/\n results << char\n else\n results << char << char\n end\n end\n\n results.join\nend", "def double_consonants(string)\n string.chars.inject('') do |str, char|\n char.downcase.count(\"a-z\", \"^aeiou\") > 0 ? str + char * 2 : str + char\n end\nend", "def rampant_repeats(string, hash)\n new_str = ''\n\n string.each_char do |char|\n if hash.has_key?(char)\n new_str += (char*hash[char])\n else\n new_str += char\n end\n end\n new_str\nend", "def repeater(string)\n string.split('').map { |char| char * 2 }.join\nend", "def rule3(str = @word)\n newstr = str.chars\n\n reverse = false\n output = ''\n\n newstr.each do |char|\n if char == '!'\n reverse = !reverse\n else\n output << char\n end\n end\n\n output.reverse! unless !reverse\n output.to_s.squeeze(\" \")\n end", "def mysterious_math(problem)\n problem.gsub(/[+\\-*\\/]/, '?')\nend", "def double_consonants(str)\n new_str = ''\n str.each_char do |char|\n if char =~ /[-!aeiou0-9' ']/i\n new_str << char\n else\n new_str << char.concat(char)\n end\n end\n new_str\nend", "def repeater(string)\n result = \"\"\n string.each_char { |char| result << char * 2}\n result\nend", "def repeater(string)\n doubled_str = ''\n string.size.times do |i|\n doubled_str << string[i] * 2\n end\n doubled_str\nend", "def redact_five_letter_words(string)\n\t\n\tsplitted_string = string.split(' ')\n\tword_in_question = \" \"\n\t\t\n\t\tsplitted_string.each do |word|\n\t\t\t\n\t\tif word.length == 5\n\t\t\t word_in_question = word\n\t\t string.sub!(word, \"#####\")\n\t end\n\t \n\t end\n\t string\n\tend", "def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend", "def repeater(string)\n doubled_str = \"\"\n string.each_char do |char|\n doubled_str << char << char\n # doubled_str.concat(char*2)\n # doubled_str.concat(char, char)\n end\n \n doubled_str\nend", "def crunch(string)\n string.gsub(/([a-z0-9])\\1+/, \"\\\\1\")\nend", "def repeater(str)\n new_str = ''\n return new_str if str.eql?('')\n str.chars.each do|char|\n new_str << char * 2\n end\n new_str\nend", "def repeater(string)\n doubled = ''\n count = 0\n\n until count == string.length\n doubled << string[count] * 2\n count += 1\n end\n doubled\nend", "def double_consonants(string)\n doubled_string = ''\n string.each_char do |char|\n char.match(/[a-z&&[^aeiou]]/i) ? doubled_string << char << char : doubled_string << char\n end\n doubled_string\nend", "def double_consonants(string)\n consonants = %(bcdfghjklmnpqrstvwxyz)\n string.chars.map{ |char| consonants.include?(char.downcase)? char * 2 : char}.join\nend", "def repeater(str)\n result = ''\n str.each_char { |char| result << char * 2 } # or result << char << char\n result\nend", "def solve(s)\n new_str = ''\n s.each_char do |char|\n if new_str[-1] != char\n new_str += char\n end\n end\n return new_str\nend", "def double_consonants(string)\n double_con_string = []\n string.chars.each do |char|\n if char.match?(/[aeiouAEIOU]/)\n double_con_string << char\n elsif char.match?(/[a-zA-Z]/)\n double_con_string << char << char\n else\n double_con_string << char\n end\n end\n double_con_string.join\nend", "def repeater(string)\n string.split(//).map {|char| char * 2 }.join\nend", "def conceal(string)\n if string.length < 8\n '****'\n else\n front = string[0, 4]\n back = string[-4, 4]\n \"#{front}****#{back}\"\n end\n end", "def gordon(a)\n\ta.upcase!\n\ta.gsub!(/[A]/, '@').gsub!(/[UIOE]/, '*')\n\tarr = a.split.each do |word|\n\t\tword << \"!!!!\"\n\tend\n\tarr.join \" \"\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |char|\n if char =~ /[a-z&&[^aeiou]]/i\n result_string << char << char\n else\n result_string << char\n end\n end\n result_string\nend", "def double_consonants(str)\n str.gsub(/([bcdfghjklmnpqrstvwxyz])/i, '\\1\\1')\nend", "def double_consonants(string)\n new_string = ''\n string.each_char do |char|\n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n new_string << char << char\n else\n new_string << char\n end\n end\n new_string\nend", "def double_char(str)\n # x = 0\n # word = \"\"\n # until x == str.length do\n # 2.times { word << str[x] }\n # x += 1\n # end\n # puts word\n #\n # or\n #\n word = \"\"\n for i in (0..str.length-1)\n 2.times { word << str[i]}\n end\n puts word\nend", "def plusserize(str)\n str.gsub(' ', '+')\n end", "def crunch(text)\n crunch_text = ''\n text.each_char do |x|\n crunch_text << x if /(.)\\1+/.match(x)\n end\n puts crunch_text\nend", "def repeater(str)\n repeated_str = ''\n\n str.each_char do |char|\n repeated_str << char * 2\n end\n\n repeated_str\nend", "def rampant_repeats(str, hash)\n new_str = \"\"\n\n str.each_char do |char|\n if hash.has_key?(char)\n new_str += char * hash[char]\n else\n new_str += char\n end\n end\n new_str\nend", "def rampant_repeats(str, hash)\n n_str = ''\n str.each_char do |char|\n if hash.has_key?(char) \n n_str += char * hash[char]\n else\n n_str += char\n end\n end\n n_str\nend", "def crunch(str)\n str.split.map do |word|\n word.chars.each_with_object('') do |char, clean_word|\n clean_word << char if char != clean_word[-1]\n end\n end.join(' ')\nend", "def hackerSpeak(word)\n\tnew_word=''\n\tword.each_char do |c|\n\t\tif c.downcase=='a'\n\t\t\tnew_word=new_word+'4'\n\t\telsif c.downcase=='e'\n\t\t\tnew_word=new_word+'3'\n\t\telsif c.downcase=='i'\n\t\t\tnew_word=new_word+'1'\n\t\telsif c.downcase=='o'\n\t\t\tnew_word=new_word+'0'\n\t\telsif c.downcase=='s'\n\t\t\tnew_word=new_word+'5'\n\t\telse\n\t\t\tnew_word=new_word+ c\t\t\t\t\t\t\n\t\tend\t\n\tend\n\tnew_word\nend", "def repeater(str)\n str.chars.each_with_object('') {|char, str| str << char * 2}\nend", "def string_replace_chars_with_asterisks(s)\n\n\ts_array = s.chars\n\ts_asterisks = []\n\n\t# TODO: check if array is > 1\n\n\t# get first value and store\n\tfirst_char = s_array[0]\n\ts_asterisks << first_char\n\t# start from 2nd value and check if == first_char and replace with '*'\n\ts_array[1..-1].each do |i|\n\t\tif i == first_char\n\t\t\ti = \"*\"\n\t\tend\n\t\ts_asterisks << i\n\tend\n\n\treturn s_asterisks.join\n\nend", "def crunch(string)\n clean_string = ''\n string.each_char do |letter|\n clean_string << letter unless letter == clean_string[-1]\n end\n clean_string\nend", "def double_metaphone(str); end", "def crunch(string)\n new_string = ''\n string.each_char { |char| new_string += char if new_string[-1] != char}\n new_string\nend", "def double_letters(word)\n str = word.squeeze\n str.size != word.size\nend", "def double_consonants(string)\n result = ''\n string.chars.each do |char|\n result += char\n result += char if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n end\n result\nend", "def redact_five_letter_words(str)\n # convert string into an array\n # iterate through each element and get length of element\n # if lengeth is 5 then replace with #####\n\n str = str.split(\" \")\n\n i = 0\n while i < str.length\n if str[i].length == 5\n str[i] = \"#####\"\n end\n i += 1\n end\n\n str.join(\" \")\n\nend", "def rampant_repeats(str, hash)\n # loop through str chars, if char is a hash key, multiply by that keys value, and add\n # if not a key, add as-is\n new_str = \"\"\n\n str.each_char do |letter|\n if hash.has_key?(letter)\n new_str += letter * hash[letter]\n else\n new_str += letter\n end\n end\n new_str\nend", "def string(string)\n string.gsub(/\\A(.)(.+?)(.?)\\z/) do |s|\n [\n $1,\n '*' * ($2 ? $2.length : 0),\n $3\n ].join\n end\n end", "def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char|\n if hash.key?(char)\n hash[char].times { new_str += char }\n else\n new_str += char \n end\n end\n new_str\nend", "def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char| \n if hash[char]\n hash[char].times { new_str += char }\n else\n new_str += char\n end\n end\n new_str\nend", "def solution(str)\n if str.size.even?\n res = str.scan(/../)\n else\n str << '_'\n res = str.scan(/../)\n end\n res\nend", "def solve(text)\n alpha = ('a'..'z').to_a\n answer = ''\n text.each_char do |char|\n new_idx = (alpha.length - 1) - alpha.index(char)\n answer += alpha[new_idx]\n end\n return answer\nend" ]
[ "0.7101016", "0.7025963", "0.7020939", "0.70161104", "0.68952066", "0.6847274", "0.67384106", "0.6737129", "0.668753", "0.6619752", "0.6591968", "0.65453845", "0.65288544", "0.65108997", "0.65024275", "0.649801", "0.6496632", "0.6492722", "0.64839554", "0.64764035", "0.64706075", "0.6446929", "0.6442301", "0.6436696", "0.6422611", "0.6397116", "0.635764", "0.63495237", "0.63476944", "0.6344704", "0.63414985", "0.63374215", "0.6329382", "0.6326214", "0.63126653", "0.6291337", "0.62903875", "0.62774837", "0.6274621", "0.62616324", "0.6259464", "0.62578475", "0.62568796", "0.6252921", "0.6250037", "0.6250037", "0.6250037", "0.6250037", "0.6250037", "0.6246459", "0.6226298", "0.62251353", "0.6218697", "0.6217889", "0.6212059", "0.6195378", "0.61894757", "0.61884123", "0.6185832", "0.6164885", "0.6163348", "0.6160767", "0.6155752", "0.6152161", "0.61401397", "0.61382866", "0.61248463", "0.612182", "0.6120606", "0.6120399", "0.6115594", "0.6108722", "0.6101254", "0.60907465", "0.60797626", "0.60731226", "0.606492", "0.6063197", "0.6059343", "0.6049303", "0.6048957", "0.6043963", "0.60294366", "0.6010675", "0.6009914", "0.60088235", "0.60020125", "0.5998758", "0.59937143", "0.5973063", "0.5972552", "0.5966928", "0.59586734", "0.5940135", "0.5925659", "0.59243435", "0.5923579", "0.5918277", "0.5908486", "0.59008825" ]
0.6221431
52
Problem 9 Reverse digits in an integer:
def reversed_number(int) int.to_s.reverse.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_digits(int)\n \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_re(num)\n num.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.digits.join.to_i\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 reverse(number)\n digits = number.to_s.split(\"\")\n digits.reverse!\n return digits.to_s.to_i\nend", "def reversed_number(number)\n number.to_s.chars.reverse.join.to_i\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 reversed_number(num)\n num.to_s.chars.reverse.join.to_i\nend", "def reversed_number(number)\n number.to_s.chars.reverse.join('').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 reverse(num)\n num.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(number)\n number.to_s.reverse.to_i\nend", "def reversed_number(num)\n num.to_s.chars.reverse.join('').to_i\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 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(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(num)\n num.to_s.reverse.to_i \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 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\tnum.to_s.reverse.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(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 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_int(int)\nend", "def reversed_number2(num)\n num.to_s.reverse.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 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 reversed_number(number)\n \n reversed_num = number.to_s.reverse\n reversed_num.to_i\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 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 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 number_reverser(integer)\n string = integer.to_s.reverse!\n string.to_i\nend", "def rev(n)\n n.to_s.chars.reverse.join('').to_i\nend", "def digit_list(int)\n int.digits.reverse\nend", "def digit_list(int)\n int.digits.reverse\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", "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 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 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 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.split('').reverse.join('').to_i\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 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 reversed_number(num)\n num.to_s.split(//).reverse.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 reversed_number(pos_int)\n pos_int.to_s.reverse.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 rotate_rightmost_digits(number, digit)\n string_number = number.to_s\n sliced_num = string_number[-digit]\n string_number.delete!(sliced_num)\n (string_number << sliced_num).to_i\nend", "def digit_list(integer)\n integer.digits.reverse\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 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(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 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 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 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 reversed_number(num)\n num_as_str = num.to_s\n num_as_str.reverse.to_i\nend", "def digit_list1(num)\n num.digits.reverse\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(num, n)\n num = num.digits.reverse\n rotators = num.pop(n)\n result = num + rotate_array(rotators)\n result.join.to_i\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 rotate_rightmost_digits(num, n)\n arr = num.to_s.chars\n arr[-n..-1] = arr[-n..-1].rotate\n arr.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 reversed_number(num)\n\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 rotate_rightmost_digits(number, n)\np all_digits = number.to_s.chars\n# all_digits[-n..-1] = rotate_array(all_digits[-n..-1])\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(num, n)\n arr = num.digits.reverse\n rotate_arr = rotate_array(arr.pop(n))\n (arr + rotate_arr).join.to_i\nend", "def rotate_rightmost_digits(long_number, n)\n return long_number if n == 1\n arr = long_number.to_s\n (arr[0...-n] + arr[-n+1..-1] + arr[-n]).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 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 rotate_rightmost_digits(num, n)\n [num.to_s[0..-(n+1)],rotate_array(num.to_s[-n..-1])].flatten.join('').to_i\nend", "def digit_list(num)\n num.digits.reverse\nend", "def digit_list(num)\n num.digits.reverse\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 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 rotate_rightmost_digits(num, digits)\n left, right = num.divmod(10**digits)\n [[left], rotate_array(right.to_s.chars)].join.to_i\nend", "def digit_list(positive_integer)\n positive_integer.digits.reverse!\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 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 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 invertirNumero(numero)\n @numero = numero.to_s\n return (@numero.reverse).to_i\nend", "def rotate_rightmost_digits(number, times)\n rotated_number = number.to_s.split('')\n rotated_number[(times * -1)..-1] = rotate_array(rotated_number[times*-1..-1])\n\n rotated_number.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(number, position)\n num_array = number.to_s.chars\n remainder_digits = num_array.delete_at(-position) # delete_at is a mutating method - original object changes\n num_array << remainder_digits\n num_array.join.to_i\nend" ]
[ "0.84039575", "0.8104306", "0.79693216", "0.7907518", "0.7893917", "0.7881715", "0.7798595", "0.7794753", "0.775013", "0.7735869", "0.7705627", "0.769371", "0.7679189", "0.7659558", "0.7659558", "0.7659558", "0.76563615", "0.76505214", "0.76505214", "0.76384026", "0.76285136", "0.76285136", "0.76285136", "0.76276", "0.76133233", "0.76115984", "0.76115984", "0.76115984", "0.76115984", "0.76115984", "0.76115984", "0.7611509", "0.7606656", "0.76036257", "0.7594832", "0.75818294", "0.75399864", "0.75388145", "0.7537464", "0.7509164", "0.75080425", "0.7504747", "0.7475092", "0.7472639", "0.7471583", "0.7466763", "0.7457744", "0.7457744", "0.74522984", "0.74519235", "0.74460727", "0.7444648", "0.7439533", "0.74382174", "0.74209523", "0.7410294", "0.74094003", "0.7401706", "0.7400559", "0.7394337", "0.7390169", "0.73869514", "0.73853713", "0.73853713", "0.73821956", "0.7369103", "0.73672926", "0.73667216", "0.7353793", "0.7352665", "0.73149824", "0.7313254", "0.73110265", "0.73077524", "0.72934544", "0.72908896", "0.72825164", "0.7279513", "0.7264464", "0.7250781", "0.7249236", "0.72366184", "0.7232898", "0.7205197", "0.71837926", "0.71823007", "0.71823007", "0.71736276", "0.7170602", "0.7158477", "0.7155465", "0.71374094", "0.7108064", "0.70823956", "0.70660126", "0.7060853", "0.70546436", "0.70179796" ]
0.76764
15
Problem 10 Return the middle one or two characters from an input string:
def center_of(string) middle = (string.size - 1) / 2.0 string[middle.floor..middle.ceil] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middle_character(string)\n array = string.split('')\n middle_index = (array.size / 2.0).floor\n if array.size.odd?\n array.slice(middle_index)\n else\n array.slice((middle_index - 1), (middle_index)).join\n end\nend", "def get_middle(str)\n str.length.even? ? str.slice(str.length / 2 - 1, 2) : str.slice(str.length / 2)\nend", "def get_middle(str)\n l = str.length\n return str.chars[l / 2] if l.odd?\n\n str.chars[l / 2 - 1] + str.chars[l / 2]\nend", "def middle_substring(str)\n length = str.length\n if length.odd?\n str[length/2]\n else\n str[length/2-1,2]\n end\nend", "def middle_character(string)\n array = string.split('')\n middle_char = ''\n middle_index = (array.size / 2.0).floor\n if array.size.odd?\n middle_char << array[middle_index]\n else\n middle_char << array[middle_index - 1] << array[middle_index]\n end\n middle_char\nend", "def middle_string(str)\n mid = str.length / 2\n if str.length.odd?\n return str.[mid]\n else\n return str[middle -1 ] + [str.middle]\n end\nend", "def get_middle(s)\n if s.length % 2 == 0\n return \"#{s[(s.length / 2) - 1]}#{s[s.length / 2]}\"\n else\n return \"#{s[(s.length - 1) / 2]}\"\n end\nend", "def middle_substring(str)\n mid = str.length / 2\n str.length.odd? ? str[mid] : str[mid-1..mid]\nend", "def get_middle(string)\n if string.length.even?\n return string[string.length/2-1] + string[string.length/2]\n else\n return string[string.length/2]\n end\nend", "def get_middle(s)\n count = s.length\n count % 2 == 0 ? s[count/2-1..count/2] : s[count/2]\nend", "def middle_substring(str)\n output_str = ''\n\n if str.length % 2 == 1\n odd_i = str.length / 2\n output_str += str[odd_i]\n else\n even_i1 = str.length / 2 - 1\n even_i2 = (str.length / 2)\n\n output_str += str[even_i1]\n output_str += str[even_i2]\n end\n\n output_str\nend", "def middle_substring(str)\r\n # your code goes here\r\n x = str.length\r\n if x % 2 == 1\r\n return str[x/2]\r\n else\r\n str[x/2 - 1] + str[x/2]\r\n end\r\nend", "def middle_substring(str)\n return str[str.length/2] if str.length % 2 != 0\n str[str.length/2-1] + str[str.length/2]\nend", "def middle_substring(str)\n mid = str.length / 2\n str.length.even? ? str[mid-1..mid] : str[mid]\nend", "def get_middle(string)\n half, remainder = string.size.divmod(2)\n middle = (half + remainder) - 1\n string.size.even? ? string[middle..(middle + 1)] : string[middle]\nend", "def middle_substring(str)\n mid = str.length / 2\n str.length.odd? ? str[mid] : str[mid - 1] + str[mid]\nend", "def middle_substring(str)\n mid = str.length/2\n if str.length%2==0\n return str[mid-1..mid]\n else\n return str[mid]\n end\nend", "def middle_substring(str)\n middle_left = str.length / 2\n middle_right = middle_left - 1\n if str.length % 2 == 0\n return \"#{str[middle_right]}#{str[middle_left]}\"\n else\n return \"#{str[middle_left]}\"\n end\nend", "def middle_substring(str)\n n = str.length / 2\n if str.length % 2 == 0\n str[(n-1)..(n)]\n else\n str[n]\n end\nend", "def center_of(string)\n if string.size.odd?\n middle_character = string[string.size / 2]\n else\n middle_characters = string[string.size / 2 - 1, 2]\n end\nend", "def middle(str)\r\n words = str.split\r\n n = words.size\r\n case\r\n when (0..1).include?(n)\r\n return str\r\n when n.even?\r\n middle_ind = (n / 2) - 1\r\n else\r\n middle_ind = (n / 2)\r\n end\r\n words[middle_ind]\r\nend", "def get_middle(s)\n len = s.length\n return s if len == 1\n\n half = len / 2\n return s[half - 1..half] if len % 2 == 0\n\n s[half]\nend", "def get_middle(s)\n if s.length % 2 == 0\n s[s.length/2-1] + s[s.length/2]\n else\n s[s.length/2]\n end\nend", "def middle_substring(str)\n\ta = str.chars\n\twhile (a.length >= 3)\n\t\ta.pop\n\t\ta.shift\n\tend\n\ta.join\nend", "def middle_two(str)\n mid = str.length / 2\n str[mid - 1...mid + 1]\n end", "def middle_substring(str)\n median = (str.size / 2)\n str.length.even? ? str[(median - 1)..median] : str[median]\nend", "def get_middle(s)\nreturn s.length % 2 == 0 ? s[s.length / 2 - 1] + s[s.length / 2] : s[(s.length / 2).floor]\n\nend", "def center_of(string)\n middle = string.length / 2\n string.length.even? ? string.slice(middle - 1, 2) : string.slice(middle)\nend", "def get_first_half_of_string(string)\n string[0..(string.length - 1)/2]\nend", "def middle(string)\n index = string.split.size/2\n size = string.split.size\n if size == 1\n string\n elsif size.odd?\n string.split[index]\n else\n \"#{string.split[index - 1]} #{string.split[index]}\"\n end\nend", "def get_first_half_of_string(string)\n string[0..(string.length-1)/2]\nend", "def middle_sign(string)\n\n a_string = string.chars\n\n if a_string.length % 2 == 0\n middle = [a_string[a_string.length / 2], a_string[a_string.length / 2 - 1]].join\n else\n middle = a_string[a_string.length / 2]\n end\n\nmiddle\nend", "def center_of(str)\n middle = (str.length/2)\n if str.length.odd?\n str[middle]\n else\n str[(middle-1)..middle]\n end\nend", "def center_of(str)\n if str.length.odd?\n str[str.length / 2]\n else\n str[str.length / 2 - 1, 2] # this sets length of 2 char from position\n end\nend", "def middle(string)\n\ta=string.size/2\n\treturn string[a-1]<<string[a] if string.size.even?\n\tstring[a]\n\t\nend", "def get_middle(s)\n s.length.even? ? s[s.length/2 -1] + s[s.length/2] : s[s.length/2]\nend", "def get_middle(s)\n mid = (s.length - 1) / 2\n s.length.odd? ? s[mid] : s[mid..mid+1]\nend", "def get_middle(s)\n mid = (s.length - 1) / 2\n s.length.odd? ? s[mid] : s[mid..mid+1]\nend", "def get_middle(s)\r\n s.length.odd? ? s[s.length / 2] : s[s.length / 2 - 1] + s[s.length / 2]\r\nend", "def center_of(str)\n str.chars.size.odd? ? str.slice(str.chars.length/2, 1) : str.slice(str.chars.length/2-1, 2)\nend", "def middle_word(str)\n words = str.split(\" \")\n middle_word = words[words.size/2]\nend", "def get_middle(s)\n return s if s.size == 1 || s.size == 2\n get_middle(s[1..-2])\nend", "def center_of(string)\n str_length = string.size\n middle = \"\"\n \n return string if str_length < 3\n \n if str_length.odd?\n middle = string[str_length / 2, 1]\n else\n middle = string[(str_length / 2) - 1, 2]\n end\n \n middle\nend", "def center_of(string)\n middle = string.size / 2\n return string[middle] if string.size % 2 == 1\n string[middle - 1..middle] if string.size % 2 == 0\nend", "def get_first_half_of_string(string)\n half_string = (string.length.to_f/2).ceil\n string[0,half_string] \nend", "def first_half(str)\n str[0...str.length / 2]\n end", "def center_of(str)\n length = str.length\n center = length / 2\n if length.even?\n center_right = center\n center_left = center - 1\n str[center_left .. center_right]\n else\n str[center]\n end\nend", "def get_middle(s)\n\tif s.size.odd?\n\t\taverage_letter = s.size.div 2 #3\n\t\treturn s[average_letter]\n\telsif s.size.even?\n\t\taverage_letter = s.size.div 2\n\t\treturn s[(average_letter - 1)..average_letter]\n\tend\nend", "def center_of(str)\n middle_range = (str.length/2 -1..str.length/2 )\n middle_index = str.length / 2\n index = str.length.odd? ? middle_index : middle_range\n str[index]\nend", "def middle(str)\n words = str.split\n\n if words.size == 0\n 'empty string provided'\n elsif words.size == 1\n words[0]\n elsif words.size.odd?\n words[(words.size / 2.0).floor]\n else\n words[(words.size / 2) - 1] + ' ' + words[(words.size / 2)]\n end\nend", "def center_of(string)\n center = string.length / 2\n\n if string.length.odd?\n string[center]\n else\n \"#{string[center - 1]}#{string[center]}\"\n end\nend", "def get_middle(s)\n s.length.even? ? s[s.length/2 - 1] + s[s.length/2] : s[s.length/2]\nend", "def center_of(string)\n string_length = string.size\n string_center = string_length / 2\n \n if string_length.odd?\n string[string_center]\n else\n string[(string_center - 1)..string_center]\n end\nend", "def get_first_half_of_string(string)\n\tnumber_of_characters = string.chars.count\n\thalf = (number_of_characters/2.0).ceil\n\tstring.slice(0, half)\nend", "def center_of(string)\n center_index = string.size / 2\n if string.size.odd?\n string[center_index]\n else\n string[center_index -1, 2]\n end\nend", "def get_middle(s)\n if (s.length.odd?)\n return (s[(s.length / 2).ceil])\n else\n return (s[(s.length / 2) - 1] + s[(s.length/2)])\n end\nend", "def center_of(string)\n middle = string.size / 2\n string.size.odd? ? string[middle] : string[middle-1, 2]\nend", "def center_of(string)\n center_index = string.size / 2\n if string.size.odd?\n string[center_index]\n else\n string[center_index - 1, 2] # 2 is the number of character contained in 'slice'\n end\nend", "def center_of(str)\n count = str.size\n middle = count / 2\n count.odd? ? str[middle] : str[middle-1..middle]\nend", "def center_of(string)\n length = string.length\n\n case length % 2\n when 1 then string[length / 2]\n else string[(length /2) - 1, 2]\n end\nend", "def center_of(string)\n array = string.chars\n if array.size.odd?\n array[array.length/2]\n else\n array[(array.length/2 -1)..array.length/2].join\n end \nend", "def center_of(string)\n middle = string.size/2\n string.size.odd? ? string[middle] : string[middle-1, 2]\nend", "def center_of(string)\n center_index = string.size / 2\n if string.size.odd?\n string[center_index]\n else\n string[center_index - 1, 2]\n end\nend", "def center_of(string)\n char = ''\n if string.size.odd?\n char << string[string.size / 2]\n else\n char << string[(string.size / 2) - 1, 2]\n end\nend", "def middle(string)\n words = string.split\n size = words.size\n if size < 2\n puts 'Sorry, you have to provide a string with at least 2 words'\n nil\n else\n size.even? ? middle = (size / 2) - 1 : middle = (size / 2)\n words[middle]\n end\nend", "def middle_word(string)\n words = string.split\n word_count = words.length\n mid_index = word_count / 2\n if word_count == 0\n ''\n elsif word_count.even?\n # if even number of words, return the two words across the middle.\n \"#{words[mid_index - 1]} #{words[mid_index]}\"\n else\n words[mid_index]\n end\nend", "def center_of(str)\n midpoint = str.length / 2\n if str.length.even?\n str[midpoint - 1..midpoint]\n else\n str[midpoint]\n end\nend", "def get_first_half_of_string(string)\n # Find string length\n # half string length\n # if odd, add one\n string_length = string.size\n string_length += 1 if string_length.odd?\n half_string_length = string_length/2\n string[0..(half_string_length-1)]\n #return string up to half\nend", "def center_of(string)\n index = string.size/2\n if string.size.odd?\n string[index]\n else\n string[index - 1, 2]\n end\nend", "def middle_word(string)\n words = string.split\n case words.size.odd?\n when true\n index = (words.size/2) \n words[index]\n when false\n \"Unable to determine middle word. An odd number of words are necessary.\"\n end\nend", "def center_of(string)\n half = (string.length / 2) - 1\n center = string[(string.length / 2)] if string.length.odd?\n center = string[half..half+1] if string.length.even?\n center\nend", "def center_of(str)\n str.length.odd? ? str[str.length / 2] : str[(str.length / 2) - 1, 2]\nend", "def without_two(str)\n return str if str.length < 2\n return '' if str.length == 2\n return str[2..] if str[0...2].eql? str[-2..]\n\n str\n end", "def center_of(string)\n quotient, remainder = (string.size - 1).divmod(2)\n string.slice(quotient, remainder + 1)\nend", "def center_of(string)\n center = ''\n\n if string.size.even?\n center = string[string.size/2 - 1 .. string.size/2]\n else\n center = string[string.size/2]\n end\n center\nend", "def center_of(string)\n half_size = string.size / 2\n case \n when string.size.odd? then string[half_size]\n when string.size.even? then string[half_size - 1, 2] \n end\nend", "def center_of2(str)\n sz = str.size\n str[(sz - 1) / 2..sz / 2]\nend", "def center_of(string)\n midpoint = string.size / 2\n string.length.odd? ? string[midpoint] : string[midpoint - 1..midpoint]\nend", "def center_of(str)\n half_point = str.size / 2 \n \n if str.size.odd?\n str[half_point]\n else\n str[half_point-1,2]\n end\nend", "def middle_word(text)\n words = text.split\n return '' if words.size <= 1\n\n words[words.size / 2]\nend", "def center_of(str)\n new_str = ''\n if str.length.odd?\n new_str = str[str.length / 2]\n else\n new_str = str[(str.length / 2) - 1] + str[str.length / 2] \n end\n p new_str\nend", "def center_of(string)\n if string.size.odd?\n p string[string.size / 2] # no need: string[(string.size - 1) / 2], since/2 get an integer\n else\n p string[(string.size / 2 - 1), 2]\n end\nend", "def center_of(string)\n middle_index = string.size / 2\n\n if string.size.odd?\n string[middle_index]\n else\n string[middle_index - 1] + string[middle_index]\n end\nend", "def starts_with_two_cons (str)\n return str + str.slice!(0,2) + 'ay'\nend", "def start_of_word(str, l); l == 1 ? str[0] : str[0...l] end", "def center_of(str)\n return str[str.size/2] if str.size.odd?\n return str[(str.size/2)-1] + str[(str.size/2)]\nend", "def center_of(str)\n mid_point = str.size / 2.0\n if str.size.odd?\n str[mid_point]\n else \n str[(mid_point - 1), 2]\n end\nend", "def center_of(str)\n sz = str.size\n sz.even? ? str[sz / 2 - 1, 2] : str[sz / 2]\nend", "def center_of(str)\ncharacters = str.chars\naverage = characters.size / 2\nif characters.size.even?\ncharacters[average - 1] + characters[average]\nelse\ncharacters[average]\nend\nend", "def start_of_word (string, number)\n number = number - 1\n string[0..number]\nend", "def MidChar ( num )\n\n x = num.to_s.length()\n\n case x\n\n when 3\n\n return num.to_s[1,1]\n\n when 5\n\n return num.to_s[2,1]\n\n when 7\n\n return num.to_s[3,1]\n\n else\n\n return -1\n\n end\n\nend", "def center_of(str)\n index = str.size / 2\n str.size.even? ? str[index - 1, 2] : str[index]\nend", "def center_of(string)\n if string.size.odd?\n index1 = string.size / 2\n elsif string.size.even?\n index1 = string.size / 2\n index2 = (string.size / 2) - 1\n end\n\n new_string = []\n string_array = string.chars\n if string.size.odd?\n new_string << string_array[index1]\n elsif string.size.even?\n new_string << string_array[index2]\n new_string << string_array[index1]\n end\n new_string.join\nend", "def center_of(str)\n str.size.odd? ? str[str.size/2] : str[str.size/2 - 1..str.size/2]\nend", "def get_char_summery(string, count)\n string[0..count]\n end", "def remove_char(s)\n s[1..-2]\nend", "def start_of_word(str, number)\n\treturn str[0, number]\nend", "def first_char_with_odd_ascii_gr8ter_80(input)\n input.find do |c|\n c.ord.odd? && c.ord > 80\n end\n end", "def center_of(str)\n p str.size.odd? ? str[str.size / 2] : str[(str.size / 2) - 1..(str.size / 2)]\nend", "def part_of_word\n @str[@first_letter..@last_letter]\n end", "def middle_word(string)\n words = string.split(' ')\n size = words.size\n if size == 0\n \"Invalid input! Empty string!\"\n elsif size.even?\n \"Invalid input! Even number of words in sentance!\"\n elsif size == 1\n \"Invalid input! Only one word in the string!\"\n else\n words[-(size/2)-1]\n end\nend" ]
[ "0.8088445", "0.8059844", "0.8052275", "0.7976995", "0.7835989", "0.7801084", "0.77518326", "0.7720265", "0.76894456", "0.76657164", "0.76598173", "0.7655968", "0.76338226", "0.7624497", "0.75902146", "0.75733304", "0.75604975", "0.7558836", "0.7534535", "0.75228256", "0.7501681", "0.74600625", "0.7409539", "0.7397592", "0.7375222", "0.7355822", "0.7345349", "0.7292795", "0.7284425", "0.7279547", "0.727844", "0.72496337", "0.72443324", "0.72372204", "0.7218273", "0.72173023", "0.72083974", "0.72083974", "0.7195381", "0.7194051", "0.719038", "0.7181466", "0.71786875", "0.71756506", "0.715753", "0.71514696", "0.71483326", "0.7146145", "0.71372914", "0.7136001", "0.71357954", "0.7125878", "0.7118223", "0.7081799", "0.7081386", "0.7078", "0.7071727", "0.70696855", "0.7069636", "0.7067223", "0.70649356", "0.70530313", "0.7052075", "0.7046971", "0.7046728", "0.7027122", "0.7026395", "0.7013037", "0.69891983", "0.6986393", "0.69795436", "0.69594395", "0.69466335", "0.6905487", "0.6892964", "0.68750304", "0.6873755", "0.6873058", "0.6864167", "0.6848171", "0.6818494", "0.68166727", "0.681473", "0.68075246", "0.6802022", "0.679439", "0.6789038", "0.6787868", "0.678616", "0.67809033", "0.6760516", "0.6749197", "0.6745396", "0.67394894", "0.67323375", "0.672988", "0.67111146", "0.6710422", "0.669223", "0.6685621", "0.6683603" ]
0.0
-1
Helper defining routes for tools Creates get and post methods and optional upload path
def tool(name, tools = []) get name => "#{name}#editor" if (!tools || tools.empty?) post name => "#{name}##{name}" else tools.each { |t| post "#{name}/#{t}" => "#{name}##{t}" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 custom_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; end", "def supports_path?; end", "def add_swagger_route http_method, path, opts = {}\n full_path = path.gsub(/{(.*?)}/, ':\\1')\n match full_path, to: \"#{opts.fetch(:controller_name)}##{opts[:action_name]}\", via: http_method\n end", "def define_path_helpers; end", "def make_collection\n if(request.body.read.to_s == '')\n if(::File.directory?(file_path))\n MethodNotAllowed\n else\n if(::File.directory?(::File.dirname(file_path)) && !::File.exist?(file_path))\n Dir.mkdir(file_path)\n Created\n else\n Conflict\n end\n end\n else\n UnsupportedMediaType\n end\n end", "def resources\n end", "def default_routes!\n # images resources\n get \"/__sinatra__/:image.png\" do\n filename = File.dirname(__FILE__) + \"/images/#{params[:image]}.png\"\n send_file filename\n end\n end", "def method_missing(method, **args, &block)\n path = method.to_s.split(\"_\", 2).join(\"/\")\n args.merge!(access_token: access_token)\n case path\n when /create$/\n raw_post path, args\n else\n raw_get path, args\n end\n end", "def post_paths\n %(/site/home\n /content/999/BOXID/TYPENAME\n /file/999/BOXID\n /shard/0000000000000000000000000000000000000000\n /schema/delete\n )\n end", "def _routes; end", "def path\n end", "def path\n end", "def path\n end", "def default_method\n case @action.to_s\n when /create/\n :post\n when /update/\n :put\n when /destroy/\n :delete\n else# and when /(index|show|new|edit)/\n :get\n end\n end", "def upload\n\n\t\t@uploads = Idea.find(params[:id]).uploads\n\t\t@idea = params[:id]\n\t\t@idea_obj = Idea.find(@idea)\n\n\t\t# allows user to delete files\n\t\t@delete = true\n\n\t\t@path = [link_to_ideas, link_to_idea_uploads(@idea_obj)]\n\t\t@subnavigation = [active_link_to_idea_uploads(@idea_obj), link_to_idea(@idea_obj), link_to_show_all_ideas(\"Alle Ideen\", \"title\", \"ASC\", \"\", 0, 30)]\n\tend", "def make_path(*args)\n end", "def resources; end", "def resources; end", "def file_uploads; end", "def verb_path\n return nil if @binding.nil?\n\n {\n get: @binding.get,\n post: @binding.post,\n put: @binding.put,\n patch: @binding.patch,\n delete: @binding.delete\n }.find { |_, value| !value.empty? }\n end", "def routes\n raise NotImplementedError\n end", "def route\n #TODO\n end", "def method_missing(method, *args)\n api_method = map[method.to_s]\n args = args.last.is_a?(Hash) ? args.last : {} # basically #extract_options!\n methods_or_resources = api_method['methods'] || api_method['resources']\n if methods_or_resources\n API.new(access_token, api, methods_or_resources)\n else\n url, options = build_url(api_method, args)\n\n raise ArgumentError, \":body parameter was not passed\" if !options[:body] && %w(POST PUT PATCH).include?(api_method['httpMethod'])\n\n send(api_method['mediaUpload'] && args[:media] ? :upload : :request, api_method['httpMethod'].downcase, url, options)\n end\n end", "def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end", "def api_create_url\n \"#{self.name.split(\"::\").last.downcase}\"\n end", "def routes_generate_options\n {\n :action => action_ref(:class => :controller),\n #TODO named root params\n :controller => controller_ref,\n :generate_all => nil,\n :method => link_to_methods,\n :use_route => nil,\n\n }\n end", "def controller_path; end", "def controller_path; end", "def get_action request_method\n case request_method\n when 'POST' then 'create'\n when 'GET' then 'read'\n when 'PUT' then 'update'\n when 'DELETE' then 'delete'\n end\n end", "def resource\n\n end", "def upload\n end", "def upload\n end", "def post(path, **args); end", "def build_path\n path = %w(api where)\n path.concat api_method\n path = path.join('/')\n @path = \"/#{path}.json\"\n end", "def define_actions_from_routes\n (effective_resource.member_actions - effective_resource.crud_actions).each do |action|\n define_method(action) { member_action(action) }\n end\n\n (effective_resource.collection_actions - effective_resource.crud_actions).each do |action|\n define_method(action) { collection_action(action) }\n end\n end", "def create_url\n DocumentHelper.get_create_url(document_type)\n end", "def create\n @resource = Resource.new(params[:resource])\n\n @resource.assetable_id = 1\n @resource.assetable_type = 'User'\n\n if params[:resource]\n if image_types.include? params[:resource][:data].content_type\n @resource.type = 'Ckeditor::Picture'\n else\n @resource.type = 'Ckeditor::AttachmentFile'\n end\n end\n\n respond_to do |format|\n \n if @resource.save\n \n #Checking resource type for image or file and redirecting as per the lists with conditions\n if @resource.is_type_image? \n redirect_path = admin_resources_path(:type => 'image')\n else\n redirect_path = admin_resources_path(:type => 'file')\n end\n\n format.html { redirect_to redirect_path, notice: 'Resource was successfully uploaded.' }\n else\n format.html { render action: \"new\", :type => @type }\n end\n end\n end", "def path(*) end", "def path\n\t\tpost_path(self)\n\tend", "def external_routes; end", "def helpers_path=(_arg0); end", "def rest_url_for(*args)\n options = args.at(0)\n case options\n when Hash\n action = options[:action]\n action ||= 'show'\n controller = options[:controller]\n key = ''\n if options[:entity] then\n entity = options[:entity]\n controller ||= entity.model_name\n key = entity.key\n end\n if action && action.include?('/') then\n action = action.split('/')\n controller = action[0]\n action = action[1]\n end\n\n url = \"#{controller}/#{key}\" \n url << \"/#{action}\" if action\n get_params = options.dup\n get_params.delete(:action)\n get_params.delete(:controller)\n get_params.delete(:entity)\n url << get_params.to_get_params if get_params.size > 0\n when Aurita::Model\n entity = args.at(0)\n options = args.at(1)\n options ||= {}\n controller = options[:controller]\n controller ||= entity.model_name\n action = options[:action]\n key = entity.key.values.first\n url = \"#{controller}/#{key}\"\n url << \"/#{action}\" if action\n get_params = options.dup\n get_params.delete(:action)\n get_params.delete(:controller)\n get_params.delete(:entity)\n url << '/' << get_params.to_get_params if get_params.size > 0\n else\n entity = args.at(0)\n options = args.at(1)\n options ||= {}\n controller ||= entity.model_name\n action = options[:action]\n url = \"#{controller}\"\n url << \"/#{action}\" if action\n get_params = options.dup\n get_params.delete(:action)\n url << '/' << get_params.to_get_params if get_params.size > 0\n end\n url\n end", "def route_upload?\n request.post? && path.match(%r{^/#{doc}/upload$})\n end", "def new_resource_path\n send route_prefix_to_method_name(\"new_#{class_name.model_name.singular_route_key}_path\")\n end", "def route\n @extname = File.extname(request.path_info)\n @extname = nil if @extname.empty?\n args = super\n\n unless args.empty? || extname == nil\n args.last.chomp!(extname)\n end\n\n args\n end", "def path_reader(*types)\n types.each do |type|\n m = :\"#{type}_path\"\n define_method(m) { Lesson.public_send m, self.name }\n end\n end", "def resource; end", "def url_after_create\n # your special path\n end", "def request_path; end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def initialize(client, path, resource_type)\n @client = client\n @path = path\n\n if INCONSISTENT_RESOURCE_TYPES.has_key?(get_singular(resource_type))\n resource_type = INCONSISTENT_RESOURCE_TYPES[get_singular(resource_type)] + 's'\n end\n @resource_type = resource_type\n # Add create methods for the relevant root RightApi::Resources\n self.define_instance_method('create') do |*args|\n client.send(:do_post, path, *args)\n end\n\n # Add in index methods for the relevant root RightApi::Resources\n self.define_instance_method('index') do |*args|\n # Session uses .index like a .show (so need to treat it as a special case)\n if resource_type == 'session'\n ResourceDetail.new(client, *client.send(:do_get, path, *args))\n else\n RightApi::Resource.process(client, *client.send(:do_get, path, *args))\n end\n end\n\n # Adding in special cases\n Helper::RESOURCE_SPECIAL_ACTIONS[resource_type].each do |meth, action|\n # Insert_in_path will NOT modify path\n action_path = insert_in_path(path, meth)\n self.define_instance_method(meth) do |*args|\n client.send(action, action_path, *args)\n end\n end if Helper::RESOURCE_SPECIAL_ACTIONS[resource_type]\n end", "def create\n @asset = @uploadable.assets.new(asset_params)\n if request.path.include? \"rooms\"\n if @asset.save\n redirect_to venue_rooms_path\n else\n render :new\n end\n else\n if @asset.save\n redirect_to @uploadable, notice: \"asset created.\"\n else\n render :new\n end\n end\n end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; end", "def path; super; end" ]
[ "0.5917844", "0.57401776", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.57281166", "0.5708758", "0.5701988", "0.5696045", "0.5664078", "0.559829", "0.55765873", "0.55240214", "0.5521716", "0.5513435", "0.55044127", "0.55044127", "0.55044127", "0.5470272", "0.5458004", "0.5413612", "0.5399621", "0.5399621", "0.5378447", "0.53374314", "0.5333632", "0.5329636", "0.5316967", "0.530426", "0.53025484", "0.5301114", "0.52959967", "0.52959967", "0.5279169", "0.52773315", "0.52657217", "0.52657217", "0.5257788", "0.5256146", "0.52494377", "0.52288467", "0.522437", "0.5213107", "0.5190765", "0.51850957", "0.51767963", "0.5172031", "0.51714826", "0.5167676", "0.51546884", "0.5150335", "0.5148436", "0.51434183", "0.5141853", "0.5139276", "0.5139276", "0.5139276", "0.51306814", "0.51293075", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.5127286", "0.51268214" ]
0.0
-1
Mock a crappy remote API call that could toss an exception on some upstream error. It also mocks a return value of ':pending' when it's not complete and returns ':happy' when it's complete.
def crappy_api_call $count += 1 # First two calls fail raise "OH SNAP" if $count < 3 # Next few calls say pending return :pending if $count < 5 # Then finally done return :happy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_WAPI_do_request_rest_client_error_417\n\n\n stub_request(:get, \"https://start/hey\").\n with(:headers => {'Accept' => 'application/json', 'Accept-Encoding' => 'gzip, deflate', 'Authorization' => 'Bearer sweet!'}).\n to_return(:status => 417, :body => \"\", :headers => {})\n\n a = Hash['api_prefix' => \"https://start\",\n 'key' => 'key',\n 'secret' => 'secret',\n 'token_server' => 'nowhere.edu',\n 'token' => 'sweet!'\n ]\n h = WAPI.new(a);\n\n r = h.do_request(\"/hey\")\n\n assert_equal(r.meta_status, 666, \"didn't get wrapped exception\")\n\n end", "def test_no_retry_with_mismatched_error\n call_count = 0\n client_stub = make_client_stub\n\n make_request_proc = lambda do |args|\n call_count += 1\n raise FakeFaradayError.new(GRPC::Core::StatusCodes::INTERNAL)\n end\n \n options = Gapic::CallOptions.new(\n retry_policy: { retry_codes: [GRPC::Core::StatusCodes::UNAVAILABLE] }\n )\n\n client_stub.stub :base_make_http_request, make_request_proc do\n ex = assert_raises Gapic::Rest::Error do\n client_stub.make_get_request uri: \"/foo\", options: options\n end\n\n refute_nil ex.cause\n assert_kind_of FakeFaradayError, ex.cause\n assert_equal GRPC::Core::StatusCodes::INTERNAL, ex.cause.grpc_code\n end\n assert_equal 1, call_count\n end", "def test_retries_then_raises_unexpected_exception\n client_stub = make_client_stub\n\n call_count = 0\n make_request_proc = lambda do |args|\n call_count += 1\n raise RuntimeError if call_count == 3\n raise FakeFaradayError.new(GRPC::Core::StatusCodes::UNAVAILABLE)\n end\n\n sleep_proc = ->(count) { }\n\n options = Gapic::CallOptions.new(\n timeout: 1,\n retry_policy: {\n retry_codes: [GRPC::Core::StatusCodes::UNAVAILABLE], \n }\n )\n\n Kernel.stub :sleep, sleep_proc do\n client_stub.stub :base_make_http_request, make_request_proc do\n ex = assert_raises RuntimeError do\n client_stub.make_get_request uri: \"/foo\", options: options\n end\n end\n end\n\n assert_equal 3, call_count\n end", "def test_get_request_error_417\n\n stub_request(:get, \"https://start/hey\").\n with(:headers => {'Accept' => 'application/json', 'Accept-Encoding' => 'gzip, deflate', 'Authorization' => 'Bearer sweet!'}).\n to_return(:status => 417, :body => \"\", :headers => {})\n\n a = Hash['api_prefix' => \"https://start\",\n 'key' => 'key',\n 'secret' => 'secret',\n 'token_server' => 'nowhere.edu',\n 'token' => 'sweet!'\n ]\n h = WAPI.new(a);\n\n r = h.get_request(\"/hey\")\n\n assert_equal(r.meta_status, 666, \"didn't get wrapped exception\")\n exp = r.result\n assert_equal(exp.http_code, 417, \"got incorrect wrapped exception\")\n\n end", "def stub_coin_market_cap_success_call_service\n \tlist_response = File.read('test/fixtures/api_responses/coin_market_cap_success.json')\n json_response = JSON.parse(list_response)\n json_response.stubs(:code).returns(200)\n CoinMarketCap.stubs(:call_service).returns(json_response)\n end", "def test_times_outs\n client_stub = make_client_stub\n to_attempt = 5\n time_delay = 60\n\n call_count = 0\n make_request_proc = lambda do |args|\n call_count += 1\n raise FakeFaradayError.new(GRPC::Core::StatusCodes::UNAVAILABLE)\n end\n\n time_now = 1\n time_proc = ->(_) do\n time_now += time_delay\n end\n\n # Default delay and multiplier are 1 and 1.3\n # The number of expects here is `to_attempt-1`, spelt out for visibility\n sleep_mock = Minitest::Mock.new\n sleep_mock.expect :sleep, nil, [1]\n sleep_mock.expect :sleep, nil, [1 * 1.3]\n sleep_mock.expect :sleep, nil, [1 * 1.3 * 1.3]\n sleep_mock.expect :sleep, nil, [1 * 1.3 * 1.3 * 1.3]\n sleep_proc = ->(count) { sleep_mock.sleep count }\n\n options = Gapic::CallOptions.new(\n timeout: time_delay * to_attempt + 0.1, # `+0.1` means that timeout stays positive on last cycle \n retry_policy: {\n retry_codes: [GRPC::Core::StatusCodes::UNAVAILABLE], \n }\n )\n\n Kernel.stub :sleep, sleep_proc do\n ::Process.stub :clock_gettime, time_proc do\n client_stub.stub :base_make_http_request, make_request_proc do\n ex = assert_raises ::Gapic::Rest::Error do\n client_stub.make_get_request uri: \"/foo\", options: options\n end\n\n refute_nil ex.cause\n assert_kind_of FakeFaradayError, ex.cause\n\n # Note that this is not a DEADLINE_EXCEEDED\n # Our fake never throws ::Faraday::TimeoutError so the error gets wrapped as is.\n # This mirrors the gRPC test\n assert_equal GRPC::Core::StatusCodes::UNAVAILABLE, ex.cause.grpc_code\n end\n end\n end\n\n assert_equal to_attempt, call_count\n sleep_mock.verify\n end", "def test_no_retry_without_codes\n call_count = 0\n client_stub = make_client_stub\n\n make_request_proc = lambda do |args|\n call_count += 1\n raise FakeFaradayError.new(GRPC::Core::StatusCodes::INTERNAL)\n end\n\n options = Gapic::CallOptions.new # no codes\n client_stub.stub :base_make_http_request, make_request_proc do\n ex = assert_raises Gapic::Rest::Error do\n client_stub.make_get_request uri: \"/foo\", options: options\n end\n\n refute_nil ex.cause\n assert_kind_of FakeFaradayError, ex.cause\n assert_equal GRPC::Core::StatusCodes::INTERNAL, ex.cause.grpc_code\n end\n\n assert_equal 1, call_count\n end", "def test_errors_from_handled_requests_are_noticed\n desc = basic_grpc_desc\n def desc.trace_with_newrelic?; true; end # force a true response from this method\n def desc.process_distributed_tracing_headers(ac); end # noop this DT method (tested elsewhere)\n def desc.metadata_for_call(call); NewRelic::EMPTY_HASH; end # canned. test metadata_for_call elsewhere\n raised_error = RuntimeError.new\n new_transaction_called = false\n NewRelic::Agent::Transaction.stub(:start_new_transaction, proc { new_transaction_called = true; transaction }) do\n received_error = nil\n notice_stub = proc { |e| received_error = e }\n NewRelic::Agent.stub(:notice_error, notice_stub) do\n assert_raises(RuntimeError) do\n result = desc.handle_with_tracing(nil, nil, method, nil) { raise raised_error }\n end\n\n assert_equal raised_error, received_error\n assert new_transaction_called\n end\n end\n end", "def stub_http_start_with_good_01_response()\n Net::HTTP.stub(:start, method(:http_start_stub_good_01)) do\n yield()\n end # Net::HTTP.stub(:start)\n end", "def test_should_handle_retry_by_status_code\n error = proc { raise Google::Cloud::Error, 'something bad happened' }\n @fire_cloud_client.stub :get_workspace_bucket, error do\n # should only retry once\n forbidden_mock = Minitest::Mock.new\n status = 403\n forbidden_mock.expect :status_code, status\n forbidden_mock.expect :nil?, false\n 3.times do\n forbidden_mock.expect :==, false, [Integer] # will check against 502..504\n end\n @fire_cloud_client.stub :extract_status_code, forbidden_mock do\n assert_raise RuntimeError do\n @fire_cloud_client.execute_gcloud_method(:get_workspace_file, 0, 'foo', 'bar.txt')\n forbidden_mock.verify\n end\n end\n # test with 502 should cause retry cascade\n status = 502\n bad_gateway_mock = Minitest::Mock.new\n 6.times do # 6 is for 5 total requests and then 6th iteration that terminates retry loop\n bad_gateway_mock.expect :status_code, status\n bad_gateway_mock.expect :nil?, false\n bad_gateway_mock.expect :==, true, [status]\n end\n @fire_cloud_client.stub :extract_status_code, bad_gateway_mock do\n assert_raise RuntimeError do\n @fire_cloud_client.execute_gcloud_method(:get_workspace_file, 0, 'foo', 'bar.txt')\n bad_gateway_mock.verify\n end\n end\n end\n end", "def test_doesnt_propagate_errors_in_instrumentation\n NewRelic::Agent::CrossAppTracing.stubs( :start_trace ).\n raises( StandardError, \"something bad happened\" )\n\n res = Curl::Easy.http_get( default_url )\n\n assert_kind_of Curl::Easy, res\n end", "def mock_faraday_error(status_code)\n mocked_error_class = if (500..599).include?(status_code) && Faraday::VERSION.to_f >= 16.0\n Faraday::ServerError\n else\n Faraday::ClientError\n end\n\n ::Faraday::Connection.any_instance.stubs(:get).\n raises(mocked_error_class.new(nil, { status: status_code}))\n end", "def test_status_green_on_502\n Excon.stub({method: :get}, {body: '<doctype', status: 502})\n\n authorize 'user', 'password'\n assert_output( /502 override/,'') { get '/status' }\n last_response.body.must_equal 'green'\n end", "def stub_message_fail\n @response_fail = File.open(File.join('fixtures', 'astros-fail.json'), 'r').read\n stub_request(:get, /api.open-notify.org\\/astros.json/).to_return(:body => @response_fail, :status => 200, :headers => {'Content-Type'=>'application/json'})\nend", "def mock_undetermined_vehicle_compliance\n allow(ComplianceCheckerApi).to receive(:vehicle_compliance)\n .and_raise(BaseApi::Error422Exception.new(422, '', {}))\n end", "def fake_a_broken_uri(uri)\n stub_request(:get, uri).to_return(body: \"Oopsies\")\nend", "def test_json_parser_error\n Excon.stub({method: :get}, {body: '<doctype', status: 200})\n\n authorize 'user', 'password'\n assert_output( /JSON::ParserError/,'') { get '/status' }\n last_response.body.must_equal 'green'\n end", "def mock_success\n head :ok\n end", "def test_WAPI_do_request_unauthorized\n\n stub_request(:get, \"https://start/hey\").\n with(:headers => {'Accept' => 'application/json', 'Accept-Encoding' => 'gzip, deflate', 'Authorization' => 'Bearer sweet!'}).\n to_return(:status => 401, :body => \"unauthorized\", :headers => {})\n\n a = Hash['api_prefix' => \"https://start\",\n 'key' => 'key',\n 'secret' => 'secret',\n 'token_server' => 'nowhere.edu',\n 'token' => 'sweet!'\n ]\n h = WAPI.new(a);\n\n r = h.do_request(\"/hey\")\n logger.info \"tWdou: #{__LINE__}: r: \"+r.inspect\n\n assert_equal(r.meta_status, 666, \"didn't get wrapped exception\")\n\n exp = r.result\n assert_equal(exp.http_code, 401, \"didn't catch unauthorized in do_request\")\n\n end", "def work()\n # FIXME : .rel[...].get doesn't update $client.rate_limit...\n\n rate_limit = $client.rate_limit\n dbgp \"#{rate_limit.remaining} API calls left.\"\n\n # A little buffer in case we use a feature from octokit\n # which doesn't update rate_limit on `$client`.\n if rate_limit.remaining < 5 then\n reset = rate_limit.resets_in + 10\n puts \"💤 zleepy timez (back in #{reset} seconds)\"\n sleep(reset)\n end\n\n begin\n yield\n rescue Octokit::BadGateway, Octokit::InternalServerError => e\n puts \"Uuuh... github is having a bad time :( #{e.response_status}\"\n pp \"=====\"\n pp \"=====\"\n pp e.response_body\n pp \"=====\"\n pp e.response_headers\n pp \"=====\"\n pp \"=====\"\n sleep 10\n retry\n end\nend", "def mock_check_barcode_request(barcode, status_code)\n if status_code == '404'\n stub_request(:get, \"#{ENV.fetch('PATRON_MICROSERVICE_URL_V01', nil)}?barcode=\" + barcode)\n .to_return(status: 404, body: {\n \"message\" => \"Failed to retrieve patron record by barcode\",\n \"statusCode\" => 404\n }\n .to_json, headers: { 'Content-Type' => 'application/json' })\n return\n end\n\n if status_code == '409'\n stub_request(:get, \"#{ENV.fetch('PATRON_MICROSERVICE_URL_V01', nil)}?barcode=\" + barcode)\n .to_return(status: 409, body: {\n \"message\" => \"Multiple patron records found\",\n \"statusCode\" => 409\n }\n .to_json, headers: { 'Content-Type' => 'application/json' })\n return\n end\n\n if status_code == '500'\n stub_request(:get, \"#{ENV.fetch('PATRON_MICROSERVICE_URL_V01', nil)}?barcode=\" + barcode)\n .to_return(status: 500, body: {\n \"message\" => \"Server error\",\n \"statusCode\" => 500\n }\n .to_json, headers: { 'Content-Type' => 'application/json' })\n return\n end\n\n # return a successful 200 \"single unique user found\" response\n stub_request(:get, \"#{ENV.fetch('PATRON_MICROSERVICE_URL_V01', nil)}?barcode=\" + barcode)\n .to_return(status: 200,\n body: SIERRA_USER.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def status_test_result_running_request\n stub_request(:get, \"http://www.webpagetest.org/testStatus.php?f=json&test=#{OTHER_TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_running_response(OTHER_TEST_ID).to_json)\n end", "def __proxied_call(**args)\n error = catch(:verbalize_error) do\n value = perform(**args)\n return Success.new(value)\n end\n\n Failure.new(error)\n end", "def test_status_green_on_empty\n Excon.stub({method: :get}, {body: '', status: 200})\n\n authorize 'user', 'password'\n assert_output( /status=200/,'') { get '/status' }\n last_response.body.must_equal 'green'\n end", "def status_test_result_completed_request\n stub_request(:get, \"http://www.webpagetest.org/testStatus.php?f=json&test=#{OTHER_TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_completed_response(OTHER_TEST_ID).to_json)\n end", "def test_email_client_secondary_success_only\n MailgunClient.stubs(:send_email).returns(bad_req_code)\n SendgridClient.stubs(:send_email).returns(ok_code)\n\n input_val = EmailObject.new\n response = ClientResponse.new input_val\n response.set_ok\n\n assert_equal response, EmailClient.send_email(input_val)\n end", "def raises_upon_errored_playbook\n expect(Ansible::Runner).to receive(:run).and_return(response_bad)\n expect { yield }.to raise_error(MiqException::Error)\nend", "def mock_send_request_to_patron_creator_service\n stub_request(:post, ENV.fetch('PATRON_MICROSERVICE_URL_V02', nil))\n .to_return(\n {\n status: 201,\n body: {\n 'status' => 'success'\n }.to_json,\n headers: {}\n },\n {\n status: 500,\n body: {\n 'status' => 'failure'\n }.to_json, headers: {}\n }\n )\n end", "def check_github_response\n Retriable.retriable(retry_options) do\n yield\n end\n rescue MovedPermanentlyError => e\n fail_with_message(e, \"The repository has moved, update your configuration\")\n rescue Octokit::Forbidden => e\n fail_with_message(e, \"Exceeded retry limit\")\n rescue Octokit::Unauthorized => e\n fail_with_message(e, \"Error: wrong GitHub token\")\n end", "def test_that_it_raises_an_api_error_if_ng_status_is_returned\n not_exist_user_id = 'NOT_EXSIT_USER'\n res_body = load_test_data 'error_404_not_found.json'\n url = \"#{HOST}/users/#{not_exist_user_id}\"\n add_stub_request :get, url, res_body: res_body, res_status: 404\n\n proc_404_error = proc do\n @client.user not_exist_user_id\n end\n assert_404_error proc_404_error\n end", "def test_result_running_request\n stub_request(:get, \"http://www.webpagetest.org/jsonResult.php?pagespeed=1&test=#{OTHER_TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_running_response(OTHER_TEST_ID).to_json)\n end", "def call(*args)\n case status\n when :closed, :half_open\n begin\n do_call(*args).tap do\n record_success\n end\n rescue Timeout::Error\n record_failure\n raise $!\n end\n when :open\n raise Open\n else\n raise \"Unreachable Code\"\n end\n end", "def test_errored_operation\n op = create_op MockOperation.new(status: :DONE, err_code: ERR_CODE, err_msg: ERR_MSG)\n assert op.done?\n assert op.error?\n refute op.response?\n assert_equal ERR_CODE, op.results.code\n assert_equal ERR_MSG, op.results.message\n assert_equal ERR_CODE, op.error.code\n assert_equal ERR_MSG, op.error.message\n assert_nil op.response\n end", "def test_no_request_retry_get\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/timeout\", http_options)\n assert_response_code(504, response)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end", "def test_errored_operation_boolean\n op = create_op MockOperation.new(status: true, err_code: ERR_CODE, err_msg: ERR_MSG)\n assert op.done?\n assert op.error?\n refute op.response?\n assert_equal ERR_CODE, op.results.code\n assert_equal ERR_MSG, op.results.message\n assert_equal ERR_CODE, op.error.code\n assert_equal ERR_MSG, op.error.message\n assert_nil op.response\n end", "def test_email_client_primary_success_only\n MailgunClient.stubs(:send_email).returns(ok_code)\n SendgridClient.stubs(:send_email).returns(bad_req_code)\n\n input_val = EmailObject.new\n response = ClientResponse.new input_val\n response.set_ok\n\n assert_equal response, EmailClient.send_email(input_val)\n end", "def test_a_noticeable_error_is_not_created_on_failure_if_a_segment_is_absent\n multi = Curl::Multi.new\n request = OpenStruct.new\n error = [OpenStruct.new(name: 'name'), 'last']\n prep_on_failure(request)\n def multi.remove_failure_callback(request); end\n # if noticeable error creation attempt, explode\n NewRelic::Agent::NoticeableError.stub(:new, -> { raise 'kaboom' }) do\n multi.install_failure_callback(request, nil, nil)\n end\n end", "def test_email_client_all_clients_bad_request\n MailgunClient.stubs(:send_email).returns(bad_req_code)\n SendgridClient.stubs(:send_email).returns(bad_req_code)\n\n input_val = EmailObject.new\n response = ClientResponse.new input_val\n response.set_bad_req\n\n assert_equal response, EmailClient.send_email(input_val)\n end", "def stub_contact_response(retval)\n service = FetchMailchimpContact.new('', '')\n\n allow(FetchMailchimpContact)\n .to receive(:new).with('API_KEY', 'http://localhost/lists/1')\n .and_return(service)\n\n allow(service).to receive(:call).and_return(retval)\n end", "def exec_api_call(rest_type, req, data = nil, exit_on_fail = false)\n max_retry = RETRIES\n get_hash = nil\n attempts = 0\n is_good = false\n while !is_good && attempts < max_retry\n attempts += 1\n get_hash = call_api(req, rest_type, data)\n is_good = get_hash[:status]\n unless is_good\n exit_script() if exit_on_fail\n puts \"Got Error making API call - #{req} \"\n if attempts < max_retry\n puts \"Retrying #{attempts}\"\n sleep(4 * attempts)\n end\n end\n end\n get_hash\n end", "def fake_exec_api(agent, operation, params)\n call = Call.new(agent, operation, params)\n stub = API.stubs.shift\n assert stub, \"Unexpected API call (no response stub set)\\n#{call}\"\n assert stub.test(call), \"Stub didn't match API call:\\n#{call}\"\n\n res = stub.response\n res = res.to_json_response if res.kind_of? CommandResponse\n logger.debug res\n return res\n end", "def stub_call(method:, message: :any, response:)\n savon.expects(method).with(message: message).returns(response)\n end", "def stub_meetup_calls!\n stub_request(:get, /api.meetup.com/).\n with(\n headers: {\n 'Accept'=>'*/*',\n 'Accept-Charset'=>'UTF-8',\n 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',\n 'User-Agent'=>'Ruby'\n }).\n to_return(status: 200, body: json_fixture, headers: {})\nend", "def call\n Success(call!)\n rescue => e\n return Failure(e) if whitelisted_error?(e.class)\n\n raise\n end", "def test_status_completed_request\n stub_request(:get, \"http://www.webpagetest.org/testStatus.php?f=json&test=#{TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_completed_response(TEST_ID).to_json)\n end", "def test_that_no_plane_can_take_off_with_a_storm_brewing\n \n @airport.stub :weather_conditions, \"stormy\" do\n assert_raises(RuntimeError) do\n @airport.take_off(@plane)\n end\n end\n end", "def test_status_running_request\n stub_request(:get, \"http://www.webpagetest.org/testStatus.php?f=json&test=#{TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_running_response(TEST_ID).to_json)\n end", "def stub_responses\n Creditsafe::Api::DummyResponse.new\n end", "def test_bad_response\n assert_log_matches('Server error when requesting an association') {\n assert_equal(call_negotiate([mk_message({})]), nil)\n }\n end", "def test_no_request_retry_get\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"0\", response.body)\n\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/delay-sec/20?backend_counter_id=get-timeout\", http_options)\n assert_response_code(504, response)\n assert_match(\"Inactivity Timeout\", response.body)\n\n # Ensure that the backend has only been called once.\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n\n # Wait 5 seconds for any possible retry attempts that might be pending, and\n # then ensure the backend has still only been called once.\n sleep 5\n response = Typhoeus.get(\"http://127.0.0.1:9442/backend_call_count?id=get-timeout\")\n assert_response_code(200, response)\n assert_equal(\"1\", response.body)\n end", "def test_bountyhill_quest_urls\n Bountybase::HTTP.stubs(:resolve).raises(\"Dont call me\")\n \n assert_nothing_raised { \n assert_equal 23, Bountybase::Graph.quest_id(\"http://bountyhill.local/quests/23\")\n assert_equal 42, Bountybase::Graph.quest_id(\"https://www.bountyhill.local/quests/42\")\n assert_equal nil, Bountybase::Graph.quest_id(\"https://www.bountyhill.local/account/12\")\n\n # These are real bountyhill URLs\n assert_equal 123, Bountybase::Graph.quest_id(\"http://bountyhill-staging-web1.herokuapp.com/quests/123\")\n assert_equal 123, Bountybase::Graph.quest_id(\"http://bountyhill-staging-web1.herokuapp.com/q/123\")\n assert_equal 123, Bountybase::Graph.quest_id(\"http://bountyhill.herokuapp.com/quests/123\")\n assert_equal 123, Bountybase::Graph.quest_id(\"http://bountyhill.herokuapp.com/q/123\")\n assert_equal 123, Bountybase::Graph.quest_id(\"https://bountyhill.com/quests/123\")\n assert_equal 123, Bountybase::Graph.quest_id(\"https://bountyhill.com/q/123\")\n assert_equal 123, Bountybase::Graph.quest_id(\"https://www.bountyhill.com/quests/123\")\n assert_equal 123, Bountybase::Graph.quest_id(\"https://www.bountyhill.com/q/123\")\n\n assert_equal nil, Bountybase::Graph.quest_id(\"https://bountyhill.com/xyz/123\")\n assert_equal nil, Bountybase::Graph.quest_id(\"https://www.bountyhill.com\")\n }\n end", "def test_dispatch_error_status_code\n Net::HTTP.class_eval do\n def self.get_response(*_args) # rubocop:todo Lint/DuplicateMethods\n DummyResponse.new('503')\n end\n end\n\n properties = {\n 'env' => 'dummyKey',\n 'combination' => 1,\n 'url' => 'https://dev.visualwebsiteoptimizer.com/server-side/track-user', # noqa: E501\n 'ed' => '{\"p\": \"server\"}',\n 'random' => 0.7382938446947298,\n 'ap' => 'server',\n 'u' => '09CD6107E42B51F9BFC3DD97EA900990',\n 'experiment_id' => 229,\n 'sId' => 1_565_949_670,\n 'sdk-v' => '1.0.2',\n 'sdk' => 'python',\n 'account_id' => 60_781\n }\n\n result = @dispatcher.dispatch(properties, {}, 'end_point')\n assert_equal(result, false)\n end", "def other_test_result_request\n stub_request(:get, \"http://www.webpagetest.org/jsonResult.php?pagespeed=1&test=#{OTHER_TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_result_response(OTHER_TEST_ID).to_json)\n end", "def test_post_to_hipchat_with_failures\n stub_request(:post, 'http://api.hipchat.com/v1/rooms/message').to_return(\n {:status => ['500', 'Server Error']},\n {:status => ['500', 'Server Error']},\n {:body => 'OK'}\n )\n\n HipChat.post_to_hipchat('fake_room', 'my_message2')\n HipChat.await_retries_for_test\n assert_requested :post, 'http://api.hipchat.com/v1/rooms/message', times: 3 do |req|\n req.body.match /message=my_message2/\n end\n\n assert_equal 2, HipChat.retries_for_test\n assert_in_delta BACKOFF + (2 * BACKOFF), HipChat.total_backoff_for_test\n end", "def test_email_client_all_clients_internal_error\n MailgunClient.stubs(:send_email).returns(internal_err_code)\n SendgridClient.stubs(:send_email).returns(internal_err_code)\n\n input_val = EmailObject.new\n response = ClientResponse.new input_val\n response.set_internal_err\n\n assert_equal response, EmailClient.send_email(input_val)\n end", "def retry\n self.solved(:retry)\n end", "def mock_error_type\n _undefined\n end", "def mock_gateway_response(response:,\n method:,\n path:,\n body: nil,\n json_body: true,\n timeout: nil,\n authorization_bearer: nil,\n authorization_token_hash: nil,\n gateway: nil,\n gateway_repository_name: :gateway,\n headers: nil,\n expect: false,\n &block)\n\n gateway ||= ArtirixDataModels::ADMRegistry.instance.get(gateway_repository_name)\n\n callable = block_given? ? block : ->(x) { x }\n\n unless body.nil? || !json_body\n body = body.kind_of?(String) ? body : body.to_json\n end\n\n params_hash = {\n path: path,\n body: body,\n json_body: json_body,\n timeout: timeout,\n authorization_bearer: authorization_bearer,\n authorization_token_hash: authorization_token_hash,\n headers: headers\n }\n\n what_to_allow = callable.call(receive(:perform).with(method, params_hash).and_return(response))\n\n if expect\n expect(gateway).to what_to_allow\n else\n allow(gateway).to what_to_allow\n end\nend", "def test_status_code_is_present\n res = get_wrapped_response(default_url)\n\n assert_equal 200, res.status_code\n end", "def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end", "def stuff_999_response(env, err)\n env.tap do\n _1.reason_phrase = \"#{err.class} #{err.message}\"\n _1.response_body = ''\n _1.response_headers = Faraday::Utils::Headers.new\n _1.status = HTTPDisk::ERROR_STATUS\n end\n Faraday::Response.new(env)\n end", "def perform_op(method, req_hash, options={}, &blk)\n set_defaults(options)\n max_retries = options[:max_retries] || 5\n max_follows = options[:max_follows] || 10\n if options[:follow_count] && options[:follow_count] >= max_follows\n raise Rest::RestError, \"Too many follows. #{options[:follow_count]}\"\n end\n current_retry = 0\n current_follow = 0\n success = false\n tries = 0\n res = nil\n # todo: typhoeus does retries in the library so it shouldn't do retries here. And we should use the max_retries here as a parameter to typhoeus\n while current_retry < max_retries && current_follow < max_follows do\n tries += 1\n begin\n res = yield blk\n res.tries = tries\n if res.code >= 300 && res.code < 400\n # try new location\n #p res.headers\n loc = res.headers[\"location\"]\n @logger.debug \"#{res.code} Received. Trying new location: #{loc}\"\n if loc.nil?\n raise InvalidResponseError.new(\"No location header received with #{res.code} status code!\")\n end\n # options.merge({:max_follows=>options[:max_follows-1]}\n options[:follow_count] ||= 0\n options[:follow_count] += 1\n res = perform_op(method, req_hash, options) do\n res = @wrapper.send(method, loc, req_hash)\n end\n #puts 'X: ' + res.inspect\n return res\n end\n # If it's here, then it's all good\n break\n rescue Rest::HttpError => ex\n if ex.code == 503\n raise ex if current_retry == max_retries - 1\n\n pow = (4 ** (current_retry)) * 100 # milliseconds\n #puts 'pow=' + pow.to_s\n s = rand * pow\n #puts 's=' + s.to_s\n sleep_secs = 1.0 * s / 1000.0\n #puts 'sleep for ' + sleep_secs.to_s\n current_retry += 1\n @logger.debug \"#{ex.code} Received. Retrying #{current_retry} out of #{max_retries} max in #{sleep_secs} seconds.\"\n sleep sleep_secs\n else\n raise ex\n end\n end\n end\n res\n end", "def test_monkey_slash_recent_endpoint\n # See Email: monkey/recent constantly timing out\n skip_message = 'Dickson & Jorge are looking into monkey/recent timing out in the db: This sql took 38 seconds to run in stg and only .005 second in production.'\n assign_http(Config['monkey']['host'])\n\n get '/recent', {}\n skip(\"#{skip_message} -- #{@parsed_response['message']}\") if @parsed_response['message'] =~ /Gateway\\:\\:GatewayTimeout/\n assert_response(@response, :success)\n end", "def _create_http_response(mock_response, code, message)\n mock_response.stub!(:code).and_return(code)\n mock_response.stub!(:message).and_return(message)\n mock_response.stub!(:is_a?).and_return(true) if [\"200\", \"201\"].member?(code)\nend", "def test_misfortune\n # find a usable canary URI (one that returns an acceptable status code already)\n if canary = find_canary\n canary_value, canary_code = canary\n vprint_status(\"#{peer} found canary URI #{canary_value} with code #{canary_code}\")\n else\n vprint_error(\"#{peer} Unable to find a suitable canary URI\")\n return Exploit::CheckCode::Unknown\n end\n\n canary_cookie_name = 'C107373883'\n canary_cookie = canary_cookie_name + \"=#{canary_value};\"\n\n # Make a request containing a specific canary cookie name with the value set\n # from the suitable canary value found above.\n res = send_request_raw(\n 'uri' => normalize_uri(target_uri.path.to_s),\n 'method' => 'GET',\n 'headers' => headers.merge('Cookie' => canary_cookie)\n )\n\n unless res\n vprint_error(\"#{full_uri} no response\")\n return Exploit::CheckCode::Unknown\n end\n\n unless res.code.to_s =~ @status_codes_regex\n vprint_status(\"#{full_uri} unexpected HTTP code #{res.code} response\")\n return check_response_fingerprint(res, Exploit::CheckCode::Detected)\n end\n\n unless res.body\n vprint_status(\"#{full_uri} HTTP code #{res.code} had no body\")\n return check_response_fingerprint(res, Exploit::CheckCode::Detected)\n end\n\n # If that canary *value* shows up in the *body*, then there are two possibilities:\n #\n # 1) If the canary cookie *name* is also in the *body*, it is likely that\n # the endpoint is puppeting back our request to some extent and therefore\n # it is expected that the canary cookie *value* would also be there.\n # return Exploit::CheckCode::Detected\n #\n # 2) If the canary cookie *name* is *not* in the *body*, return\n # Exploit::CheckCode::Vulnerable\n if res.body.include?(canary_value)\n if res.body.include?(canary_cookie_name)\n vprint_status(\"#{full_uri} HTTP code #{res.code} response contained canary cookie name #{canary_cookie_name}\")\n return check_response_fingerprint(res, Exploit::CheckCode::Detected)\n else\n vprint_good(\"#{full_uri} HTTP code #{res.code} response contained canary cookie value #{canary_value} as URI\")\n report_vuln(\n host: rhost,\n port: rport,\n name: name,\n refs: references\n )\n return Exploit::CheckCode::Vulnerable\n end\n end\n\n vprint_status(\"#{full_uri} HTTP code #{res.code} response did not contain canary cookie value #{canary_value} as URI\")\n check_response_fingerprint(res, Exploit::CheckCode::Safe)\n end", "def expect_server_error_status\n is_expected.to respond_with 500\n end", "def test_request(digest, rem_ip, port)\n device = Device.find_by_id_digest(digest)\n puts \"-- Test_request on device \" + device.dev_name + \" (\" + device.id.to_s + \")\"\n address = nil\n i = 0\n while i < 2 do\n begin\n address = \"http://\" << rem_ip\n uri = URI.parse(address)\n if port != nil\n address << \":\" << port.to_s\n else\n port = uri.port\n end\n puts \"-- Timeout count #\" + (i+1).to_s + \" BEGIN on device: \" + device.dev_name + \" (\" + device.id.to_s + \"), \" + address\n timeout(5 + 15*i) do\n Net::HTTP.start(uri.host, port) { |http|\n response = http.head(uri.path.size > 0 ? uri.path : \"/\")\n }\n i = 2\n end\n puts \"-- Timeout count #\" + (i+1).to_s + \" END on device: \" + device.dev_name + \" (\" + device.id.to_s + \")\"\n rescue TimeoutError\n puts \"-- TIMEOUT #\" + (i+1).to_s + \"on device: \" + device.dev_name + \" (\" + device.id.to_s + \")\"\n device.update_attribute(:direct_access, false)\n device.update_attribute(:address, nil)\n i += 1\n if i == 2\n return\n end\n rescue => exception\n puts exception\n puts \"-- HTTP ERROR on device: \" + device.dev_name + \" (\" + device.id.to_s + \")\"\n device.update_attribute(:direct_access, false)\n device.update_attribute(:address, nil)\n return\n end\n end\n device.update_attribute(:direct_access, true)\n device.update_attribute(:address, address)\n \n ActiveRecord::Base.verify_active_connections!()\n puts \"-- Test_request SUCCESSFUL on device: \" + device.dev_name + \" (\" + device.id.to_s + \"), \" + address\n end", "def should_retry?(code)\n false\n end", "def test_time_out\n get_method = proc { create_op MockOperation.new(status: :NOTDONE, name: NAME) }\n mock_client = MockLroClient.new get_method: get_method\n op = create_op MockOperation.new(status: :NOTDONE, name: NAME), client: mock_client\n\n sleep_counts = [10, 20, 40, 80]\n sleep_mock = Minitest::Mock.new\n sleep_counts.each do |sleep_count|\n sleep_mock.expect :sleep, nil, [sleep_count]\n end\n sleep_proc = ->(count) { sleep_mock.sleep count }\n\n Kernel.stub :sleep, sleep_proc do\n time_now = Time.now\n incrementing_time = lambda do\n delay = sleep_counts.shift || 160\n time_now += delay\n end\n Time.stub :now, incrementing_time do\n retry_config = { initial_delay: 10, multiplier: 2, max_delay: (5 * 60), timeout: 400 }\n op.wait_until_done! retry_policy: retry_config\n refute op.done?\n end\n end\n\n sleep_mock.verify\n end", "def test_result_request\n stub_request(:get, \"http://www.webpagetest.org/jsonResult.php?pagespeed=1&test=#{TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_result_response(TEST_ID).to_json)\n end", "def mock_devices options\n mac = '11:22:33:44:55:%02d' % options[:id]\n escaped_mac = mac.gsub /:/, '%3A'\n allow(Mac).to receive(:addrs) { [mac] }\n\n if options[:register_fail]\n stub_request(:put, \"http://hivemind/api/devices/update_state.json\").\n to_return(:status => 500, :body => \"{}\", :headers => {})\n\n stub_request(:post, \"http://hivemind/api/devices/register.json\").\n with(body: /%5Bmacs%5D%5B%5D=#{escaped_mac}/).\n to_return(:status => 500, :body => '', :headers => {})\n else\n stub_request(:post, \"http://hivemind/api/devices/register.json\").\n with(body: /%5Bmacs%5D%5B%5D=#{escaped_mac}/).\n to_return(:status => 200, :body => {id: options[:id], connected_devices: options[:hm_devices]}.to_json, :headers => {})\n\n stub_request(:put, \"http://hivemind/api/devices/poll.json\").\n with(body: /%5Bdevice_id%5D=#{options[:id]}/).\n to_return(:status => 200, :body => \"{}\", :headers => {})\n\n stub_request(:put, \"http://hivemind/api/devices/update_state.json\").\n with(body: /%5Bdevice_id%5D=#{options[:id]}/).\n to_return(:status => 200, :body => \"{}\", :headers => {})\n \n end\n\n if options[:poll_fail]\n stub_request(:put, \"http://hivemind/api/devices/poll.json\").\n with(body: /id%5D=#{options[:id]}/).\n to_return(:status => 500, :body => '{}', :headers => {})\n else\n stub_request(:put, \"http://hivemind/api/devices/poll.json\").\n with(body: /id%5D=#{options[:id]}/).\n to_return(:status => 200, :body => {connected_devices: options[:hm_devices]}.to_json, :headers => {})\n end\n allow(DeviceAPI::Android).to receive(:devices) { options[:adb_devices] }\nend", "def test_wait_until_done\n to_call = 3\n get_method = proc do\n to_call -= 1\n status = to_call == 0 ? :DONE : :NOT_DONE\n MockOperation.new(status: status, name: NAME)\n end\n\n mock_client = MockLroClient.new get_method: get_method\n op = create_op MockOperation.new(status: :NOTDONE, name: NAME), client: mock_client\n\n sleep_counts = [10.0, 13.0, 16.900000000000002]\n sleep_mock = Minitest::Mock.new\n sleep_counts.each do |sleep_count|\n sleep_mock.expect :sleep, nil, [sleep_count]\n end\n\n sleep_proc = ->(count) do \n sleep_mock.sleep count \n end\n\n Kernel.stub :sleep, sleep_proc do\n time_now = Time.now\n Time.stub :now, time_now do\n op.wait_until_done!\n end\n end\n\n sleep_mock.verify\n assert_equal 0, to_call\n end", "def test_exponential_backoff\n call_count = 0\n get_method = proc do\n call_count += 1\n if call_count >= 10\n MockOperation.new(status: :DONE, name: NAME)\n else\n MockOperation.new(status: :NOT_DONE, name: NAME)\n end\n end\n mock_client = MockLroClient.new get_method: get_method\n op = create_op MockOperation.new(status: :NOT_DONE, name: NAME), client: mock_client\n\n sleep_counts = [10, 20, 40, 80, 160, 300, 300, 300, 300, 300]\n sleep_mock = Minitest::Mock.new\n sleep_counts.each do |sleep_count|\n sleep_mock.expect :sleep, nil, [sleep_count]\n end\n sleep_proc = ->(count) { sleep_mock.sleep count }\n\n Kernel.stub :sleep, sleep_proc do\n time_now = Time.now\n incrementing_time = lambda do\n delay = sleep_counts.shift || 300\n time_now += delay\n end\n Time.stub :now, incrementing_time do\n retry_config = { initial_delay: 10, multiplier: 2, max_delay: (5 * 60), timeout: (60 * 60) }\n op.wait_until_done! retry_policy: retry_config\n assert op.done?\n end\n end\n\n sleep_mock.verify\n end", "def some_method(message)\n # Write your own code here to build request and parse response\n request = ProtobufRubyExample::Proto::RequestPb.new(id: rand(100), message: message)\n\n response = @rpc_stub.some_method(request)\n\n return response.status\n end", "def mock_send_request_to_s3_adapter\n stub_request(:get, \"https://my-library-nyc-config.s3.amazonaws.com/test/feature_flag.yml\")\n .to_return(\n { status: 200, body: { 'status' => 'success' }.to_json, headers: {} },\n { status: 500, body: { 'status' => 'failure' }.to_json, headers: {} }\n )\n end", "def successful_response_to\n attempts = 0\n loop do\n random_response = yield\n if random_response.success?\n return random_response\n elsif attempts > 2\n raise 'Unable to get a successful response'\n else\n assert_equal 'Declined_(General).', random_response.params.fetch('error')\n attempts += 1\n end\n end\n end", "def detect\n get\n handle_response_code\n return @retval\n rescue Errno::ECONNREFUSED\n return [\"??? Cannot connect to #{@url}\"]\n rescue Exception => e\n return [\"??? Error: #{e.message}\"]\n end", "def test_WAPI_do_request_successful\n\n z='{\"mystuff\":\"yourstuff\"}'\n\n stub_request(:get, \"https://start/hey\").\n with(:headers => {'Accept' => 'application/json', 'Authorization' => 'Bearer sweet!', 'User-Agent' => 'Ruby'}).\n to_return(:status => 200, :body => z, :headers => {})\n\n a = Hash['api_prefix' => \"https://start\",\n 'key' => 'key',\n 'secret' => 'secret',\n 'token_server' => 'nowhere.edu',\n 'token' => 'sweet!'\n ]\n h = WAPI.new(a);\n\n wr = h.do_request(\"/hey\")\n logger.info \"#{__LINE__}: wr \"+wr.inspect\n\n ## get status of successful in wrapper\n assert_equal 200, wr.meta_status\n\n r = wr.result\n logger.info \"#{__LINE__}: r \"+r.inspect\n\n ## verify that body came through\n body = JSON.parse(r)\n logger.info \"#{__LINE__}: body \"+body.inspect\n assert_equal \"yourstuff\", body[\"mystuff\"]\n end", "def stub_self_data_request(response_code = 200)\n body = response_code == 200 ? Yajl::Encoder.encode(:user => valid_user_cache_data['me']) : \"\"\n stub_request(:get, \"https://#{valid_params[:subdomain]}.campfirenow.com/users/me.json\").\n with(:headers => {'Authorization'=>['6124d98749365e3db2c9e5b27ca04db6', 'X'], 'Content-Type'=>'application/json', 'User-Agent' => valid_params[:user_agent]}).\n to_return(:status => response_code, :body => body, :headers => {:ETag => etag_for_data(valid_user_cache_data['me'])})\nend", "def test_error_in_check_completion\n new_ab_test(:ab) { metrics :happiness }\n e = experiment(:ab)\n e.complete_if { true }\n e.stubs(:complete!).raises(RuntimeError, \"A forced error\")\n e.expects(:warn)\n e.stubs(:identity).returns(:b)\n e.track!(:a, Time.now, 10)\n end", "def mas_net_http_response(status = :success, \n body = '', \n obj_stubs = {})\n response = Spec::Mocks::Mock.new(Net::HTTPResponse)\n response.stub!(:body).and_return(body)\n case status\n when :success || 200\n _create_http_response(response, \"200\", \"OK\")\n when :created || 201\n _create_http_response(response, \"201\", \"Created\")\n when :redirect || 301\n _create_http_response(response, \"301\", \"Redirect\")\n when :not_authorized || 401\n _create_http_response(response, \"401\", \"Not Authorized\")\n when :forbidden || 403\n _create_http_response(response, \"403\", \"Forbidden\")\n when :file_not_found || 404\n _create_http_response(response, \"404\", \"File Not Found\")\n when :server_error || 500\n _create_http_response(response, \"500\", \"Server Error\")\n end\n response\nend", "def ensure_with_retries(type, repo, object)\n attempts = 1\n send(\"ensure_#{type}\".to_sym, repo, object)\nrescue Octokit::BadGateway => e\n raise \"Too many errors received from Github. Cannot continue! #{e}\" if attempts > 10\n sleep 5\n attempts += 1\n retry\nrescue Octokit::TooManyRequests\n time_until_limit_over = github.rate_limit[\"resets_in\"] + 5 # 5 more to be safe\n decorator = TTY::Spinner.new(\" :spinner GitHub API limit reached! Waiting #{time_until_limit_over} seconds before making the next request\", format: :spin)\n decorator.run { sleep time_until_limit_over }\n retry\nend", "def test_do_not_call_finish_on_an_absent_segment\n desc = basic_grpc_desc\n def desc.trace_with_newrelic?; true; end # force a true response from this method\n def desc.process_distributed_tracing_headers(ac); end # noop this DT method (tested elsewhere)\n def desc.metadata_for_call(call); NewRelic::EMPTY_HASH; end # canned. test metadata_for_call elsewhere\n # force finishable to be nil\n NewRelic::Agent::Tracer.stub(:start_transaction_or_segment, nil) do\n result = desc.handle_with_tracing(nil, nil, method, nil) { return_value }\n\n assert_equal return_value, result\n # MiniTest does not have a wont_raise, but this test would fail if\n # finishable called #finish when nil\n end\n end", "def test_no_plane_can_land_if_airport_is_full\n @airport.stub :weather_conditions, \"sunny\" do\n plane2 = Plane.new(2)\n plane3 = Plane.new(3)\n @airport.land(@plane)\n @airport.land(plane3)\n assert_raises(RuntimeError) do\n @airport.land(plane2)\n end\n end \n end", "def test_errored_operation_message\n error = OpenStruct.new(code: ERR_CODE, message: ERR_MSG)\n op = create_op MockOperation.new(status: :DONE, err: error), err_field: \"err\"\n assert op.done?\n assert op.error?\n refute op.response?\n assert_equal error, op.results\n assert_equal error, op.error\n assert_nil op.response\n end", "def test(*args)\n client.ping\n\n { success: true, result: 'Checked API endpoint' }\n rescue Gitlab::PrometheusError => err\n { success: false, result: err }\n end", "def test_post_to_hipchat_with_repeated_failure\n stub_request(:post, 'http://api.hipchat.com/v1/rooms/message').to_return(\n {:status => ['500', 'Server Error']}\n )\n\n CDO.log.info 'Expecting following HipChat post to fail:'\n HipChat.post_to_hipchat('fake_room', 'my_message3')\n HipChat.await_retries_for_test\n\n # Make we only tried 3 times (HipChat.MAX_RETRIES)\n assert_equal 3, HipChat.retries_for_test\n assert_in_delta BACKOFF + (2 * BACKOFF) + (4 * BACKOFF),\n HipChat.total_backoff_for_test\n end", "def test_status_red_on_dev_red\n status = {'status' => {'development' => 'red', 'production' => 'green'}}\n Excon.stub({method: :get}, {body: status.to_json, status: 200})\n\n authorize 'user', 'password'\n assert_output( /red/,'') { get '/status' }\n last_response.body.must_equal 'red'\n end", "def test_service_error_response\n twerr = Twirp::Error.invalid_argument('foo')\n resp = Twirp::Service.error_response(twerr)\n assert_equal 400, resp[0]\n assert_equal 'application/json', resp[1]['Content-Type']\n assert_equal '{\"code\":\"invalid_argument\",\"msg\":\"foo\"}', resp[2][0]\n end", "def test_done_operation_zeroerrcode\n op = create_op MockOperation.new(status: :DONE, err_code: 0)\n assert op.done?\n refute op.error?\n assert op.response?\n assert_nil op.error\n refute_nil op.response\n end", "def test_status_green_on_green\n status = {'status' => {'development' => 'green', 'production' => 'green'}}\n Excon.stub({method: :get}, {body: status.to_json, status: 200})\n\n authorize 'user', 'password'\n assert_output(/green/,'') { get '/status' }\n last_response.body.must_equal 'green'\n end", "def test_that_no_plane_can_land_when_there_is_a_storm_brewing\n @airport.stub :weather_conditions, \"stormy\" do\n assert_raises(RuntimeError) do\n @airport.land(@plane)\n end \n end \n end", "def unknown; status[:unknown]; end", "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.timed_out?\n fail ApiError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => response.body),\n response.status_message\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end", "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.timed_out?\n fail ApiError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => response.body),\n response.status_message\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end", "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.timed_out?\n fail ApiError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => response.body),\n response.status_message\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end", "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.timed_out?\n fail ApiError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => response.body),\n response.status_message\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end", "def api_connect(server, endpoint)\n url= \"http://#{server}:4569/#{endpoint}\"\n #puts url\n begin \n response = open(url).read\n rescue Errno::ECONNREFUSED\n return :unreachabe\n rescue Errno::ENETUNREACH\n return :unreachabe\n rescue Errno::ETIMEDOUT\n return :unreachabe\n rescue Errno::EHOSTUNREACH\n return :unreachable\n end\n \n return response\nend", "def handle_http_error(res)\n if res.code == \"202\" # retry\n self.call\n else\n raise \"Error in FoodTruckApiClient: Call to API failed, returning the HTTP status code #{res.code} and the following error message: #{error}\"\n end\n end", "def mock_vehicle_not_found_in_dvla\n allow(ComplianceCheckerApi)\n .to receive(:vehicle_details)\n .and_raise(BaseApi::Error404Exception.new(404, '', {}))\n end" ]
[ "0.6178254", "0.6141393", "0.60216916", "0.59456843", "0.5910256", "0.5890731", "0.5865106", "0.58541054", "0.5812357", "0.57681704", "0.57539564", "0.57478607", "0.57234883", "0.57191676", "0.56989217", "0.56568074", "0.56478715", "0.56476104", "0.5606398", "0.55973184", "0.5580324", "0.5564777", "0.5517927", "0.5506444", "0.5474862", "0.5443437", "0.54322463", "0.54181176", "0.5375391", "0.53753257", "0.53735507", "0.5355818", "0.5344256", "0.533856", "0.53315437", "0.53282666", "0.5327522", "0.5321961", "0.5311645", "0.53068566", "0.53000116", "0.52991325", "0.52974397", "0.52941287", "0.5292968", "0.52812123", "0.52784216", "0.52711844", "0.5232051", "0.5229689", "0.5219999", "0.5212442", "0.52069396", "0.51735884", "0.51647985", "0.5146128", "0.5137435", "0.51368475", "0.5136652", "0.51298845", "0.5124451", "0.51239026", "0.5119292", "0.51114005", "0.51095784", "0.510501", "0.5099926", "0.50922984", "0.5090058", "0.5089893", "0.50897133", "0.5074628", "0.507058", "0.5069883", "0.5068757", "0.5067922", "0.50657076", "0.50618315", "0.5051691", "0.5046541", "0.5043639", "0.5041838", "0.5029712", "0.50243455", "0.50146484", "0.5013093", "0.49991855", "0.49958503", "0.49911067", "0.49807847", "0.49769092", "0.49756455", "0.49701735", "0.4969301", "0.4969301", "0.4969301", "0.4969301", "0.49664816", "0.4963322", "0.4959423" ]
0.67977315
0
gives access only to admins
def admin_authorize unless admin? unauthorized_access end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def admin_only\n logged_in_as_admin? || admin_only_access_denied\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 only_authorize_admin!\n authorize!(is?(:admin))\n end", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def admin_in!\n access_denied! unless current_user.admin?\n end", "def admin_required\n current_user.is_admin? || access_denied\n end", "def admin_only\n deny_access(\"You must be signed in as an admin to access this page.\") unless signed_in_as_admin?\n end", "def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def admin_access?\n admin?\n end", "def only_for_admins\n raise ActiveRecord::RecordNotFound unless current_user.has_role? :admin\n end", "def require_admin\n deny_wrong_user if !admin?\n end", "def must_be_admin!\n access_denied! unless current_admin?\n end", "def ensure_admin!\n authorize! :read, :admin_dashboard\n end", "def ensure_admin!\n authorize! :read, :admin_dashboard\n end", "def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end", "def must_be_admin\n if current_user.is? \"EA\"\n return true\n else\n redirect_to root_path,:notice =>\"Access Denied...\"\n end\n end", "def admin_only\n @user = current_user\n if @user.role != \"admin\"\n redirect_to root_path\n end\n end", "def adminprotected!\n if authorized? == true and isuseradmin? == true\n return\n else redirect '/denied'\n end\n end", "def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\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 admin_access\n if current_user.access? :admin\n return true\n elsif current_user\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to nationalities_path\n else\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to login_path\n end\n end", "def show\n authorize @admin\n end", "def has_admin_access?\n admin? || moderator?\n end", "def user_accessible?\n is_admin\n end", "def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end", "def authorize_admin!\n authorize! :manage, :all\n end", "def admin\n\t\tcan :manage, :all\n\tend", "def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end", "def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end", "def admin_authorized?\n\t\tif @user\n\t\t\t@user.level >= ADMIN_USER_LEVEL \n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def is_admin\n test_access :admin\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def admin_only\n false\n end", "def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end", "def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end", "def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def show\n # authorize Admin\n end", "def admin_only\n current_client == current_user\n unless current_user.admin? || @client == current_user\n redirect_to clients_path, :alert => \"Access denied.\"\n end\n end", "def authorize_admin\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level == 2\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"access_denied\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end", "def authorize_admin\n return unless current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def admins_only\n if current_user.nil? or !current_user.is_admin?\n # Silently redirect, no need to tell anyone why. If they're\n # not an admin, they have no business here\n redirect_to root_path\n end\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def admin_only\n\t\t\tif logged_in?\n\t\t\t\tif User.find_by(id: current_user.id.to_i).admin != true\n\t\t\t\t\tredirect_to root_path, :alert => \"Odmowa dostępu musisz być adminem\"\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def only_admin\n if user_role == 'admin'\n else\n redirect_to clients_path, notice: \"У вас нет прав для просмотра даного раздела, или редактирования информации\"\n end\n end", "def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end", "def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end", "def access_whitelist\n current_user.try(:admin?) || current_user.try(:editor?) || current_user.try(:door_super?)\n end", "def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end", "def show\n authorize! :read, @admin_system_admin\n end", "def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end", "def admin_permission\n if session[:position].to_s == \"Secretary\" or\n session[:position].to_s == \"Treasurer\" or\n session[:position].to_s == \"Chairman\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n position: session[:position]\n return false\n end\n\n end", "def administrator\n can :manage, :all\n end", "def authorize_admin_path_only\n @show_to_admin_only = false\n if request.path =~ /admin/\n authorize\n @show_to_admin_only = true\n end\n end", "def is_admin\n render status: :unauthorized unless current_user.admin\n end", "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "def authorize_admin\n if user = User.find_by_id(session[:user_id])\n unless user.role == \"admin\"\n redirect_to login_url, :notice => \"You don't have permissions to view this page\"\n end\n end\n end", "def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end", "def authenticate_admin!\n access_denied! unless current_user.admin?\n end", "def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end", "def admin_only(&block)\n role_only(\"admin\", &block)\n end", "def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end", "def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end", "def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end", "def is_admin?\n admin\n end", "def is_admin?\n admin\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend", "def authorize_admin!\n redirect_to login_path unless current_user\n end", "def require_admin\n if !logged_in? or !current_user.admin?\n redirect_to login_path, :alert => \"Access denied.\"\n end\n end", "def isAdmin?\n if session[:perm] == 1\n return true;\n else\n return false;\n end\n end", "def show\n is_admin?\n end", "def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend", "def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end", "def require_admin_roles\r\n if logged_in? and not current_user.has_admin_roles?\r\n not_authorized\r\n end\r\n end", "def authorize_admin!\n redirect_to home_path unless current_user&.admin\n end", "def check_admin\n\t\tif current_user && current_user.role == 2\n\t\telsif current_user && current_user.role != 2\n\t\t\tredirect_to buildings_url, notice: 'You are not authorized'\n\t\telse\n\t\t\tredirect_to buildings_url, notice: 'You are not logged in'\n\t\tend\n\tend", "def require_admin\n unless env['warden'].user.advisor? || env['warden'].user.resident?\n flash.error = \"You are not authorized to access that page.\"\n redirect '/'\n end\n end", "def show\n isadmin\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end", "def admin?( id )\n acl.has_permission?(id, AlbumACL::ADMIN_ROLE) || SystemRightsACL.singleton.has_permission?(id, SystemRightsACL::SUPPORT_HERO_ROLE)\n end", "def authorized?\n current_user.login == \"Admin\"\n end", "def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n end\n end", "def show\n is_admin?\n end", "def checkAdmin\n current_user.present? && current_user.isAdmin\n end", "def admin()\n @data[\"access\"][\"user\"][\"roles\"].each do |role|\n if role[\"name\"].eql?(\"admin\")\n return true\n end\n end\n return false\n end", "def is_admin\n admin?\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def is_admin\n if current_user && !((current_user.roles.first.name==\"Super Admin\" || current_user.roles.first.name==\"Department Admin\") && current_user.role_memberships.first.status==\"A\")\n redirect_to dashboard_index_path\n end\n end", "def require_admin\n unless !current_user.nil? && current_user.admin?\n render file: 'public/401.html', status: :unauthorized\n end\n end", "def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end" ]
[ "0.86371636", "0.83459985", "0.82223135", "0.82223135", "0.82223135", "0.8175221", "0.8144395", "0.80259246", "0.8019694", "0.8017181", "0.80156016", "0.7998937", "0.78378737", "0.7828317", "0.78093797", "0.7798542", "0.77846724", "0.77846724", "0.7780404", "0.77686113", "0.7765058", "0.7763252", "0.77614284", "0.7755435", "0.7729244", "0.7725183", "0.7722924", "0.7705577", "0.77028537", "0.76915634", "0.76877755", "0.7676951", "0.7676712", "0.7674193", "0.7665523", "0.7660338", "0.7660317", "0.765805", "0.76534635", "0.7646178", "0.7630463", "0.7630463", "0.76289994", "0.76241523", "0.76231325", "0.7616913", "0.76117784", "0.7593981", "0.75754267", "0.7574636", "0.7572268", "0.75708485", "0.756546", "0.753661", "0.7516025", "0.7510188", "0.75014395", "0.75006753", "0.74994415", "0.74859726", "0.7479957", "0.7479147", "0.74625325", "0.74489045", "0.74442935", "0.7436463", "0.74351245", "0.7434949", "0.7431743", "0.74282426", "0.74282426", "0.742401", "0.742401", "0.7422993", "0.7421643", "0.74133325", "0.74132675", "0.74116135", "0.7410802", "0.74071896", "0.7404402", "0.7398896", "0.7389283", "0.73841006", "0.7382493", "0.73737705", "0.7371842", "0.73709905", "0.7369969", "0.7369357", "0.73687935", "0.7368066", "0.7366538", "0.73664826", "0.73664826", "0.73664826", "0.73664826", "0.7362672", "0.73584884", "0.7356355" ]
0.80476624
7
gives access only to site users who are logged in
def logged_in_authorize unless logged_in? unauthorized_access end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_only\n deny_access(\"You must be signed in to access this page.\") unless signed_in?\n end", "def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end", "def require_logged_in_user\n if !current_user\n head 403\n end\n end", "def check_user_access\n check_access_and_redirect(@request)\n end", "def user_access\n @bot = current_user.admin? ? Bot.find(params[:id]) : current_user.bots.find(params[:id])\n\n check_user_access(@bot.account.user_id)\n\n rescue\n flash_access_denied\n end", "def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\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 check_login\n head :forbidden unless self.current_user\n end", "def logged_in?\n !session[:user_id].nil? #&& User.find(session[:user_id]).owns(@current_site)\n end", "def show\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end", "def require_auth(user)\n return head(:forbidden) unless current_user == user.account\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 restrict_access\n if session[:user_id]\n if !setting_params.nil?\n setting_params[:user_id] = session[:user_id]\n end\n else\n authenticate_or_request_with_http_token do |token, options|\n @user = User.where(:auth_token => token).first()\n if (@user)\n if !setting_params.nil?\n setting_params[:user_id] = @user.id\n end\n return true\n end\n false\n end\n end\n end", "def allow_access\n !@current_user.nil?\n end", "def allow_access_by_any_user\n @attributes[:allow_access_by_any_user]\n end", "def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n if User.exists?(token: token)\n @currentUser = User.find_by_token(token)\n end\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 users_only\n unless logged_in?\n redirect_to(:sign_in)\n return false\n end\n\n return true\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def index\n redirect_to(:action => 'login') and return unless logged_in?\n \n @user = current_user\n end", "def accessible_by?(user)\n return false unless user&.logged_in?\n\n accessible_by_user?(user)\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def check_current_user_owns\n head :not_found unless @user == current_user\n end", "def site_authenticate\n deny_access unless signed_in?\n end", "def before_filter\n if current_user\n true\n end\n end", "def access_whitelist\n current_user.try(:admin?) || current_user.try(:editor?) || current_user.try(:door_super?)\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 logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\t end\n end", "def restrict_access\n\t authenticate_or_request_with_http_token do |token, options|\n\t User.exists?(api_key: token)\n\t end\n\tend", "def restrict_users\n \t\tif user_signed_in?\n \t\t\tif current_user.has_role? :client\n \t\t\t\tif current_user.profile.agreed == nil\n \t\t\t\t\tredirect_to edit_profile_path(current_user.profile)\n \t\t\t\tend\n \t\t\tend\n\n \t\tend\n\n \tend", "def restrict_access\n if session[:user_id]\n if !report_publication_params.nil?\n report_publication_params[:user_id] = session[:user_id]\n end\n else\n authenticate_or_request_with_http_token do |token, options|\n @user = User.where(:auth_token => token).first()\n if (@user)\n if !report_publication_params.nil?\n report_publication_params[:user_id] = @user.id\n end\n return true\n end\n false\n end\n end\n end", "def restrict_access\n render :\"/home/http_404\" unless @profile && @profile.user == current_user\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def declared_user\n if logged_in?\n if Protege.find_by(user_id: current_user.id.to_i).nil?\n redirect_to root_path, :alert => \"Access denied.\"\n end\n else\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def view_authorized(current_user)\n return self.public? || self.edit_authorized(current_user)\n end", "def block_access\n if current_user.present?\n redirect_to users_path\n end\n end", "def restrict_access\n unless logged_in?\n flash[:error] = \"You have to login to access this page.\"\n redirect_to login_url\n end\n end", "def accessible_by?(context)\n return false unless context.logged_in?\n\n accessible_by_user?(context.user)\n end", "def authorized_user\n @user = Post.find(params[:id]).user\n redirect_to(root_url) unless logged_in? && (current_user?(@user) || current_user.admin?)\n end", "def show\n authorize @user # Can only see your own profile\n end", "def user_can_view?(_check_user)\n true # everyone can view these\n end", "def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend", "def index\n @users = User.all\n authorize User\n end", "def show\n @users = User.all\n authorize @colaboradore\n end", "def index\n @user = User.find(params[:user_id])\n @conditions = @user.conditions\n\n if current_user.id == @user.id\n\t\t\trender action: :index\n\t\telse\n\t\t\trender file: 'public/denied'\n\t\tend\n end", "def check_if_public_user\n if session[:public_user]\n session[:public_user] = nil\n session[:user_id] = nil\n flash[:notice] = \"RESTRICTED: You do not have access\"\n redirect_to controller: :access, action: :user_menu\n false\n end\n end", "def show\n redirect_to(default_url) unless logged_in? || User.count > 0\n @user = current_user\n end", "def can_access user\n return self.users.include? user\n end", "def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n User.find_by_api_key(token).present?\n end\n end", "def access_robot\n raise 'unauthorised' if current_user != @robot.user \n end", "def user_authorized\n redirect_to \"/\" unless session[:user_id]\n end", "def accessible_for?(user)\n user_id == user.id && !user.anonimous?\n end", "def user_access\n @account = current_user.admin? ? Account.find(params[:id]) : current_user.accounts.find(params[:id])\n\n check_user_access(@account.user_id)\n\n rescue\n flash_access_denied\n end", "def authorized?\n logged_in? && current_user.login == \"ej0c\"\n end", "def authorize\n if !session[:user_id]\n redirect_to root_path\n end\n if session[:user_id]\n if User.find_by(id: session[:user_id]).access != \"admin\"\n redirect_to root_path\n end\n end\n end", "def only_for_anonymous\n redirect_to root_path if session[:username]\n end", "def user_authorized?(user)\n user == current_user || is_admin?\n end", "def authorize\n unless User.find_by(id: session[:user_id])\n redirect_to tasks_index_path, notice: \"Please log in\"\n end\n end", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def view_authorized(current_user)\n return self.goal.public? || self.edit_authorized(current_user)\n end", "def owner_only(user_id)\n if session['user_id'] == user_id\n true\n else\n redirect '/'\n end\nend", "def check_login\n unless logged_in?\n access_denied\n end\n end", "def users_only\n redirect_to band_path(current_user.accountable) if is_band\n end", "def is_logged_in\n #since these are also marked as helper methods, they are availalble in not just all ctronollers (cuz they inherit from appc ontroler) but also avialble to views\n\n (session[:user_id] && session[:user_id].present? ) ? true : false\n end", "def require_login\n !!current_user || access_denied\n end", "def require_login\n return head(:forbidden) unless current_user || current_employee\n end", "def authorized?\nlogged_in?\nend", "def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end", "def logged_user_only\n unless logged_in?\n\t store_location\n\t flash[:danger] = \"Please log in!\"\n\t redirect_to login_url\n\tend\n end", "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 index\n redirect_to(:action => 'login') #unless logged_in? || User.count > 0\n end", "def show\n \tauthorize! :read, @user\n end", "def only_current_user\n @user=User.find(params[:user_id])\n redirect_to(root_url) unless @user == current_user #current user is from devise\n end", "def check_is_login_required\n authorized_denied unless logged_in?\n end", "def can_access?(user)\n user == self.user\n end", "def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end", "def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end", "def logged_in_only()\n # session[:current_user_id] = 123\n # if you are a logged in user\n if(session[:current_user_id])\n # execute script inside of this block\n yield\n else\n # otherwise\n # send login failure and redirect to login\n flash[:warning] = \"Not Logged In\"\n redirect_to \"/login\"\n end\n end", "def allow_access\n !current_cas_user.nil?\n end", "def guest_user(_user)\n if RuntimeConfig.vote_signin_active?\n can :access, :sessions\n end\n end", "def user_logged_in\n if session[:just_logged_in] && !current_user.is_admin \n gon.display_login_popup = true\n \n session[:just_logged_in] = false\n end\n end", "def access_control\n \n end", "def index\n @users = User.all\n authorize @users\n end", "def check_access\n if not user_signed_in?\n redirect_to('/users/sign_in')\n end\n end", "def authorized?\n current_user.logged_in?\n end", "def restrict_access\n user = User.find_by_authentication_token(params[:access_token])\n head :unauthorized unless user\n end", "def require_logged_in\n access_denied(\"You must be logged in to do that.\") unless logged_in?\n end", "def authorize_agent\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level >= 1\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"agent_not_authorized_wo_login\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end", "def index\n \t@users = User.accessible_by(current_ability)\n \tauthorize! :read, User\n end", "def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end", "def index\n # @users = User.all\n # authorize @users \n @users = policy_scope(User)\n authorize @users\n end", "def login_required\n not_authorized unless current_user\n end", "def accessible_staff\n return User.any_role if admin?\n return fellow_staff if staff?\n return User.none\n end", "def show\n @user = current_user\n authorize @user\n end", "def check_user\n if user_signed_in? && (current_user.has_role?(:admin) || current_user.id == @listing.user_id )\n else \n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to root_path\n end\n end" ]
[ "0.730793", "0.7149087", "0.7117983", "0.70749795", "0.69553155", "0.69322926", "0.6916093", "0.69120735", "0.6886978", "0.68804616", "0.6854237", "0.6820669", "0.67882574", "0.67832416", "0.6763707", "0.6740942", "0.67242223", "0.6723324", "0.6716212", "0.66941446", "0.6693985", "0.6693985", "0.6693985", "0.6693985", "0.6689332", "0.66859806", "0.66783625", "0.66622597", "0.6659074", "0.6654871", "0.6651532", "0.66394943", "0.66150194", "0.66136914", "0.65993667", "0.6595422", "0.65861875", "0.6584906", "0.6573657", "0.655761", "0.6549723", "0.65275043", "0.65269524", "0.6515778", "0.6513875", "0.65123796", "0.64996463", "0.64985615", "0.6493801", "0.64889723", "0.6487913", "0.6487336", "0.6482392", "0.64791775", "0.6472638", "0.64675015", "0.64600235", "0.64570004", "0.6456737", "0.64528924", "0.6450412", "0.64491606", "0.6440028", "0.6439237", "0.64320415", "0.64298147", "0.6425447", "0.6422223", "0.6421578", "0.6420514", "0.6419516", "0.64177924", "0.641454", "0.6408346", "0.6408198", "0.6399583", "0.6398669", "0.6397766", "0.6394015", "0.6390227", "0.63845205", "0.63830644", "0.6382346", "0.63799316", "0.63664806", "0.6364036", "0.6363877", "0.63628", "0.6362397", "0.6360588", "0.6358507", "0.6356036", "0.63550913", "0.63515776", "0.6348333", "0.6344758", "0.6344004", "0.63438696", "0.6339652", "0.63362443" ]
0.6344052
96
gives access only to the a specific member or admin helpfull for making sure that users can get at their own data
def owner_authorize(member_id) unless logged_in? and (current_member.id == member_id or admin?) unauthorized_access end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n #@members = member.all\n #@members = member.with_restricted_access_access\n @members = policy_scope(Member)\n end", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def show\n \t@person = Person.find(params[:id])\n \t@is_admin = false\n \tactive_person = Person.find(session[:user_id])\n \troles = active_person.roles.collect {|role| role.name}\n if roles == [\"DirectCareProvider\"] && session[:user_id] != params[:id]\n flash[:notice] = \"You can only access your own profile.\"\n @person = active_person\n elsif roles.member?(\"Supervisor\") || roles.member?(\"Administrator\")\n \t@is_admin = true\n end\n end", "def get_read_access( u)\n \n return (u == self.user) || (self.public)\n \n \n end", "def show?\n user.try(:admin?) || record.has_member?(user) \n end", "def profile_authorization\n #if view admins' profile, allow only admin\n return false unless(params[:id])\n user = User.find(params[:id])\n return false unless user\n return admin_authorization if user.admin?\n return true if GraderConfiguration[\"right.user_view_submission\"]\n\n #finally, we allow only admin\n admin_authorization\n end", "def show\n authorize @admin\n end", "def show\n # authorize Admin\n end", "def access_required_member\n\tlogger.debug session.to_yaml\n\t\tredirect_to '/access_denied.html' and return unless session[\"user_#{current_user.id}\"][:access_level] >= Role.access_level('Member')\n\tend", "def index\n @members = Member.where(admin: false)\n end", "def listings\n authorize! :read, @user\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 show\n \tauthorize! :read, @user\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 admin_in!\n access_denied! unless current_user.admin?\n end", "def show?\n @current_user.permission('Bid', :guest)\n end", "def access_inlcude_member\n @post = Post.find params[:id]\n\n unless @post.community_id == 0 \n @community = Community.find_by_id @post.community_id \n if @community.status.to_s == \"private\"\n if validate_member_for(@community,@post)\n #if true then redirect\n redirect_to RAILS_URL\n end\n end \n end\n end", "def show\n authorize! :read, @admin_system_admin\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 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 show\n restrict 'allow only admins' or begin\n @admin = Admin.find_by_id(params[:id]) || current_user\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @admin.to_xml }\n end\n end\n end", "def show\n restrict 'allow only admins' or begin\n @admin = Admin.find_by_id(params[:id]) || current_user\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @admin.to_xml }\n end\n end\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def access\n if self.read_users.present?\n \"limited\"\n elsif self.read_groups.empty?\n \"private\"\n elsif self.read_groups.include? \"public\"\n \"public\"\n elsif self.read_groups.include? \"registered\"\n \"restricted\" \n else \n \"limited\"\n end\n end", "def show\n authorize @institute\n @admins = User.where(role:3,institute_id: @institute.id)\n @students = User.where(role:1,institute_id: @institute.id)\n end", "def show\n admin_only\n end", "def show\n admin_only\n end", "def show\n admin_only\n end", "def allow_access_by_any_user\n @attributes[:allow_access_by_any_user]\n end", "def admin_user?\n member_type == MEMBER_TYPE[:admin]\n end", "def band_admin_user\n # If a current user is an admin, pass. If not, check.\n if !admin?\n @band = Band.find(params[:id])\n @member = Member.find_by({\n band_id: params[:id],\n user_id: current_user.id\n })\n\n if !@member || !@member.is_admin?\n flash[:danger] = \"You are not authorized to manage this band.\"\n redirect_to root_url\n end\n end\n end", "def can_access?(user)\n user == self.user\n end", "def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end", "def show\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end", "def accessible\n accessible_for(Aurita.user)\n end", "def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end", "def user_access\n @bot = current_user.admin? ? Bot.find(params[:id]) : current_user.bots.find(params[:id])\n\n check_user_access(@bot.account.user_id)\n\n rescue\n flash_access_denied\n end", "def index\n if Member.exists?(uid: current_admin.uid) == false\n redirect_to(new_member_path)\n else\n @current_member = Member.where(uid: current_admin.uid).first\n\n if @current_member.isAdmin == true\n @is_admin = true\n else\n @is_admin = false\n redirect_to(announcements_path)\n end\n end\n\n @activities = Activity.all\n end", "def show\n isadmin\n end", "def user_access\n @account = current_user.admin? ? Account.find(params[:id]) : current_user.accounts.find(params[:id])\n\n check_user_access(@account.user_id)\n\n rescue\n flash_access_denied\n end", "def can_access user\n return self.users.include? user\n end", "def show\n authorize @user # Can only see your own profile\n end", "def member\n Member.find(id) if auth == 'customer'\n end", "def is_admin?\n usertype == \"admin\" and id == 0\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 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 administrators\n members.where(memberships: { role: 'admin' })\n end", "def admin_member\n redirect_to root_path, notice: \"You are not authorized to do that\" if !current_member.admin?\n end", "def access_control\n \n end", "def show\n is_admin?\n end", "def admin_access\n if current_user.access? :admin\n return true\n elsif current_user\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to nationalities_path\n else\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to login_path\n end\n end", "def admin\n\t\tcan :manage, :all\n\tend", "def is_admin\n test_access :admin\n end", "def admin_only\n logged_in_as_admin? || admin_only_access_denied\n end", "def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end", "def user_can_see?(user)\n !self.private || self.is_owner?(user)\n end", "def filter_access!\n treat_as get_current_role\n end", "def allows_admin_access_for?(user_or_person)\n if user_or_person.is_a?(User)\n return true if user_or_person.admin?\n person = user_or_person.person\n elsif user_or_person.is_a?(Person)\n person = user_or_person\n end\n return false if person.nil?\n return true if person.current_lead?\n return true if event_coordinator == person\n return true if person.event_attendances.find_by_event_id(id).try(:admin?)\n return false\n end", "def index\n authorize Admin\n @admins = User.find_by_sql([\"select * from users where role = ?\",2])\n end", "def show\n\t\t\tputs current_user.is_admin?\n\tend", "def access_whitelist\n current_user.try(:admin?) || current_user.try(:editor?) || current_user.try(:door_super?)\n end", "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def accessible_staff\n return User.any_role if admin?\n return fellow_staff if staff?\n return User.none\n end", "def owner_or_admin\n listing = SellerListing.find(params[:id])\n\n unless user_signed_in? && (current_user.id == listing.user_id || current_user.admin?)\n if !user_signed_in?\n Rails.logger.warn(\"User tried to access page without being signed in\")\n elsif current_user.id != listing.user_id\n Rails.logger.warn(\"#{current_user.to_s} tried to access a page that belongs to #{listing.user.to_s}\")\n elsif !current_user.admin?\n Rails.logger.warn(\"#{current_user.to_s} needs to be an admin to access this page\")\n end\n\n flash[:error] = 'Sorry, but you are not permitted to view that page.'\n redirect_to new_home_offer_path\n end\n end", "def show\n is_admin?\n end", "def index\n \t@users = User.accessible_by(current_ability)\n \tauthorize! :read, User\n end", "def member_check\n return nil if admin?\n\n # if not admin, redirect to memberDashboard\n redirect_to member_dashboard_path\n end", "def only_your_profile_page\n @admin = Admin.find(params[:admin_id])\n\n if current_admin != @admin\n redirect_to sectors_path, notice: \"Access denied! You can only view your own profile page.\"\n end\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 authorize @moderation\n end", "def admin_user\n render_forbidden unless current_user.admin?\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 can_access?\n allows_current_user_access_to? :access\n end", "def admin_required\n current_user.is_admin? || access_denied\n end", "def user_can_view?(_check_user)\n true # everyone can view these\n end", "def check_read_access_helper(ven, plan_id, usr)\r\n #MES- Is the place public?\r\n return ven if ven.public_venue\r\n \r\n #MES- If the usr is nil, they can't see private places.\r\n raise \"You must log in to view this place\" if usr.nil?\r\n \r\n #MES- We should be able to view public places,\r\n # places that we own, and places that are associated\r\n # with plans that we're attending.\r\n return ven if usr.administrator?\r\n\r\n\r\n #MES- Does the current user own the place?\r\n return ven if ven.owner == usr\r\n\r\n #MES- Is the place associated with the given plan, and is the current\r\n # user associated with the given plan?\r\n raise \"Current user doesn't have read rights on place #{ven.id} and plan_id is nil\" if plan_id.nil?\r\n\r\n pln = Plan.find(plan_id)\r\n raise \"Current user doesn't have read rights on place #{ven.id} and plan #{plan_id} not found\" if pln.nil?\r\n raise \"Place #{ven.id} is not associated with plan #{plan_id}\" if ven != pln.place\r\n if !pln.invitees.include? usr\r\n #MES- The user has to EITHER be on the plan OR be able to see a planner on which the plan is\r\n if params[:cal_id]\r\n planner = Planner.find(params[:cal_id])\r\n if !pln.planners.include?(planner)\r\n raise \"Planner #{planner.id} does not include plan #{plan_id}\"\r\n elsif planner.visibility_level(usr) < Planner::USER_VISIBILITY_LEVEL_DETAILS\r\n raise \"Planner #{planner.id} not visible to current user\"\r\n end\r\n return ven\r\n else\r\n #MGS- no planner passed on querystring\r\n raise \"Current user is not associated with plan #{plan_id}\"\r\n end\r\n end\r\n return ven\r\n end", "def show\n\t\tauthorize! :index, TipoPrivilegio\n end", "def has_admin_access?\n admin? || moderator?\n end", "def has_access(developer)\r\n current_user.id == developer.id\r\n end", "def admin_index\n authorize User\n @users = current_user.org.users.includes(:roles)\n end", "def has_access?\n true\n end", "def has_access?\n true\n end", "def _admin_or_self\n not_authorizaed unless current_user.admin? || current_user == @user\n end", "def show\n require 'uri'\n @event = EventOwner.find(params[:id])\n @is_admin = current_user && current_user.id == @event.id\n end", "def check_access\n result = false\n if current_user.is_a? Admin\n result = true\n elsif !@measurement.nil?\n patient = @measurement.patient\n result = patient.id == current_user.id or patient.dietician.id == current_user.id\n end\n unless result\n redirect_to root_path, alert: \"Brak dostępu!\"\n end\n end", "def show\n # 需要验证是否公开或属于该登录成员,否则没有权限查看\n # 管理员可以查看\n if !@event.is_public && (!@_current_member || @_current_member.id != @event.member_id && @_current_member.role == 'user')\n # 没有查看权限\n @message = '没有权限查看'\n respond_to do |format|\n format.html { redirect_to root_path, alert: @message }\n format.json { render json: { message: @message, status: 'error' }, status: :unprocessable_entity }\n end\n end\n end", "def set_editability\n @editable = user_signed_in? && (current_user.member.role.name.eql? \"University Admin\") &&\n current_user.member.institution.id == @course.department.institution.id\n end", "def admin_access?\n admin?\n end", "def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend", "def any_logged_in(user)\n can :export_calendar, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check)\n end\n\n # only matters if read in any_one() is false (ie. user_check is junior)\n can :read, User do |user_check| \n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || user.friends.include?(user_check) || admin_of_users_league?(user, user_check)\n end\n\n # contact details and shit\n can :read_private_details, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || admin_of_users_team?(user, user_check) || admin_of_users_league?(user, user_check)\n end\n\n # ie parent\n can :act_on_behalf_of, User do |user_check|\n user_check.junior? && user_check.parent_ids.include?(user.id)\n end\n\n # TEAM\n can :read, Team do |team|\n team.has_member?(user) || team.primary_league.has_organiser?(user) || can?(:manage_teams, team.tenant)\n end\n\n # currently only used for mobile app, prob should use on web too. TS\n can :read_private_details, Team do |team|\n team.has_member?(user) || (!team.primary_league.nil? && team.primary_league.has_organiser?(user))\n end\n\n can :export_calendar, Team do |team|\n team.has_member?(user)\n end\n\n # Not sure these should be here... Can be inferred from other info (eg. are they in the team)\n # also, they're more about whether it is feasible, rather than whether they're allowed\n # Plus, this is checking the team, and the setting belong to the user. We should just be\n # looking for the settings (if has perms to edit user), and raise invalid id not there. TS\n can :read_notification_settings, Team do |team|\n team.has_associate?(user)\n end\n can :update_notification_settings, Team do |team|\n team.has_associate?(user) \n end\n\n # EVENT\n # only matters is read in any_one gives false\n can :read, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n can :read_messages, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # TODO: remove in favour of :read_private_details\n can :read_all_details, Event do |event|\n can? :read_private_details, Event\n end\n\n # TODO: remove in favour of :read_private_details\n can :view_private_details, Event do |event|\n can? :read_private_details, Event\n end\n\n can :read_private_details, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # SR: Added to mimic\n can :view_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # SR: Added to mimic\n can :read_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # DEPRECATED: this is only used for view code, not actual authorisation, so should be removed from here. TS.\n can :respond_to_invite, Event do |event|\n event.teamsheet_entries.map{|tse| tse.user_id}.include?(user.id) && event.user_id != user.id\n end\n\n can :respond, TeamsheetEntry do |tse|\n # player, event organiser (legacy), parent, or team organiser\n #tse.event.team.has_associate?(user) &&\n (user.id == tse.user_id || tse.event.user_id == user.id || can?(:act_on_behalf_of, tse.user) || can?(:manage, tse.event.team))\n end\n\n can :check_in, TeamsheetEntry do |tse|\n can? :manage_roster, tse.event.team\n end\n\n # ACTIVITY ITEMS\n can :view, ActivityItem\n\n can :create_message_via_email, Event do |event|\n # organiser, or registered player\n # TODO: generalise this set of perms (and refactor to check user has role on team)\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # ACTIVITY ITEM COMMENTS AND LIKES\n can :comment_via_email, EventMessage do |message| \n # if this implementation changes then a test is required\n if message.messageable.is_a? Team \n message.messageable.has_active_member?(user)\n elsif message.messageable.is_a? Event\n can? :create_message_via_email, message.messageable\n end \n end\n\n can :comment_via_email, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message_via_email, event_result.event \n end\n\n can :comment_via_email, User\n can :comment_via_email, Event \n can :comment_via_email, TeamsheetEntry \n can :comment_via_email, InviteResponse\n can :comment_via_email, InviteReminder\n end", "def user_accessible?\n is_admin\n end", "def show\n admin_only do\n end\n end", "def vip_member\n is_admin != true\n end", "def index\n @member_groups = @user.groups_where_member\n @admin_groups = @user.groups_where_admin\n end", "def view_authorized(current_user)\n return self.public? || self.edit_authorized(current_user)\n end", "def show?\n user.id == record.id || user.administrator?\n end", "def can_edit\n return current_user && (current_user.id == Integer(params[:id]) || current_user.is_admin)\n end", "def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end" ]
[ "0.6990862", "0.69782126", "0.69671196", "0.6959876", "0.69419694", "0.69389963", "0.6847647", "0.68387246", "0.6830375", "0.6826971", "0.67902064", "0.678618", "0.67756116", "0.67606384", "0.6757479", "0.6737181", "0.6736251", "0.6726605", "0.67249906", "0.6718217", "0.6717167", "0.6717167", "0.6716707", "0.6706605", "0.6684523", "0.66763157", "0.66763157", "0.66763157", "0.66741806", "0.6670391", "0.6670251", "0.6669322", "0.66638684", "0.6632915", "0.6631402", "0.6631032", "0.66261125", "0.6616072", "0.6612135", "0.6609996", "0.66048056", "0.6597797", "0.65913725", "0.6583996", "0.6581659", "0.65807563", "0.65807563", "0.65807563", "0.6579699", "0.6574789", "0.6569679", "0.65695703", "0.6569306", "0.6567713", "0.65623903", "0.6560109", "0.6557824", "0.6555408", "0.65474266", "0.653705", "0.6533489", "0.6530411", "0.65294933", "0.65242654", "0.6519783", "0.6511302", "0.6508972", "0.6507642", "0.65039134", "0.64961946", "0.64953065", "0.6493365", "0.6483767", "0.6483348", "0.64832896", "0.64780384", "0.6477785", "0.6476475", "0.647117", "0.64689445", "0.6468283", "0.6467317", "0.646662", "0.646662", "0.6465204", "0.64620453", "0.6461542", "0.6460298", "0.64564383", "0.64563996", "0.64563894", "0.64553374", "0.6450397", "0.6449994", "0.64468867", "0.64452463", "0.64412296", "0.6433352", "0.64322597", "0.6427849" ]
0.68640155
6
handles any unauthorized access
def unauthorized_access flash[:notice] = "Unauthorized access" redirect_to "/" return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_denied\n end", "def access_denied\n\n end", "def unauthorized\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 access_denied\n render status: 401, text: \"nice try\"\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def unauthorized\n\n render_error( :unauthorized )\n\n end", "def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end", "def access_denied\n head 401\n end", "def access_denied\n case content_type\n when :html\n store_location\n redirect url(:login)\n when :xml\n basic_authentication.request\n end\n end", "def unauthorized\n head :unauthorized\n end", "def skip_authorization; end", "def access_denied\n respond_to do |format|\n format.html {\n flash[:error] = \"Sie sind nicht angemeldet oder nicht berechtigt, auf die angeforderte Seite zuzugreifen.\"\n render text: \"\", layout: true, status: :unauthorized\n }\n \n format.any {\n head status: :unauthorized\n }\n end\n end", "def access_denied\n if @current_user\n render_401\n else\n redirect_to \"#{FUSESOURCE_URL}/login?return_to=#{external_url_to(request.request_uri)}\"\n end\n end", "def access_denied!\n render partial: 'errors/401', status: 401 && return\n end", "def access_denied\n case content_type\n when :html\n store_location\n redirect url(:login)\n when :xml\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n set_status(401)\n render :text => \"Couldn't authenticate you\"\n end\n end", "def authorization_denied\n head :unauthorized\n end", "def access_denied\n redirect_to main_app.root_url, alert: \"Not authorized\"\n end", "def access_forbidden\n if !@authenticated.nil?\n send_response_document :forbidden\n else\n flash.keep\n authentication_needed!\n end\n end", "def unauthorised\n flash[:notice] = 'Unauthorised operation. Please try another option '\n redirect_to robots_path\n end", "def access_denied\n store_location\n redirect_to root_path(:target => request.request_uri)\n #respond_to do |format|\n # format.json do\n # render :partial => \"json/response\",\n # :locals => {\n # :success => false,\n # :message => \"Authorization Required\",\n # :body => nil}\n # end\n # format.html do \n # redirect_to root_path#(:after_login => request.request_uri)\n # end\n #end\n end", "def unauthenticated\n end", "def umn_access_denied\n redirect_to(login_and_redirect_url)\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 access_denied\n render \"common/access_denied\"\n end", "def restrict_anonymous_access\n return unless current_user.nil?\n\n handle_http_401(t('application.errors.restricted_access'))\n end", "def require_authorization( message=\"You are not authorized to access this resource.\" )\n\t\tfinish_with( HTTP::FORBIDDEN, message )\n\tend", "def user_not_authorized\n redirect_to((request.referrer || root_path) ,notice: \"Authorization error.\")\n end", "def login_required\n authorized? || throw(:halt, :access_denied)\n end", "def not_authorized\n flash[:error] = I18n.t :forbidden\n response.headers['Status-Code'] = '403'\n redirect_to root_path\n end", "def unauthorized_access_response(err)\n error_with_data(\n err,\n 'unauthorized_access_response',\n GlobalConstant::ErrorAction.default\n )\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 access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end", "def denied\n end", "def unauthorized\n error(t('messages.generics.errors.access'), 401)\n end", "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 authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def access_control\n \n end", "def access_denied\n redirect '/login'\n end", "def not_authorised\n headers['WWW-Authenticate'] = 'Basic realm=\"Restricted Area\"'\n error(401, 'Not authorised.')\n end", "def permission_denied\n respond_to do |format|\n format.html { render :template => \"shared/forbidden\", :status => :forbidden }\n format.any { head :forbidden }\n end\n end", "def deny_access\n respond_to do |format|\n format.html {\n flash[:alert] = 'You are not authorized to perform this action'\n\n redirect_to root_path\n }\n\n format.json {\n # Some schools of thought advocate the use of 404 (:not_found). See\n # http://www.bennadel.com/blog/2400-handling-forbidden-restful-requests-401-vs-403-vs-404.htm\n render json: {}, status: :unauthorized\n }\n end\n end", "def deny_access\n @status = 401\n respond_to do |format|\n format.html { render template: \"errors/401\", status: @status, layout: \"errors\" }\n format.all { render nothing: true, status: @status }\n end\n end", "def access_denied\n puts \"access denied\"\n respond_to do |accepts|\n accepts.html do\n store_location\n # render :text => \"Authentication failed: access denied\"\n redirect_to log_in_path\n end\n accepts.json do\n render :json => {:success => false, :message => \"Authentication failed\"}\n end\n accepts.xml do\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text => \"Could't authenticate you\", :status => '401 Unauthorized'\n end\n end\n false\n end", "def access_denied\n clear_session\n respond_to do |format|\n format.html { redirect_to login_path and return false }\n format.xml do\n headers['Status'] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text =>'Unauthorized', :status=>401\n end\n end\n end", "def unauthorized\n respond_to do |format|\n format.html do\n if admin?\n flash.now[:error] = I18n.t(:authorization_failure)\n redirect_to login_path and return\n elsif current_user || admin?\n flash.now[:error] = I18n.t(:authorization_failure)\n render 'shared/unauthorized'\n else\n store_location\n redirect_to login_path and return\n end\n end\n format.xml do\n request_http_basic_authentication 'Web Password'\n end\n format.json do\n render :text => \"Not Authorized \\n\", :status => 401\n end\n end\n end", "def unauthorized\n render :text => \"You are not authorized to perform this action\", :status => 401\n end", "def user_not_authorized\n flash[:danger] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end", "def deny_access_action( txn, *args )\n\t\t\tself.log.error \"Unauthorized request for %s\" % [ txn.uri ]\n\t\t\ttxn.status = Apache::FORBIDDEN\n\t\t\treturn \"access denied\"\n\t\tend", "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 access_denied\n if ( user_signed_in? )\n render :file => File.join( RAILS_ROOT, 'public', '404.html' ),\n :status => :not_found\n else\n authenticate_user!\n end\n end", "def access_denied\nrespond_to do |format|\nformat.html do\nstore_location\nredirect_to new_session_path\nend\nformat.any do\nrequest_http_basic_authentication 'Web Password'\nend\nend\nend", "def user_not_authorized\n flash[:alert] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end", "def access_denied\n error = error_response_method($e12)\n render :json => error\n end", "def authority_forbidden(error)\n Authority.logger.warn(error.message)\n redirect_to request.referrer.presence || root_path, :alert => '당신은 이 행동을 수행할 권한이 없습니다.'\nend", "def user_not_authorized\n \tflash[:alert] = \"You are not authorized to perform this action.\"\n \tredirect_to(request.referrer || root_path)\n end", "def access_denied\n if logged_in?\n flash[:notice] = I18n.t('application.not_authorized')\n respond_to do |f|\n f.html do\n unless request.xhr?\n redirect_to current_user.has_any_role? ? admin_nodes_path : root_path\n else\n render text: flash[:notice], status: :forbidden # Render HTML\n end\n end\n f.js do\n render :update do |page|\n page.redirect_to '/admin' # Redirect through JS\n end\n end\n f.json do\n render json: { error: flash[:notice] }.to_json, status: :forbidden\n end\n end\n else\n super\n end\n end", "def access_denied_handler(exception)\n __debug_exception('RESCUE_FROM', exception)\n msg = exception.message\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, alert: msg) }\n format.json { render_json({ error: msg }, status: :unauthorized) }\n format.xml { render_xml({ error: msg }, status: :unauthorized) }\n end\n rescue => error\n error_handler_deep_fallback(__method__, error)\n end", "def user_not_authorized(exception)\n case exception.query\n when 'approve?',\n 'can_add_attachment?',\n /^add_response_to_flagged_case/,\n 'upload_responses?',\n 'update_closure?'\n super(exception, case_path(@case))\n else\n super\n end\n end", "def check_access\n @response = Response.new\n \n check_hash()\n \n if @response.error?\n access_denied\n return\n end\n end", "def require_login\n authorize_request || render_unathorized(\"Access denied\")\n end", "def deny_access\n respond_to do |format|\n format.json {\n # Some schools of thought advocate the use of 404 (:not_found). See\n # http://www.bennadel.com/blog/2400-handling-forbidden-restful-requests-401-vs-403-vs-404.htm\n render json: {}, status: :unauthorized\n }\n end\n end", "def unauthorized\n render \"errors/401\", :status => 401\n\tend", "def not_authorized\r\n render :file => 'public/401.html', :status => 401, :layout => false\r\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 permission_denied\n flash[:error] = 'Sorry, you are not allowed to the requested page.'\n respond_to do |format|\n format.html { logged_in? ? redirect_back_or_default(root_path) : redirect_to(login_path) } \n format.xml { head :unauthorized }\n format.js { head :unauthorized }\n end\n end", "def permission_denied\n\t\tif current_user\n\t\t\tflash[:warning] = \"Sorry, your account is not allowed to do that. Try another?\"\n\t\telse\n\t\t\tflash[:notice] = \"To do that, I need to know who you are.\"\n\t\tend\n\t\tif request.request_method == :get\n\t\t\tsession[:next] = request.request_uri\n\t\telse\n\t\t\tsession.delete(:next)\n\t\tend\n\t\tlogin_page = url_for :controller => :user_sessions, :action => :new, :secure => true, :host => request.host\n\t\trespond_to do |format|\n\t\t\tformat.html { return redirect_to login_page }\n\t\t\tformat.js { render(:update) {|p| p.redirect_to login_page }}\n\t\t\tformat.all { render :file => \"#{RAILS_ROOT}/public/403.html\", :status => '403 Forbidden' }\n\t\tend\n\t\tno_cache\n\tend", "def login_required\nauthorized? || access_denied\nend", "def login_required\n authorized? || throw(:halt, :access_denied)\n end", "def permission_denied\n respond_to do |format|\n flash[:error] = 'Sorry, you are not allowed to view the requested page.'\n format.html { redirect_to(:back) rescue redirect_to('/') }\n format.xml { head :unauthorized }\n format.js { head :unauthorized }\n end\n end", "def access_denied\n redirect_to signin_url\n end", "def unauthorized\n render :json => \"You are not authorized for access.\", :status => :unauthorized\n end", "def deny_access\n\t\t# store location for forwarding users after log in to their intended location\n\t\tstore_location\n \tredirect_to signin_path, :notice => \"Please sign in to access this page.\"\n \tend", "def access_denied\n {\n :html => 'Sorry, we cannot verify that you are a user. Please reinstall this Raplet.',\n :status => 401\n }\n end", "def login_required\n authorized? || access_denied\n end", "def login_required\n authorized? || access_denied\n end", "def login_required\n authorized? || access_denied\n end", "def permision_denied_error\n error(403, 'Permision Denied!')\n end", "def without_access_control\n previous_state = Authorization.ignore_access_control\n Authorization.ignore_access_control(true)\n result = yield\n ensure\n Authorization.ignore_access_control(previous_state)\n result\n end", "def deny_access\n if not current_user\n authenticate_user!\n elsif current_user.member?\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def access_denied\n respond_to do |format|\n format.html do\n store_location\n redirect_to new_session_path\n end\n format.any do\n request_http_basic_authentication 'Web Password'\n end\n end\n end", "def not_authorised\n flash[:notice] = 'You are not authorized to perform this action!'\n redirect_back(fallback_location: root_path)\n end", "def user_not_authorized(exception)\n wiki_policy = exception.policy.class.to_s.underscore\n\n flash[:alert] = \"You are not authorized to do that!\"\n redirect_to(request.referrer || root_path)\n end", "def access_denied\n clear_session\n redirect_to login_path and return false\n end", "def non_contributer_access_denied\n respond_to do |format|\n format.html { redirect_to :back, :notice => \"You need to be a contributor to access this page. You can contribute trip reports, routes or photos to the site to gain access. See the #{ help.link_to(\"contribution guide\", main_contributions_path)} for more information.\" }\n format.xml do\n headers[\"Status\"] = \"Unauthorized\"\n headers[\"WWW-Authenticate\"] = %(Basic realm=\"Web Password\")\n render :text => \"You need to be a contributor to access this page. You can contribute trip reports, routes or photos to the site to gain access.\", :status => '401 Unauthorized'\n end\n end\n end", "def user_not_authorized\n flash[:warning] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end", "def access_denied\n respond_to do |format|\n format.html do\n session[:original_uri] = request.fullpath\n flash[:notice] = 'Please log in'\n redirect_to new_session_url\n end\n format.any(:json, :xml) do\n request_http_basic_authentication 'Web Password'\n end\n end\n end", "def authorize_access_to(obj)\n unless authorized?(obj)\n raise Repia::Errors::Unauthorized\n end\n end", "def deny_access\n\t\tstore_location\n\t\tredirect_to signin_path, :notice => \"Please sign in to access this page.\"\n\tend", "def authenticate\n logged_in? || access_denied\n end", "def authenticate\n \t\tlogged_in? || access_denied\n \tend", "def redirect_403\n return hit_error(403) unless current_user\n end" ]
[ "0.8153234", "0.8111288", "0.8007728", "0.7906234", "0.7906234", "0.7815678", "0.7541762", "0.7495611", "0.7486655", "0.74267477", "0.73973364", "0.73643005", "0.73596156", "0.73589784", "0.7343593", "0.7312019", "0.7270852", "0.72624624", "0.7259183", "0.7242461", "0.72200763", "0.7218994", "0.7208913", "0.72025275", "0.7199014", "0.7155338", "0.7148423", "0.71454656", "0.71402717", "0.7132827", "0.7130852", "0.7107607", "0.7107077", "0.7107077", "0.7102484", "0.7102484", "0.7102484", "0.7102484", "0.7102484", "0.7102484", "0.7102484", "0.70943034", "0.7092318", "0.70897", "0.7072844", "0.7068445", "0.70634055", "0.7041028", "0.7018919", "0.7014025", "0.7005461", "0.7005142", "0.7003453", "0.6978152", "0.69770974", "0.6970182", "0.696317", "0.695208", "0.69500256", "0.6949892", "0.6948985", "0.6945164", "0.69438297", "0.6936909", "0.6932041", "0.6931697", "0.69221413", "0.6921012", "0.69176704", "0.6915934", "0.6913157", "0.6908156", "0.69075096", "0.69069356", "0.6904298", "0.6903798", "0.69020635", "0.6901694", "0.68993765", "0.68986243", "0.6894809", "0.6889522", "0.6876049", "0.6876049", "0.6876049", "0.68731046", "0.6864146", "0.6863085", "0.68560207", "0.6851957", "0.68512166", "0.68432564", "0.68213165", "0.68189687", "0.68087304", "0.6806186", "0.6802964", "0.6790625", "0.6790405", "0.6788914" ]
0.7126877
31
This sets up method which allows controllers to either assign a member_id param to a specific member_id or to current_member.id if none is supplied using a merge method on the param hash. Returns the hash that gets fed into the create method. Helps tests not fuck up...
def memberified_params(object) entry_params = params[object.to_sym] if current_member entry_params = {:member_id => current_member.id}.merge(entry_params) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_member\n if current_member \n @member = Member.find(current_member.id)\n else \n @member = Member.find(params[:id])\n end\n end", "def set_member\n member_id = params[:id]\n @member = Member.find(member_id)\n end", "def set_member\n @member = Member.find(params[:member_id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def to_param\n member_id\n end", "def set_member\n @member = User.find(params[:id])\n end", "def create\n r = params[:member]\n @member = Member.where(:email => r[:email], :group_name => r[:group_name], :admin_uuid => session[:user_uuid]).first\n r = @member.attributes.merge(r) unless @member.nil?\n @member = Member.new(r) if @member.nil?\n @member.update_attributes(r) unless @member.nil?\n\n unless @member.err\n @member.get_member_uuid\n end\n respond_to do |format|\n unless @member.nil?\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n r = params[:member]\n @member = Member.where(:email => r[:email], :group_name => r[:group_name], :admin_uuid => session[:user_uuid]).first\n r = @member.attributes.merge(r) unless @member.nil?\n @member = Member.new(r) if @member.nil?\n @member.update_attributes(r) unless @member.nil?\n unless @member.err\n @member.get_member_uuid\n end\n respond_to do |format|\n unless @member.nil?\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = User.find(params[:id])\n end", "def member_params\n params.require(:member).permit(:user_id, :brochure_id)\n end", "def set_member\n @member = Member.friendly.find(params[:id])\n end", "def set_member\n\t\t\t\t@member = Member.find(params[:id])\n\t\t\tend", "def set_member\n @member = @account.members.find(params[:id])\n end", "def set_member\n @member = Member.with_attached_avatar.includes(:teams).find(params[:id])\n end", "def set_member\n @member = @current_enterprise.members.find(params[:id])\n end", "def member_params\n params.require(:member).permit(:group_id, :contact_id)\n end", "def member_params\n params.require(:member).permit( :user_id, :email, :password, :password_confirmation, :company_id )\n end", "def member_id=(member_id)\n write_attribute(:member_id, member_id) unless self.member_id\n end", "def set_member\n @member = @space.members.friendly.find(params[:id])\n end", "def set_member\n @agent_member = Member.find_by(site_id: @site.id, id: params[:id])\n end", "def member_params\n params.require(:member).permit(:user_name, :rank_id, :activity_status_id)\n end", "def update\n # byebug \n respond_to do |format|\n if self.current_member && self.current_member.id == params[:id].to_i\n if @member.update(member_params)\n format.json { render :show, status: :ok, location: @member }\n else\n return api_error(status: :unprocessable_entity, message: @member.errors)\n end\n else\n return api_error(status: 401, message: '没有操作权限')\n end\n end\n end", "def member_params\n\t\t\t\tparams.require(:member).permit(:name, :title, :manager_id)\n\t\t\tend", "def set_user_member\n @user_member = User::Member.find(params[:id])\n end", "def member_params\n #ap = activity_params\n\n [:id, :member_id].each_with_object(params) do |key, obj|\n obj.require(key)\n end\n end", "def member_params\n params.require(:member).permit(:name, :email, :location_id, :plan_id, :status)\n end", "def initialize(params={})\n params['member'] = params.delete('member__r')\n super(params)\n end", "def set_member\n @member = User.where(id: params[:id], tenant_id: current_tenant.id).first\n rescue Exception\n puts Exception\n end", "def member_params\n params[:member]\n end", "def member_params\n params.require(:member).permit(:attend, :user_id, :party_id)\n end", "def member_params\n params.require(:member).permit(:member_number, :entry, :exit, :entry_federation, :exit_federation, :person_id, :dad_id, :mum_id, :user_id, :person_attributes => [:id, :last_name, :first_name, :gender, :birth_date, :birth_place, :nationality, :street, :zip, :city, :contacts_attributes => [:id, :name, :number, :_destroy]], :user_attributes => [:id, :email, :person])\n end", "def member_params\n attrs = [:member_id, :fullname, :email, :upline_id, :telephone, :address, :package]\n attrs += [:region_name, :set_region_admin] if current_member.the_admin?\n\n params.require(:member).permit(attrs)\n end", "def create\n @member = @organization.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n logger.info(\"User #{current_user.email} created Member '#{@member.first_name} #{@member.last_name}' on #{@member.updated_at}\")\n format.html { redirect_to organization_path(@organization), notice: 'Member was successfully created.' }\n #format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def member_params\n params.fetch(:member, {})\n params.require(:member).permit(\n :name,\n :member_no,\n :birthday,\n :sex,\n :company_id,\n :bill_to_id,\n :sales_staff_id,\n :payment_terms,\n :unit_price,\n :upper_standerd,\n :lower_standerd,\n :dev_content,\n :task\n )\n end", "def set_member_status\n @member_status = MemberStatus.find(params[:id])\n end", "def member_id=(value)\n @member_id = value\n end", "def create\n user = User.find_user(params[:member][:user_id])\n @board = Board.find_board(params[:member][:board_id])\n @action = 'join'\n if ( !user.nil? && !@board.nil? )\n logger.debug \"----------------Member.new-------------------------------------\"\n @member = Member.new(params[:member])\n @member.user_id = user.id\n if params[:commit] == Member::Commit::FOLLOW\n logger.debug \"----------------Adding a follower #{user.full_name}-------------------------------------\"\n @member.user_id = current_user.id # follower could be only the current user\n @member.member_type = Member::MemberType::FOLLOWER\n # follower? is true if a user is a follower, member or owner\n if !current_user.follower?(@board)\n logger.debug \"----------------Saving follower #{user.full_name}-------------------------------------\"\n @action = 'follow'\n @member.save\n flash.now[:success] = \"Board \\\"#{@board.title}\\\" was linked to your profile.\"\n else\n flash.now[:warning] = \"Your profile already linked to \\\"#{@board.title}\\\".\"\n end\n else\n logger.debug \"----------------Adding a member #{user.full_name}-------------------------------------\"\n if !user.member?(@board)\n logger.debug \"----------------User #{user.full_name} is not a member-------------------------------------\"\n follower = user.follower?(@board)\n if follower\n logger.debug \"----------------Updating follower #{user.full_name} to become a member-------------------------------------\"\n follower.update_attribute(:member_type, Member::MemberType::MEMBER)\n else\n logger.debug \"----------------Saving #{user.full_name} as a member-------------------------------------\"\n @member.member_type = Member::MemberType::MEMBER\n @member.save\n end\n else\n logger.debug \"----------------Saving a follower #{user.full_name}-------------------------------------\"\n @member.member_type = Member::MemberType::MEMBER\n @member.save\n end\n flash.now[:success] = \"#{user.full_name} was added to your Board \\\"#{@board.title}\\\".\"\n end\n end\n\n if params[:commit] == Message::Commit::CONFIRM\n msg_id = params[:member][:message]\n unless ( msg_id.nil? )\n message = Message.find(msg_id)\n unless ( message.nil? )\n message.update_attribute(:msg_state, Message::State::CONFIRMED)\n end\n end\n end\n \n params[:act] = 'board_search'\n params[:search] = params[:member][:search] if !params[:member][:search].nil?\n\n respond_to do |format|\n #if @member.save\n format.html { redirect_to home_path }\n format.js\n format.json { render json: home_path, status: :created, location: home_path }\n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @member.errors, status: :unprocessable_entity }\n #end\n end\n end", "def set_member_point\n @member_point = MemberPoint.find(params[:id])\n end", "def member_params\n params.require(:member).permit(:profile_picture, :name, :name_am, :father_name, :father_name_am, :grand_father_name, :grand_father_name_am, :gender, :dob, :educational_level, :work, :christian_name, :christian_name_am, :membership_date, :talent, :home_address_id, :work_address_id, :emergency_contact_id, :status, :created_by, :modified_by, :deleted_at, :depart => [], :home_addr => [:id, :sub_city, :woreda, :house_no, :home_phone, :mobile_phone, :email, :postal_code], :work_addr => [:id, :sub_city, :woreda, :house_no, :home_phone, :mobile_phone, :email, :postal_code], :emergency_cont => [:id, :full_name, :relation, :addr => [:id, :sub_city, :woreda, :house_no, :home_phone, :mobile_phone, :email, :postal_code]] )\n end", "def touring_member_params\n params.require(:touring_member).permit(:user_id, :team_id)\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 set_group_member\n @group_member = GroupMember.find(params[:id])\n end", "def set_group_member\n @group_member = GroupMember.find(params[:id])\n end", "def set_household_member\n @household_member = HouseholdMember.find(params[:id])\n end", "def create\n @member = Member.new(create_params)\n respond_to do |format|\n if @member.save\n session[:member_id] = @member.id\n format.html { redirect_to @member }\n format.json { render action: 'show', status: :created, location: @member }\n else\n format.html { render action: 'new' }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @member = Member.new(params[:member])\n @member.house = current_member.house\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to root_url, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_member(data)\n headers = @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"), data)[1]\n id = Client.get_id_from_location_header(headers[:location])\n get_member(id)\n end", "def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\n end", "def set_member_post\n @member_post = MemberPost.find(params[:id])\n end", "def existing_member\n member = Member.find_by({\n band_id: params[:id],\n user_id: params[:user_id]\n })\n\n if member.nil?\n flash[:danger] = \"This user not a member of the band.\"\n redirect_to band_url(params[:id])\n end\n end", "def household_member_params\n #params.fetch(:household_member, {})\n params.require(:household_member).permit(:id, :name, :primary_applicant, :household_id, :created_at, :updated_at)\n end", "def member_params\n params.require(:member).permit(:member_name, :avatar)\n end", "def room_member_params\n\t\t\tparams.require(:room_member).permit(:user_id)\n\t\tend", "def update!(**args)\n @member_type = args[:member_type] if args.key?(:member_type)\n @person_id = args[:person_id] if args.key?(:person_id)\n end", "def set_member_of_parliament\n @member_of_parliament = MemberOfParliament.find(params[:id])\n end", "def create\n if check_if_field_empty(member_params)\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n else\n @member = User.new(member_params)\n @member.tenant_id = current_tenant.id\n respond_to do |format|\n if @member.save\n add_roles(params[:roles])\n format.html { redirect_to member_path(@member), notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def membership_params\n params.require(:membership).permit(:is_admin, :remote_uid)\n end", "def membership_params\n params.require(:membership).permit(:is_admin, :remote_uid)\n end", "def create\n @member = Member.new(member_params)\n unless @member.set_region_admin == \"1\"\n @member.region_id = current_member.region_id\n end\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n @uplines = Member.order(\"fullname\")\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @member = Member.where(email: params[:member][:email]).first\n if @member\n @member.active = true\n @member.update(member_params)\n else\n @member = Member.new(member_params)\n end\n respond_to do |format|\n if @member.save\n Notify.welcome_email(@member).deliver_now\n if current_user.nil?\n log_in @member\n is_admin?\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n else\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render :show, status: :created, location: @member }\n end\n else\n format.html { render :new }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n #to update all parameters of Member\n @member = Member.new(params[:member])\n \n #to do entry in member_event\n params[:events][:id].each do |e|\n if !e.empty?\n @member.member_events.build(:event_id => e)\n \n end\n end\n #to do entry in member_group\n params[:group_events][:id].each do |e|\n if !e.empty?\n @member.member_groups.build(:group_event_id => e)\n end\n end\n\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n format.json { render json: @member, status: :created, location: @member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_group_member\n @groupmember = GroupMember.find(params[:id])\n end", "def member_params\n params.require(:member).permit(:username, :nickname, :password, :password_confirmation, \n :bio, :open_id, :union_id, :birthday, :new_password, :new_password_confirmation)\n end", "def member_params\n params.require(:member).permit(:first_name, :last_name, :email)\n end", "def member_params\n params.require(:member).permit(:avatar, :baby_picture, :bio, :first_name, :last_name, :position, :role, :linked_in_profile)\n end" ]
[ "0.70346093", "0.6793235", "0.65289307", "0.6348152", "0.6348152", "0.6348152", "0.6348152", "0.6348152", "0.63186455", "0.63106835", "0.62819356", "0.6279582", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6267783", "0.6266881", "0.6228695", "0.62240064", "0.6216558", "0.6210572", "0.6186597", "0.6185023", "0.61598444", "0.6110365", "0.60409373", "0.6020588", "0.6012365", "0.6004117", "0.5976125", "0.595989", "0.5948942", "0.5930893", "0.59039783", "0.5865774", "0.5865581", "0.58558214", "0.5850637", "0.5830295", "0.58108735", "0.57924324", "0.5784108", "0.5756353", "0.57507396", "0.5750695", "0.5747226", "0.57467765", "0.5715376", "0.57130724", "0.5679675", "0.5673006", "0.5657674", "0.5657674", "0.56555086", "0.5653948", "0.5641904", "0.55886394", "0.5583974", "0.5582154", "0.5555539", "0.55517095", "0.55500907", "0.55444086", "0.55341756", "0.5530934", "0.55275744", "0.55261576", "0.55261576", "0.55251384", "0.5520714", "0.5519039", "0.5517159", "0.5511557", "0.5511375", "0.55087525" ]
0.6534034
2
converts an array into an unordered list
def to_list(options = {}) css_class = options.delete(:class) || 'errors' list_items = self.inject("") do |items, error| items << "<li>#{error}</li>" end return '<ul class="%s">%s</ul>' % [css_class, list_items] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_to_html array, type\n '<ul> <li>' +\n array.join('</li><li>')\n + '</li> </ul>'\nend", "def make_list(array)\n\ty = []\n\tarray.each_with_index do |element, index|\n\t\ty << \"#{index+1}. #{element}\"\n\tend\n\ty\nend", "def make_list_a(array)\n\tstring_array = []\n\tarray.each do |element|\n\t\tstring_array << element.to_s\n\tend\n\tnumbered_array = []\n\tcounter = 0\n\tstring_array.each do |string|\n\t\tcounter += 1\n\t\tnumbered_array << \"#{counter}:#{string}\"\n\tend\n\tnumbered_array\nend", "def unordered_list; end", "def unordered_list(_arr)\n raise NotImplementedError\n end", "def make_list(array)\n array.compact!\n new_array = []\n number = 0\n array.each do |item|\n number += 1\n new_array << \"#{number}. #{item}\"\n end \n new_array\nend", "def make_list(array)\n string = \"\"\n array.each_with_index do |item, index|\n index < array.length-1? c = \", \": c = \"\"\n formatted_item = \"#{index +1}. #{item}#{c}\"\n string = string.concat(formatted_item)\n end\n string\nend", "def convert_array(arr)\n return '' if arr.nil?\n result = ''\n case arr\n when String, Fixnum then result << arr.to_s\n when NilClass then result << ''\n when Array\n case arr.first\n when String, Fixnum\n result << '<ul>'\n arr.each do |a|\n result << \"<li>#{convert_array(a)}</li>\" unless a.empty?\n end\n result << '</ul>'\n when NilClass then result << ''\n when Array\n result << '<ul>'\n arr.each do |a|\n result << convert_array(a)\n end\n result << '</ul>'\n when Hash\n # Change the formatting of sub-tables for easier viewing\n result << '<span class=\"ReportCSSChildTable ReportCSS\"><table><thead><tr>'\n arr.first.keys.each { |a| result << \"<td>#{convert_array(a)}</td>\" }\n result << '</tr></thead><tbody>'\n arr.each do|a|\n result << '<tr>'\n a.values.each { |b| result << \"<td>#{convert_array(b)}</td>\" }\n result << '</tr>'\n end\n result << '</tbody></table></span>'\n else\n result << 'Unknown value!!'\n end\n else\n result << 'Unknown value!'\n end\n end", "def array_list(array) \t\t\t\t\t\t\n\tarray.each {|item| puts \"* #{item}\"}\nend", "def to_a list = @list\n lines = []\n return lines if list.length < 2\n if list[0].is_a? Array\n left = to_a(list[0]).flatten\n right = to_a(list[1]).flatten\n indent = (left + right).collect { |i| i.length }.max\n all = left[0..(left.length / 2)]\n left[(left.length / 2 + 1)..-1].each do |i|\n all << ((i + (\" \"*indent))[0..(indent-1)] + \"|\")\n end\n all << (\" \"*indent) + \"|---\"\n right[0..(right.length / 2 - 1)].each do |i|\n all << ((i + (\" \"*indent))[0..(indent-1)] + \"|\")\n end\n all << right[(right.length / 2)..-1]\n else\n return [list[0].to_s, \"---\", \" |---\", \"---\", list[1].to_s]\n end\n end", "def flat(a)\n\tnew_arr = []\n\ta.each do |el|\n\t\tif el.is_a? Array\n\t\t\tel.each do |n|\n\t\t\t\tif el.is_a? Array\n\t\t\t\t\ta << n\n\t\t\t\telse\n\t\t\t\t\tnew_arr << n\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tnew_arr << el\t\n\t\tend\n\tend\n\tp new_arr\nend", "def nice_list(arr)\n\tarr.each { |i| puts \"* \" + i.to_s }\nend", "def list (array) #method that outputs an array as a list with an asterisk\n\t\tarray.sort.each do |item| #sorts alphabetically\n\t\tputs \"* #{item}\"\n\tend\t\nend", "def deconvert\n result = []\n yield result\n array.each do |converted_item|\n result << UniversalDumper.deconvert(converted_item)\n end\n result\n end", "def from_list_to_html(list, depth_to_traverse=1000, start_depth=0)\n depth = start_depth\n if list.is_a?(Array) && !list.empty?\n str =''\n str << '<ul>'\n depth += 1\n list.each do |value|\n unless depth > depth_to_traverse\n str << \"<li> #{value} </li> \"\n if value.is_a?(Array) \n str << from_hash_to_html(value, depth_to_traverse, depth)\n end\n end\n end\n str << '</ul> '\n return str\n end\n return ''\n end", "def lcts(array)\nend", "def flatten_sequence(list); end", "def flatten(arr)\n\n flat = []\n\n arr.each do |el|\n if el.class != Array\n flat << el \n else\n #flatten(el).each {|char| flat << char}\n flat.push(*flatten(el))\n end\n end\n flat \nend", "def flatten(array)\n return [] if array.empty? \n list = []\n head = array[0]\n rest = array[1..-1]\n if head.is_a? Array \n flatten(head) + flatten(rest)\n else \n list += [head] + flatten(rest)\n end \nend", "def create_list arr\n list = SinglyLinkedList.new\n arr.each do |i|\n list.insert_at_end i\n end\n list\nend", "def create_list arr\n list = SinglyLinkedList.new\n arr.each do |i|\n list.insert_at_end i\n end\n list\nend", "def create_list arr\n list = SinglyLinkedList.new\n arr.each do |i|\n list.insert_at_end i\n end\n list\nend", "def add_ly(array)\n array.collect! do |element|\n if element.is_a?(Array)\n add_ly(element)\n else\n element += \"ly\"\n end\n end\n return array\nend", "def flatten(array)\n container = []\n\n array.each do |element|\n if element.is_a?(Array)\n container += element\n else\n container << element\n end\n end\n\n container\nend", "def toc\n ary = []\n\n lopen = \"<#@toc_style>\"\n lclose = \"</#@toc_style>\"\n prev_depth = open = 0\n\n @toc.each do |a|\n cur = a.first\n\n # close out the previous list item if we're at the same level\n if cur == prev_depth\n ary << \"</li>\"\n\n # if we are increasing the level, then start a new list\n elsif cur > prev_depth\n ary << if ary.empty? then @list_opening else lopen end\n open += 1\n\n # we are decreasing the level; close out tags but ensure we don't\n # close out all the tags (leave one open)\n else\n (prev_depth - cur).times {\n ary << \"</li>\" << lclose\n open -= 1\n break if open <= 0\n }\n if open > 0\n ary << \"</li>\"\n else\n ary << lopen\n open += 1\n end\n end\n\n # add the current element\n ary << \"<li>\" << a.last\n prev_depth = cur\n end\n\n # close out the remaingling tags\n ary << \"</li>\" << lclose\n ary.join(\"\\n\")\n end", "def translate_array(array)\n array.each_with_object([]) do |input_element, output_array|\n output_element = self.map(input_element)\n if output_element.kind_of? Array\n output_array.concat output_element\n elsif ! output_element.nil?\n output_array << output_element\n end\n end\n end", "def write_list(list, array)\n\tstart = 1\n\tstart = list[array[-1] - 1] if list[array[-1] - 1] != 0\n\tarray.length.times do |i| \n\t\tif array[i] <1E6 && list[array[i] - 1] == 0\n\t\t\tlist[array[i] - 1] = array.length - i - 1 + start\n\t\tend\n\tend\nend", "def format_list(items); end", "def to_list\n foldr(List[]) { |x, xs| Cons[x, xs] }\n end", "def convert_ul(el, opts)\n @current_indent += @indent unless opts[:parent].type == :root\n content = inner(el, opts)\n @current_indent -= @indent unless opts[:parent].type == :root\n content.join\n end", "def flip_horizontally(array)\n\tif array[1].kind_of?(Array)\n\t\tfor item in array\n\t\t\titem.reverse!\n\t\tend\n\telse \n\t\tarray.reverse!\n\tend\n\treturn array\nend", "def reverser(array)\n new_array = []\n array.each { |e| new_array.unshift(e) }\n new_array\nend", "def magic_array (liste)\n\treturn liste.flatten.collect {|x| x * 2} .delete_if { |x| x%3 == 0 } .uniq .sort\nend", "def listify(string)\n output = \"<ul>\\n\"\n string.gsub!(/\\:\\n/, \":\")\n arrayify = string.split(\"\\n\")\n arrayify.each do |line|\n line.strip!\n if line.length>0\n output << \"\\t<li>#{line}</li>\\n\"\n end\n end\n output << \"</ul>\\n\"\nend", "def nested_array_to_html(nodes)\n classes = \"depth-#{ nodes.first[:depth] }\"\n classes += \" folder-tree\" if nodes.first[:depth].zero?\n\n html = \"<ul class=\\\"#{ classes }\\\">\"\n nodes.each do |node|\n html += \"<li>\"\n\n if node[:children]\n html += '<i class=\"icon-folder-close\"></i>'\n else\n html += '<i class=\"icon-file-alt\"></i>'\n end\n\n html += \"<span class=\\\"name\\\">#{ node[:name].strip }</span>\"\n unless (node[:children].nil? || node[:children].empty?)\n html += nested_array_to_html(node[:children]) \n end\n html += '</li>'\n end\n\n html += '</ul>'\n\n html\n end", "def fixed_array\n reformated_array.map! do |element|\n element.join(\", \").split(\", \")\n end \nend", "def a_ul hsh\n\tstr = \"\"\n\thsh.each_pair {|key, value| str += \"<li>#{key}: #{value}<li>\"}\n\t\"<ul>\"+ str + \"</ul>\"\nend", "def partlist(arr)\n len = arr.length\n i = 0\n masterArr = []\n while i < len - 1 do\n masterArr << [arr[0..i].join(\" \")] + [arr[i+1..len].join(\" \")]\n i += 1\n end\n masterArr\nend", "def reverse(array)\n result = []\n array.each do |item|\n result.prepend(item)\n end\n result\nend", "def my_flatten(array)\n print array.flatten\n end", "def normalize_array(array)\n array.map(&:to_s)\n end", "def normalize_array(array)\n array.map(&:to_s)\n end", "def flatt(arr, flat_arr = [])\n arr.each do |element|\n if element.is_a?(Array)\n flatt(element, flat_arr)\n else\n flat_arr << element\n end\n end\n flat_arr\nend", "def primitive_list(value,tabs)\n s = \"\"\n s << tabs+'<ul>' << \"\\n\"\n value.each_pair do |k,v|\n s << tabs+' '+'<li>'+kv(k,v)+'</li>' << \"\\n\" if k.class == String\n end\n s << tabs+'</ul>' << \"\\n\"\n s\n end", "def to_a; @list; end", "def reverse_array(array)\n flipped = []\n array.each{ |el| flipped.unshift(el) }\n flipped\nend", "def array_to_lines(array, delimiter = '<br />')\n array.blank? ? nil : array * delimiter\n end", "def to_s\r\n @list.map{|el| el.to_s}.join ' | '\r\n end", "def convert_java_util_list(object)\n array_list = []\n object.size.times do\n |i| array_list << wrap_java_object(object.get(i))\n end\n array_list\n end", "def doubler(array)\n \nend", "def doubler(array)\n \nend", "def flatten(array)\n return [] if array.empty?\n\n res = []\n array.each do |el|\n if el.is_a? Array\n res += flatten(el)\n else\n res << el\n end\n end\n res\nend", "def build_list_from_array(values)\n values.each { |v| enqueue(v) }\n end", "def using_flatten(array)\n array.flatten\n end", "def doubler(array)\r\n res = []\r\n array.each do |ele|\r\n res << ele * 2\r\n end\r\n res\r\nend", "def partlist(arr)\n result = []\n arr[0..-2].each_with_index do |item, index|\n result << [arr[0..index].join(\" \"), arr[(index + 1)..-1].join(\" \")]\n end\n result\nend", "def reverse(arr)\n reverse_array = []\n arr.each do |item|\n reverse_array.unshift(item)\n end\n p reverse_array\nend", "def reverse(arr)\n output = []\n arr.reverse_each {|x| output.push x}\n output\nend", "def two_d_translate(array)\n new_array = []\n array.each do |sub_array|\n num = sub_array[1]\n ele = sub_array[0]\n num.times { new_array << ele }\n end\n\n new_array\nend", "def convert_to_java_list( ruby_array ) \n list = java.util.ArrayList.new\n ruby_array.each do |item|\n list.add( item )\n end\n \n list\n end", "def list(array)\n array.each do |x|\n puts x\n end\nend", "def hierarchies(array)\n count = 0\n array.reduce([]) { |acc, value| acc << array.slice(0, count += 1) }\n end", "def printListEnumerated(arr)\r\n i = 0\r\n while i < arr.length\r\n puts ' ' + i.to_s + ' ' + arr[i].to_s\r\n i += 1\r\n end\r\n if(arr.length == 0)\r\n puts ' List is empty.'\r\n end\r\n\r\n end", "def reverse(array)\n new_array = []\n \n array.reverse_each { |element| new_array << element }\n \n new_array\nend", "def flatten(array)\n new_array = []\n array.each do |x|\n if x.class == Array\n x.each {|y| new_array.push(y)}\n else\n new_array.push(x)\n end\n end\n new_array\nend", "def array_joiner( *arr)\n p arr\n array = [] \n array << arr\n array.flatten.flatten\n\nend", "def formatStepList(stepList)\n formattedList = []\n for direction in stepList\n for step in direction\n formattedList.push(step)\n end\n end\n return formattedList\nend", "def flatten(array)\n a = []\n array.each do |n|\n if n.is_a? Array\n b = flatten(n)\n b.each { |x| a << x }\n else\n a << n\n end\n end\n a\nend", "def unordered_list_elements(identifier)\n platform.unordered_lists_for(identifier.clone)\n end", "def using_flatten(array)\n \n array.flatten\n \nend", "def reverse(arr)\n temp = []\n for el in arr\n temp.unshift(el)\n end\n temp\nend", "def to_s\r\n @list.map{|el| el.to_s}.join ' '\r\n end", "def reverse(array)\n array.each_with_object([]) do |item, result|\n result.prepend(item)\n end\nend", "def print_array list\n print \"[\"\n list[0..-2].each do |num|\n print \"#{num}, \"\n end\n print \"#{list[-1]}]\"\nend", "def treeify(arr, pre)\n arr.map { |elem| (elem.is_a? Array) ? treeify(elem, pre + \"-\") : nodeify(pre, elem) }\n end", "def triplify(array)\n \t \n \t new_array = array.map { |i| i * 3 }\n \t p new_array\n end", "def reverse(array)\n reversed_array = []\n array.each { |item| reversed_array.unshift(item) }\n reversed_array\nend", "def list(arr)\n return \"\" if arr.empty?\n\n str = []\n\n arr.each do |hsh|\n hsh.each do |k, v|\n str << v\n end\n end\n \n return str[0] if str.length < 2\n\n names = ''\n idx = 0\n\n until idx == str.length - 2\n names << str[idx] + ', '\n idx += 1\n end\n names << str[-2] + ' & '\n names << str[-1]\n \nend", "def make_list(text)\n\traw_text_array = text.split(\" \")\n\treturn raw_text_array\nend", "def reverse(arr)\n new_arr = []\n arr.each do |element|\n new_arr.prepend(element)\n end\n new_arr\nend", "def reverse(array)\n result_array = []\n array.each { |element| result_array.unshift(element) }\n result_array\nend", "def add array\n #$log.debug \"tabular got add #{array.count} #{array.inspect} \" if $log\n @list ||= []\n @list << array\n end", "def list_of(maybe_an_array)\n [maybe_an_array].flatten\n end", "def converted_arrays; end", "def add_line_breaks(arr)\n arr.map {|element| element[0..-1] + [\"\\n\"]}\nend", "def return_string_array(array)\n count = 0\n # create new array to store converted elements\n new_array = []\n # iterate over a provided array\n while count < array.length do\n # add each converted element to the end of a new array with Shovel Method\n new_array << array[count].to_s\n count += 1\n end\n # return new array\n new_array\nend", "def flatten(list)\n list.flatten\nend", "def to_s\n\t\ts = \"[\"\n\t\tcurr = @head\n\t\twhile !curr.nil?\n\t\t\ts << curr.to_s\n\t\t\tcurr = curr.next\n\t\tend\n\t\ts << \"]\"\n\tend", "def rb2scm_list(array)\n if array.nil?\n SCM_EMPTY_LIST\n else\n m = Rubeme.method(:rb2scm)\n scm_make_list(*array.map(&m))\n end\n end", "def reverse(array)\r\n new_array = []\r\narray.reverse_each do |element|\r\n new_array << element\r\nend\r\nnew_array\r\nend", "def explode_list(list)\n res = [[]]\n list.each do |key|\n if key.kind_of?(Array)\n res_bak = res\n res = []\n key.each do |k|\n res_bak.each do |list|\n res << (list + [k])\n end\n end\n else\n res.each do |list|\n list << key\n end\n end\n end\n res\n end", "def reverse_array(array)\n new_array = [ ]\n array.each do |word|\n new_array.unshift(word)\n end\n\n return new_array\nend", "def reverse(arr)\n\nnew_arr = []\n\n arr.each do |element|\n new_arr.unshift(element)\n end\n new_arr\n\nend", "def encode_list(value)\n encode_string(value.map { |s| encode_string(s) }.join)\n end", "def reverse(array)\n result_array = []\n array.reverse_each { |element| result_array << element }\n result_array\nend", "def reverse(array)\n result_array = []\n array.reverse_each { |element| result_array << element }\n result_array\nend", "def reverse(list)\n list.each_with_object([]) { |el, arr| arr.unshift(el) }\nend", "def to_list\n retval = []\n 1.upto(@tiles.length - 1) do |row|\n 1.upto(@tiles[row].length - 1) do |col|\n retval << @tiles[row][col]\n end\n end\n retval\n end", "def reverse_every_element_in_array(arr)\n reformed_array = []\n index = 0\n arr.each do |entry|\n reformed_array.insert(index, entry.reverse())\n index += 1\n end\n return reformed_array\nend", "def convert_ul(el, opts)\n @current_indent += @indent unless opts[:parent].type == :root\n inner(el, opts)\n @current_indent -= @indent unless opts[:parent].type == :root\n end", "def serialize_list_array(list_uri, uris)\n uris.each_index { |index|\n next_uri = nil\n next_uri = uris[index + 1] if index + 1 < uris.length\n serialize_list(uris, index, uris[index], next_uri, list_uri)\n }\n end" ]
[ "0.75367564", "0.6981503", "0.68928045", "0.6551364", "0.6535587", "0.6497203", "0.6449394", "0.642377", "0.62411296", "0.6121402", "0.60963625", "0.6071792", "0.60167044", "0.59830135", "0.5947059", "0.5935377", "0.5882502", "0.5839958", "0.58238006", "0.5794239", "0.5794239", "0.5794239", "0.57466865", "0.57398874", "0.5684953", "0.56756127", "0.566508", "0.565903", "0.5643882", "0.56308955", "0.56266147", "0.5606501", "0.55968976", "0.55943036", "0.5587432", "0.558063", "0.55792564", "0.55441654", "0.5542563", "0.5531929", "0.5508645", "0.5508645", "0.54614836", "0.5447573", "0.5446127", "0.54420805", "0.54321563", "0.54208964", "0.5415794", "0.5408311", "0.5408311", "0.5403395", "0.5395951", "0.5389358", "0.53833926", "0.5381386", "0.5380795", "0.537506", "0.53691214", "0.53687924", "0.53593946", "0.53484935", "0.5342143", "0.5334252", "0.533389", "0.53326344", "0.5332112", "0.53287756", "0.53283507", "0.5328089", "0.5322172", "0.53192264", "0.53152007", "0.5315048", "0.53117055", "0.53057045", "0.5298555", "0.52978134", "0.5296489", "0.52962863", "0.5296037", "0.5294861", "0.5293137", "0.5287399", "0.5284012", "0.52685225", "0.5268246", "0.5267987", "0.5267915", "0.5267415", "0.5266818", "0.52624696", "0.52603334", "0.5257035", "0.52477616", "0.52477616", "0.52472466", "0.52439207", "0.5239147", "0.5236347", "0.5230104" ]
0.0
-1
exercise_2 x = 2 => 2 puts x = 2 nil p name = "Joe" => "Joe" four = "four" => "four" print something = "nothing" nothing=> nil exercise_3
def multiply(num1, num2) num1 * num2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def praise_person(name, age)\n puts \"#{name} is amazing\"\n puts \"#{name} is charming\"\n puts \"#{name} is talented\"\n puts \"#{name} is #{age} years old\"\n puts \"In 5 years he is going to be #{age + 5}\"\nend", "def main\n\n #\n # In Ruby, everything is an expression, even the control structures.\n #\n\n #\n # if, else, elsif\n #\n # The value that results from evaluating an if expression is the\n # value of the last expression in the code that was executed, or\n # nil if no block of code is executed.\n #\n \n x = 3\n\n if x == 1\n name = \"one\"\n elsif x == 2\n name = \"two\"\n elsif x == 3\n name = \"three\"\n elsif x == 4\n name = \"four\"\n else\n name = \"many\"\n end\n\n puts name\n\n # here is another way to write the above if expression\n\n if x == 1\n name = \"one\"\n elsif x == 2\n name = \"two\"\n elsif x == 3 then name = \"three\"\n elsif x == 4 ; name = \"four\"\n else\n name = \"many\"\n end\n\n puts name\n\n # here is another way to write the above if expression\n\n name = if x == 1 then \"one\"\n elsif x == 2 then \"two\"\n elsif x == 3 then \"three\"\n elsif x == 4 then \"four\"\n else \"many\"\n end\n\n puts name\n\n # for single-line conditionals: use \"if\" as a modifier\n y = x.odd? if x.respond_to?(:odd?)\n puts y\n \n #\n # unless is the opposite of if. unless executes code only if associated\n # expression evaluates to false or nil. elsif clauses are not allowed.\n #\n x = 10\n unless x == 0\n puts \"x is not 0\"\n else\n puts \"x is 0\"\n end\n \n # for single-line conditionals: use \"unless\" as a modifier\n s = x.to_s unless x.nil?\n puts s\n \n #\n # case statement is a multiway conditional. Like if, case returns a value\n #\n x = 5\n case x\n when 1\n name = \"one\"\n when 2\n name = \"two\"\n when 3\n name = \"three\"\n when 4\n name = \"four\"\n else # optional\n name = \"many\"\n end\n puts name\n \n # since case returns a value, here is another way to write the above case\n name = case x\n when 1\n \"one\"\n when 2\n \"two\"\n when 3\n \"three\"\n when 4\n \"four\"\n else \"many\"\n end\n puts name\n \n #\n # Ruby has three looping statements: while, until, and for/in.\n #\n x = 10\n while x >= 0 do\n puts x\n x -= 1\n end\n puts\n \n # above code using until\n x = 10\n until x < 0 do\n puts x\n x -= 1\n end\n puts\n \n # while as a modifier\n x = 0\n puts x = x + 1 while x < 10\n puts\n \n # until as a modifier\n x = 0\n puts x = x + 1 until x == 10\n puts\n \n #\n # for/in loop is used to iterate through the elements of an enumerable object\n #\n for i in 1..10 do\n print i, \" \"\n end\n print \"\\n\\n\"\n \n # print elements in an array\n a = [5, 10, 15, 20, 25]\n for e in a do\n print e, \" \"\n end\n print \"\\n\\n\"\n \n # print keys and values in a hash\n h = {:a => 1, :b => 2, :c => 3}\n for key,value in h\n puts \"#{key} => #{value}\"\n end\n puts\n \nend", "def praise_person(name)\n puts \"#{name} is amazing\"\n puts \"#{name} is talented\"\nend", "def ask_question(player)\n puts \"#{player.name}: What does #{@num1} plus #{@num2} equal?\"\n puts \" \"\n end", "def print_name(name = \"Cole Henson\")\n p (name)\nend", "def saludar(name=nil)#El nulo o NULL en ruby es nil\n if name\n puts \"Hola #{name}\"#Llamas una variable dentro del puts con #{variable}\n else\n puts \"Hola\"\n end\nend", "def exercise_119 (number)\n end", "def print_name \n name = ''\n # binding.pry\n puts name \nend", "def fiction_details_one(arg)\n puts \"Fiction\"\n puts arg\n puts \"asdfasdfsd\"\n end", "def marriage(name1,name2)\n p \"Do you #{name1} take #{name2} to be your lawfully wedded partner?\"\nend", "def rude_greeting(name=nil)\n name ||= \"you jerk\" #if name is nil, substitute the later argument\n puts \"Hey there, #{name}\"\n end", "def print_two(thing, another_thing)\n\tputs \"thing 1: #{thing}, thing 2: #{another_thing}\"\nend", "def print_two (thing, another_thing)\r\n #...this is where the code goes\r\n puts \"thing_1: #{thing}, thing 2: #{another_thing}\"\r\nend", "def fungi_jalan()\n\tx=5\n\tputs \"tuk... tuk .. \"\n\tputs \"tuk... tuk .. \"\n\tputs \"tuk... tuk .. #{x}\"\nend", "def variable(name)\n puts \"Hello, #{name}\"\n sleep(1)\n puts \"Let's begin with variables!\"\n sleep(1.5)\n puts \"A variable is a way of storing data for later use\"\n sleep(1.5)\n puts \"A variable begins with a descriptive name, followed by equals '=' and then what you want to assign the variable as\"\n sleep(2)\n puts \"For example: \"\n sleep(1)\n puts \"days_in_a_year = 365\".colorize(:blue)\n sleep(1)\n puts \"hours_in_a_day = 24\".colorize(:blue)\n sleep(1)\n puts \"your_name = '#{name}'\".colorize(:blue)\n sleep(1)\n puts \"my_name = 'Axel'\".colorize(:blue)\n sleep(2)\n puts \"This allows us to use whats in the variable, without having to remember what's in it.\"\n sleep(1.5)\n puts \"Say we wanted to figure out how many hours are in a week\"\n sleep(2)\n puts \"We can simple do: 7 x hours_in_a_day = 168\"\n sleep(1.5)\n puts \"Another reason variables are so helpful is because they are easy to change!\"\n sleep(3)\n puts \"Let's say that the hours in a day change\"\n sleep(2)\n puts \"I'll let you decide what they change to\"\n sleep(1.5)\n puts \"What do they change to??\"\n sleep(1)\n prompt = TTY::Prompt.new\n hours_in_a_day = prompt.ask(\"How many hours in a day now?\".colorize(:green), convert: :int, default: ENV[\"User\"], )\n puts \"Awesome, so hours_in_a_day = #{hours_in_a_day}\"\n sleep(2)\n puts \"So to find out how many hours in a week we do 7 x hours_in_a_day = #{7 * hours_in_a_day}\"\n sleep(3)\n puts \"Notice how the variables my_name and your_name had quotation marks around them\"\n sleep(2)\n puts \"my_name = 'Axel' \".colorize(:blue)\n puts \"your_name = '#{name}'\".colorize(:blue)\n sleep(3)\n puts \"but hours_in_a_day didn't\"\n puts \"hours_in_a_day = #{hours_in_a_day}\".colorize(:blue)\n sleep(3)\n puts \"This is because they are different 'data types'. \"\n sleep(1)\n end", "def print_question(num)\n puts \"=> Please enter the #{num} number:\"\nend", "def captain_obvious(name, what_you_love)\n\tputs(\"My name is #{name} and I love #{what_you_love}!\")\nend", "def mess_with_vars1(one, two, three)\n one = two\n two = three\n three = one\nend", "def print_name(name)\n p \"Get out of my house #{name}!\"\nend", "def func3(name=\"default name\",age=18)\n puts (\"name is \"+name)\n puts (\"age is \"+age.to_s)\n puts \"\"\nend", "def example num\n puts\n puts \"------ Example #{num} ------\"\nend", "def print_student something_else, blah, info={}\r\n\tputs something_else + \" \" + blah\r\n\tputs \"#{info['name']} is #{info['age']} old and has a gpa of #{info['gpa']}\"\r\nend", "def nameandageprint\n puts 'What is your name?'\n uname = gets.chomp\n puts 'What is your age?'\n uage = gets.chomp\n puts \"Your Name is #{uname}\"\n puts \"Your age is #{uage}\"\nend", "def print\n puts \"My name is #{@name} and I am #{@age} y.old\"\n end", "def print_two_again(arg1, arg2)\n p \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_name(name)\n puts ('Rob')\nend", "def interpolation(name)\r\n \r\n puts \"Hi, my name is #{name}.\"\r\n \r\n (name) = \"Josh\"\r\n \r\n \r\n end", "def mess_with_vars2(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars2(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def print_again_third (arg2,arg3)\n puts \"arg2: #{arg2}, arg3:#{arg3}\"\nend", "def saludar(name=nil)\n print 'Hola'\n print \" #{name}\" if name\n print \"\\n\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def print_two_again(arg1, arg2) # Non-variable list of inputs it will accept\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def print_one(thing)\n\tputs \"thing: #{thing}\"\nend", "def introduce(name:, age:, food:)\n puts \"I am #{name}\"\n puts \"I am #{age} years old\"\n puts \"I like #{food}\"\nend", "def print_name(name)\n p \"Your name is #{name}\"\nend", "def parrot(name =\"Squawk!\")\nputs \"#{name}\"\nreturn \"#{name}\"\nend", "def test(name=\"no name\",age=-1)\n puts (\"Hi \" + name +\" age\" + age.to_s)\n end", "def print_name(name)\n p \"My name is #{name}\"\nend", "def meow\n puts \"My name is #{name} and i eat #{preferred_food} at #{eats_at}\"\n end", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\nend", "def print_two_again(arg1, arg2)\r\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\r\nend", "def print_two_again(arg1, arg2)\r\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\r\nend", "def current_player(board) # can't have a space b/f and use parenthesise to hold argument\n#start a REPL session\n #def current_player\n #def current_player (board) # wrong number of arguments (0 for 1)\n #def current_player () # wrong number of arguments (1 for 0)\n #def current_player (board, first = \"X\", second = \"O\")\n if turn_count(board) % 2 == 0 #failed to include turn_count method's argument (board) 1st x; worked after argument inclusion\n return \"X\" #1st x w/ \"O\"-returned failure/error msg where it expected \"X\" & got \"O\"\n #puts \"O\", returns nil. same as print command\n elsif turn_count(board) % 2 == 1\n return \"O\" #1st x w/\"X\"-returned failure/error msg where it expected \"X\" & got \"O\"\n #puts \"X\", return nil. same as print command\n end\nend", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # Print the value assigned to c_c\n puts \"You have #{cheese_count} cheeses!\"\n # Print the value assigned to b_o_c\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # Print text\n puts \"Man, that's enough for a party!\"\n # Print text\n puts \"Get a blanket.\\n\"\n# End the method\nend", "def nonsense name\n yield 1\n puts \"#{name} is a non sense person\"\n yield 2\n puts \"but #{name} is very nice\"\n yield 3\n puts \"he makes people happy\"\nend", "def print(num,subs)\n puts \"num#{subs} = #{num}\"\nend", "def display_e(num)\n Kernel.puts(\"=> Exercise \\##{num}:\")\nend", "def greet(name)\n\nif name == \"\"\n p nil\nelsif name == nil\n p nil\nelse\n \"hello #{name}!\"\nend\n\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg2}, arg2:#{arg2}\"\nend", "def fizzbuzz(number)\n #binding.pry\n if (number % 3 == 0 && number % 5 == 0)\n then \"FizzBuzz\"\n elsif number % 3 == 0\n then \"Fizz\"\n elsif number % 5 == 0\n then \"Buzz\"\n else\n nil\n end\nend", "def print_two_again(arg1, arg2)\n puts \"arg1 #{arg1}, arg2: #{arg2}\"\nend", "def introduce()\r\n\t\tprint \"I am #{@name}, I am #{@age} years old\"\r\n\r\nend", "def print_two_again(arg1, arg2)\n puts \"arg1; #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1; #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\n end", "def print_one(arg)\r\n puts \"arg: #{arg}\"\r\nend", "def print_name_age(name, age)\n puts \"#{name} is #{age} years old!\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend" ]
[ "0.64835894", "0.63050634", "0.6302982", "0.6074408", "0.5968881", "0.5822489", "0.58056784", "0.5795795", "0.5788402", "0.57811505", "0.5778462", "0.5766011", "0.5762608", "0.57476556", "0.5741858", "0.5726895", "0.57242477", "0.57239497", "0.5711015", "0.5696518", "0.56886023", "0.56846124", "0.56766117", "0.56725633", "0.56711346", "0.5670279", "0.56682384", "0.5662756", "0.5662756", "0.5657602", "0.5651594", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.5628046", "0.56236595", "0.5621182", "0.5621182", "0.5621182", "0.5621182", "0.5621182", "0.5621182", "0.5621182", "0.5621182", "0.5621182", "0.5621182", "0.5616011", "0.5611134", "0.5600873", "0.5584412", "0.558008", "0.55746466", "0.5572035", "0.55675846", "0.5565256", "0.5565256", "0.55635256", "0.5562836", "0.55611026", "0.5538264", "0.55331886", "0.553221", "0.5524239", "0.5512373", "0.55082047", "0.5502699", "0.5492384", "0.5492384", "0.549204", "0.5486255", "0.54859734", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654", "0.54844654" ]
0.0
-1
=begin Write a recursive method that computes the nth Fibonacci number, where nth is an argument to the method. =end
def fibonacci(nth) return 1 if nth <= 2 fibonacci(nth - 1) + fibonacci(nth - 2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nthFibonacci(n)\r\n if n == 1\r\n return 1\r\n\r\n elsif n == 2\r\n return 1\r\n\r\n else n > 2\r\n n = nthFibonacci(n-1) + nthFibonacci(n-2)\r\n end\r\nend", "def nth_fibonacci(n) \n if n == 1\n return 0\n elsif n == 2\n return 1\n end\n return nth_fibonacci(n-1) + nth_fibonacci(n-2)\nend", "def fibo_nth(n)\n puts \"computing fibo for n=#{n}\" if @debug\n\n case n\n when 0 then 0\n when 1 then 1\n else fibo_nth(n-2) + fibo_nth(n-1)\n end\nend", "def iterative_nth_fib(n)\n return 1 if n <= 2\n a = 1\n b = 1\n i = 3\n while i <= n\n new_a = b\n b = a + b\n a = new_a\n i += 1\n end\n b\nend", "def fib(n)\n if n == 0 || n == 1\n return n\n else\n fib(n - 1) + fib(n - 2)\n end\n end", "def get_nth_fib(n)\n if n == 0 || n == 1\n return 0\n elsif n == 2\n return 1\n else\n return get_nth_fib(n-1) + get_nth_fib(n-2)\n end\n\nend", "def fibonacci(nth)\n return 1 if nth <= 2\n\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend", "def fib(nth)\n return 1 if nth == 1 || nth == 2\n fib(nth - 2) + fib(nth - 1)\nend", "def fibonacci_given(nth)\n return 1 if nth <= 2\n fibonacci_given(nth - 1) + fibonacci_given(nth - 2)\nend", "def get_nth_fib(n)\n if n == 2\n return 1\n elsif n == 1\n return 0\n else\n return get_nth_fib(n - 1) + get_nth_fib(n - 2)\n end\nend", "def find_fib_nth(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n return (find_fib_nth(n - 2) + find_fib_nth(n - 1))\n end\nend", "def fib n\n if n == 0\n 0\n elsif n == 1\n 1\n else\n fib(n-2) + fib(n-1)\n end\nend", "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n\n return fib(n-1) + fib(n-2)\nend", "def fib(n)\n if n == 0 || n == 1\n return n\n else\n fib(n-1) + fib(n-2)\n end\nend", "def recursive_fib n\n return 1 if n == 1 || n == 2\n recursive_fib(n-1) + recursive_fib(n-2)\nend", "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n \n\n fib(n - 1) + fib(n - 2)\nend", "def nthFibonacci (n)\n # Your code here \nend", "def fib(n)\n if n < 2\n 1\n else\n fib(n-2) + fib(n-1)\n end\nend", "def fib(n)\n if n == 1 || n == 2\n n\n else\n fib(n-1) + fib(n-2)\n end\nend", "def fib(n)\n return 1 if n == 2\n return 0 if n == 1\n\n fib(n-1) + fib(n-2)\nend", "def fib(n)\n # your implementation here\n if n==0 then\n 1\n elsif n==1 then\n 1\n else \n fib(n-2) + fib(n-1)\n end\nend", "def fib(n)\n if n == 0\n 0\n elsif n == 1 || n == 2\n 1\n else fib(n - 2) + fib(n - 1)\n end\nend", "def fib(n)\n\n if n == 1 or n == 2\n return 1\n else\n return fib(n-1) + fib(n-2)\n end\n\nend", "def fib(n)\n if n <= 2\n n\n else\n fib(n-1) + fib(n-2)\n end\nend", "def fib(n)\n return 0 if n <= 0\n return 1 if n == 1\n\n fib(n - 1) + fib(n - 2)\nend", "def fib(n)\r\n if n == 1 then\r\n 10\r\n elsif n == 0 then\r\n 1\r\n else\r\n fib(n - 1) + fib(n - 2)\r\n end\r\nend", "def fib(n)\n return 1 if n == 1 || n == 2\n fib(n-1) + fib(n-2)\nend", "def fib(n)\n if n < 2\n n\n else\n fib(n-1)+fib(n-2)\n end\nend", "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n-1) + fib(n-2)\nend", "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n-1) + fib(n-2)\nend", "def fib(n)\n return 1 if n <= 2\n fib(n-1) + fib(n-2)\nend", "def fibonacci(n)\n\treturn 0 if n == 0\n\treturn 1 if n == 1\n\tfibonacci(n-1) + fibonacci(n-2)\nend", "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n - 1) + fib(n - 2)\nend", "def fibonacci(n)\r\n if n == 0\r\n return 0\r\n elsif n == 1\r\n return 1\r\n else\r\n return fibonacci(n-1) + fibonacci(n-2)\r\n end\r\nend", "def fibonacci(n)\n if n <= 2\n 1\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend", "def recursive_fib(n, a=0, b=1)\r\n if n == 0\r\n return a\r\n else\r\n recursive_fib(n - 1, b, a + b)\r\n end\r\nend", "def fib(n)\n return n if n < 2\n fib(n-1) + fib(n-2)\nend", "def fib(n)\n return 1 if n <= 2\n fib(n - 1) + fib(n - 2)\nend", "def fib (n)\n # return appropriate starter values if n is 0 or 1\n if n == 0 \n return 0\n elsif n == 1\n return 1\n end\n # set up initial constants\n prevNum = 0\n currNum = 1\n # Loop through fibonacci numbers, starting at index 2.\n 2.upto(n) do\n nextNum = prevNum + currNum\n prevNum = currNum\n currNum = nextNum\n end\n return currNum\nend", "def fib(n) (n<=2) ? 1 : (fib(n-2)+fib(n-1)) end", "def fib(n)\n return n if n <= 1\n fib(n-1) + fib(n-2)\nend", "def fibonacci(n)\n if n < 2\n n\n else\n fibonacci(n - 1) + fibonacci(n - 2)\n end\nend", "def fibonacci(n)\n raise ArgumentError, \"n cannot be less than 0\" if n < 0\n return 0 if n == 0 \n\n old_sum, new_sum = 0, 1\n return fib_helper(old_sum, new_sum, n)\nend", "def recur_nth_fib(n)\n nth_fib(n, { 1 => 1, 2 => 1 })[n]\nend", "def fib(n)\n if (n <= 1) \n return n;\n else\n return fib(n-1)+fib(n-2);\n end\nend", "def fibonacci(n)\n\tif n == 0 || n == 1\n\t\treturn 1\n\telse\n\t\treturn fibonacci(n-1) + fibonacci(n-2)\n\tend\nend", "def fibs(n)\n return n if n <= 1\n fibs(n - 1) + fibs(n - 2)\nend", "def recursive_fib(n)\n if n<2\n return n\n else\n return (recursive_fib(n-1)+recursive_fib(n-2))\n end \nend", "def fibonacci(nth)\n return 1 if nth < 3\n fibonacci(nth - 1) + fibonacci(nth - 2)\nend", "def fibonnaci(n)\n if n == 1 || n == 2\n 1\n else\n fibonnaci(n - 1) + fibonnaci(n - 2)\n end\nend", "def fib n\n return n if n < 2\n fib(n-2) + fib(n-1)\nend", "def fibonacci(n)\n if n == 0 or n == 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend", "def fib n\n return n if n < 2\n fib(n - 1) + fib(n - 2)\nend", "def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1 ) + fibonacci(n - 2)\nend", "def fibonacci(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n fibonacci(n-2) + fibonacci(n-1)\n end\nend", "def fib(n)\n if n<2\n return n\n else\n return fib(n-2)+fib(n-1)\n end\nend", "def fibonacci(n)\n if n < 2\n return n\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend", "def fibonacci(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n if n == 1 || n == 2\n 1\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend", "def fibonacci(n)\n return 1 if n <= 2\n fibonacci(n - 2) + fibonacci(n - 1)\nend", "def fib(n)\n\treturn n if (n < 2)\n\treturn fib(n - 1) + fib(n - 2)\nend", "def fibonacci(n)\n return 0 if n == 1\n return 1 if n == 2\n return fibonacci(n-1)+fibonacci(n-2)\nend", "def fib_basic(n)\n if (0..1).include? n\n return n\n else\n (fib_basic(n - 1) + fib_basic(n - 2))\n end\nend", "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n return 1 if n == 2\n # return 2 if n == 3\n fib(n - 1) + fib(n - 2)\nend", "def fibonacci n\n return n if n < 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n return 1 if n <= 2\n \n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fib(n)\n return 0 if n == 0\n fib_helper(0, 1, n-1)\nend", "def fibonacci(n)\n if n <= 1\n return n\n else\n return fibonacci(n - 1) + fibonacci(n - 2)\n end\nend", "def fib(n)\n return n if n < 2\n f0, f1 = 0, 1\n (n-1).times { f0, f1 = f1, f0+f1 }\n f1\nend", "def fib(n)\n # edge cases:\n if n < 0\n raise Exception, 'Index was negative. No such thing as a negative index in a series.'\n elsif n == 0 || n == 1\n return n\n end\n\n # we'll be building the fibonacci series from the bottom up\n # so we'll need to track the previous 2 numbers at each step\n prev_prev = 0\n prev = 1\n current = prev + prev_prev\n\n # since we already initialized up to the 2nd number in the series\n # we take n - 2 steps ahead to reach n (.times is exclusive)\n (n - 1).times do\n current = prev + prev_prev\n prev_prev = prev\n prev = current\n end\n\n current\nend", "def fibonacci(n)\n if n < 2\n return n\n else\n return fibonacci(n-1) + fibonacci(n-2)\n end\nend", "def fib(n)\n return n if (0..1).include? n\n fib(n-1) + fib(n-2)\nend", "def fib_rec( n )\n $call_count += 1\n # Define the base case\n if n < 2\n return 1\n else\n # do the recursive calculation:\n return fib_rec( n - 1 ) + fib_rec( n - 2 )\n end\n\nend", "def fibonacci(n)\n return n if n == 1 || n == 0 \n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci( n )\n return n if n <= 1 \n fibonacci( n - 1 ) + fibonacci( n - 2 ) \nend", "def fibonacci(n)\n if n.nil?\n raise ArgumentError.new(\"Invalid\")\n elsif n < 0\n raise ArgumentError.new(\"Invalid\")\n end\n\n return 0 if n == 0\n\n num_one = 0\n num_two = 1\n fib_n = 1\n\n count = n - 1\n\n count.times do\n fib_n = num_one + num_two\n num_one = num_two\n num_two = fib_n\n end\n\n return fib_n\nend", "def fibonacci(n)\n \n return n if n == 1\n \n if n > 2 \n fibonacci(n-1) + fibonacci(n-2)\n else\n fibonacci(n-1)\n end\nend", "def fibonacci(n)\n return 1 if n == 1 || n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n return 1 if n == 1 || n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def show_fib(n)\n return 0 if n == 0\n return 1 if n == 1\n show_fib(n-1) + show_fib(n-2)\nend", "def fibonacci(n)\n return 1 if n == 1 || n == 2\n\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n return 1 if n == 1\n return 1 if n == 2\n fibonacci(n - 1) + fibonacci(n - 2)\nend", "def fibonacci(n)\n n = fibonacci( n - 1 ) + fibonacci( n - 2 ) if n > 1\n n\nend", "def fibonacci(n)\n if n < 3\n 1\n else\n fibonacci(n-1) + fibonacci(n-2)\n end\nend", "def fibonacci(n)\n return n unless n > 1\n fibonacci(n -1) + fibonacci(n -2)\nend", "def nth_fibonacci(n)\n return 0 if n == 1\n sequence = [1]\n (n - 2).times do\n current_number, last_number = sequence.last(2)\n sequence << current_number + (last_number || 0)\n end\n\n sequence.last\nend", "def fib(n)\n return nil if n < 1\n return 1 if n == 1 || n == 2\n fib(n-1) + fib(n-2)\nend", "def fibonacci(n)\n return 0 if n == 0\n raise ArgumentError if n < 0\n\n fib_helper(0, 1, n-1)\nend", "def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend", "def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend", "def fibonacci( n )\n return n if ( 0..1 ).include? n\n ( fibonacci( n - 1 ) + fibonacci( n - 2 ) )\nend", "def fib(n)\n return fib_num[n] if fib_num[n]\n\n fib_num[n - 2] = fib(n - 2) unless fib_num[n - 2]\n fib_num[n - 1] = fib(n - 1) unless fib_num[n - 1]\n\n return (fib_num[n - 2] + fib_num[n - 1])\n end", "def fib_rec(n)\n return 0 if n == 1\n return 1 if n == 2\n fib_rec(n - 1) + fib_rec(n - 2)\nend", "def nthFibonacci (n)\r\n # Your code here\r\n a = 0\r\n b = 1\r\n n.times do\r\n temp = a\r\n a = b\r\n b = temp + b\r\n end\r\n return a\r\nend", "def fibonacciRecursive(n)\n\tif n <= 1\n\t\treturn n\n\telse\n\t\treturn fibonacciRecursive(n - 1) + fibonacciRecursive(n - 2)\n\tend\nend" ]
[ "0.88453704", "0.87202966", "0.8685772", "0.86717737", "0.8661782", "0.86557686", "0.8654843", "0.8651081", "0.8637643", "0.86105245", "0.8604302", "0.8581592", "0.85796225", "0.85788125", "0.85763425", "0.8569461", "0.85639817", "0.8561878", "0.85530084", "0.85500234", "0.85488033", "0.85478276", "0.854623", "0.85302496", "0.85294175", "0.8529074", "0.8527551", "0.8524208", "0.8520306", "0.8520306", "0.85182923", "0.85081595", "0.8500784", "0.8498447", "0.84947234", "0.8492825", "0.84917617", "0.8488941", "0.8483345", "0.8481114", "0.84705156", "0.8468546", "0.8466506", "0.84621984", "0.8461157", "0.84546036", "0.8452164", "0.84509075", "0.8448717", "0.84473664", "0.84441054", "0.8443324", "0.8440679", "0.84400034", "0.8438088", "0.843742", "0.84370905", "0.8435547", "0.8429194", "0.8429194", "0.8428435", "0.84145874", "0.84113914", "0.8409779", "0.8409672", "0.84093946", "0.8408361", "0.8407204", "0.84035903", "0.84029484", "0.8401415", "0.83994067", "0.83987474", "0.8397062", "0.83964986", "0.83925045", "0.83922386", "0.83916014", "0.8384781", "0.8372668", "0.8372668", "0.8365927", "0.8360358", "0.83554906", "0.8349837", "0.8346138", "0.83460563", "0.833708", "0.83367616", "0.83353806", "0.8334264", "0.8334264", "0.8334264", "0.83295983", "0.8319582", "0.83127314", "0.8309253" ]
0.86496305
10
Use callbacks to share common setup or constraints between actions.
def set_amiibo_character @amiibo_character = AmiiboCharacter.find(params[:name]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def 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 init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def 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 setup(&blk)\n @setup_block = blk\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); 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 call\n setup_context\n super\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.5330087", "0.5311993", "0.5297402", "0.5296789", "0.52957207", "0.52596015", "0.5245442", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5235431", "0.5231888", "0.5226663", "0.52220625", "0.5217086", "0.52137345", "0.5208314", "0.5205469", "0.5175606", "0.5174914", "0.5173361", "0.51662856", "0.5161792", "0.51572216", "0.5153063", "0.5152982", "0.5152632", "0.51435786", "0.5139829", "0.51346594", "0.511372", "0.511372", "0.51136476", "0.51083213", "0.5108011", "0.5091935", "0.5089297", "0.5081576", "0.50807106", "0.50656676", "0.50548106", "0.50537366", "0.505074", "0.505074", "0.5033361", "0.5025158", "0.5020441", "0.5015611", "0.50142473", "0.5000281", "0.50001067", "0.49989453", "0.4989465", "0.4989465", "0.4985425", "0.49805096", "0.49795893", "0.49783278", "0.49676263", "0.49656346", "0.49579078", "0.4955427", "0.49554235", "0.49536413", "0.49523768", "0.49457142", "0.49433607", "0.4933641", "0.49320185", "0.49265638", "0.49262375", "0.49259067", "0.4922456", "0.49201223", "0.49165115", "0.49158815", "0.49151883", "0.49149552", "0.4914386" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def amiibo_character_params params.require(:amiibo_character).permit(:name, :image_URL) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def parameters\n nil\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.71217275", "0.7052942", "0.6947555", "0.6903013", "0.6735074", "0.67167085", "0.6687677", "0.66765445", "0.66602796", "0.65548825", "0.6524274", "0.6455697", "0.6451343", "0.645123", "0.64465624", "0.6433475", "0.64118403", "0.64118403", "0.6390524", "0.6378871", "0.6378871", "0.6374268", "0.6360606", "0.6354037", "0.6284485", "0.62780905", "0.624562", "0.6225378", "0.6224288", "0.62237734", "0.6210716", "0.62073183", "0.61760557", "0.61714864", "0.61689645", "0.6159245", "0.6145253", "0.61351544", "0.61209726", "0.61050045", "0.60978544", "0.6073292", "0.6052814", "0.60387754", "0.60352194", "0.60294884", "0.6018536", "0.6017761", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6015598", "0.60044724", "0.6003913", "0.6001379", "0.599616", "0.5994301", "0.5994205", "0.5984454", "0.5983921", "0.5976679", "0.5974281", "0.59687614", "0.59656674", "0.59649783", "0.59649783", "0.59568197", "0.5950897", "0.5950399", "0.59472823", "0.59424376", "0.59294873", "0.59292394", "0.592647", "0.59236294", "0.59178543", "0.59175855", "0.5913039", "0.5912506", "0.59062296", "0.5905145", "0.5904936", "0.5901632", "0.5899609", "0.589707", "0.58955824", "0.5894598" ]
0.0
-1
GET /publications/1 GET /publications/1.json
def show #@publication = Publication.find(params[:id]) #@issues = @publication.issues.where( :issue_states => {:name => 'released'}) #render json: @issues publication = Publication.find_by_product_code(params[:id]) state = IssueState.find_by_name('Released') issues = Issue.where(:publication_id => publication, :issue_state_id => state) render json: issues.as_json({:except => :pdf_zip}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if @author_id\n @publications = @author.publications\n else\n @publications = Publication.all\n end\n render json: @publications\n end", "def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publication }\n end\n end", "def publications\n @publications = Publication.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def show\n render json: @publication\n end", "def index\n @publications = Publication.all\n end", "def index\n @publications = Publication.all\n end", "def index\n @publications = Publication.all\n end", "def index\n @publications = Publication.all\n end", "def show\n @publication = Publication.find(params[:id])\n @title = @publication.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publication }\n end\n end", "def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n end", "def new\n @publication = Publication.new\n @publication.url ||= 'http://www.'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n end", "def index1\n @publications = Publication.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end", "def show\n @pub = Pub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pub }\n end\n end", "def show\n pub = Publication.find_by(id: params[:id])\n if pub.blank?\n head :not_found\n return\n elsif pub.deleted?\n head :gone\n return\n end\n render json: pub.pub_hash\n end", "def index\n @pubs = Pub.all\n\n render json: @pubs\n end", "def index\n @publications = Publication.limit(20)\n end", "def show\n @publication = Publication.find_by(publication_params)\n end", "def index\n @search = Publication.search(params[:q])\n @publications = @search.result\n end", "def show\n render json: @pub\n end", "def show\n @publication_type = PublicationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @publication_type }\n end\n end", "def index\n @publication_types = PublicationType.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @publication_types }\n end\n end", "def show\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publisher }\n end\n end", "def show\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publisher }\n end\n end", "def show\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @publisher }\n end\n end", "def index\n @publinks = Publink.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinks }\n end\n end", "def index\n joins = {:user_id => doorkeeper_token.resource_owner_id, :slug => params[:topic_id]}\n joins.merge!(:application_id => doorkeeper_token.application_id) unless has_scope?(\"read_any_publications\")\n @publications = Topic::Publication.joins(:topic).where(:sensit_topics => joins).page(params[:page] || 1).per(params[:per] || 10)\n respond_with(@publications)\n end", "def show\n @publication = Publication.find(params[:id])\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def show\n @publink = Publink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publink }\n end\n end", "def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def publications\r\n params = {\r\n method: :get,\r\n url: '/report/publications',\r\n params: {\r\n reportUUID: @uuid\r\n }\r\n }\r\n @session.request(params).perform!\r\n end", "def show\n if attempting_to_access_topic_from_another_application_without_privilage(\"read_any_publications\")\n raise ::ActiveRecord::RecordNotFound\n else\n @publication = scoped_owner(\"read_any_publications\").topics.find(params[:topic_id]).publications.find(params[:id])\n respond_with(@publication)\n end\n end", "def index\n @publications = Publication.paginate :page=>params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml\n end\n end", "def index\n @view_publications = ViewPublication.all\n end", "def index\n @q = Citation.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @citations = @q.result(distinct: true).page(params[:page])\n else\n @citations = @q.result(distinct: true)\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @citations.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key]\n )\n }\n end\n end", "def index\n @publications = Publication.all.order(:pub_name)\n end", "def index\n @publications = Publication.all\n @publications_by_year = @publications.group_by(&:year).sort.reverse\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end", "def show\n render json: @citation\n end", "def show\n render json: @citation\n end", "def new\n @pub = Pub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pub }\n end\n end", "def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def new\n @publication = Publication.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def new\n @publication_type = PublicationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @publication_type }\n end\n end", "def show\n @published = Published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @published }\n end\n end", "def update\n if @publication.update(publication_params)\n render json: @publication, status: :ok\n else\n render json: @publication.errors, status: :unprocessable_entity\n end\n end", "def index\n @publishers = Publisher.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publishers }\n end\n end", "def index\n @publication_numbers = PublicationNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publication_numbers }\n end\n end", "def new\n @publication = Publication.new(:kind => \"Full Paper\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def index\n @publications = Publication.order(:year)\n \n respond_to do |format|\n format.html\n format.json { render json: @publications.tokens(params[:q]) }\n end\n \n end", "def show\n @publication.page_views += 1\n @publication.save\n @publication_attachments = @publication.publication_attachments.all\n\n @publications = Publication.all\n end", "def show\n @publication_number = PublicationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication_number }\n end\n end", "def show\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @primary_publication_number }\n end\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def index\n @publications = Publication.paginate :per_page => 5, :page => params[:page],\n :order => 'title'\n end", "def show\n @publications = @author.publications.paginate(page: params['page'], per_page: 10)\n @crumbs = [['Authors', authors_path], @author.family]\n end", "def publication_info\n\n {:type => :content, :id => id}\n\n end", "def show\n store_location\n @publication = Publication.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end", "def index\n @publication_requests = PublicationRequest.all\n end", "def show\n @author_paper = AuthorPaper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author_paper }\n end\n end", "def show\n @pubtype = Pubtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pubtype }\n end\n end", "def find_publication\n if action_name == 'rebuild'\n @publication= @user.publications.find(params[:id].to_i)\n elsif action_name == 'show'\n zip= params[:id].split('---').first\n @publication= Publication.find_by_zip(zip)\n else\n @publication= Publication.find_by_zip(params[:id])\n end\n\n access_denied and return unless @publication\n @audited_object= @publication # audition system\n @object_for_role_system= @publication # role system\n end", "def new\n @primary_publication = PrimaryPublication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @primary_publication }\n end\n end", "def show\n @publish = Publish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publish }\n end\n end", "def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to publications_url, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @saved_publications = SavedPublication.all\n end", "def set_publication\n @publication = Publication.find(params[:id])\n end", "def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render action: 'show', status: :created, location: @publication }\n else\n format.html { render action: 'new' }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @publication = Publication.new(publication_params)\n\n if @publication.save\n render json: @publication, status: :created\n else\n reponse = { status: \"error\", code: 422,\n message: \"couldn't create the publication\",\n errors: @publication.errors }\n render json: reponse, status: :unprocessable_entity\n end\n end", "def create\n datasource = params[:publication][:datasource]\n sourceid = params[:publication][:sourceid]\n publication = {}\n\n if !ImportManager.datasource_valid?(datasource: datasource)\n error_msg(ErrorCodes::OBJECT_ERROR, \"Given datasource is not configured: #{datasource}\")\n render_json\n return\n end\n\n case datasource\n when \"none\"\n #do nothing\n else\n item = ImportManager.find(datasource: datasource, sourceid: sourceid)\n if item && item.errors.messages.empty?\n publication.merge!(item.json_data)\n else\n error_msg(ErrorCodes::VALIDATION_ERROR, \"Identifikatorn #{sourceid} hittades inte i #{datasource}\")\n render_json\n return\n end\n end\n\n # Check publication identifiers for possible duplications\n\n publication_identifiers = publication[:publication_identifiers] || []\n\n publication_identifier_duplicates = Publication.duplicates(publication_identifiers)\n publication[:publication_identifier_duplicates] = publication_identifier_duplicates\n\n @response[:publication] = publication\n render_json\n\n end", "def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @paper = Paper.find(params[:id])\n @document = Document.where(paper_id: @paper.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper }\n end\n end", "def index\n @analyses = Analysis.order(:analysis_name, :publication_year)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @analyses }\n end\n end", "def index\n @pubtypes = Pubtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pubtypes }\n end\n end", "def index\n if (params[:public])\n @documents = Document.where('public = ?', params[:public])\n else\n @documents = Document.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render jbuilder: @documents }\n end\n end", "def index\n @event_publications = EventPublication.all\n end", "def new\n @publisher = Publisher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publisher }\n end\n end", "def show\n\t\t@publisher = Publisher.find(params[:id])\n\t\tif Book.all.count>0\n\t\t\t@books_of_publisher = @publisher.books.order(title: :asc).paginate(page: params[:page], per_page: 24)\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.json {}\n\t\t\tformat.js\n\t\tend\n\tend", "def new\n @publisher = Publisher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @publisher }\n end\n end", "def new\n @publink = Publink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publink }\n end\n end", "def show\n @publicaciones = Publicacione.find(params[:id])\n render json: @publicaciones, status: :ok\n end", "def show\n @publication = Publication.find(params[:id])\n\n # Get previous version if requested\n if params[:version]\n @version = @publication.versions.find(params[:version])\n @publication = @version.reify\n\n # get hmt from meta data in versions table if available\n if !@version.keywords.nil?\n @keywords = Variable.find(YAML.load(@version.keywords))\n else\n @keywords = []\n end\n\n if !@version.mediators.nil?\n @mediators = Keyword.find(YAML.load(@version.mediators))\n else\n @mediators = []\n end\n\n if !@version.outcomes.nil?\n @outcomes = Keyword.find(YAML.load(@version.outcomes))\n else \n @outcomes = []\n end\n\n if !@version.determinants.nil?\n @determinants = Keyword.find(YAML.load(@version.determinants))\n else \n @determinants = []\n end \n\n if !@version.inclusions.nil?\n @inclusions = Inclusion.find(YAML.load(@version.inclusions))\n else \n @inclusions = []\n end \n\n if !@version.foundations.nil?\n @foundations = Foundation.find(YAML.load(@version.foundations))\n else \n @foundations = []\n end \n\n else # setting them here to get least work in view\n @keywords = @publication.keywords.map{|k| Variable.find(k.variable_id)}\n @mediators = @publication.mediators.map{|k| Variable.find(k.variable_id)}\n @outcomes = @publication.outcomes.map{|k| Variable.find(k.variable_id)}\n @determinants = @publication.determinants.map{|k| Variable.find(k.variable_id)}\n @inclusions = @publication.inclusions\n @foundations = @publication.foundations\n end\n\n # respond to format, mostly for pdf rendering\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publication }\n # wicked_pdf\n format.pdf do\n render :pdf => @publication.title,\n template: \"publications/publication.pdf.erb\",\n# :stylesheets => [\"application\",\"print\"],\n # :layout => \"pdf.html\",\n page_size: 'A4',\n disposition: 'inline',\n orientation: 'Landscape'\n # :wkhtmltopdf => Rails.root.join('vendor', 'wkhtmltopdf-amd64').to_s\n end \n end\n end", "def show\n @article = Article.published.find_by_id_or_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n msg = 'Getting publications'\n msg += \" for profile #{params[:capProfileId]}\" if params[:capProfileId]\n msg += \" where capActive = #{params[:capActive]}\" if params[:capActive]\n msg += \" where updated_at > #{params[:changedSince]}\" if params[:changedSince]\n logger.info msg\n\n matching_records = []\n capProfileId = params[:capProfileId]\n capActive = params[:capActive]\n page = params.fetch(:page, 1).to_i\n per = params.fetch(:per, 1000).to_i\n last_changed = Time.zone.parse(params.fetch(:changedSince, '1000-01-01')).to_s\n\n if capProfileId.blank?\n description = \"Records that have changed since #{last_changed}\"\n matching_records = Publication.select(:pub_hash).updated_after(last_changed).page(page).per(per)\n matching_records = matching_records.with_active_author if capActive.present? && (capActive || capActive.casecmp('true').zero?)\n else\n author = Author.find_by(cap_profile_id: capProfileId)\n if author.nil?\n render json: { error: \"No such author with capProfileId #{capProfileId}\" }, status: :not_found, format: 'json'\n return\n end\n matching_records = author.publications.order('publications.id').page(page).per(per).select(:pub_hash) unless params[:format] =~ /csv/i\n end\n logger.debug(\"Found #{matching_records.length} records\")\n\n respond_to do |format|\n format.json do\n render json: wrap_as_bibjson_collection(description, matching_records, page, per)\n end\n format.csv do\n send_data(generate_csv_report(author), filename: 'author_report.csv')\n end\n end\n end", "def new\n if ! session[:user].nil?\n @title = \"Добавление новой публикации\" \n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n \n else\n redirect_to_back\n end\n \n end", "def show\n @document = Document.where(:id => params[:id])\n render :json => @document, :include => [:versions]\n end", "def show\n @publinktype = Publinktype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publinktype }\n end\n end", "def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to root_path, notice: 'Publicação foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { redirect_to root_path }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @publinktypes = Publinktype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinktypes }\n end\n end", "def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end", "def new\n @published = Published.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @published }\n end\n end", "def create\n @publication = Publication.new(publication_params)\n @publication.user_id = current_user.id\n respond_to do |format|\n if @publication.save\n format.html { redirect_to :controller => 'ubications', :action => \"new\", :id_pub => @publication.id }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @publication = Publication.new(publication_params)\n if @publication.save\n redirect_to root_path, notice: \"Publication #{@publication.pub_name} was successfully created for #{@publication.client.client_name}\" \n else\n render :new\n end\n end", "def set_publication\n @publication = Publication.find(params[:id])\n end", "def set_publication\n @publication = Publication.find(params[:id])\n end", "def set_publication\n @publication = Publication.find(params[:id])\n end", "def set_publication\n @publication = Publication.find(params[:id])\n end", "def set_publication\n @publication = Publication.find(params[:id])\n end", "def set_publication\n @publication = Publication.find(params[:id])\n end", "def set_publication\n @publication = Publication.find(params[:id])\n end" ]
[ "0.7736908", "0.74060816", "0.7345839", "0.7342929", "0.7266342", "0.7266342", "0.7266342", "0.7266342", "0.7246774", "0.7091658", "0.7055921", "0.69800436", "0.6962401", "0.69450855", "0.69283414", "0.6888351", "0.6845632", "0.6840642", "0.68183666", "0.6756092", "0.6739041", "0.6737043", "0.6737043", "0.6700924", "0.66629785", "0.6624546", "0.6618584", "0.6584366", "0.6583295", "0.6583295", "0.65504485", "0.6504939", "0.64702827", "0.6459654", "0.64387625", "0.64279485", "0.6380793", "0.6376232", "0.6376232", "0.6375478", "0.637214", "0.6360724", "0.63604474", "0.6334055", "0.63125587", "0.6309114", "0.6301355", "0.62997115", "0.62907696", "0.627686", "0.6273967", "0.62676907", "0.62626475", "0.6256589", "0.6255185", "0.62461805", "0.62178427", "0.6210778", "0.6186064", "0.6166543", "0.6141601", "0.61379987", "0.6130984", "0.61205155", "0.6118164", "0.6117758", "0.61173", "0.61161166", "0.6112992", "0.60960525", "0.60960525", "0.60820824", "0.60785043", "0.6066258", "0.60648316", "0.606053", "0.6054957", "0.60516006", "0.60454535", "0.6037982", "0.60367435", "0.6034314", "0.60315114", "0.6002776", "0.60004026", "0.5995693", "0.59930974", "0.5982999", "0.5976287", "0.5967491", "0.59622556", "0.59507084", "0.59374034", "0.5936824", "0.5936824", "0.5936824", "0.5936824", "0.5936824", "0.5936824", "0.5936824" ]
0.6005596
83
Open the bookmarks and return an REXML::Document. If the cache option is provided, the document is loaded from the localpath specified.
def open require 'rexml/document' xml = if cache && File.exist?(cache) File.read(cache) else request :all end File.open(cache, 'wb') { |io| io.write(xml) } if cache REXML::Document.new(xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(path)\n document = parse(File.read(path))\n document.path = path\n document\n end", "def get_html\n print \"Getting doc...\"\n if File.size?(@cache)\n html = File.read(@cache)\n else\n html = open(URL).read\n IO.write(@cache, html)\n end\n puts \"done.\"\n html\n end", "def sdmx_doc(cache, url=ECB_ALL_RATES_URL)\n rates_source = !!cache ? cache : url\n Nokogiri::XML(open(rates_source))\n end", "def open_document\n @document = Nokogiri::XML(open(@feed_uri).read)\n end", "def parse(cache)\n raise ParserException, \"No HTML document found\" if\n cache.assets[:documents].empty?\n # TODO: limited to a single document only\n raise ParserException, \"More than one HTML document found, this is not supported (yet)\" if\n cache.assets[:documents].size > 1\n \n @cache = cache\n @document = @cache.assets[:documents][0]\n log.debug \"-- Parsing #{@document}\"\n @doc = Nokogiri::HTML.parse(IO.read(File.join(@cache.path, @document)), nil, 'UTF-8')\n \n @uid = @cache.name\n parse_title\n parse_toc\n self\n end", "def load_bookmarks\n if File.exist? File.expand_path(\"~/Dropbox/test.txt\")\n return YAML.load_stream(open(File.expand_path(\"~/Dropbox/test.txt\"))).documents \n else\n puts \"Add: ./dl.rb url\"\n puts \"Get: ./dl.rb tagname\"\n return open(File.expand_path(\"~/Dropbox/test.txt\"), \"w\")\n end\nend", "def get_file_doc(prptfile, filename)\n Zip::ZipFile.open(prptfile, Zip::ZipFile::CREATE) do |zipfile|\n return REXML::Document.new zipfile.read(filename)\n end\nend", "def get_content_as_dom()\n if @state == RedXmlResource::STATE_LAZY\n @document = @doc_service.find_document(@doc_name)\n @state = RedXmlResource::STATE_LOADED\n end\n return @document\n end", "def load_xml_document file_name\n xml_file = File.new file_name, \"r\"\n return Document.new xml_file\n end", "def get_document(depth: nil, pierce: nil)\n {\n method: \"DOM.getDocument\",\n params: { depth: depth, pierce: pierce }.compact\n }\n end", "def doc(path, options = {})\n require 'nokogiri'\n\n File.open(path) do |f|\n yield Nokogiri::XML(f)\n end\n end", "def moddify_document(path)\n doc = nil\n File.open(path,'r+') do | file|\n xml_string = file.read\n doc = process_xml(xml_string) if valid_xml?(xml_string)\n end\n doc\nend", "def load_document(url, filters = {})\n html = load_html(url, filters)\n ProxyFetcher::Document.parse(html)\n end", "def read_cache\n @html = File.read(@cache_file) if cache_exist?\n parse_html unless @html.nil?\n end", "def sitemap_doc\n return doc if doc && !gzip?\n\n begin\n @sitemap_doc ||= Nokogiri::XML::Document.parse(unzipped_body, @url.to_s, content_charset)\n rescue\n end\n end", "def open(id, rev = nil)\n begin\n unless Colonel.config.rugged_backend.nil?\n repo = Rugged::Repository.bare(File.join(Colonel.config.storage_path, id), backend: Colonel.config.rugged_backend)\n else\n repo = Rugged::Repository.bare(File.join(Colonel.config.storage_path, id))\n end\n rescue Rugged::OSError\n return nil\n end\n\n Document.new(nil, id: id, repo: repo, type: self)\n end", "def doc\n @doc ||= Nokogiri::HTML(open(self.url))\n end", "def initialize_file_based_cache\n Dir.mkdir(\"cache\")\n @document_cache = ActiveSupport::Cache::FileStore.new(\"cache\")\n @file_based_cache = true\n end", "def new_document(content, opts = {})\n RetrievalLite::Document.new(content, opts)\n end", "def get_document_bookmarks(request)\n data, _status_code, _headers = get_document_bookmarks_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def open_uri(*args, &blk)\n OpenURI::DbCache::Page.fetch(*args, &blk)\n end", "def create_doc(path)\n doc = File.read(path)\n @current_xml_document = doc\n Hpricot.XML(doc)\n end", "def load_doc(path)\n page = HTTParty.get(path)\n \n Nokogiri::HTML(page)\nend", "def cache_open(url)\n Cachy.cache(url, hash_key: true) { open(url).read }\nend", "def as_xml_document(remove_stylesheets = false) \n # pulling this in instead of calling fro it from the file store everytime we need it\n data = current_data\n data = data.gsub(/\\<\\?xml\\-stylesheet.*\\?\\>/,'') if remove_stylesheets\n data ? REXML::Document.new(data) : nil\n end", "def load_html\n file = @local_source + @url.sub(@host, '')\n if (@url != @host) && !@local_source.nil? && File.exists?(file)\n f = File.open(file)\n @doc = Nokogiri::XML(f)\n f.close\n else\n html = Flatfish::Url.open_url(@url)\n @doc = Nokogiri::HTML(html)\n end\n end", "def read(document=section)\n @downloader.read(\n document: document,\n origin: origin_for(document)\n )\n end", "def load_document(id)\n cached = cache && id.is_a?(String) && cache[id]\n if cache\n if cached\n ActiveSupport::Notifications.instrument('couch_potato.load.cached') do\n cached\n end\n else\n cache[id] = load_document_without_caching(id)\n cache[id]\n end\n else\n load_document_without_caching(id)\n end\n end", "def downloads\n @downloads ||= DocumentDownloads.new(self)\n end", "def read_cache\n @cache_file = select_cache_file\n begin\n\topen(@cache_file, \"rb\") { |f| load_local_cache(f) } || {}\n rescue StandardError => ex\n\t{}\n end\n end", "def fetch(filename, options = { :prefer_writable => true })\n return nil unless filename\n\n filename = General.absolute_path(filename)\n filename_key = General.canonize(filename)\n weakref_books = @filename2books[filename_key]\n return nil unless weakref_books\n\n result = open_book = closed_book = nil\n weakref_books = weakref_books.map { |wr_book| wr_book if wr_book.weakref_alive? }.compact\n @filename2books[filename_key] = weakref_books\n weakref_books.each do |wr_book|\n if !wr_book.weakref_alive?\n # trace \"warn: this should never happen\"\n begin\n @filename2books[filename_key].delete(wr_book)\n rescue\n # trace \"#{$!.message}\"\n # trace \"Warning: deleting dead reference failed: file: #{filename.inspect}\"\n end\n else\n book = wr_book.__getobj__\n next if book.excel == try_hidden_excel\n\n if options[:prefer_excel] && book.excel == options[:prefer_excel]\n result = book\n break\n end\n if book.alive?\n open_book = book\n break if book.writable && options[:prefer_writable]\n else\n closed_book = book\n end\n end\n end\n result ||= (open_book || closed_book)\n result\n end", "def class_cache\n return @class_cache if @class_cache\n\n # Get the documentation directories used to make the cache in order to see\n # whether the cache is valid for the current ri instantiation.\n if(File.readable?(@cache_doc_dirs_path))\n cache_doc_dirs = IO.read(@cache_doc_dirs_path).split(\"\\n\")\n else\n cache_doc_dirs = []\n end\n\n newest = map_dirs('created.rid') do |f|\n File.mtime f if test ?f, f\n end.max\n\n # An up to date cache file must have been created more recently than\n # the last modification of any of the documentation directories. It also\n # must have been created with the same documentation directories\n # as those from which ri currently is sourcing documentation.\n up_to_date = (File.exist?(class_cache_file_path) and\n newest and newest < File.mtime(class_cache_file_path) and\n (cache_doc_dirs == @doc_dirs))\n\n if up_to_date and @use_cache then\n open class_cache_file_path, 'rb' do |fp|\n begin\n @class_cache = Marshal.load fp.read\n rescue\n #\n # This shouldn't be necessary, since the up_to_date logic above\n # should force the cache to be recreated when a new version of\n # rdoc is installed. This seems like a worthwhile enhancement\n # to ri's robustness, however.\n #\n $stderr.puts \"Error reading the class cache; recreating the class cache!\"\n @class_cache = create_class_cache\n end\n end\n else\n @class_cache = create_class_cache\n end\n\n @class_cache\n end", "def get_document_bookmark_by_name(request)\n data, _status_code, _headers = get_document_bookmark_by_name_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def read_from_cache\n if config.cache.is_a?(Proc)\n config.cache.call(nil)\n elsif (config.cache.is_a?(String) || config.cache.is_a?(Pathname)) &&\n File.exist?(file_path)\n open(file_path).read\n end\n end", "def open(key)\n BlockFile.open(cache_path(key), 'rb')\n rescue Errno::ENOENT\n nil\n end", "def initialize(filename)\n @filename = filename\n Powirb.log.debug(\"Retrieving workitem from #{@filename}\")\n begin\n\t @doc = Nokogiri::XML(open(@filename))\n\trescue Exception => e\n\t Powirb.log.error(e)\n\tend\t\n end", "def fetch(remote_url, &fetcher)\n entry = entry_for(remote_url)\n if entry.valid?\n entry.document\n else\n entry.document = fetcher.call\n end\n end", "def xml_document\n if @xml_document.nil?\n return nil if self.feed_data.blank?\n if self.feed_data_type != :xml\n @xml_document = nil\n else\n begin\n @xml_document = REXML::Document.new(self.feed_data_utf_8)\n rescue Exception\n # Something failed, attempt to repair the xml with html5lib.\n begin\n @xml_document = HTML5::XMLParser.parse(self.feed_data_utf_8)\n rescue Exception\n # Failed again, give up.\n return nil\n end\n end\n end\n end\n return @xml_document\n end", "def get_document_bookmarks(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_bookmarks_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_document_bookmarks_with_http_info(name, opts)\n else\n raise\n end\n return data\n end", "def bookmark_query(q,&blk)\n response = query(q)\n bookmark = response[\"bookmark\"]\n docs = response[\"docs\"]\n\n until !docs || docs.empty?\n yield docs\n q[\"bookmark\"] = bookmark\n response = query(q)\n bookmark = response[\"bookmark\"]\n docs = response[\"docs\"]\n end\n\n docs\n end", "def load_document(document_string, document_uri = nil)\n document = Nokogiri.XML(document_string, document_uri).extend(Document) # returns a Nokogiri::XML::Document\n document.root.extend(self)\n document\n end", "def get_content()\n if @state == RedXmlResource::STATE_LAZY\n @document = @doc_service.find_document(@doc_name)\n @state = RedXmlResource::STATE_LOADED\n end\n return \"#{@document}\"\n end", "def get_cache(url, options = {})\n\t\t\tpath = @@cache_directory_path + options[:lang] + '/' + url_to_filename(url)\n\t\t\t\n\t\t\t# file doesn't exist, make it\n\t\t\tif !File.exists?(path)\n\t\t\t\tif options[:debug]\n\t\t\t\t\tputs 'Cache doesn\\'t exist, making: ' + path\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# make sure dir exists\n\t\t\t\tFileUtils.mkdir_p(localised_cache_path(options[:lang])) unless File.directory?(localised_cache_path(options[:lang]))\n\t\t\t\t\n\t\t\t\txml_content = http_request(url, options)\n\t\t\t\t\n\t\t\t\t# write the cache\n\t\t\t\tfile = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)\n\t\t\t\tfile.write(xml_content)\n\t\t\t\tfile.close\n\t\t\t\n\t\t\t# file exists, return the contents\n\t\t\telse\n\t\t\t\tputs 'Cache already exists, read: ' + path if options[:debug]\n\t\t\t\t\n\t\t\t\tfile = File.open(path, 'r')\n\t\t\t\txml_content = file.read\n\t\t\t\tfile.close\n\t\t\tend\n\t\t\treturn xml_content\n\t\tend", "def proofread_document_internal(xml_url)\n use_document(xml_url, true)\n proofread # returns valid?\n end", "def doc(new_markup=nil)\n if markup = new_markup || content\n @doc = nil if new_markup\n @doc ||= case parser.to_sym\n when :xml then Nokogiri::XML(markup)\n when :html then Nokogiri::HTML(markup)\n else raise InvalidParser.new(\"Nokogiri cannot parse as '#{parser.inspect}'. Please request :xml or :html.\")\n end\n end\n end", "def load_rop(file_path)\n f = File.open(file_path, 'rb')\n xml = REXML::Document.new(f.read(f.stat.size))\n f.close\n return xml\n end", "def bookmarks\n xpath './bookmark'\n end", "def existing_bookmark_for(document_id)\n # to_a, we don't want to go to the database, we want to use cached\n # copy. \n self.bookmarks.to_a.find {|b| b.document_id == document_id}\n end", "def open_search\n @open_search ||= OpenSearch.new(@doc)\n end", "def open_search\n @open_search ||= OpenSearch.new(@doc)\n end", "def cache_object\n if !@href.nil? && @href =~ /^file:\\/\\//\n return nil\n end\n unless FeedTools.feed_cache.nil?\n if @cache_object.nil?\n begin\n if @href != nil\n begin\n @cache_object = FeedTools.feed_cache.find_by_href(@href)\n rescue RuntimeError => error\n if error.message =~ /sorry, too many clients already/\n warn(\"There are too many connections to the database open.\")\n raise error\n else\n raise error\n end\n rescue => error\n warn(\"The feed cache seems to be having trouble with the \" +\n \"find_by_href method. This may cause unexpected results.\")\n raise error\n end\n end\n if @cache_object.nil?\n @cache_object = FeedTools.feed_cache.new\n end\n rescue\n end \n end\n end\n return @cache_object\n end", "def cache\n @@cache ||= PStore.new(File.expand_path(@@cache_file))\n end", "def get_doc_feed(doc_client)\n @doc_feed=doc_client.get(\"https://documents.google.com/feeds/documents/private/full?prettyprint=true\").to_xml\n #@doc_feed=doc_client\n return @doc_feed\n end", "def document(path); end", "def new_input_set()\n return DownloadDocumentInputSet.new()\n end", "def get_document_bookmarks_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document_bookmarks ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document_bookmarks\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/bookmarks/tree\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].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 # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BookmarksResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document_bookmarks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def doc\n unless @doc\n @doc = Nokogiri::HTML(html)\n end\n @doc\n end", "def bookmarks\n full = options[:full]\n docs = options[:doc] && documents.map { |doc| [doc.id, doc] }.to_h\n item_list.map { |item|\n next unless item.is_a?(Bookmark)\n entry = {\n document_id: item.document_id,\n document_type: item.document_type.to_s,\n lens: item.lens,\n updated_at: item.updated_at,\n created_at: item.created_at,\n }\n full && entry.merge!(\n title: item.user_type, # TODO: not persisted; should it be?\n id: item.id,\n user_id: item.user_id,\n user_type: item.user_type,\n )\n docs && entry.merge!(doc: docs[item.document_id])\n entry\n }.compact.as_json\n end", "def get_cache(url, options = {})\n\t\t\tpath = cache_path(url, options)\n\t\t\t\t\n\t\t\t# file doesn't exist, make it\n\t\t\tif !File.exists?(path) ||\n\t\t\t\t\toptions[:refresh_cache] ||\n\t\t\t\t\t(File.mtime(path) < Time.now - @cache_timeout)\n\t\t\t\t\t\n\t\t\t\tif options[:debug]\n\t\t\t\t\tif !File.exists?(path)\n\t\t\t\t\t\tputs 'Cache doesn\\'t exist, making: ' + path\n\t\t\t\t\telsif (File.mtime(path) < Time.now - @cache_timeout)\n\t\t\t\t\t\tputs 'Cache has expired, making again, making: ' + path\n\t\t\t\t\telsif options[:refresh_cache]\n\t\t\t\t\t\tputs 'Forced refresh of cache, making: ' + path\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# make sure dir exists\n\t\t\t\tFileUtils.mkdir_p(localised_cache_path(options[:lang])) unless File.directory?(localised_cache_path(options[:lang]))\n\t\t\t\t\n\t\t\t\txml_content = http_request(url, options)\n\t\t\t\t\n\t\t\t\t# write the cache\n\t\t\t\tfile = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)\n\t\t\t\tfile.write(xml_content)\n\t\t\t\tfile.close\n\t\t\t\n\t\t\t# file exists, return the contents\n\t\t\telse\n\t\t\t\tputs 'Cache already exists, read: ' + path if options[:debug]\n\t\t\t\t\n\t\t\t\tfile = File.open(path, 'r')\n\t\t\t\txml_content = file.read\n\t\t\t\tfile.close\n\t\t\tend\n\t\t\treturn xml_content\n\t\tend", "def open(path, opts = {})\n Cubby.logger.warn OPEN_WARNING if defined?(@store) && !@store.nil?\n @store = Cubby::Store.new path, opts\n self\n end", "def parse(path_to_file)\n file = self.class.get_file(path_to_file)\n\n parser = Parser.new(file)\n @title = parser.get_title\n @authors = parser.get_authors\n @abstract = parser.get_abstract\n @content = parser.get_content\n @references = parser.get_references.map do |r|\n Reference.new(r[:html_id], r[:entry])\n end\n\n # TODO remove after we've switched to online\n file.close\n end", "def documents\n DocumentManager.new(self)\n end", "def linked_documents\n LinkedDocumentManager.new(self)\n end", "def docs\n if @docs.nil?\n @docs = FeedTools::XmlHelper.try_xpaths(\n self.channel_node, [\"docs/text()\"],\n :select_result_value => true)\n begin\n if !(@docs =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(@docs)\n channel_base_uri = nil\n unless self.channel_node.nil?\n channel_base_uri = self.channel_node.base_uri\n end\n @docs = FeedTools::UriHelper.resolve_relative_uri(\n @docs, [channel_base_uri, self.base_uri])\n end\n rescue\n end\n if self.configurations[:url_normalization_enabled]\n @docs = FeedTools::UriHelper.normalize_url(@docs)\n end\n end\n return @docs\n end", "def show \n render :file => cache_file and return if cached_file?\n \n @document = Document.find_by_path(request_path)\n \n raise ActiveRecord::RecordNotFound unless @document and (@document.published? or @document.allowed? current_user, 'read')\n\n respond_to do |format|\n format.html do\n setup_view_environment\n render :template => view_for\n end\n format.xml { render :xml => @document.to_xml(:only => [:title, :summary, :body, :published_at, :permalink]) }\n format.rss { render :template => 'pages/feed.rss.builder' }\n end\n\n cache_this_page!\n end", "def load_xml_doc( filename )\n File.open( filename, 'r') do |file|\n return Oga.parse_xml( file )\n end\n\n puts \"ERROR: loading #{filename}\"\n return nil\n end", "def document(path)\n begin\n target_path = File.join(root_path, lang.to_s, doc_to_fs_path(path))\n doc_file = open(target_path, \"r\")\n rescue Errno::ENOENT\n raise Documentation::DocumentNotFoundError, \"No such document: #{path.inspect}, lang: #{lang} (filesystem: #{target_path.inspect})\"\n end\n\n body = doc_file.read\n Documentation::Markdown::Preprocessing.preprocess! body\n\n @renderer.reset_for_reuse!\n rendered_source = @redcarpet.render(body)\n\n Documentation::Document.new(rendered_source, @renderer.toc_root)\n end", "def document_from_io(io)\n REXML::Document.new(io)\n end", "def get_document( doc_id:, version:CURRENT, filename: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :get, path_for(doc_id, filename, version), {}, :binary\n end", "def read_xml\n @epub.file.read_xml(abs_filepath)\n end", "def new(url, options = {})\n Document.new(url, options)\n end", "def with_cache(options)\n path = Picasa.path(options)\n @request_cache.delete(path) if options[:reload]\n xml = nil\n if @request_cache.has_key? path\n xml = @request_cache[path]\n else\n xml = @request_cache[path] = xml(options)\n end\n if xml\n yield xml\n end\n end", "def doc\n # get_html beforehand for good output messages\n html = get_html\n print \"Parsing doc...\"\n doc = Nokogiri::HTML(html)\n puts \"done.\"\n puts\n doc\n end", "def download_and_read_docs\n return enum_for :download_and_read_docs unless block_given?\n\n tmpdir = '/tmp/rugments'\n php_manual_url = 'http://us3.php.net/distributions/manual/php_manual_en.tar.gz'\n\n sh \"rm -rf #{tmpdir}\" if Dir.exist?(tmpdir)\n sh \"mkdir -p #{tmpdir}\"\n Dir.chdir(tmpdir) do\n sh \"curl -L #{php_manual_url} | tar -xz\"\n\n Dir.chdir('./php-chunked-xhtml') do\n Dir.glob('./ref.*').sort.each { |x| yield File.read(x) }\n end\n end\nend", "def bookmarklet\n # @bookmark = Bookmark.new(:tags => [Tag.new])\n @bookmark = Bookmark.where(:url => params[:address], :user_id => session[:user_id]).first_or_initialize(:tags => [Tag.new])\n respond_to do |format|\n format.html # bookmarklet.html.erb\n format.xml { render :xml => @bookmark }\n end\n end", "def start_document\n reset!\n delegate.start_document(DOCUMENT_NODE, self) if delegate.respond_to?(:start_document)\n end", "def initialize(docx_file_path)\n # Use the private getter to access @doc within this class.\n @doc = Docx::Document.open(docx_file_path)\n end", "def document\n @document ||= if html_content_only && content_type != \"text/html\"\n raise \"The url provided contains #{content_type} content instead of text/html content\" and nil\n else\n request.read\n end\n rescue Exception => e\n add_fatal_error \"Scraping exception: #{e.message}\"\n end", "def reader\n return @reader if @reader\n @reader = PDF::Reader.new(@file_path)\n end", "def get_doc(url)\n page = MetaInspector.new(url)\n doc = page.document\n\n raise page.errors[0] if !page.ok?\n\n doc\n end", "def read_from_cache\n result = if cache.is_a?(Proc)\n cache.call(nil)\n elsif File.exist?(cache.to_s)\n File.read(cache)\n end\n result if valid_rates?(result)\n end", "def fetch_feed\n endpoint = @current_feed.values.first\n\n begin\n document = SimpleRSS.parse(URI.open(endpoint, 'User-Agent' => 'Ruby-wget'))\n rescue StandardError => e\n puts \"Error: <#{e}> while trying to call <#{@current_feed_link}>\"\n # effectively skip document\n document = { title: Rss::NO_VALUE, items: {} }\n end\n\n # Ensuring string access instead of symbol access.\n # I know there's probably a better way to do this...\n # but I can't remember if with_indifferent_access is\n # a rails thing...\n @cache[@current_feed.keys.first] = JSON.parse(document.items.to_json)\n end", "def load_local_cache\n return nil unless File.exists?(LOCAL_CACHE_PATH)\n yaml = File.read(LOCAL_CACHE_PATH)\n YAML.load(yaml)\n end", "def url_for_bookmark doc, options = {}\n require 'cgi'\n \n # This branch is the one executed for a search results index page \n if doc and doc[\"DocId\"]\n # IF doc exists and has this field\n Rails.logger.debug(\"Route - returning doc #{doc['DocId']}\" )\n # One mechanism is to return the doc itself (Ruby can recognize that it is an object and create the appropriate url)\n # In that case, the url would be catalog/id\n # but here, we want to ensure we pass the DocId parameter and we are escaping the ID in the parameter \n # Additionally, we tried updating the doc id to be the escaped uri, but that did not work correctly\n # What we are doing here is passing the local name (which has no slashes, etc. that could throw either apache or ruby off)\n # and then utilizing the normal behavior for showing a document but passing in the parameter as well\n # Code on the solr document helper side knows to expect that parameter and utilize that for the solr document id if it exists\n # Not passing in a local name in the url would make the code expect this was some search query, and without a query it jsut\n # goes back to the front page\n id = doc[\"DocId\"]\n uri_sliced = id.split(\"/\")\n local_name = uri_sliced.last\n uri_escaped = CGI::escape(id)\n # This was there originally before but let's try it without this, this would be useful if we were passing back doc\n # instead of passing the parameter in the URL\n # doc[\"id\"] = local_name \n \"/bookmarks/\" + local_name + \"?DocId=\" + id\n else \n #Does what this code would do without our updates \n doc \n end\n \n \n end", "def get_bookmarks_with_http_info(name, bookmark_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_bookmarks ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_bookmarks\"\n end\n # verify the required parameter 'bookmark_path' is set\n if @api_client.config.client_side_validation && bookmark_path.nil?\n fail ArgumentError, \"Missing the required parameter 'bookmark_path' when calling PdfApi.get_bookmarks\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/bookmarks/list/{bookmarkPath}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'bookmarkPath' + '}', bookmark_path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].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 # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BookmarksResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_bookmarks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def cache_xml\n write_xml = to_xml\n file = File.new \"#{cache_file_path}.xml\", 'w'\n file.puts write_xml\n file.close\n write_xml\n end", "def document_hashes(search_args = {})\n return @document_hashes if defined?(@document_hashes)\n @document_hashes = LazySearch.new(@client, @search_definition, search_args)\n end", "def download\n @doc = Nokogiri::HTML(open(@url))\n\tend", "def browse(options={})\n response = API.instance.send_request('docs.browse', options.merge(:category_id => self.scribd_id))\n documents = []\n response.elements['/rsp/result_set'].elements.each do |doc|\n documents << Document.new(:xml => doc)\n end\n return documents\n end", "def get(year, number)\n dir = File.join(CACHE_DIR, year.to_s)\n FileUtils.mkdir_p(dir) if not File.directory?(dir)\n path = sprintf(PATH_TEMPLATE, year, number)\n cached_doc = File.join(CACHE_DIR, year.to_s, File.basename(path))\n\n # XXX should check for 200 OK\n if not File.file?(cached_doc)\n content = Net::HTTP.get(HOST, path)\n File.open(cached_doc, \"w\") { |f| f.puts(content) } if content\n end\n\n return File.read(cached_doc)\nend", "def Open()\n\t\t#Begin document\n\t\t@state = 1\n\tend", "def use_document(xml, use_internal_proof=false)\n if use_internal_proof\n proofsheets = Proofsheets.new\n @xml_document = proofsheets.load_document_proofsheets(xml)\n @proof = Proof.new(proofsheets)\n else\n if xml.is_a?(REXML::Document)\n @xml_document = xml_document\n else\n @xml_document = REXML::Document.new(fetch_xml(xml))\n end\n end\n end", "def document(docid)\n Document.new(\"#{@uri}/docs\", docid)\n end", "def open!(path, flags=\"r\", options={}, &callback)\n wait_for(open(path, flags, options, &callback), :handle)\n end", "def create_html_document(directory, filename, locale, deliverable_json = nil)\n version = Settings[:CURRENT_VERSION]\n \n # Why not let CouchDB create the ID? Because it actually affects performance.\n # Also, if we define the ID, then we can find the document without a view.\n id = \"#{Settings[:APP_NAME]}.#{filename}.#{locale}.#{version}\"\n \n # Create a Nokogiri document from the XML file on disk\n content_doc = Nokogiri::XML(open(\"#{directory}/#{filename}\")){|config| config.noent }\n content_doc.remove_namespaces!\n \n # Figure out the title for the document, pick it up from the\n # Dublin Core metadata, if available, otherwise grab it from the\n # title element.\n title=content_doc.xpath(\"/html/head/meta[@name = 'DC.Title']/@content\")\n title ||= content_doc.xpath('/html/head/title').inner_text().to_s\n title = title.to_s rescue nil\n \n # Add facets.\n # The rescue nil is there because if something happens, we're okay\n # with no value.\n app_area = content_doc.xpath(\"/html/head/meta[@name = 'app_area']/@content\").to_s rescue nil \n role = content_doc.xpath(\"/html/head/meta[@name = 'role']/@content\").to_s rescue nil\n edition = content_doc.xpath(\"/html/head/meta[@name = 'edition']/@content\").to_s rescue nil\n topic_type = content_doc.xpath(\"/html/head/meta[@name = 'topic_type']/@content\").to_s rescue nil\n technology = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.Technology']/@content\").to_s rescue nil\n\n # Add deliverable title and other metadata\n deliverable_title = deliverable_json['title'] rescue nil\n deliverable_type = deliverable_json['type'] rescue nil\n deliverable_pdf_name = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.RelatedPDF']/@content\").to_s rescue nil\n deliverable_pdf_url = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.RelatedPDFURL']/@content\").to_s rescue nil\n deliverable_home = deliverable_json['default_topic'] rescue nil\n \n #scrub the table of data we don't need\n body_content = content_doc.xpath('/html/body/*')\n scrub_table(body_content)\n body_content = body_content.to_html\n \n\n # Create a document to add the searchable text. We have to create a\n # new document, we can't reuse content_doc. That's because nodesets\n # are queries of documents. In other words, if you do a\n # nodeset.xpath('//xpath').remove, it removes that xpath from all\n # nodesets created from a document, not just nodeset.\n search_doc = content_doc.dup\n \n # Remove items we don't want returned in the search snippet\n search_content=search_doc.xpath('/html/body')\n search_content.xpath('/html/body//table[contains(@class, \"permTable\") or contains(@class, \"editionTable\")]').remove\n search_content.xpath('/html/body//*[contains(@class, \"breadcrumb\")]').remove\n search_content.xpath('/html/body/h1[1]').remove\n \n # Encode the search_content, replacing unsafe codepoints. This allows search to find items like >\n coder = HTMLEntities.new\n search_content=coder.encode(search_content.children().inner_text()).strip\n \n #remove weird new line characters\n search_content = search_content.gsub(\"\\n\", ' ')\n search_content = HTMLEntities.new.decode(search_content)\n \n #doc fields to create, if needed\n newDoc = {\n '_id' => id,\n :name => filename,\n :locale => locale,\n :version => version,\n :title => title,\n :body_content => body_content,\n :app_area => app_area,\n :role => role,\n :edition => edition,\n :topic_type => topic_type,\n :technology => technology,\n :deliverable_title => deliverable_title,\n :deliverable_type => deliverable_type,\n :deliverable_pdf_name => deliverable_pdf_name,\n :deliverable_pdf_url => deliverable_pdf_url,\n :deliverable_home => deliverable_home,\n :search_content => search_content}\n \n #This content hash accounts for changes necessary from the deliverable metadata as well as changes to the xml document in general\n newDoc[:content_hash] = generateCheckSum(newDoc.inspect)\n \n #Dynamic content added after the hash\n newDoc[:updated] = Time.now.to_date.iso8601\n \n #upsert the document\n upsert_doc_via_checksum(@db, newDoc, [:locale, :version], @id_checksum_hash[id], @log)\n \n return id\n end", "def document\n @document ||= begin\n visit \"https://www.gp.endesaonline.com/gp/GenericForward.do?TO=obtenerBuscadorFacturasGP\"\n rows = all(\"#listado_facturas tr\").to_a\n rows.shift # header\n\n row = rows.detect do |row|\n date = row.all('td')[6].text\n date =~ %r{\\d{2}/#{month.to_i}/\\d{2}}\n end\n\n invoice = row.first('a')\n\n raise \"Endesa invoice for month #{month} is not available yet.\" unless invoice\n\n cd_cfactura, cd_contrext, estado, secfactu, creffact, sfecha, sPos = invoice[:href].scan(/descargarPDFFactura\\(([^\\)]+)\\)/).flatten.first.split(\",\").map { |s| s[1..-2] }\n url = \"https://www.gp.endesaonline.com/gp/GenericForward.do?TO=GenerarFacturas&CFACTURA=\" + cd_cfactura +\"&SECFACTU=\"+ secfactu +\"&CREFFACT=\" + creffact+ \"&SFECHA=\" + sfecha+\"&ESTADO=\" + estado + \"&pos=\" + sPos\n cookie = Cookie.new('JSESSIONID', get_me_the_cookie('JSESSIONID')[:value])\n Document.new(url, :get, cookie)\n end\n end", "def get_xml_document(workflow_file)\n xml_file = File.new(workflow_file)\n document = Document.new(xml_file)\n end", "def document\n @document ||= open(@url).read\n\n rescue SocketError\n warn 'MetaInspector exception: The url provided does not exist or is temporarily unavailable (socket error)'\n @scraped = false\n rescue TimeoutError\n warn 'Timeout!!!'\n @scraped = false\n rescue Exception => e\n warn 'An exception occurred while trying to fetch the page!'\n warn e.message\n @scraped = false\n end", "def read document_file_name\n path_to_document = File.join(items_from, document_file_name)\n \n raise DocumentNotFound unless document_exists? path_to_document\n \n ActiveDocument::FileUtils.open path_to_document\n end", "def open\n require 'wiki-lib'\n ary = Array.new\n Selection.each do |dd|\n docu = dd.cite_key.get\n ary << docu unless File.exists?(\"#{Wikipages_path}/ref/#{docu}.txt\")\n ensure_refpage(docu)\n end\n `open http://localhost/wiki/ref:#{Selection[0].cite_key.get}`\nend" ]
[ "0.5680514", "0.55620104", "0.54649127", "0.54545224", "0.5450304", "0.5341162", "0.5259545", "0.5218658", "0.5166951", "0.5152344", "0.51081336", "0.50645673", "0.50215924", "0.499534", "0.49784198", "0.49608606", "0.4945149", "0.49401587", "0.49323162", "0.49273184", "0.4921945", "0.48802957", "0.4795255", "0.47935385", "0.478112", "0.47409216", "0.47292516", "0.4715568", "0.4710571", "0.47102362", "0.47044381", "0.46827936", "0.4674285", "0.46601537", "0.46560818", "0.4655471", "0.46546686", "0.46402717", "0.4620945", "0.4599859", "0.45825037", "0.45774505", "0.45715693", "0.45673397", "0.4558167", "0.454869", "0.4540874", "0.45310277", "0.45303416", "0.45303416", "0.45253247", "0.4524346", "0.45215058", "0.45109737", "0.4510181", "0.4501607", "0.4495862", "0.4493401", "0.44864509", "0.44854653", "0.4483992", "0.44827458", "0.44780463", "0.4477884", "0.4476062", "0.44748196", "0.44676876", "0.44588125", "0.44587275", "0.4444433", "0.4442201", "0.4440166", "0.4439099", "0.44374028", "0.44344756", "0.44341", "0.441672", "0.44140285", "0.4405145", "0.44048563", "0.4403978", "0.4395024", "0.43916962", "0.43804094", "0.43769252", "0.43763262", "0.43731797", "0.43728217", "0.43703634", "0.4364016", "0.4361534", "0.43524393", "0.4349598", "0.4343224", "0.43405908", "0.43403673", "0.43375218", "0.4331239", "0.432811", "0.4317177" ]
0.72416097
0
The Time of the most recently updated bookmark on del.icio.us.
def last_updated_at if cache @last_updated_at ||= remote_last_updated_at else remote_last_updated_at end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bookmark_time\n @ole.BookmarkTime\n end", "def last_update\n Time._load(index_time_dbm_file['last']) rescue \"none\"\n end", "def last_update\n Time.parse(@record.SystemModstamp)\n end", "def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end", "def last_updated_time\n data[:last_updated_time]\n end", "def last_seen_at() ; info_time(:last_seen) ; end", "def last_edited_time\n begin\n $redis.hget 'last_edit:instrument', self.id\n rescue\n nil\n end\n end", "def remote_last_updated_at\n require 'rexml/document'\n doc = REXML::Document.new(request('update'))\n Time.iso8601(doc.root.attributes['time'])\n end", "def last_modified_at(page)\n Gtn::ModificationTimes.obtain_time(page['path'])\n end", "def last_update_date_time\n return @last_update_date_time\n end", "def last_update_date_time\n return @last_update_date_time\n end", "def last_update_date_time\n return @last_update_date_time\n end", "def last_update_date_time\n return @last_update_date_time\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def last_updated_date_time\n return @last_updated_date_time\n end", "def last_updated_date_time\n return @last_updated_date_time\n end", "def last_updated_date_time\n return @last_updated_date_time\n end", "def last_updated_date_time\n return @last_updated_date_time\n end", "def latest_restorable_time\n data[:latest_restorable_time]\n end", "def latest_restorable_time\n data[:latest_restorable_time]\n end", "def last_refresh\n @dt\n end", "def last_refresh\n @dt\n end", "def last_refresh\n @dt\n end", "def updated\n Time.parse @doc.at_xpath(\"atom:feed/atom:updated\", ::AtomFeed::NS).content\n end", "def last_updated\n time = self.updated_at\n if time < Time.now - (3600 * 24)\n time.strftime(\"%b %-d, %Y\")\n else\n time.strftime(\"%l:%M %p\")\n end\n end", "def date_updated\n Time.parse(@attrs['DateUpdated'])\n end", "def date_updated\n Time.parse(@attrs['DateUpdated'])\n end", "def last_edited\n\t\tself.latest_update.to_date\n\tend", "def updated\n Time.parse @node.at_xpath(\"atom:updated\", ::AtomFeed::NS).content\n end", "def last_updated_time\n CGI.escape(30.minutes.ago.to_datetime.to_formatted_s(:iso8601))\n end", "def last_written_at\n entry = read(1).first\n entry.time if entry\n end", "def last_edited\n self.latest_update.to_date\n end", "def last_updated\n\t\tupdated_at\n\tend", "def last_entry_time\n last_entry = db.last_entry_temp.flatten.first\n last_entry ? Time.at(last_entry) : nil\n end", "def last_written\n wtime = (@cred_struct[:last_written][:dw_high_date_time] << 32) +\n (@cred_struct[:last_written][:dw_low_date_time])\n Time.at((wtime - 116444736000000000) / 10000000)\n end", "def last_fetch\n datetime_from(\"sf:last_fetch\")\n end", "def tnow\n Updater::Update.time.now.to_i\n end", "def modified_at\n ensure_full_data!\n Time.at(@gapi[\"lastModifiedTime\"] / 1000.0)\n end", "def last_time\n @last_time\n end", "def last_used_at\n begin\n Time.parse(self.last_use_date)\n rescue\n nil\n end\n end", "def last_refresh_time\n return @last_refresh_time\n end", "def bookmark_time(value)\n @ole.BookmarkTime = value\n nil\n end", "def last_modified_time\n mtime\n end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def system_modified_dtsi\n Time.parse get('system_modified_dtsi')\n end", "def last_seen_at\n @data[:last_seen_at]\n end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def last_modified\n @metadata[:last_modified] || Time.now.utc\n end", "def last_run\n DateTime.parse(\"1 Jan 2007\")\n end", "def deletion_time\n data[:deletion_time]\n end", "def last_seen\n return Time.now.to_date if match(/Last\\sseen\\s+:\\s(now)/)\n Date.parse(match(/Last\\sseen\\s+:\\s+(\\w+ [0-9]{2} [0-9(:?)]+ [0-9]{4})/)) rescue nil\n end", "def history_end_dt\n @parent.last_updated_dt\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def first_seen_date_time\n return @first_seen_date_time\n end", "def first_seen_date_time\n return @first_seen_date_time\n end", "def last_modified\n if v = @meta['last-modified']\n Time.httpdate(v)\n else\n nil\n end\n end", "def last_modification_date\n return DateTime.iso8601(@doc.xpath('//mets:metsHdr/@LASTMODDATE').to_s)\n end", "def last_modified\n# stat.mtime\n @bson['uploadDate'] || Date.new\n end", "def updated_at\n DateTime.parse((solr_document[\"updated_at_dtsi\"] || solr_document[\"timestamp\"] || solr_document[\"created_at_dtsi\"]).to_s).utc\n end", "def last_modified_date_time\n return @last_modified_date_time\n end", "def last_epoch_time; end", "def last_use_at\n @attributes[:last_use_at]\n end", "def cache_timestamp\n Tml::Utils.interval_timestamp(version_check_interval)\n end", "def last_used\n Date.parse(match(/Last\\sused\\s+:\\s+(\\w+ [0-9]{2} [0-9(:?)]+ [0-9]{4})/)) rescue nil\n end", "def current_time\r\n return @owner.timestamp.to_i - @start.to_i\r\n end", "def btc_mtime\n Time.at(read['assigned'].to_i)\n end", "def get_last_modified(feed)\n\t\t\t#assume, that first entry is newest\n\t\t\tfeed.last_modified || (feed.entries[0] && feed.entries[0].published) || Time.now\n\t\tend", "def timestamp\n _timestamp.as_time\n end", "def last_modified\n stat.mtime\n end", "def timestamp\n _timestamp.as_time\n end", "def rev\n updated_at\n end", "def last_reported_date_time\n return @last_reported_date_time\n end", "def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at] + self.page.elements.collect{|e| e.last_modified}\n timestamps.sort.last\n end", "def httpdate\n Time.now.httpdate\n end", "def last_update_at\n connection.get_metric_last_update_at(@id)\n end", "def get_time()\n return @noko.css(\"li.g:first-of-type table table\")[0].text\n end", "def updated_time\n Time.parse(object[\"updated_time\"]) if object[\"updated_time\"]\n end", "def getlastmodified\n if !record.nil? and record.respond_to? :updated_at\n record.updated_at.httpdate\n end\n end", "def google_modification_time\n local_url = URI.parse \"http://spreadsheets.google.com/feeds/list/#{google_key}/od6/public/basic\"\n web_modification_time local_url\n end", "def finished_at; @doc['finished_at']; end" ]
[ "0.7913958", "0.6993065", "0.69735515", "0.6973531", "0.68950564", "0.68847346", "0.680392", "0.6698146", "0.66977865", "0.6677674", "0.6677674", "0.6677674", "0.6677674", "0.6674719", "0.6674719", "0.6674719", "0.66537464", "0.66537464", "0.66537464", "0.66537464", "0.6635172", "0.6635172", "0.66295624", "0.66295624", "0.66295624", "0.6625857", "0.66115445", "0.65936613", "0.65936613", "0.6568794", "0.65569806", "0.65566486", "0.65312225", "0.6493255", "0.6492117", "0.64921045", "0.64780945", "0.64251846", "0.6417059", "0.64122134", "0.6410926", "0.6404788", "0.6398084", "0.6387497", "0.6384656", "0.63632375", "0.63628083", "0.6310442", "0.6295586", "0.6295586", "0.6295586", "0.6295586", "0.6295586", "0.6295586", "0.6273995", "0.6269319", "0.62664", "0.62557346", "0.6239385", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6226745", "0.6224838", "0.6224838", "0.6215316", "0.62084806", "0.61972994", "0.6193679", "0.61881214", "0.6182356", "0.6177655", "0.61691236", "0.61672145", "0.615912", "0.6158732", "0.61575913", "0.61533886", "0.61464775", "0.6141354", "0.614105", "0.6139386", "0.6132929", "0.61257976", "0.6121091", "0.6105608", "0.6102512", "0.6100509", "0.60991716", "0.60886633" ]
0.6143404
89
Determine if any bookmarks have been updated since the time specified.
def updated_since?(time) time < last_updated_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stale?(time = Time.now)\n updated_at < time\n end", "def has_beeen_updated_recently?( update_time )\n now = Time.now.utc\n ( (! update_time.nil?) && (update_time.year == now.year) && (update_time.month == now.month) && (update_time.day == now.day) &&\n (update_time.hour == now.hour) && (update_time.min == now.min) && ((now.sec - update_time.sec).abs < 7) )\n end", "def updates_since? last_update\r\n return true unless self.updated_since(last_update).blank?\r\n return true unless self.problems.updated_since(last_update).blank?\r\n false\r\n end", "def fresh_at?(time)\n time >= updated_at\n end", "def content_changed_since?(last_updated)\n stale?(:last_modified => last_updated)\n end", "def changed_since_publication?\n return true unless on_flickr?\n\n last_updated > published_at + 1.second\n end", "def stale?\n updated_at < 2.weeks.ago || json == '{}'\n end", "def has_changed?\n updated_at > 8.hours.ago\n end", "def movies_stale?\n Time.new - self.movies.last.updated_at >= 900\n end", "def contact_info_updated_since(t)\n return false if sdb_update_at.nil?\n t < sdb_update_at\n end", "def stale?\n updated_at < 2.hours.ago\n end", "def modified_since?( time )\n mtime > time\n end", "def has_played_since_last_update?\n @front_page = get_page(bungie_net_front_page_url)\n last_played = (@front_page/\"div.spotlight div \").inner_html.split(\"&nbsp; | &nbsp;\")[1].gsub(\"Last Played \", \"\").to_date\n return last_played > self.updated_at.to_date\n end", "def outdated?\n (Time.now - self.time_of_last_ok) > threshold_for_oldest_ok\n end", "def stale?\n (last_updated_at || Time.at(0)) < 5.minutes.ago\n end", "def gets_updated?\n for p in all_periods\n return true if p.keep_updated?\n end\n return false\n end", "def stale?\n unlocked? and item.has_attribute?(:updated_at) and updated_at < item.updated_at\n end", "def isDataUpToDate?\n DailyNews.first.updated_at.to_s.slice(5..6).eql? Time.now.to_s.slice(8..9)\n end", "def stale?\n forecasts.empty? || (Time.now - data_file.mtime) > 14_400\n end", "def any_updates?\n change_history.size > 1\n end", "def any_updates?\n change_history.size > 1\n end", "def fresh_by_time?\n return false unless env.key?(IF_MODIFIED_SINCE) && !last_modified.nil?\n Time.parse(last_modified) <= Time.parse(env.fetch(IF_MODIFIED_SINCE))\n end", "def is_stale?\n frequency = dispatchable.frequency.name\n created_at < time_for_interval(frequency)\n end", "def up_to_date_for?(timestamp)\n keys.sort.last >= timestamp\n end", "def stale?\n @stale ||= Time.now.to_i - timestamp.to_i > MaximumAge\n end", "def up_to_date?\n lu = latest_stored_update\n\n if !lu && !@prev_latest_update\n # They match if both nil\n true\n elsif lu && @prev_latest_update && (lu - @prev_latest_update).abs < 2\n # Consider them a match if they are within 2 seconds of one another,\n # accounting for the difference between Rails and DB times\n true\n elsif @prev_latest_update.nil?\n # The remembered value was nil, so let the caller know this\n self.prev_latest_update = lu\n nil\n else\n # There was no match\n self.prev_latest_update = lu\n false\n end\n end", "def updated?\n !ignore? && !removed? && mtime != File.mtime(path)\n end", "def need_update?\n return true unless @lastread\n @lastread < File::stat(@path).mtime\n end", "def updated\n watchers.find_all(&:updated?)\n end", "def stale?\n if config.cache.is_a?(Proc)\n proc_timestamp != mem_timestamp\n else\n file_timestamp != mem_timestamp\n end\n end", "def checked_for_updates\n @@checked_for_updates\n end", "def records_modified_since(time)\n []\n end", "def _update_check_needed\n (Time.now - @last_update_check) > UPDATE_VALID_PERIOD\n end", "def update?\n if @w_up_to_date && true #all up_to_date-caches!!!\n @up_to_date = true\n return @up_to_date\n end\n false\n end", "def out_of_date?\n time_diff = Time.zone.now - updated_at\n time_diff >= 2.weeks\n end", "def not_modified?(time = self.last_modified)\n request.if_modified_since && time && time <= request.if_modified_since\n end", "def updated?\n updater && author != updater\n end", "def check_timestamp\n @recent.save! if Time.now - @recent.updated_at >= 600\n end", "def modified_since?(datetime_string)\n last_modified != datetime_string\n end", "def has_updates?\n self['newUpdatesFlag']\n end", "def uptodate?(new, old_list)\n return false unless File.exist?(new)\n new_time = File.mtime(new)\n old_list.each do |old|\n if File.exist?(old)\n return false unless new_time > File.mtime(old)\n end\n end\n true\n end", "def changed_files_since(root, time, prunes = [ ])\n prunes = prunes.map { |p| File.expand_path(p) }\n \n root = File.expand_path(root)\n key = key_for(root, prunes)\n data = @roots[key]\n \n unless data && data[:up_to_date]\n new_mtimes = { }\n start_time = Time.now\n if @filesystem_impl.exist?(root)\n @filesystem_impl.find(root) do |path|\n if prunes.detect { |p| File.expand_path(path)[0..(p.length - 1)] == p }\n @filesystem_impl.prune\n else\n new_mtimes[path] = @filesystem_impl.mtime(path)\n end\n end\n end\n end_time = Time.now\n \n # Deleted files -- if we don't have a new mtime for it, it doesn't exist;\n # we then say it was modified now, the first time we noticed it was gone.\n if data\n data.keys.each { |path| new_mtimes[path] ||= start_time }\n end\n \n data = new_mtimes\n @roots[key] = data\n @roots[key][:up_to_date] = true\n end\n \n file_list = data.keys - [ :up_to_date ]\n if time\n time = Time.at(time.to_i)\n file_list = file_list.select { |path| data[path] >= time }\n end\n \n file_list\n end", "def file_changed(f)\n if !MrBucket.exists?(f)\n return true\n end\n local_time = open(f).mtime\n live_time = Time.parse(MrBucket.find(f).about[:\"last-modified\"])\n return local_time > live_time\nend", "def more_recently_modified?(target_entry)\n self.entry_modified_on > target_entry.entry_modified_on\n end", "def requires_update?\n\t\tif @twitter_account.new_record? || @twitter_account.name.nil?\n\t\t\treturn true\n\t\tend\n\n\t\treturn Time.now - @twitter_account.updated_at > 60 * CACHE_DURATION\n\tend", "def should_be_offline?\n time_ago = (update_frequency.seconds * 4.8).ago\n # Provides leeway for new stations\n if created_at > time_ago\n return false\n end\n observations.since(time_ago).order(created_at: :desc).count < 3\n end", "def old?\n if modified_at.nil?\n false\n else\n modified_at < self.class.old_in_days.days.ago.to_i\n end\n end", "def update_found(feed, latest_db_post)\n if latest_db_post.nil?\n Log.log.debug \"Latest Post date is nil, table is empty. Performing initial update\"\n return true\n end\n last_blog_update = feed.updated.content\n Log.log.debug \"last_blog_update: #{last_blog_update}\"\n Log.log.debug \"latest_db_post: #{latest_db_post}\" \n if last_blog_update > latest_db_post\n Log.log.debug \"Updates Detected\"\n return true\n else\n Log.log.debug \"No updates found\"\n return false\n end\nend", "def changed_notably?\n if @is_touch && changes_in_latest_version.empty?\n true\n else\n super\n end\n end", "def changed_notably?\n if ignored_attr_has_changed?\n timestamps = @record.send(:timestamp_attributes_for_update_in_model).map(&:to_s)\n (notably_changed - timestamps).any?\n else\n notably_changed.any?\n end\n end", "def has_updates?\n !@update_map.empty?\n end", "def has_status_timestamp?\n !overall_status_modified_at.nil?\n end", "def ever_tracked?\n !!last_tracked_at\n end", "def tracked_recently?\n if ever_tracked?\n last_tracked_at > 24.hours.ago\n else\n false\n end\n end", "def records_modified_since(time)\n condition = []\n %w(updated_at created_at).each do |col|\n condition << \"#{col} >= ?\" if column_names.include? col\n end\n if condition.empty?\n logger.warn \"#{self.name}: Override records_modified_since(time) to keep the index up to date with records changed during rebuild.\"\n []\n else\n find :all, :conditions => [ condition.join(' AND '), *([time]*condition.size) ]\n end\n end", "def recent?\n Time.at(timestamp) >= 2.minutes.ago\n end", "def recent?\n (!self.available_on.nil? && self.available_on >= self.class.recent_on && self.available_on < self.class.new_on)\n end", "def isStale?(file, old_files)\n\t\treturn true unless File.exist?(file)\n\t\tnew_time = File.mtime(file)\n\t\told_files.each do |old|\n\t\t\tif File.exist?(old)\n\t\t\t\t#debug \"New Time: #{new_time}\"\n\t\t\t\t#debug \"Old Time: #{File.mtime(old)}\"\n\t\t\t\treturn true if new_time < File.mtime(old)\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def needs_refresh?(time)\n !refreshed_at || refreshed_at < time\n end", "def updateable?\n return true if @cursor == STOP\n now = Time.now\n @last_update ||= now\n now - @last_update > UPDATE_DELAY\n end", "def historical?\n self.as_of_time.present?\n end", "def not_modified?(time = self.last_modified)\n if !request.if_modified_since.nil? and !time.nil?\n time <= request.if_modified_since\n else\n false\n end\n end", "def has_updated_at_timestamp?\n !!@updated_at\n end", "def updated?\n @changed_files.clear()\n start_size = @file_cache.size\n listen_for_changes\n end_size = @file_cache.size\n start_size != end_size || !@changed_files.empty?\n end", "def historical?\n self.attributes.key?('as_of_time') || self.kind_of?(self.class.history)\n end", "def published?\n published_at && published_at == edited_at\n end", "def published?\n published_at && published_at == edited_at\n end", "def up_to_date?\n self.entries.size >= Round.all.size\n end", "def uptodate?(new, old_list, options = nil)\r\n raise ArgumentError, 'uptodate? does not accept any option' if options\r\n\r\n return false unless File.exist?(new)\r\n new_time = File.mtime(new)\r\n old_list.each do |old|\r\n if File.exist?(old)\r\n return false unless new_time > File.mtime(old)\r\n end\r\n end\r\n true\r\n end", "def uptodate?(new, old_list, options = nil)\r\n raise ArgumentError, 'uptodate? does not accept any option' if options\r\n\r\n return false unless File.exist?(new)\r\n new_time = File.mtime(new)\r\n old_list.each do |old|\r\n if File.exist?(old)\r\n return false unless new_time > File.mtime(old)\r\n end\r\n end\r\n true\r\n end", "def uptodate?(new, old_list, options = nil)\r\n raise ArgumentError, 'uptodate? does not accept any option' if options\r\n\r\n return false unless File.exist?(new)\r\n new_time = File.mtime(new)\r\n old_list.each do |old|\r\n if File.exist?(old)\r\n return false unless new_time > File.mtime(old)\r\n end\r\n end\r\n true\r\n end", "def pics_updated?\n pics(latest_local[:timestamp], latest_remote) unless up_to_date?\n end", "def is_in_hot_list\n if self.added_to_hot_list.nil?\n return false\n end\n\n if self.added_to_hot_list >= 4.days.ago.utc\n return true\n end\n\n return false\n end", "def out_of_date?(stamp)\n puts \"jsdb: checking_out_of_date\"\n @prerequisites.each do |pr|\n p pr\n end\n @prerequisites.any? { |n| application[n, @scope].timestamp > stamp }\n end", "def update_timestamps_for_changes?\n klass = commentable.class\n if klass.respond_to? :update_timestamps_for_comment_changes?\n klass.update_timestamps_for_comment_changes?\n else\n false\n end\n end", "def updates_for? subscription\n tweets.where(:created_at.gt => (subscription.notified_at || subscription.created_at)).any?\n end", "def deleted_since_last_ingest?\n last_ingest = self.premis_events.where(event_type: Pharos::Application::PHAROS_EVENT_TYPES['ingest']).order(date_time: :desc).limit(1).first\n last_deletion = self.premis_events.where(event_type: Pharos::Application::PHAROS_EVENT_TYPES['delete']).order(date_time: :desc).limit(1).first\n if !last_ingest.nil? && !last_deletion.nil? && last_deletion.date_time > last_ingest.date_time\n return true\n end\n return false\n end", "def isTopStoryUpToDate?\n TopStory.last.created_at.strftime('%d').eql? Time.now.strftime('%d')\n end", "def should_update?(file, since_date=nil)\n if since_date.nil?\n # if there is no specified date, then update everything\n return true\n else\n # if a file has been updated since a time specified by user\n file_date = File.mtime(file)\n return file_date > since_date\n end\nend", "def compare_timestamp(subreddit_last, time_recent)\n subreddit_last <= time_recent\n end", "def set_since?(time)\n created_at && created_at >= time\n end", "def fresh_visit?\n visit = current_visit\n visit && visit.updated_at + Constants::Config::VISIT_STALE_AFTER > Time.now\n end", "def backlist?\n (!self.available_on.nil? && self.available_on < self.class.recent_on)\n end", "def has_changes?\n @has_updated || @has_created\n end", "def updated\n Time.parse @doc.at_xpath(\"atom:feed/atom:updated\", ::AtomFeed::NS).content\n end", "def stale?\n !fresh?\n end", "def stale?\n !fresh?\n end", "def stale?\n !fresh?\n end", "def stale!\n if stale?\n update\n true\n else\n false\n end\n end", "def need_to_update_metrics?\n days_old = self.days_between(Time.now)\n ttl = AppConfig.photo_metrics_ttl * (days_old < 0 ? ((-days_old)+1) : 1)\n !self.metrics_last_updated_at || self.metrics_last_updated_at < ttl.ago\n end", "def updated_within_current_event_duration?(margin)\n return false unless event.current_start_time\n\n updated_at > (event.current_start_time - margin) &&\n updated_at < event.current_end_time\n end", "def able_to_set_updated_at?\n !frozen? && !timeless? && (new_record? || changed?)\n end", "def old?\n # they specifically told us via chatops that they were done, so they\n # probably don't mean this one\n return true if chat_end\n\n # the incident is still open in the external incident source, so they\n # probably mean this one\n return false if open?\n\n return true if !timeline_entries.empty? && timeline_entries.last.timestamp < 1.hour.ago\n return true if timeline_entries.empty? && chat_start? && chat_start < 1.hour.ago\n\n false\n end", "def hearing_updated?\n hearing_updates.each_value do |value|\n return true unless [nil, {}, []].include?(value)\n end\n false\n end", "def fresh?\n return false if FORMATS_TO_ALWAYS_RECREATE.include?(format)\n\n return false unless updated_at # new record - too fresh!\n\n current_time = Time.now.gmtime\n yesterday = current_time - 1.day\n (yesterday..current_time).cover?(Time.at(updated_at).gmtime)\n end", "def retrieved?\n return false unless submitted?\n retrieved_at.try(:past?)\n end", "def changed?\n # Allow the timeout to be disabled entirely.\n return true if Puppet[:filetimeout] < 0\n current_stamp = current_timestamp\n\n # We use a different internal variable than the stamp method\n # because it doesn't keep historical state and we do -- that is,\n # we will always be comparing two timestamps, whereas\n # stamp just always wants the latest one.\n if current_stamp == @previous_timestamp\n false\n else\n @previous_timestamp = current_stamp\n true\n end\n end", "def check_if_asqs_up_to_date\n asq = Asq.all.order(last_run: :desc).limit(1)[0]\n return true if !asq.nil? && asq.last_run > Time.now - 20.minutes\n false\n end", "def has_future_exchange_dates\n now = Time.now.utc.to_i\n self.exchange_dates.each do |availability_date|\n if availability_date.latest_date.to_i > now\n return true\n end\n end\n return false\n end", "def is_stale?\n remaining() > @lifetime\n end" ]
[ "0.70125854", "0.6957735", "0.68587834", "0.685865", "0.6844506", "0.6724337", "0.6705332", "0.6684811", "0.6628862", "0.6596946", "0.6590277", "0.653508", "0.6528973", "0.6457132", "0.6413472", "0.6410814", "0.6402752", "0.63746107", "0.6356492", "0.6343933", "0.6343933", "0.63326395", "0.6316552", "0.62589824", "0.6256015", "0.62278134", "0.62240934", "0.6224039", "0.619349", "0.616603", "0.61472", "0.61192083", "0.6106425", "0.6086964", "0.6076897", "0.60643756", "0.60501873", "0.6043775", "0.6033087", "0.6016564", "0.60096705", "0.59679544", "0.59529305", "0.59491825", "0.59459203", "0.5929605", "0.5910499", "0.5902581", "0.5878822", "0.5876722", "0.5868418", "0.58678305", "0.58639276", "0.5859586", "0.5854024", "0.5845201", "0.5843361", "0.5837295", "0.58298826", "0.5823874", "0.58233124", "0.58049643", "0.57975364", "0.57709557", "0.5767755", "0.57391256", "0.57391256", "0.57341844", "0.57286364", "0.57286364", "0.57286364", "0.5721065", "0.57205707", "0.57126904", "0.5709164", "0.5706079", "0.5695418", "0.5693732", "0.5685686", "0.56848973", "0.56839406", "0.5683681", "0.56797737", "0.5678493", "0.5674137", "0.56738764", "0.56738764", "0.56738764", "0.56727374", "0.56706506", "0.56573755", "0.5655697", "0.56551874", "0.5649132", "0.56479263", "0.56434083", "0.56419957", "0.56388205", "0.56354755", "0.5631345" ]
0.741279
0