query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
The add_cpoint method is used to create a construction point. | def add_cpoint(point)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_point\n end",
"def addPoint( x, y) \n point = PVector.new(x, y)\n @points.push(point)\n end",
"def add(point)\n if point.class == ControlPoint\n @controlpoints << point\n else\n raise TypeError, 'Point should be type of ControlPoint'\n end\n end",
"def add_point(point)\n point.cluster.remove_point point if point.cluster\n self.points << point\n point.cluster = self\n end",
"def add(point)\n @controlpoints << case point\n when ControlPoint\n point\n when Array\n ControlPoint.new(*point[0..1])\n else\n raise(TypeError, 'Point should be type of ControlPoint')\n end\n\n\t\t\t# if point.class == ControlPoint\n\t\t\t# \t@controlpoints << point\n # elsif point.class == Array\n # @controlpoints << ControlPoint.new(*point[0..1])\n\t\t\t# else\n\t\t\t# \traise TypeError, 'Point should be type of ControlPoint'\n\t\t\t# end\n\t\tend",
"def add_point(position)\n MSPhysics::Newton::CurvySlider.add_point(@address, position)\n end",
"def add_point(position)\n MSPhysics::Newton::CurvySlider.add_point(@address, position)\n end",
"def add_point(point)\n puts \"adding p: #{point}\" if @debug\n @points << point\n if self.mec && self.mec.center\n unless self.mec.contains?(point)\n iterate\n end\n else\n iterate\n end\n end",
"def add point\n self.x += point.x\n self.y += point.y\n self\n end",
"def create\n points.insert(coordinates: attribute)\n end",
"def add_to_point point\n add_to_point! point.dup\n end",
"def curveto(cp1x, cp1y, cp2x, cp2y, x, y)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x, y)\n end",
"def +(point)\n\t\t\t\tx = nil\n\t\t\t\ty = nil\n\t\t\t\t\n\t\t\t\tif [email protected]? || !point.x.nil?\n\t\t\t\t\tx = @x.to_i + point.x.to_i\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif [email protected]? || !point.y.nil?\n\t\t\t\t\ty = @y.to_i + point.y.to_i\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tself.class.new(x, y)\n\t\t\tend",
"def add(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x + point.x\r\n new_point.y = @y + point.y\r\n return new_point\r\n end",
"def add_bezierpath_withcp1_cp2_endpoint(controlPoint1: { :x => 0.0,\n :y => 0.0 }, \n controlPoint2: { :x => 9.0,\n :y => 9.0 }, \n endPoint: { :x => 10.0,\n :y => 20.0 })\n pathElement = { :elementtype => \"pathbeziercurve\",\n :controlpoint1 => controlPoint1,\n :controlpoint2 => controlPoint2,\n :endpoint => endPoint }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end",
"def create\n @cp = Cp.new(cp_params)\n\n respond_to do |format|\n if @cp.save\n format.html { redirect_to @cp, notice: 'Cp was successfully created.' }\n format.json { render :show, status: :created, location: @cp }\n else\n format.html { render :new }\n format.json { render json: @cp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_arc_topoint_onpath(tangentPoint1: { x: 0.0, y: 0.0 },\n tangentPoint2: { x: 100.0, y: 100.0 },\n radius: 1.0)\n pathElement = { elementtype: :pathaddarctopoint,\n tangentpoint1: tangentPoint1,\n tangentpoint2: tangentPoint2,\n radius: radius }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def bbpAdd(first_point, second_point)\n\n cxp(first_point.x + second_point.x, first_point.y + second_point.y)\n end",
"def add_line(point1, point2)\n end",
"def + (point)\n self.class.new(x + point.x, y + point.y)\n end",
"def + point\n\t\tPoint.new(@x+point.x, @y+point.y)\n\tend",
"def create\n @course_point = CoursePoint.new(params[:course_point])\n\n respond_to do |format|\n if @course_point.save\n format.html { redirect_to @course_point, notice: 'Course point was successfully created.' }\n format.json { render json: @course_point, status: :created, location: @course_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end",
"def +(other_point)\n Point.new(self.x + other_point.x, self.y + other_point.y)\n end",
"def + (point)\n return Point2D.new(@x + point.x, @y + point.y)\n end",
"def add_point(point)\n return if point.x < 1 || point.y < 1 || point.x > @max_x-1 || point.y > @max_y-1\n if @glade['toolbar_move'].active?\n if @first_point \n @start = point\n @first_point = false\n @points = [@start]\n print\n else\n @finish = point\n @points = []\n move\n end\n elsif @glade['toolbar_record_points'].active?\n if @x_coords[point.x]\n @glade['statusbar'].push(@context, \"Este programa não suporta 2 ou mais pontos com mesma X-coordenada!\")\n else\n @points << point\n @x_coords[point.x] = point\n end\n print\n end\n end",
"def add(coordinate)\n new_x = @x + coordinate.x\n new_y = @y + coordinate.y\n new_coordinate = Coordinate.new(new_x,new_y)\n end",
"def curve(cp1x, cp1y, cp2x, cp2y, x1, y1, x2, y2)\n beginpath(x1, y1)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x2, y2)\n endpath\n end",
"def create\n @cpt = Cpt.new(cpt_params)\n\n respond_to do |format|\n if @cpt.save\n format.html { redirect_to @cpt, notice: 'Cpt was successfully created.' }\n format.json { render :show, status: :created, location: @cpt }\n else\n format.html { render :new }\n format.json { render json: @cpt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw_point(x, y, mul, col)\n Line.new(\n x1: CENTER_X + x * mul, y1: CENTER_Y - y * mul,\n x2: CENTER_X + 1 + x * mul, y2: CENTER_Y + 2 - y * mul,\n width: 1,\n color: col,\n z: 20\n )\n end",
"def add(point, index, attrib, metadata = nil)\n item = node_class.new(point, attrib, @insert_point, metadata)\n @lookup[index] = item\n @items[@insert_point] = item\n heapify(@insert_point)\n @insert_point += 1\n end",
"def create\n @collection_point = CollectionPoint.new(params[:collection_point])\n\n respond_to do |format|\n if @collection_point.save\n @collection_point.delay.create_collection_point_tag_on_contacts\n format.html { redirect_to @collection_point, notice: 'Collection point was successfully created.' }\n format.json { render json: @collection_point, status: :created, location: @collection_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def +(other)\n raise TypeError, \"Addition between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n Point.new(self.x + other.x, self.y + other.y)\n end",
"def initialize(point_xy = [0, 0])\n @point_xy = { x: point_xy[0].to_i, y: point_xy[1].to_i }\n chxyattr\n end",
"def add_point\n @point = Point.new\n @point.user_id = self.find_id\n @point.save\n end",
"def addTerm(coeff, constr); end",
"def create\n @base_point = BasePoint.new(base_point_params)\n if @base_point.save\n flash[:success] = \"拠点登録完了しました\"\n else\n flash[:danger] = \"拠点登録に失敗しました\"\n end\n redirect_to base_points_path\n end",
"def add_connection(source, target, source_point, target_point, s_type, t_type, name, definition)\n\n line = Line2D::Double.new source_point, target_point\n\n source_intersecting_line = get_intersecting_line source, line\n target_intersecting_line = get_intersecting_line target, line\n\n source_intersecting_point = get_intersection_point line.get_p1,\n line.get_p2,\n source_intersecting_line.get_p1,\n source_intersecting_line.get_p2\n\n\n target_intersecting_point = get_intersection_point line.get_p1,\n line.get_p2,\n target_intersecting_line.get_p1,\n target_intersecting_line.get_p2\n\n sEP = add_endpoint s_type, source, source_intersecting_point.get_x, source_intersecting_point.get_y\n tEP = add_endpoint t_type, target, target_intersecting_point.get_x, target_intersecting_point.get_y\n\n connection = Connection.new sEP, tEP, name, definition\n\n [sEP,tEP].each {|ep| ep.connection = connection}\n\n label = JLabel.new name\n @panel.add label\n @cm.register_component label\n\n\n label.set_size label.get_preferred_size\n connection.label = label\n connection.reset_label_position\n\n @connections << connection\n connection\n end",
"def cp_c\n end",
"def to_cncPoint\r\n # # # # # # # # # \r\n return conv_polar_to_rectangular(distance, angle)\r\n end",
"def add_to_point point\n vec = as_bearing_vector\n point.destination_point vec.bearing, vec.distance.in_kms\n end",
"def add_to_point! point\n vec = as_bearing_vector\n dest = point.destination_point vec.bearing, vec.distance.in_kms\n point.lat = dest.lat\n point.lng = dest.lng\n point\n end",
"def create\n @cn_curve = CnCurve.new(cn_curve_params)\n\n respond_to do |format|\n if @cn_curve.save\n format.html { redirect_to @cn_curve, notice: 'Cn curve was successfully created.' }\n format.json { render json: @cn_curve, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @cn_curve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_cpl( dcp_reels, content_title, content_kind, rating_list ) \n cpl_uuid = ShellCommands.uuid_gen # FIXME\n @logger.debug(\"add_cpl: cpl_uuid = #{ cpl_uuid }\")\n content_version_id = cpl_uuid + '_' + DateTime.now.to_s,\n @logger.debug(\"add_cpl: content_version_id = #{ content_version_id }\")\n content_version_label = content_version_id\n cpl = CPL_GENERIC.new( cpl_uuid, dcp_reels, @dcp_common_info, content_title, content_kind, content_version_id, content_version_label, rating_list, @dcp_functions)\n if @dcp_common_info.sign\n\tcpl_new = DCSignature::DCSignature.new( cpl.xml, @signature_context.signer_key, @signature_context.certchain_objs )\n\tcpl = cpl_new\n end # if\n @cpls << CPLInfo.new(cpl_uuid, cpl.xml)\n \n # add assets of this dcp and the dcp itsself to the packing list\n dcp_reels.each do |reel| @packing_list << reel.assets_to_a end\n @packing_list << DCPPKLAsset.create_asset( \n\tDCP::cpl_file( @dcpdir, cpl_uuid ),\n\tcpl_uuid, \n\tCinemaslidesCommon::MIMETYPE_XML,\n\tasdcp_digest_string( cpl.xml ), \n\tcpl.xml.length )\n end",
"def addPoints(points) \n\t\t@points += points\n\tend",
"def initialize(point)\n @point = point\n end",
"def point(id, x:0, y:0, **attrs)\n draw_init\n attrs.update(shape:\"point\", pos:\"#{x},#{y}!\")\n node(id, attrs)\n end",
"def create\n @ecopoint = Ecopoint.new(ecopoint_params)\n\n respond_to do |format|\n if @ecopoint.save\n format.html { redirect_to @ecopoint, notice: 'Ecopoint was successfully created.' }\n format.json { render :show, status: :created, location: @ecopoint }\n else\n format.html { render :new }\n format.json { render json: @ecopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert_piece(piece,x,y) \n piece.points.each { |point| \n #puts \"Inserting #{point[0]},#{point[1]} to #{x},#{y}\" \n @pole[x+point[0]][y-point[1]] = piece.name\n }\n end",
"def create_crl_distribution_point(crl_distribution_point, opts = {})\n data, _status_code, _headers = create_crl_distribution_point_with_http_info(crl_distribution_point, opts)\n data\n end",
"def create\n @geopoint = Geopoint.new(params[:geopoint])\n\n respond_to do |format|\n if @geopoint.save\n format.html { redirect_to @geopoint, notice: 'Geopoint was successfully created.' }\n format.json { render json: @geopoint, status: :created, location: @geopoint }\n else\n format.html { render action: \"new\" }\n format.json { render json: @geopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end",
"def add_person\n coord = get_empty_coords()\n x_coord = coord[0]\n y_coord = coord[1]\n\n new_person = Person.new(x_coord, y_coord, @x_size, @y_size)\n @all_persons.push(new_person)\n end",
"def create\n @cadd = Cadd.new(params[:cadd])\n\n respond_to do |format|\n if @cadd.save\n format.html { redirect_to(@cadd, :notice => 'Cadd was successfully created.') }\n format.xml { render :xml => @cadd, :status => :created, :location => @cadd }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cadd.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_connectionPoint! s\n _log { \"add_connectionPoint! #{s.inspect}\" }\n\n if @connectionPoint.find { | x | x.name == s.name }\n raise ArgumentError, \"connectionPoint named #{s.name.inspect} already exists\"\n end\n\n @connectionPoint << s\n s.state = self\n\n # Notify.\n s.connectionPoint_added! self\n\n s\n end",
"def point(x, y)\n primitive 'point ' + sprintf('%g,%g', x, y)\n end",
"def addCoordinate(coordinate:, at:nil)\n if at\n @points.insert(at, coordinate)\n else\n @points << coordinate\n end\n if @map\n if next_active_trackpoint = @map.activeTrack.nextPoint\n if next_active_trackpoint.distanceTo(point: coordinate) < FunkyGPS::ACTIVETRACKMINIMALDISTANCETOPOINT\n next_active_trackpoint.passed = true\n end\n end\n end\n end",
"def add_person_coordinate(x_coord, y_coord)\n new_person = Person.new(x_coord, y_coord, @x_size, @y_size)\n @all_persons.push(new_person)\n end",
"def add_connectionPoint! s\n _log { \"add_connectionPoint! #{s.inspect}\" }\n\n if @connectionPoint.find { | x | x.name == s.name }\n raise ArgumentError, \"connectionPoint named #{s.name.inspect} already exists\"\n end\n\n @ownedMember << s # ownedElement?!?!\n @connectionPoint << s\n s.state = self\n\n # Notify.\n s.connectionPoint_added! self\n\n s\n end",
"def cpline_to(x, y, w = nil)\n return line_to(x, y) unless w\n command = absolute? ? 'C' : 'c'\n args = [@last.x + w, @last.y, x - w, y, x, y]\n @path_builder << \"#{command}#{to_path(args)}\"\n @last.x = (absolute? ? 0 : @last.x) + x\n @last.y = (absolute? ? 0 : @last.y) + y\n @last.bx = x - w\n @last.by = y\n end",
"def point( *args ) @g.class.new( *args ); end",
"def initialize(c1 = Point.new, c2 = Point.new)\n\t@c1 = c1\n\t@c2 = c2\n end",
"def addCuratorPoints _obj, _args\n \"_obj addCuratorPoints _args;\" \n end",
"def set_cp\n @cp = Cp.find(params[:id])\n end",
"def add_travel_node_proposal(type, address, lat, lng, travel_node)\n self.send(\"#{type.to_s}_travel_nodes\").create(\n address: address,\n title: travel_node.title,\n weight: travel_node.weight,\n tag: travel_node.tag,\n lat: lat,\n lng: lng,\n has_normalized: 1,\n event_title: travel_node.event_title,\n event_start_time: travel_node.event_start_time,\n event_end_time: travel_node.event_end_time,\n event_location: travel_node.event_location,\n event_google_id: travel_node.event_google_id\n )\n end",
"def create\n @cordinate = Cordinate.new(cordinate_params)\n\n respond_to do |format|\n if @cordinate.save\n format.html { redirect_to @cordinate, notice: 'Cordinate was successfully created.' }\n format.json { render :show, status: :created, location: @cordinate }\n else\n format.html { render :new }\n format.json { render json: @cordinate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_quadraticpath(controlPoint1: { :x => 0.0, :y => 0.0 }, \n endPoint: { :x => 10.0, :y => 20.0 })\n pathElement = { :elementtype => \"pathquadraticcurve\",\n :controlpoint1 => controlPoint1,\n :endpoint => endPoint }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def add_point(user_id, unit_point, point_type)\n # create/find user_point\n user_point = UserPoint.new\n if UserPoint.find_by_user_id(user_id) == nil\n user_point.user_id = user_id\n user_point.save\n else\n user_point = UserPoint.find_by_user_id(user_id)\n end\n\n # increase point\n if point_type == 'event'\n new_point = unit_point + user_point.point_event\n user_point.update_attribute(:point_event, new_point)\n elsif point_type == 'fun'\n new_point = unit_point + user_point.point_fun\n user_point.update_attribute(:point_fun, new_point)\n elsif point_type == 'music'\n new_point = unit_point + user_point.point_music\n user_point.update_attribute(:point_music, new_point)\n elsif point_type == 'video'\n new_point = unit_point + user_point.point_video\n user_point.update_attribute(:point_video, new_point)\n elsif point_type == 'steps'\n new_point = unit_point + user_point.point_step\n user_point.update_attribute(:point_step, new_point)\n end\n end",
"def create\n @cat_poly = CatPoly.new(cat_poly_params)\n\n respond_to do |format|\n if @cat_poly.save\n format.html { redirect_to @cat_poly, notice: 'Cat poly was successfully created.' }\n format.json { render :show, status: :created, location: @cat_poly }\n else\n format.html { render :new }\n format.json { render json: @cat_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_point(point)\n # again, as with add_bbox(), we do not know whether to add the point\n # \"to the left\" or \"to the right\". So we do it three times:\n # as is, 360 to the left, 360 to the right, and choose the one\n # which minimizes the new side length\n @north = [@north, point[\"lat\"].to_f].max\n @south = [@south, point[\"lat\"].to_f].min\n lng = point[\"lng\"].to_f\n @east, @west = optimize_east_west_add(lng, lng)\n normalize\n end",
"def add_line(x, y, label=\"data #{@dataxy.length + 1}\")\n @dataxy << [label, x, y]\n end",
"def create\n # set the user_id in the params, so when the comment is created, the user it's already created\n params[:point_of_interest_comment][:user_id] = current_user.id\n @point_of_interest_comment = @point_of_interest.point_of_interest_comments.create(params[:point_of_interest_comment])\n\n respond_to do |format|\n if @point_of_interest_comment.save\n format.html { redirect_to(points_of_interest_point_of_interest_comments_path(@point_of_interest), :notice => 'Point of interest comment was successfully created.') }\n format.xml { render :xml => @point_of_interest_comment, :status => :created, :location => @point_of_interest_comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point_of_interest_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_a_c\n end",
"def initialize(points, colour) #position, points, colour)\n super(colour) #position, colour)\n @points = points\n #puts \"PointsPart\"\n #@points.each { |p| puts \"(#{p.x}, #{p.y})\" }\n end",
"def pcc(*args)\n return\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point added') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add( *pos )\n off = Pos.set( *pos )\n @x.add( off.xref )\n @y.add( off.yref )\n self\n end",
"def create\n @point = Point.new(point_params)\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to @point, notice: 'Point was successfully created.' }\n format.json { render :show, status: :created, location: @point }\n else\n format.html { render :new }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_interest_point = ProjectInterestPoint.new(project_interest_point_params)\n\n respond_to do |format|\n if @project_interest_point.save\n format.html { redirect_to @project_interest_point, notice: 'Project interest point was successfully created.' }\n format.json { render :show, status: :created, location: @project_interest_point }\n else\n format.html { render :new }\n format.json { render json: @project_interest_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def to_point\n CGPoint.new(first, second)\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to([@layer, @point], :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new( point, opts )\n @point = point\n @options = opts\n self\n end",
"def point3c(point3c=nil,point3=self)\n (point3c ||= Point3c.new).set(point3.c_radius,point3.theta,point3.z)\n end",
"def add_ordinance(options)\n self.ordinances ||= []\n ordinance = OrdinanceAssertion.new\n ordinance.add_value(options)\n self.ordinances << ordinance\n end",
"def create\n @coutline = Coutline.new(coutline_params)\n\n respond_to do |format|\n if @coutline.save\n format.html { redirect_to @coutline, notice: 'Coutline was successfully created.' }\n format.json { render :show, status: :created, location: @coutline }\n else\n format.html { render :new }\n format.json { render json: @coutline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @business_geopoint = BusinessGeopoint.new(business_geopoint_params)\n\n respond_to do |format|\n if @business_geopoint.save\n format.html { redirect_to @business_geopoint, notice: 'Business geopoint was successfully created.' }\n format.json { render action: 'show', status: :created, location: @business_geopoint }\n else\n format.html { render action: 'new' }\n format.json { render json: @business_geopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def press(point)\n\t\t# mark the initial point for reference\n\t\t@origin = point\n\t\t@start = @entity[:physics].body.p.clone\n\tend",
"def create_point(lng, lat)\n Rails.logger.debug \"RgeoGeometryAdapter Creating point geometry from lng = #{lng}, lat = #{lat}\"\n @geometry_factory.point(lng, lat)\n end",
"def create\n @cp_press = CpPress.new(params[:cp_press])\n\n respond_to do |format|\n if @cp_press.save\n format.html { redirect_to @cp_press, notice: 'Cp press was successfully created.' }\n format.json { render json: @cp_press, status: :created, location: @cp_press }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cp_press.errors, status: :unprocessable_entity }\n end\n end\n end",
"def +(other)\n case other\n when Point\n Point.new(x + other.x, y + other.y)\n when Numeric\n Point.new(x + other, y + other)\n when Array\n self + Geom2D::Point(other)\n else\n raise ArgumentError, \"Invalid argument class, must be Numeric or Point\"\n end\n end",
"def create_constraint\n\t\ttravel_mean = params[:constraint][:travel_mean]\n\t\tsubject = Subject.find(params[:constraint][:subject].to_i)\n\t\toperator = Operator.find_by(description: params[:constraint][:operator], subject_id: subject.id)\n\t\tvalue = Value.find_by(value: params[:constraint][:value], subject_id: subject.id)\n\t\tc = Constraint.new({travel_mean: travel_mean, subject: subject, operator: operator, value: value, user: current_user})\n\t\tif c.save\n\t\t\tredirect_to settings_page_path\n\t\telse\n\t\t\trender 'add_constraint'\n\t\tend\n\tend",
"def add_curve(*args)\n end",
"def initialize(point, value)\n @point = point.clone\n @value = value\n end",
"def start_point\n raise Error::UnsupportedOperation, \"Method Curve#start_point not defined.\"\n end",
"def create\n @cpd_event = CpdEvent.new(cpd_event_params)\n\n respond_to do |format|\n if @cpd_event.save\n format.html { redirect_to @cpd_event, notice: 'Cpd event was successfully created.' }\n format.json { render :show, status: :created, location: @cpd_event }\n else\n format.html { render :new }\n format.json { render json: @cpd_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cultural_heritage_culture_point = CulturalHeritage::CulturePoint.new(params[:cultural_heritage_culture_point])\n\n respond_to do |format|\n if @cultural_heritage_culture_point.save\n format.html { redirect_to(@cultural_heritage_culture_point, :notice => 'Culture point was successfully created.') }\n format.xml { render :xml => @cultural_heritage_culture_point, :status => :created, :location => @cultural_heritage_culture_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cultural_heritage_culture_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_cop(cop)\n department = find_department(cop)\n\n return if department && @cops.include?(department)\n return if @cops.include?(cop)\n\n @cops << cop\n @new_cop_added = true\n end",
"def insertVertice(node, distance, predecessor)\n\t\t@graph << @vertice.new(node, distance, predecessor)\n\tend",
"def create\n @deadlift_data_point = DeadliftDataPoint.new(params[:deadlift_data_point])\n\n respond_to do |format|\n if @deadlift_data_point.save\n format.html { redirect_to @deadlift_data_point, notice: 'Deadlift data point was successfully created.' }\n format.json { render json: @deadlift_data_point, status: :created, location: @deadlift_data_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deadlift_data_point.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.620884",
"0.6018313",
"0.5898276",
"0.5827222",
"0.5796931",
"0.5739868",
"0.5739868",
"0.55395424",
"0.5524788",
"0.5494856",
"0.546308",
"0.5453075",
"0.5438829",
"0.54255205",
"0.5365418",
"0.53540194",
"0.5337275",
"0.5303954",
"0.52858835",
"0.52385014",
"0.52236414",
"0.5222025",
"0.5213779",
"0.5213672",
"0.5213198",
"0.5191839",
"0.5179698",
"0.5172596",
"0.5135061",
"0.5052578",
"0.50371736",
"0.50055295",
"0.49826205",
"0.49684882",
"0.4958341",
"0.4934196",
"0.4930656",
"0.49238873",
"0.48757094",
"0.486325",
"0.48623613",
"0.48619547",
"0.48566693",
"0.4850134",
"0.48319936",
"0.48204896",
"0.48153996",
"0.48107865",
"0.480748",
"0.48013875",
"0.47979861",
"0.47936922",
"0.47936186",
"0.47934425",
"0.47927418",
"0.4791087",
"0.47786307",
"0.47717288",
"0.4743567",
"0.47408918",
"0.47377262",
"0.47297364",
"0.472682",
"0.46994516",
"0.4691043",
"0.46809325",
"0.46734837",
"0.46656314",
"0.46516493",
"0.46310717",
"0.461635",
"0.46118522",
"0.4610245",
"0.46069565",
"0.46064696",
"0.46026736",
"0.45989776",
"0.4597904",
"0.4593791",
"0.45935896",
"0.45795998",
"0.4575164",
"0.4570016",
"0.4562486",
"0.455695",
"0.45518968",
"0.4546566",
"0.4545981",
"0.45411867",
"0.45362064",
"0.4534052",
"0.45268714",
"0.45226628",
"0.45206228",
"0.45163545",
"0.45108968",
"0.45104837",
"0.45071468",
"0.45054325",
"0.45017132"
] | 0.8374009 | 0 |
The add_curve method is used to create a curve from a collection of edges. The arguments are either Points or an Array of Points. At least 2 points are required. | def add_curve(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_bezierpath_withcp1_cp2_endpoint(controlPoint1: { :x => 0.0,\n :y => 0.0 }, \n controlPoint2: { :x => 9.0,\n :y => 9.0 }, \n endPoint: { :x => 10.0,\n :y => 20.0 })\n pathElement = { :elementtype => \"pathbeziercurve\",\n :controlpoint1 => controlPoint1,\n :controlpoint2 => controlPoint2,\n :endpoint => endPoint }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def define_curve_adder(num_curves)\n params = Array.new(num_curves) { |i| \"c#{i}\" }\n param_list = params.join(', ')\n name = :\"add_curves_#{num_curves}\"\n\n # rubocop:disable Style/DocumentDynamicEvalDefinition\n instance_eval(<<-RUBY, __FILE__, __LINE__ + 1)\n def #{name}(#{param_list})\n length = curves_length(#{param_list})\n\n ::Merit::Curve.new(Array.new(length) do |index|\n #{params.map { |p| \"(#{p}[index] || 0.0)\" }.join(' + ')}\n end)\n end\n\n private_class_method name\n RUBY\n # rubocop:enable Style/DocumentDynamicEvalDefinition\n\n name\n end",
"def add_quadraticpath(controlPoint1: { :x => 0.0, :y => 0.0 }, \n endPoint: { :x => 10.0, :y => 20.0 })\n pathElement = { :elementtype => \"pathquadraticcurve\",\n :controlpoint1 => controlPoint1,\n :endpoint => endPoint }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def add_edge(*e)\n raise InvalidArgumentError if e.size > 2\n \n e = [e] if e.size == 2\n @edges.add(e[0])\n end",
"def add_edge(*edge_details)\r\n if (edge_details.length <3)||(edge_details.length>4)\r\n raise \"Error: Incorrect number of arguments in add_edge\"\r\n end # end if length\r\n @edges.push edge_details\r\n end",
"def add_many(curves)\n while curves.length > 1\n curves = curves\n .each_slice(partition_size(curves))\n .map { |partition| add_curves(partition) }\n end\n\n curves.first\n end",
"def curve_points(points)\n cur_page.curve_points(points)\n end",
"def add_edges(*args)\n edges = []\n len = args.length\n (len-1).times {|i| \n edge = Edge.new(args[i], args[i+1])\n edges.push(edge)\n }\n @list.concat(edges)\n return(edges)\n end",
"def add_edges(*args)\n edges = []\n len = args.length\n (len-1).times {|i| \n edge = Edge.new(args[i], args[i+1])\n edges.push(edge)\n }\n @list.concat(edges)\n return(edges)\n end",
"def add_line(point1, point2)\n end",
"def curve(cp1x, cp1y, cp2x, cp2y, x1, y1, x2, y2)\n beginpath(x1, y1)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x2, y2)\n endpath\n end",
"def open_curve(vertices)\n return if vertices.empty?\n vertices = vertices.dup\n origin = vertices.shift\n move_to(origin[:point])\n previous_handle2 = origin[:handle2]\n vertices.each do |vertex|\n curve_to(vertex[:point],\n :bounds => [previous_handle2 || vertex[:point],\n vertex[:handle1] || vertex[:point]])\n previous_handle2 = vertex[:handle2]\n end\n end",
"def CreateCurveElement1(arg0, arg1)\n ret = _invoke(1610743978, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_ARRAY | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def add_edge(x, y, cost: 1)\n raise\n end",
"def closed_curve(vertices)\n return if vertices.empty?\n vertices = vertices.dup\n origin = vertices.shift\n move_to(origin[:point])\n previous_handle2 = origin[:handle2]\n vertices.each do |vertex|\n curve_to(vertex[:point],\n :bounds => [previous_handle2 || vertex[:point],\n vertex[:handle1] || vertex[:point]])\n previous_handle2 = vertex[:handle2]\n end\n curve_to(origin[:point],\n :bounds => [previous_handle2 || origin[:point],\n origin[:handle1] || origin[:point]])\n end",
"def curve(x1, y1, x2, y2, x3, y3)\n [x1.value, y1.value, x2.value, y2.value, x3.value, y3.value]\n end",
"def test_is_polygon_with_curve\n m = Sketchup.active_model\n ents = m.entities\n\n # Create a curve\n pts = []\n pts.push [1, 4, 0]\n pts.push [3, 3, 0]\n pts.push [2, 3, 0]\n pts.push [0, 4, 0]\n pts.push [3, 2, 0]\n pts.push [3, -2, 0]\n pts.push [3, -3, 0]\n pts.push [2, -4, 0]\n pts.push [1, -4, 0]\n ents.add_curve pts\n\n # Check curve edges\n m.entities.each do |e|\n if e.is_a? Sketchup::Edge and e.curve.respond_to? 'is_polygon?'\n assert_equal(false, e.curve.is_polygon?,\n 'Curve of curve edge should not be polygon.')\n end\n end\n end",
"def CreateBsplineCurveElement2(arg0, arg1)\n ret = _invoke(1610744122, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def quadratic_curve(x1, y1, x2, y2)\n [x1.value, y1.value, x2.value, y2.value]\n end",
"def bezier_curve(points, stroke_color = ChunkyPNG::Color::BLACK)\n points = ChunkyPNG::Vector(*points)\n case points.length\n when 0, 1 then return self\n when 2 then return line(points[0].x, points[0].y, points[1].x, points[1].y, stroke_color)\n end\n\n curve_points = []\n\n t = 0\n n = points.length - 1\n\n while t <= 100\n bicof = 0\n cur_p = ChunkyPNG::Point.new(0, 0)\n\n # Generate a float of t.\n t_f = t / 100.00\n\n cur_p.x += ((1 - t_f)**n) * points[0].x\n cur_p.y += ((1 - t_f)**n) * points[0].y\n\n for i in 1...points.length - 1\n bicof = binomial_coefficient(n, i)\n\n cur_p.x += (bicof * (1 - t_f)**(n - i)) * (t_f**i) * points[i].x\n cur_p.y += (bicof * (1 - t_f)**(n - i)) * (t_f**i) * points[i].y\n i += 1\n end\n\n cur_p.x += (t_f**n) * points[n].x\n cur_p.y += (t_f**n) * points[n].y\n\n curve_points << cur_p\n\n t += 1\n end\n\n curve_points.each_cons(2) do |p1, p2|\n line_xiaolin_wu(p1.x.round, p1.y.round, p2.x.round, p2.y.round, stroke_color)\n end\n\n self\n end",
"def curve(curve_name)\n self.curves[curve_name]\n end",
"def curve(x0, y0, x1, y1, x2, y2, x3, y3)\n cur_page.curve(x0, y0, x1, y1, x2, y2, x3, y3)\n end",
"def CreateBsplineCurveElement1(arg0, arg1)\n ret = _invoke(1610744121, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def polygon *points, color\n points << points.first\n points.each_cons(2) do |p1, p2|\n w.line(*p1, *p2, color)\n end\n end",
"def add_edge(id1, id2)\n # YOUR WORK HERE\n end",
"def add_edge(from, to, cost)\n @edges << Edge.new(from, to, cost)\n end",
"def new_edge(*args)\n add_edge(build_edge(*args))\n end",
"def curve(base)\n if base.respond_to?(:to_curve) && base.length == Fever::FRAMES\n return base.to_curve\n end\n\n case base\n when Numeric then curve_from_numeric(base)\n when Enumerable then curve_from_enum(base)\n else raise(ArgumentError, \"cannot create a curve from #{ base.inspect }\")\n end\n end",
"def create\n @curve = Curve.new(params[:curve])\n\n respond_to do |format|\n if @curve.save\n format.html { redirect_to @curve, notice: 'Curve was successfully created.' }\n format.json { render json: @curve, status: :created, location: @curve }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(*args)\n\t args.map! {|a| (a.is_a?(Array) || a.is_a?(Vector)) ? Point[a] : a}\n\t raise(ArgumentError,'Unknown argument type') unless args.all? {|a| a.is_a?(Point) || a.is_a?(Edge) }\n\n\t @edges = [];\n\t @vertices = [];\n\n\t first = args.shift\n\t if first.is_a?(Point)\n\t\[email protected] first\n\t elsif first.is_a?(Edge)\n\t\[email protected] first\n\t\[email protected] *(first.to_a)\n\t end\n\n\t args.reduce(@vertices.last) do |previous,n|\n\t\tif n.is_a?(Point)\n\t\t push_edge Edge.new(previous, n)\n\t\t push_vertex n\n\t\t n\n\t\telsif n.is_a?(Edge)\n\t\t if previous == n.first\n\t\t\tpush_edge n\n\t\t\tpush_vertex n.last\n\t\t elsif previous == n.last\n\t\t\tpush_edge n.reverse!\n\t\t\tpush_vertex n.last\n\t\t else\n\t\t\te = Edge.new(previous, n.first)\n\t\t\tpush_edge e, n\n\t\t\tpush_vertex *(e.to_a), *(n.to_a)\n\t\t end\n\t\t n.last\n\t\tend\n\t end\n\n\t # Close the polygon if needed\n\t @edges.push Edge.new(@edges.last.last, @edges.first.first) unless @edges.empty? || (@edges.last.last == @edges.first.first)\n\tend",
"def connect_endpoint(collection, edge)\n if collection.any? { |o| ! edge.equal?(o) && edge.similar?(o) }\n raise DuplicateEdgeError.new(self, edge)\n end\n\n collection.add(edge)\n end",
"def load_curves\n LoadCurvePresenter.present(self).transpose\n end",
"def initialize(*points_or_lines)\n @points = []\n points_or_lines.each { |pol| self << pol }\n end",
"def curve\n end",
"def curve\n end",
"def add_edge(source, dest, weight)\n edges << Edge.new(source, dest, weight)\n end",
"def add_points *args\n last = self.points.length\n args.each do |arg|\n case arg\n when Point then\n self.points << arg\n when TrackSegment then\n self.points += arg.points\n when Array then\n arg.each { |a| add_points a }\n else\n raise Ubiquity::Error::BadArgument, \"args should be a list of Points, TrackSegments or Arrays of any of them\"\n end\n end\n clean_memoized # ensures future recalculations\n self\n rescue\n self.points.slice!(last..-1) # in case of error eliminates added elements if any\n nil\n end",
"def add_lineto(endPoint)\n pathElement = { :elementtype => \"pathlineto\", :endpoint => endPoint }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def consumption_curve\n consumption = @adapters\n .select { |a| a.config.type == :consumer && a.config.subtype != :pseudo }\n .map { |c| c.participant.load_curve }\n\n Merit::CurveTools.add_curves(consumption) || EMPTY_CURVE\n end",
"def entities_of_curve?(*entities)\n if entities.first.is_a?(Sketchup::Edge) # First is an edge...\n curve = entities.first.curve\n if curve && (# ...and has part of a curve...\n entities.length == 1 ||\n entities.all? {|e| e.is_a?(Sketchup::Edge) && e.curve == curve}) # ...and all the others too.\n return true\n end\n end\n return false\n end",
"def add_edge(e)\n @edges[e.from] << e\n end",
"def add_edge(edge)\n @edges.push(edge)\n end",
"def <<(*things)\n if things.size == 1\n thing = things.first\n if thing.is_a?(Point)\n @points << thing\n elsif thing.is_a?(Line)\n @points << thing.p1\n @points << thing.p2\n elsif thing.is_a?(Array)\n if thing.size == 2 && thing.all? { |e| e.numeric? }\n @points << Point.new(thing)\n else\n thing.each { |e| self << e }\n end\n else\n raise 'arguments must be Points or Lines'\n end\n else\n self << things\n end\n end",
"def initialize(curve)\n @curve = curve\n @errors = []\n @error_keys = []\n end",
"def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end",
"def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end",
"def inject_curve!(direction = nil, full_name: nil)\n if direction.nil? && full_name.nil?\n raise 'No curve name given to inject_curve!'\n end\n\n name = full_name || :\"heat_#{direction}_curve\"\n\n @node.dataset_lazy_set(name.to_sym) do\n @context.curves.derotate(yield.to_a)\n end\n end",
"def inject_curve!(direction = nil, full_name: nil)\n if direction.nil? && full_name.nil?\n raise 'No curve name given to inject_curve!'\n end\n\n name = full_name || @context.curve_name(direction)\n\n target_api.dataset_lazy_set(name) do\n @context.curves.derotate(yield.to_a)\n end\n end",
"def test_add_edge\n assert_equal(\"e1\", @e[0][:name])\n assert_equal(\"v1\", @e[1][:name])\n assert_equal(\"v2\", @e[2][:name])\n assert_equal(1, @e[0][:id])\n assert_equal(1, @g.e_id)\n assert_equal(1, @g.size)\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", {:name=>\"v2\"}) }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, {:name=>\"v1\"}, \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", {:name=>\"v1\"}, \"v2\") }\n end",
"def price_curve\n load_curve('price.csv')\n end",
"def edges\n temp = []\n @strokes.each do |stroke|\n position = stroke.position\n colour = stroke.colour\n case stroke\n when CircleStroke\n radius = stroke.radius\n part = CirclePart.new(position, radius, colour)\n when LineStroke\n points = stroke.points.map { |p| p + position }\n part = PointsPart.new(points, colour)\n end\n temp << part\n end\n temp\n end",
"def line(points, colour)\n\tpoints.each do |point|\n\t paint(point[0], point[1], colour)\n\tend\n end",
"def explode_curve\n end",
"def explode_curve\n end",
"def add_triangle(points: nil)\n fail \"Needs an array of 3 points\" if points.nil?\n fail \"Needs an array of 3 points\" unless points.length.eql? 3\n \n self.add_moveto(points[0])\n self.add_lineto(points[1])\n self.add_lineto(points[2])\n self.add_lineto(points[0])\n self.add_closesubpath()\n end",
"def bezier_curve(params = {})\n params[:name] ||= @pictureName.gsub('.png', 'Bezier.png')\n params[:save] ||= @picturePath\n \n display_picture\n \n points = parse_points\n \n if points.nil? \n puts \"Unable to draw: no control points generated.\"\n return false\n else\n bez = dup\n bez.picture = bez.picture.bezier_curve(points)\n bez.pictureName, bez.picturePath = params[:name], params[:save]\n return bez\n end\n end",
"def demand_curve\n @demand_curve ||= CurveTools.add_curves(\n participants.users.reject(&:provides_price?).map(&:load_curve)\n )\n end",
"def new_edge(label,points)\n\t\ttmp=MyEdge.new\n\t\ttmp.label=label\n\t\t\n\t\t# Points should be two strings, not the Vertex objects themselves\n\t\ttmp.points=points\n\t\treturn tmp\n\tend",
"def lines(points)\n CGContextAddLines(@ctx, points, points.size)\n CGContextDrawPath(@ctx, KCGPathStroke) # apply stroke\n endpath\n end",
"def edges\n inputs + outputs\n end",
"def addPoints(points) \n\t\t@points += points\n\tend",
"def curve_from_enum(enum)\n length = enum.length\n\n if length == FRAMES\n return enum.respond_to?(:to_curve) ? enum.to_curve : enum.to_a.dup\n end\n\n if length > FRAMES\n raise(\n ArgumentError,\n \"Input curve has too many items (#{ enum.length }), \" \\\n \"must not exceed #{ Fever::FRAMES }\"\n )\n end\n\n enum.to_a + Array.new(FRAMES - enum.length, 0.0)\n end",
"def create_handler(curve_name, io)\n CurveHandler::AttachService.new(\n config_for(curve_name),\n io,\n scenario,\n metadata_parameters\n )\n end",
"def initialize(curve_expression)\n raise InvalidCurveError, \"A curve expression should have :c as it's first symbol\" unless curve_expression[0] == :c\n raise InvalidCurveError, \"Curve expression contained no values\" unless curve_expression[2]\n \n # Nuke7 sometimes produces curves where the command is a string literal \n # within quotes, and it contains a trailing space\n cmd = curve_expression[1].to_s.strip\n raise InvalidCurveError, \"Curve expression should start with a 'curve' command\" unless cmd =~ /^curve/\n \n # Compute the curve increment or decrement. It looks like a modifier:\n # \"curve+5\" means we have to add 5 to every value on the curve\n xformer = lambda { |v| v} # Identity\n if cmd =~ /^(curve)([+-])([\\d\\.]+)$/\n operator = $2[0..1] # Ensure only one character gets through\n modifier = $3.to_f\n xformer = lambda{|v| v.send(operator, modifier) }\n end\n \n expand_curve(curve_expression, &xformer)\n end",
"def bezier(*points)\n if points.length.zero?\n Kernel.raise ArgumentError, 'no points specified'\n elsif points.length.odd?\n Kernel.raise ArgumentError, 'odd number of arguments specified'\n end\n primitive 'bezier ' + points.map! { |x| sprintf('%g', x) }.join(',')\n end",
"def price_curve\n @price_curve ||= PriceCurve.new(self, fallback_price)\n end",
"def connect(vertex1, vertex2, edge_attributes = {})\n self.vertices << vertex1 unless self.vertices.include? vertex1\n self.vertices << vertex2 unless self.vertices.include? vertex2\n edge = Edge.new(edge_attributes)\n self.edges << edge\n edge << vertex1 << vertex2\n end",
"def polyline points, options, &block\n \n # build a line\n line = Line.new options[:name]\n \n # build up a points float buffer\n pbuf = BufferUtils.createVector3Buffer(points.length / 2)\n puts \"arrived\"\n c = 0\n points.each do |v|\n pbuf.put v\n c += 1\n pbuf.put 0 if c % 2 == 0\n end\n \n # set the width\n if options.has_key? :line_width\n line.set_line_width(options[:line_width])\n end\n \n # set up the colors\n if options.has_key? :colors\n line.set_color_buffer(BufferUtils.create_float_buffer(options[:colors].to_java ColorRGBA))\n elsif options.has_key? :color\n line.set_default_color(options[:color])\n end\n \n #textures\n if options.has_key? :texture_points\n buffer = BufferUtils.createVector2Buffer options[:texture_points].length\n buffer.put options[:texture_points]\n line.set_texture_coords(TexCoords.new(buffer))\n end\n \n # index buffer\n ibuf = BufferUtils.createIntBuffer((0..(points.length / 2) - 1).to_a.to_java :int)\n \n # finish building the quad\n line.reconstruct(pbuf, nil, line.get_color_buffer, line.get_texture_coords[0])\n line.set_index_buffer ibuf\n \n # block invoke\n line.instance_eval(&block) if block\n \n line\n end",
"def add_edge(u, v)\n raise NotImplementedError\n end",
"def production_curve\n production = @adapters\n .select { |a| a.config.type == :producer && PRODUCTION_TYPES.include?(a.config.subtype) }\n .map { |c| c.participant.load_curve }\n\n (Merit::CurveTools.add_curves(production) || EMPTY_CURVE).map(&:-@)\n end",
"def add_edge(start_vertex_name, end_vertex_name)\n\n # Check if graph is not empty\n if (@vertices.length == 0)\n raise GraphError.new('No edges can be added to an empty graph', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n first_vertex_index = find_index_for_vertex(start_vertex_name)\n second_vertex_index = find_index_for_vertex(end_vertex_name)\n\n if (first_vertex_index == nil)\n raise GraphError.new('Edge cannot be added. First vertex could not be found', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n if (second_vertex_index == nil)\n raise GraphError.new('Edge cannot be added. Second vertex could not be found', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n add_edge_by_indexes(first_vertex_index,second_vertex_index)\n end",
"def safe_add_edge(x, y, type)\n catch(:add_edge_throw) do \n add_edge(x, y, type)\n end\n end",
"def load_curve\n curve = Curve.new([], Merit::POINTS)\n\n Merit::POINTS.times do |point|\n if cheaper_locally?(point)\n curve.set(point, [\n available_capacity(point),\n foreign_demand(point),\n @capacity.get(point)\n ].min)\n else\n curve.set(point, 0.0)\n end\n end\n\n curve\n end",
"def call(curve)\n if @reducer.arity == 2\n @reducer.call(curve, default_curve)\n else\n @reducer.call(curve)\n end\n end",
"def add_directed_edge(id1,id2)\n @g[id1] ||= Array.new\n @g[id1] << id2\n end",
"def add_edge(source, destiny, weigth)\n source, destiny, weigth = convert_values(source, destiny, weigth)\n\n add_vertex(source)\n add_vertex(destiny)\n\n make_edge(source, destiny, weigth)\n end",
"def qcurve(cpx, cpy, x1, y1, x2, y2)\n beginpath(x1, y1)\n CGContextAddQuadCurveToPoint(@ctx, cpx, cpy, x2, y2)\n endpath\n end",
"def process_edges\n # Assume that one point will always be at the origin. The points can always be translated in such a way that this is true,\n # so it's a reasonable simplifying assumption.\n current_vertex_id = find_origin\n next_vertex_id = get_clockwise_neighbor(*get_neighboring_vertices(current_vertex_id))\n current_edge_id = find_edge_by_vertices(current_vertex_id, next_vertex_id)\n\n # Set the current vertex to be the lagging vertex of the current edge we're on.\n current_edge = @edges[current_edge_id]\n\n (@edges.size).times do\n if current_edge.circular\n current_edge.set_radius(@vertices)\n\n # We are advancing clockwise. If a curve is anti-clockwise, then the curve is concave. Intuitively, a concave angle is\n # created when the path 'reverses direction.'\n if current_vertex_id == current_edge.clockwise_vertex_id\n current_edge.concave = false\n current_edge.convex = true\n current_edge.find_farthest_points(@vertices)\n else\n current_edge.concave = true\n current_edge.convex = false\n end\n end\n next_edge_id = get_other_edge(current_vertex_id, current_edge_id)\n next_edge = @edges[next_edge_id]\n\n current_edge_id = next_edge_id\n current_edge = @edges[current_edge_id]\n current_vertex_id = current_edge.get_other_vertex(current_vertex_id)\n end\n end",
"def add_edge(src, dest, weight)\n @v << src if [email protected]?(src)\n @v << dest if [email protected]?(dest)\n new_edge = Edge.new(src,dest, weight)\n src.out_edges << new_edge\n dest.in_edges << new_edge\n @e << new_edge\n end",
"def add_edges(nodes, ary, edge_type)\n ary && ary.each do |a_node, other_node, wt|\n nodes[a_node].\n send(edge_type).\n add(nodes[other_node], wt.to_i)\n end\n\n nodes\n end",
"def curve_names\n self.curves.keys\n end",
"def add(point)\n @controlpoints << case point\n when ControlPoint\n point\n when Array\n ControlPoint.new(*point[0..1])\n else\n raise(TypeError, 'Point should be type of ControlPoint')\n end\n\n\t\t\t# if point.class == ControlPoint\n\t\t\t# \t@controlpoints << point\n # elsif point.class == Array\n # @controlpoints << ControlPoint.new(*point[0..1])\n\t\t\t# else\n\t\t\t# \traise TypeError, 'Point should be type of ControlPoint'\n\t\t\t# end\n\t\tend",
"def points=(arrayOfPoints)\n @elementHash[:points] = arrayOfPoints\n end",
"def add_edge(x, y, type)\n debug_msg \"adding edge #{x}, #{y}, #{type}\"\n if self[x,y]\n unless self[x,y] == type\n @contradiction = true\n debug_msg \" \\tcontradiction\"\n throw :add_edge_throw, :contradiction\n else\n debug_msg \"\\ti know\"\n throw :add_edge_throw, :i_know\n end\n else\n super(x, y, type)\n end\n end",
"def append_edge(edge)\n @meeting_edges << edge\n end",
"def add_quad( *args )\r\n entities = parent\r\n # Array Argument\r\n if args.size == 1 && args.is_a?( Enumerable )\r\n args = args[0]\r\n end\r\n if args.size == 1 && args.is_a?( Sketchup::Curve )\r\n # Curve\r\n curve = args[0]\r\n points = curve.vertices.map { |v| v.position }\r\n if points.size != 4\r\n raise( ArgumentError, 'Too many vertices in curve. Cannot create Quad.' )\r\n end\r\n elsif args.size == 4 && args.all? { |a| a.is_a?( Sketchup::Edge ) }\r\n # Edges\r\n loop = TT::Edges.sort( args )\r\n vertices = TT::Edges.sort_vertices( loop )\r\n points = vertices.map { |v| v.position }\r\n elsif args.size == 4 && args.all? { |a| a.is_a?( Geom::Point3d ) }\r\n # Points\r\n points = args\r\n elsif args.size == 3 && args.all? { |a| a.is_a?( Geom::Point3d ) }\r\n # Triangle\r\n return parent.add_face( args )\r\n else\r\n raise( ArgumentError, 'Invalid arguments. Cannot create Quad.' )\r\n end\r\n # Create triangulated Quad if the quad is not planar.\r\n if TT::Geom3d.planar_points?( points )\r\n face = entities.add_face( points )\r\n QuadFace.new( face )\r\n else\r\n face1 = entities.add_face( points[0], points[1], points[2] )\r\n face2 = entities.add_face( points[0], points[2], points[3] )\r\n edge = ( face1.edges & face2.edges )[0]\r\n QuadFace.set_divider_props( edge )\r\n QuadFace.new( face1 )\r\n end\r\n end",
"def build_edge(*args)\n edge_class.new(*args)\n end",
"def draw_part(pts)\r\n\r\n # Draw holes\r\n for i in 0..(pts.length-1)\r\n draw_circle(pts[i], $normVec, $holeRadius)\r\n end\r\n \r\n # Loop through points\r\n for i in 0..(pts.length-1)\r\n \r\n # Get adjacent points\r\n adjPts = GetAdjacentPts(pts, i)\r\n \r\n # Compute start and end angles\r\n sAngle = angle_between_point_xy([adjPts[0],adjPts[1]])\r\n eAngle = angle_between_point_xy([adjPts[1],adjPts[2]])\r\n \r\n # Make adjustments\r\n sAngle = sAngle - 0.5\r\n eAngle = eAngle - 0.5\r\n if(eAngle < sAngle) \r\n eAngle = eAngle + 2 \r\n end\r\n\r\n # Draw curves\r\n draw_curve(adjPts[1], $normVec, $xaxis, $outerRadius, sAngle * Math::PI, eAngle * Math::PI)\r\n\r\n # Draw lines \r\n draw_line(add_outer_radius(adjPts[0],$outerRadius,sAngle),add_outer_radius(adjPts[1],$outerRadius,sAngle))\r\n \r\n end\r\n \r\nend",
"def add(edge)\n source = edge.source\n if @contained_vertices.include? source\n @vertex_array.at(source).add_edge(edge)\n else\n new_vertex = Vertex.new(source)\n new_vertex.add_edge(edge)\n @contained_vertices.push(source)\n if @vertex_array.size < source\n @vertex_array.insert(source, new_vertex)\n else\n @vertex_array[source] = new_vertex\n end\n end\n end",
"def add_edge(node_city_A, node_city_B, distance)\n @edges[node_city_A] << Edge.new(node_city_B, distance)\n end",
"def self_curve(name, node)\n @self_curves ||= SelfCurves.new(@graph.plugin(:time_resolve), @context)\n @self_curves.curve(name, node)\n end",
"def add_edge(source, target, weight = 1)\r\n\t\tself.push source unless self.include?(source)\r\n\t\tself.push target unless self.include?(target)\r\n\t\[email protected] Edge.new(source, target, weight)\r\n\tend",
"def insert_edge(edges, p1, p2, y_next)\n max_y, dy = 0, 0\n x2, dx, max_x = 0.0, 0.0, 0.0\n\n p2 = p2.dup\n\n dx = (p2.x - p1.x) / (p2.y - p1.y).to_f\n x2 = p2.x\n \n # Sonderfaelle\n if ((p2.y > p1.y) && (p2.y < y_next))\n p2.y -= 1\n x2 = x2 - dx\n end\n if ((p2.y < p1.y) && (p2.y > y_next))\n p2.y += 1\n x2 = x2 + dx\n end\n\n dy = p2.y - p1.y\n \n if (dy>0)\n max_y = p2.y\n max_x = x2.to_f\n dy =+ 1\n else\n max_y = p1.y\n max_x = (p1.x).to_f\n dy = 1 - dy\n end\n \n # Hilfsobjekt\n edge1 = edges.dup\n\n while (edge1.next.y_top >= max_y)\n edge1 = edge1.next\n end\n\n # einfuegen sortiert nach max_y\n newedge = Edge.new(max_y, max_x, dy, dx, edge1.next)\n edge1.next = newedge\n end",
"def ec_from_params(curve, pub_key, priv_key)\n # Old versions of jruby-openssl don't include an EC class (version 0.9.16).\n ec_class = (::OpenSSL::PKey::EC rescue raise ArgumentError, \"Unsupported algorithm: #{ppk.algorithm}\")\n\n ec_class.new(curve).tap do |pkey|\n group = pkey.group || ::OpenSSL::PKey::EC::Group.new(curve)\n pkey.public_key = ::OpenSSL::PKey::EC::Point.new(group, pub_key)\n pkey.private_key = priv_key\n end\n end",
"def add_edge(a,b)\n @adj_list[a][b] = 1\n end",
"def add_edge(x, y) # from x to y\n if @nodes.key?(x) and @nodes.key?(y)\n if @edges.key?(x)\n unless @edges[x].include?(y)\n @edges[x] << y\n end\n end\n if @back_edges.key?(y)\n unless @back_edges[y].include?(x)\n @back_edges[y] << x\n end\n end\n else\n raise RuntimeError.new \"#{x} and #{y} not both present\"\n end\n end",
"def e(*filters, &block)\n raise Pacer::UnsupportedOperation, \"Can't call edges for VerticesRoute.\"\n end",
"def add_edge(x, y)\n\t\traise if @x_connections[x] != -1\n\t\traise if @y_connections[yIdx(y)] != -1\n\t\t\n\t\t@x_connections[x] = y\n\t\t@y_connections[yIdx(y)] = x\n\t\t\n\t\t@unconnected_x_vertices -= 1\n\t\t\n#\t\traise if @x_connected_vertices.member?(xy[0])\n#\t\traise if @y_connected_vertices.member?(xy[1])\n\t\n\tend",
"def add_edge(edge)\n edge.each { |node| add_vertex(node) }\n @structure[edge[0]] << edge[1]\n end",
"def add_edge(source, target, edge = Edge.new)\n _clear_cache\n @pathway.append(Bio::Relation.new(source, target, edge))\n edge\n end"
] | [
"0.59552974",
"0.59411335",
"0.56921977",
"0.5678162",
"0.5596444",
"0.54808456",
"0.547696",
"0.54009044",
"0.54009044",
"0.5387943",
"0.53176993",
"0.5272498",
"0.5225896",
"0.52054524",
"0.516832",
"0.5137809",
"0.51266843",
"0.5114433",
"0.5099677",
"0.50885504",
"0.50857764",
"0.5080379",
"0.50524586",
"0.5039032",
"0.50054705",
"0.497617",
"0.49676704",
"0.49615437",
"0.49007607",
"0.48721012",
"0.48694208",
"0.48685738",
"0.48407406",
"0.48401928",
"0.48401928",
"0.48287597",
"0.48259327",
"0.48144698",
"0.4814127",
"0.48136905",
"0.4798348",
"0.47901532",
"0.47849742",
"0.47788477",
"0.47533393",
"0.47533393",
"0.4751606",
"0.47482666",
"0.4736259",
"0.47285673",
"0.47189716",
"0.46790308",
"0.4656063",
"0.4656063",
"0.4633697",
"0.46321225",
"0.46256614",
"0.45945898",
"0.45845187",
"0.4577678",
"0.457531",
"0.45687684",
"0.45355985",
"0.45068976",
"0.44912937",
"0.4475689",
"0.4470152",
"0.4467323",
"0.44281256",
"0.44192588",
"0.44178948",
"0.4417093",
"0.4399363",
"0.43961543",
"0.43943852",
"0.4392573",
"0.43523464",
"0.43366185",
"0.43364984",
"0.43308887",
"0.43290418",
"0.43257055",
"0.42953238",
"0.42922407",
"0.4287518",
"0.42772445",
"0.42695332",
"0.42646566",
"0.42570764",
"0.42501122",
"0.42494807",
"0.4247602",
"0.42431247",
"0.4241429",
"0.42405117",
"0.42395264",
"0.42335987",
"0.423181",
"0.42247212",
"0.42168468"
] | 0.7172665 | 0 |
The add_dimension_radial method adds a radial dimension (i.e arc/circle radius/diameter dimension) to the entities. | def add_dimension_radial(arc_curve, leader_break_pt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radial(gradient, sx=@width/2, sy=@height/2, er=@width/2, ex=sx, ey=sy, sr=0.0)\n #options = KCGGradientDrawsBeforeStartLocation\n #options = KCGGradientDrawsAfterEndLocation\n CGContextDrawRadialGradient(@ctx, gradient.gradient, NSMakePoint(sx, sy), sr, NSMakePoint(ex, ey), er, gradient.pre + gradient.post)\n end",
"def add_circle(center, normal, radius, numsegs = 24)\n end",
"def radial_plus\n api_get(API_MAP[:radial_plus]).to_f\n end",
"def add_arc(centerPoint: { x: 0.0, y: 0.0 }, radius: 1.0, \n startAngle: 0.0, endAngle: Math::PI * 0.25,\n isClockwise: false)\n pathElement = { elementtype: :patharc,\n centerpoint: centerPoint,\n radius: radius,\n startangle: startAngle,\n endangle: endAngle,\n clockwise: isClockwise }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def given_dimension(name, options)\n dimension = options.fetch(:category).dimensions.find_or_create_by_name(name)\n options.fetch(:values).each do |value|\n dimension.values.find_or_create_by_value(value)\n end\n dimension\n end",
"def add_custom_dimension(index, value)\n self.custom_dimensions[\"cd#{index}\"] = value\n end",
"def radar(location:, radius:, keyword: nil, min_price: nil,\n max_price: nil, name: nil, open_now: false, type: nil)\n raise StandardError, 'either a keyword, name, or type arg is required.' unless (keyword || name || type)\n\n _places(url_part: 'radar', location: location, radius: radius,\n keyword: keyword, min_price: min_price, max_price: max_price,\n name: name, open_now: open_now, type: type)\n end",
"def makeArc\r\n @entities.add_arc @centre, @vector2, @normal, @toolRadius, 0, Math::PI, 6\r\n end",
"def radius=(radius)\n @elementHash[:radius] = radius\n end",
"def add_ngon(center, normal, radius, numsides = 24)\n end",
"def create\n @dimension = Dimension.new(params[:dimension])\n\n respond_to do |format|\n if @dimension.save\n format.html { redirect_to @dimension, :notice => 'Dimension was successfully created.' }\n format.json { render :json => @dimension, :status => :created, :location => @dimension }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @dimension.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_entities(entity_characteristics)\n type, x, y, radius = entity_characteristics\n @entities << Entity.new(type, x, y, radius)\n end",
"def add_entities(entity_characteristics)\n type, x, y, radius = entity_characteristics\n @entities << Entity.new(type, x, y, radius)\n end",
"def dimension_form\n @dimension = dimension_params[:id] ? Dimension.find(dimension_params[:id]) : Dimension.new(\n dim_type: dimension_params[:dim_type]\n )\n #TO DO:\n @form_path = @dimension.id ? update_dimension_trees_path : create_dimension_trees_path\n subjects = Subject.where(:tree_type_id => @treeTypeRec.id).pluck(\"code\").uniq\n @dimension_subject_opts = [] #used only for new dimensions?\n subjects.each do |subj_code|\n @dimension_subject_opts << {code: subj_code, name: Translation.find_translation_name(\n @locale_code,\n Subject.get_default_name_key(subj_code),\n subj_code)\n }\n end\n\n @dimension_subject = Translation.find_translation_name(\n @locale_code,\n Subject.get_default_name_key(@dimension.subject_code),\n @dimension.subject_code) if @dimension.subject_code\n @dimension_text = Translation.find_translation_name(\n @locale_code,\n @dimension.dim_name_key,\n \"\"\n ) if @dimension.dim_name_key\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def add_dimension_to_items\n new_items = Array.new\n items.each do |i|\n Rails.logger.debug(\"i[:product_id] is #{i[:product_id]}\")\n p = CachedProduct.find_by_product_id(i[:product_id])\n i = i.merge({:height=>p.height, :width=>p.width, :length =>p.length})\n new_items << i\n end\n new_items\n end",
"def add_dim *args, opt: false, shapes: nil, typ: nil, use_var: false\n if use_var\n offsets = [0] + accumulate(shapes)\n return \"#{opt ? '?' : ''}var(offsets=#{offsets}) * #{typ}\"\n else\n n = shapes.uniq.size\n shape = (n == 0 ? 0 : shapes[0])\n return \"#{shape} * #{typ}\"\n end\n end",
"def update_dimension\n dimension_id = BSON::ObjectID.from_string(params[:id])\n dimension = @current_knowledge.get_dimension_by_id(dimension_id)\n if parent_id = params[:dimension][:parent_id]\n params[:dimension][:parent_id] = BSON::ObjectID.from_string(parent_id)\n end\n dimension.update_attributes(params[:dimension])\n render :update do |page|\n page.replace_html(\"list_dimensions\", :partial => \"dimensions\",\n :locals => { :dimensions => [@current_knowledge.dimension_root] })\n end\n end",
"def radar_params\n params.require(:radar).permit(:latitude, :longitude, :description)\n end",
"def find_dimension(name)\n NetCDF::Dimension.new(@netcdf_elmt.findDimension(name))\n end",
"def add_entity(name, type, definition, x, y)\n entity = Entity.new\n entity.type = type\n entity.definition = definition\n entity.set_tool_tip_text definition\n\n if name.empty? || name.nil?\n name = \"untitled\"\n else\n entity.name = name\n end\n\n entity.set_bounds x, y, ENTITY_WIDTH, ENTITY_HEIGHT\n @panel.add entity\n\n entity.add_mouse_listener @select_action\n entity.add_component_listener @move_action\n @entities << entity\n @cm.register_component entity\n\n @panel.repaint\n entity\n end",
"def dimensions(*fields)\n @dimensions ||= ListParameter.new(:dimensions, [])\n @dimensions << fields\n end",
"def raid!\n raiders = units\n unless raiders.blank?\n Unit.save_all_units(raiders, nil, EventBroker::CREATED)\n Cooldown.create_or_update!(\n @planet.location_point, Cfg.after_spawn_cooldown\n )\n end\n register!\n end",
"def draw_force_circle(context, center, radius)\n rectangle = CGRectMake(center.x - radius, center.y - radius, radius*2, radius*2)\n CGContextSetStrokeColorWithColor(context,UIColor.redColor.CGColor)\n CGContextSetLineWidth(context, 5)\n CGContextAddEllipseInRect(context, rectangle)\n CGContextStrokePath(context)\n end",
"def add_data\n Sol.add_data(\"native_array\", @data.nc_array)\n Sol.add_data(\"labels\", @dimension_labels.nc_array)\n end",
"def radius1=(theRadius)\n @elementHash[:radius] = theRadius\n end",
"def dimension\n raise Error::UnsupportedOperation, \"Method Geometry#dimension not defined.\"\n end",
"def add_definition(definition, position, direction)\n definitions[direction]||={}\n definitions[direction][position[direction_other_than(direction)]]||={}\n definitions[direction][position[direction_other_than(direction)]][position[direction]] = definition\n end",
"def add_generic\n\t\temp = getMyEnterpriseAPP\n\t\tdim = params[:dimension]\n\t\t# ES: La dimension puede venir en español o en ingles, verifica y ajusta (En la BD SIEMPRE EN ESPAÑOL!)\n\t\t# EN: The dimension could be in spanish or english, verify and adjust it (In the DB ALWAYS IN SPANISH!)\n\t\tif !I18n.default_locale.to_s.eql?(\"es\")\n\t\t\t# ES: Viene en ingles, debe pasarla a español:\n\t\t\t# EN: English, must translate it:\n\t\t\tdim = view_context.translateDimensionToES(dim)\n\t\tend\n\t\t\n\t\tdesc = params[:description]\n\t\t# ES: Crea una decision generica:\n\t\t# EN: Creates a generic decision:\n\t\tdecGen = GovernanceDecision.new\n\t\tdecGen.description = desc\n\t\tdecGen.dimension = dim\n\t\tdecGen.decision_type = GENERIC_TYPE\n\t\tdecGen.enterprise_id = emp.id\n\n\t\trespond_to do |format|\n\t\t\tif decGen.save\n\t\t\t\t# OK\n\t\t\t\tformat.json {render json: decGen}\n\t\t\telse\n\t\t\t\t# ES: No se pudo guardar\n\t\t\t\t# EN: Couldn't save\n\t\t\t\tformat.json {render json: 'ERROR'}\n\t\t\tend\n\t\t\t\n end\t\n\tend",
"def add(organisation_id, name, type, display_rate, effective_rate, options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n body[:organisation_id] = organisation_id\n body[:name] = name\n body[:type] = type\n body[:display_rate] = display_rate\n body[:effective_rate] = effective_rate\n\n response = @client.post \"/core.tax/add\", body, options\n\n return response\n end",
"def create_new_data_dimensions\n # map the meta information to the resolution\n delta_x = ((@meta_data.domain_x.upper - @meta_data.domain_x.lower) /\n @columns).round(3) * 2\n delta_y = ((@meta_data.domain_y.upper - @meta_data.domain_y.lower) /\n @lines).round(3)\n meta_string = add_domain_information(@meta_data.domain_x, delta_x)\n meta_string.concat(add_domain_information(@meta_data.domain_y, delta_y))\n end",
"def circle(id, x:0, y:0, r:0.5, **attrs)\n attrs.update(width:r*2, height:r*2)\n ellipse(id, x:x, y:y, **attrs)\n end",
"def set_dimension\n @dimension = Dimension.find(params[:id])\n end",
"def dimension_params\n params.require(:dimension).permit(:name, :questionnaire_id)\n end",
"def update_custom_dimension request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_custom_dimension_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::CustomDimension.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create_custom_dimension request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_custom_dimension_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::CustomDimension.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def diameter\n @diameter = @radius + @radius\n end",
"def register!\n @planet.next_raid_at += Cfg.raiding_delay_random\n @planet.raid_arg = generate_arg\n CallbackManager.register_or_update(\n @planet, CallbackManager::EVENT_RAID, @planet.next_raid_at\n )\n @planet.delayed_fire(@planet, EventBroker::CHANGED,\n EventBroker::REASON_OWNER_PROP_CHANGE)\n @planet.save!\n end",
"def add entity\n @body.push(entity)\n end",
"def total_energy\n potential_energy = 0.0\n DIMS.values.each { |dim| potential_energy += @position[dim].abs }\n kinetic_energy = 0.0\n DIMS.values.each { |dim| kinetic_energy += @velocity[dim].abs }\n potential_energy * kinetic_energy\n end",
"def add_nfs_datastore\n vm_host = find_vm_host\n hds = vm_host.configManager.datastoreSystem\n nfsdatastoreconfig = {:remoteHost => get_host_management_ip,\n :remotePath => resource[:nfs][\"remote_path\"],\n :localPath => \"_nfs_asm_#{vm.name}\",\n :accessMode => \"readOnly\"\n }\n\n nfsds = get_nfs_datastore(hds)\n #checks if nfsdatastore already exists\n if nfsds\n Puppet.notice (\"nfs is already mounted as %s\" % nfsds.info.name )\n else\n nfsds = hds.CreateNasDatastore(:spec => VIM.HostNasVolumeSpec(nfsdatastoreconfig))\n Puppet.notice (\"added nfs datastore %s and mounted\" % nfsds.info.name )\n end\n\n nfsds\n end",
"def add_radius_server(name, server, opts = {})\n # order of command options matter here!\n server = \"server #{server} \"\n server << \"auth-port #{opts[:auth_port]} \" if opts[:auth_port]\n server << \"acct-port #{opts[:acct_port]} \" if opts[:acct_port]\n server << \"vrf #{opts[:vrf]}\" if opts[:vrf]\n configure [\"aaa group server radius #{name}\", server, 'exit']\n end",
"def add_arc(arc)\n if (arc.validate self) && [email protected]?(arc.name)\n if arc.need_update? self\n arc.update self\n end\n @arcs[arc.name] = arc.id\n @objects[arc.id] = arc\n arc.net = self\n return arc.id\n end\n changed_structure\n return false\n end",
"def centripetal_force_v1(mass, linear_velocity, radius)\n if radius.zero?\n raise ZeroDivisionError.new('divided by 0')\n else\n return (mass * (linear_velocity ** 2.0)) / radius\n end\n end",
"def add_part_group_taxon()\n new_taxons = @product_row[:category].to_s.split(\",\")\n new_taxons.each do |category|\n category.strip!\n my_taxon = Spree::Taxon.where(\"description=?\", category)\n my_taxonomy = Spree::Taxon.where(\"description=?\", category.split('-')[0])\n if(my_taxon.length === 0 || my_taxonomy.length === 0)\n @errors << { :part_number => @product_row[:name], :condition => @product_row[:condition], :message => \"Unable to identify proper part group for \" + @product_row[:category].to_s }\n end\n @new_product.taxons << my_taxon\n @new_product.taxons << my_taxonomy\n end\n\n # add package taxon\n if(@product_row[:package] && @product_row[:package].to_s.downcase === \"y\")\n package_taxon = Spree::Taxon.where(\"name=?\", \"Packages and Assemblies\")\n @new_product.taxons << package_taxon\n end\n end",
"def add_circle(options)\n circle = OptionsHelper.to_circle(options)\n self.add_overlay circle\n\n circle\n end",
"def add_fulfillment_rights_row\n @organization = Organization.find(params[:organization_id])\n @new_fr_identity = Identity.find_or_create(params[:new_fr_identity_id])\n @fulfillment_rights = fulfillment_rights(@organization_id)\n set_registrar_enabled(@organization)\n end",
"def add(glob, options)\n definition << options.merge(:glob => glob)\n end",
"def make_dimensionless\n self.physical_quantity = 'dimensionless'\n @base_quantity_hash = { }\n end",
"def add_circle(terrain, x0, y0, radius)\n x = radius\n y = 0\n decisionOver2 = 1 - x # Decision criterion divided by 2 evaluated at x=r, y=0\n\n while y <= x do\n set_cell x + x0, y + y0, terrain # Octant 1\n set_cell y + x0, x + y0, terrain # Octant 2\n set_cell -x + x0, y + y0, terrain # Octant 4\n set_cell -y + x0, x + y0, terrain # Octant 3\n set_cell -x + x0, -y + y0, terrain # Octant 5\n set_cell -y + x0, -x + y0, terrain # Octant 6\n set_cell x + x0, -y + y0, terrain # Octant 8\n set_cell y + x0, -x + y0, terrain # Octant 7\n y += 1\n end\n\n if decisionOver2 <= 0\n decisionOver2 += 2 * y + 1 # Change in decision criterion for y -> y+1\n else\n x -= 1\n decisionOver2 += 2 * (y - x) + 1; # Change for y -> y+1, x -> x-1\n end\n end",
"def add(rational)\n\n\t\t#\tCopy the second rational\n\t\ttemp = RationalNumber.new(rational.numerator, rational.denominator)\n\n\t\t#\tMake sure we have LCD \n\t\tif not self.denominator == rational.denominator\n\t\t\ttemp.denominator = rational.denominator * self.denominator\n\t\t\ttemp.numerator = rational.numerator * self.denominator\n\t\tend\n\n\t\t#\tNow add...\n\t\tself.numerator = self.numerator + temp.numerator\n\n\t\treturn self\n\tend",
"def +(right)\n if @value.kind_of?(Integer) || @value.kind_of?(Float) || @value.kind_of?(String) \n return (@value + right)\n else\n raise OEDLIllegalCommandException.new(\"+\", \"Illegal operation, Experiment Property '#{@name}' not a float, integer, or string.\")\n end\n end",
"def +(right)\n if @value.kind_of?(Integer) || @value.kind_of?(Float) || @value.kind_of?(String) \n return (@value + right)\n else\n raise OEDLIllegalCommandException.new(\"+\", \"Illegal operation, Experiment Property '#{@name}' not a float, integer, or string.\")\n end\n end",
"def add_air_space(thickness, resistance )\n layer = Layer.new()\n layer.set_air_space(thickness, resistance)\n @layers.push(layer)\n end",
"def compute_radius radius\n angle = Math.atan(Y_DIM/X_DIM) - Math.atan( (Y_DIM - D_DIST * (OUTER - radius)) / X_DIM)\n @image = MiniMagick::Image.open(@original_path)\n crop_square\n rotate angle\n depolarize\n resize\n read_row radius\n end",
"def add(entity)\n\t\t# TODO: set entity ID when adding to Space\n\t\t# (without a proper unique ID, serialization will not work. without serialization, we can't roll back history.)\n\t\t@entities << entity\n\t\t\n\t\t\n\t\t@cp_space.add_shape(entity.shape)\n\t\t@cp_space.add_body(entity.body)\n\tend",
"def add_ingredient_to_recipe quantity, measure, food_item_name, recipe \n food_item = FoodItem.new(:name => food_item_name, :price => nil)\n ingredient = Ingredient.new(:food_item => food_item, :quantity => quantity, :measure => measure, :recipe_id => recipe.id)\n recipe.ingredients << ingredient\n end",
"def religion=(value)\n self.dim_religion=DimReligion.find_by_name(value)\n end",
"def insert_object_folder_identifier(opts={})\n type = nil\n if !opts[:object_folder_identifierType].nil?\n type = opts[:object_folder_identifierType]\n end\n value = nil\n if !opts[:object_folder_identifierValue].nil?\n value = opts[:object_folder_identifierValue]\n end\n node = PremisFolderObjectDatastream.object_folder_identifier_template(type, value)\n nodeset = self.find_by_terms(:object_folder_identifier)\n\n unless nodeset.nil?\n if nodeset.empty?\n self.ng_xml.root.add_child(node)\n index = 0\n else\n nodeset.after(node)\n index = nodeset.length\n end\n # deprecated...\n # self.dirty = true\n end\n \n return node, index\n end",
"def add_planet_object(new_planet_object)\n @solar_system.push(new_planet_object)\n end",
"def validates_dimensions_of name, options = {}\n attachment_definitions[name][:validations] << [:dimensions, options]\n end",
"def add(selector)\n if selector.kind_of?(Array)\n # Check if each name in the 'selector' refer to a valid NodeSet\n # If so, then add this NodeSet to this new group of NodeSet\n selector.each { |name|\n s = NodeSet[name]\n if s == nil\n raise \"Unknown NodeSet (name '#{name}')\"\n end\n s.add_observer(self)\n @nodeSets.add(s)\n }\n elsif selector.kind_of?(ExperimentProperty)\n s = selector.value\n add(s)\n else\n raise \"Unrecognized node set selector type '#{selector.class}'.\"\n end\n end",
"def add_polar_h!\n @ob.add_polar_hydrogens\n self\n end",
"def radius( r = nil )\n if r\n @size = Pos.ini( r, r )\n else\n @size.xnow\n end\n end",
"def dimensions=(dimensions)\n if dimensions.is_a? Dimensions\n @dimensions = dimensions\n elsif dimensions.is_a?(String) || dimensions.is_a?(Symbol)\n @dimensions = Dimensions.for(dimensions)\n else\n raise Exceptions::InvalidArgumentError, \"Unknown physical_quantity specified\"\n end\n end",
"def set_ObjectDimension(value)\n set_input(\"ObjectDimension\", value)\n end",
"def set_ObjectDimension(value)\n set_input(\"ObjectDimension\", value)\n end",
"def set_ObjectDimension(value)\n set_input(\"ObjectDimension\", value)\n end",
"def set_ObjectDimension(value)\n set_input(\"ObjectDimension\", value)\n end",
"def centripetal_force_v2(mass, angular_velocity, radius)\n return mass * (angular_velocity ** 2.0) * radius\n end",
"def add_right_to_personalgroup(right)\n self.rights << right\n end",
"def send_add\n Rails.logger.info \"Sending a message to #{rhizome.name}/add of: \" <<\n to_add_args_str\n\n result = -1\n begin\n result = rhizome.particle\n .function 'add',\n to_add_args_str\n rescue Particle::BadRequest\n msg = 'Lost contact with Rhizome or the Rhizome doesn\\'t support ' <<\n 'the \"add\" function! Check your equipment!'\n Rails.logger.error msg\n return false\n end\n\n # If the function returned the ID we provided, it was successful\n unless result.to_i == rhizome_eid.to_i\n raise RhizomeInterfaces::Errors::RhizomeArgumentError.new('add', result)\n end\n\n true\n end",
"def attribute(name, domain, options = {})\n raise \"Invalid attribute definition #{name}\" unless Symbol===name and Class===domain\n @relvar.add_attribute(name, domain, options)\n end",
"def dimension\n map { |qnt, exp| qnt.dimension * exp }.reduce SY::Dimension.zero, :+\n end",
"def add_new_sprite(position)\n\n @random ||= Random.new\n\n block_column = @random.rand > 0.5 ? 0 : 1\n block_row = @random.rand > 0.5 ? 0 : 1\n\n body = @world.new_body position: position,\n type: KDynamicBodyType do\n\n polygon_fixture box: [16, 16],\n friction: 0.3,\n density: 1.0\n\n circle_fixture radius: 32,\n friction: 0.3,\n density: 0.3,\n restitution: 0.5\n chain_fixture chain: [[10, 10], [20, 20], [30, 30]],\n friction: 0.3,\n density: 0.3,\n restitution: 0.5\n end\n\n\n # block_sprite = PhysicsSprite.new texture: @sprite_batch.texture,\n # rect: [[32 * block_column, 32 * block_row], [32, 32]],\n # body: body\n\n # @sprite_batch << block_sprite\n end",
"def initialize(dimensions, operator)\n @dimensions = dimensions\n @operator = operator\n super(create_label)\n # add to the extent\n CompositeDimension << self\n end",
"def radar_zone\n strength = radar_strength\n solar_system = without_locking { planet.solar_system }\n [\n (solar_system.x - strength)..(solar_system.x + strength),\n (solar_system.y - strength)..(solar_system.y + strength)\n ]\n end",
"def size=(dimension); end",
"def add_external_refs(params)\n #raise if kind_ref.nil?\n if params[:kind] != nil\n kind = Kind.find(params[:kind])\n kind.tree = self\n kind.save\n end\n unit = params[:unit]\n dim = params[:dimensions]\n self.dimensions.create(:height => {:value => dim[:hvalue], :unit => unit},\n \t\t:width => {:value => dim[:wvalue], :unit => unit},\n \t\t:observation => dim[:obs]) unless dim[:hvalue].empty? && dim[:wvalue].empty?\n end",
"def total_dimension\n return self.input_dimension + self.output_dimension\n end",
"def add_related(guid, name, other_guid, find_model=model)\n do_related('add', guid, name, other_guid, find_model)\n end",
"def AddNode(type, xpos, ypos, numRadios = 0)\n\tname = NodeName(xpos, ypos)\n\tnode = Orbit::Topology::Node.new(@lastId, name, type)\n\tnode.SetPos(xpos,ypos)\n\t@lastId=@lastId+1\n\t#let OMF know we have created this node\n\tDefineGroup(node)\n\t@nodes_by_name[name]=node\n\treturn node\n end",
"def addNasDatastoreByName(dsName, accessMode = \"readWrite\")\n if (dsh = @invObj.dataStoresByFilter_local(\"summary.name\" => dsName).first).nil?\n raise \"MiqHostDatastoreSystem.addNasDatastoreByName: datastore #{sdName} not found\"\n end\n\n unless dsh.summary.type.casecmp('nfs') == 0 || dsh.summary.type.casecmp('nas') == 0\n raise \"MiqHostDatastoreSystem.addNasDatastoreByName: datastore #{dsName} is not NAS\"\n end\n\n remoteHost = dsh.info.nas.remoteHost\n remotePath = dsh.info.nas.remotePath\n localPath = dsh.info.nas.name\n type = dsh.info.nas.type\n\n logger.info \"MiqHostDatastoreSystem.addNasDatastoreByName: remoteHost = #{remoteHost}, remotePath = #{remotePath}, localPath = #{localPath}\"\n createNasDatastore(remoteHost, remotePath, localPath, accessMode, type)\n end",
"def add(name, options = {}, &block)\n fact = create_or_return_fact(name, options)\n\n fact.add(options, &block)\n\n fact\n rescue StandardError => e\n log.log_exception(e)\n end",
"def add_fraction_and_term(fraction, term)\n\tterm_as_numerator = multiply_unknown_terms_or_term_lists(fraction.denominator, term)\n\tnew_numerator = add_unknown_terms_or_term_lists(fraction.numerator, term_as_numerator)\n\treturn Fraction.new(frac1.line, frac1.col, numerator: new_numerator, denominator: fraction.denominator)\nend",
"def update\n @dimension = Dimension.find(params[:id])\n\n respond_to do |format|\n if @dimension.update_attributes(params[:dimension])\n format.html { redirect_to @dimension, :notice => 'Dimension was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @dimension.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_roundedrectangle(theRect, radius: 10.0)\n pathElement = { :elementtype => \"pathroundedrectangle\",\n :rect => theRect, :radius => radius.to_f }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def +(right)\n if @value.kind_of?(Integer) || @value.kind_of?(Float) || @value.kind_of?(String)\n return (@value + right)\n else\n raise OEDLCommandException.new(\"+\", \"Illegal operation, \"+\n \"The value of Experiment Property '#{@name}' does not support addition \"+\n \"(current value is of type #{value.class})\")\n end\n end",
"def get_dimension(dim, dta)\n dim_div = :\"div_#{dim}\"\n dim_sym = dim.to_sym\n\n dta[dim_div] = if options.key?(:fullscreen)\n Display.size[dim_sym].to_s + 'px'\n elsif options.key?(dim_div)\n if options[dim_div] == :full\n Display.size[dim_sym].to_s + 'px'\n elsif options[dim_div].is_a?(Integer)\n options[dim_div].to_s + '%'\n else\n options[dim_div].to_s\n end\n else\n '100%'\n end\n end",
"def radius=(r); @@R = r; end",
"def radius=(_radius)\n reset_caches unless @radius == _radius\n @radius = _radius\n end",
"def set_RadiusUnits(value)\n set_input(\"RadiusUnits\", value)\n end",
"def set_RadiusUnits(value)\n set_input(\"RadiusUnits\", value)\n end",
"def calculate_circle_area(radius)\nend",
"def calculate_circle_area(radius)\nend",
"def get_resource_dimension(entry_datatype, entry_data)\n unit_type = (entry_data & 0xF)\n case unit_type\n when COMPLEX_UNIT_PX\n unit_name = \"px\"\n when COMPLEX_UNIT_DIP\n unit_name = \"dp\"\n when COMPLEX_UNIT_SP\n unit_name = \"sp\"\n when COMPLEX_UNIT_PT\n unit_name = \"pt\"\n when COMPLEX_UNIT_IN\n unit_name = \"in\"\n when COMPLEX_UNIT_MM\n unit_name = \"mm\"\n else\n unit_name = \"\"\n end\n\n return complex_to_float(entry_data).to_s + unit_name\n #return ((entry_data >> 8) & 0xFFFFFF).to_s + unit_name\n end",
"def create_dependent_entity_in_global_registry # rubocop:disable Metrics/AbcSize\n return if global_registry_entity.parent.blank?\n ensure_parent_entity_has_global_registry_id!\n entity_attributes = {\n global_registry_entity.parent_type => {\n :client_integration_id => global_registry_entity.parent.id,\n global_registry_entity.type => model.entity_attributes_to_push\n }\n }\n entity = GlobalRegistry::Entity.put(global_registry_entity.parent_id_value, entity: entity_attributes)\n global_registry_entity.id_value = dig_global_registry_id_from_entity(entity[\"entity\"],\n global_registry_entity.type,\n global_registry_entity.parent_type)\n model.update_column(global_registry_entity.id_column, # rubocop:disable Rails/SkipsModelValidations\n global_registry_entity.id_value)\n update_fingerprint\n end",
"def build_fact(name, options={})\n options[:rows] ||= 100\n options[:generators] ||= {}\n options[:fk_limit] ||= {}\n rows = []\n\n fact_class = Fact.to_fact(name)\n options[:rows].times do\n row = {}\n fact_class.content_columns.each do |column|\n generator = (options[:generators][column.klass] || @generators[column.klass])\n row[column.name] = generator.generate(column, options)\n end\n fact_class.dimension_relationships.each do |name, reflection|\n # it would be better to get a count of rows from the dimension tables\n fk_limit = (options[:fk_limit][reflection.foreign_key] ||\n options[:dimensions] || 100) - 1\n row[reflection.foreign_key] = rand(fk_limit) + 1\n end\n rows << row\n end\n\n rows\n end",
"def get_units(dimension)\n nil\n end",
"def circle(radius)\n pixels = []\n \n @width.times do |x|\n row = Array.new(@height, nil)\n \n @height.times do |y|\n pixel = 0\n @density.times do |i|\n xx = (x + i.to_f/@density) - @x_offset\n yy = f_halfcircle(xx, radius)\n yt = yy + @y_offset\n yb = -yy + @y_offset\n\n if (yt >= y && yt < y + 1) || (yb >= y && yb < y + 1)\n pixel = 1\n end\n end\n row[y] = pixel\n end\n pixels << row\n end\n \n PNM.create(pixels.transpose.reverse!, {:type => :pbm})\n end",
"def add_person\n coord = get_empty_coords()\n x_coord = coord[0]\n y_coord = coord[1]\n\n new_person = Person.new(x_coord, y_coord, @x_size, @y_size)\n @all_persons.push(new_person)\n end"
] | [
"0.47272795",
"0.42956868",
"0.42830494",
"0.40558127",
"0.40501666",
"0.39372614",
"0.38690415",
"0.38416234",
"0.3786328",
"0.37771162",
"0.37769103",
"0.37181687",
"0.37181687",
"0.37153387",
"0.37059188",
"0.3695941",
"0.36771247",
"0.3646932",
"0.36344904",
"0.36033562",
"0.3589505",
"0.35788873",
"0.3565452",
"0.3556217",
"0.35473558",
"0.35296243",
"0.35276383",
"0.35247275",
"0.35142377",
"0.3509933",
"0.35053036",
"0.35045192",
"0.34914014",
"0.3469243",
"0.34682488",
"0.34583002",
"0.34457523",
"0.34388295",
"0.34370896",
"0.34367874",
"0.3422864",
"0.34189716",
"0.34016666",
"0.33982626",
"0.33772027",
"0.33626878",
"0.33436358",
"0.33380923",
"0.33324683",
"0.33221102",
"0.3321656",
"0.3321656",
"0.33131617",
"0.33086842",
"0.33084616",
"0.32969898",
"0.3296059",
"0.3294578",
"0.3278191",
"0.3262171",
"0.32606897",
"0.3258816",
"0.32571667",
"0.32528478",
"0.325276",
"0.325276",
"0.325276",
"0.325276",
"0.32511002",
"0.32409996",
"0.32269502",
"0.32223633",
"0.32211947",
"0.32112",
"0.32067242",
"0.320434",
"0.32005584",
"0.32000926",
"0.31932256",
"0.3186823",
"0.31826136",
"0.31819662",
"0.31774762",
"0.31753764",
"0.31706005",
"0.31690642",
"0.3168971",
"0.31645945",
"0.31643185",
"0.3159266",
"0.31571293",
"0.31571293",
"0.31550282",
"0.31550282",
"0.31520796",
"0.3139722",
"0.31367755",
"0.31283703",
"0.31248638",
"0.31144515"
] | 0.6036537 | 0 |
The add_face method is used to create a face. You can call this method a number of ways: entities.add_face(edge1, edge2, edge3, ...) entities.add_face(edgearray) entities.add_face(pt1, pt2, pt3, ...) entities.add_face([pt1, pt2, pt3,...]) entities.add_face(curve) For the last form that takes a Curve, the curve must be closed like a circle. | def add_face(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_attached_face(vertex_array, num_edges)\n vertex_array_check(vertex_array)\n num_edges_check(num_edges)\n # Make the vertices into a line\n vertex_line = confirm_vertex_line(vertex_array)\n # This finds the \"ends\" of the vertex line\n end_vertices = [vertex_line.first, vertex_line.last]\n # Find the neighbors that will be added later\n new_neighbors = find_neighbors(vertex_array)\n # How many vertices and edges to be made\n vertices_to_make = num_edges - vertex_array.length\n edges_to_make = vertices_to_make + 1\n\n # Make new vertices\n vert_ref = Array.new(vertices_to_make) {Vertex.new}\n\n edge_ref = []\n # Connect new vertices in a line\n (edges_to_make - 2).times do |vert_id|\n # Connect each vertex to the one after it\n edge_ref << make_connection(vert_ref[vert_id], vert_ref[vert_id + 1])\n end\n # Connect \"ends\" of new vertices to \"ends\" of vertex line (making a circuit)\n # Connect \"first\" of new vertices to \"last end\" of old ones\n edge_ref << make_connection(vert_ref.first, end_vertices.last)\n # Connect \"last\" of new vertices to \"first end\" of old ones\n edge_ref << make_connection(vert_ref.last, end_vertices.first)\n\n # Add edges from vertex_line to edge_ref\n (vertex_line.length - 1).times do |vert_id|\n edge_ref << find_connection(vertex_line[vert_id], vertex_line[vert_id + 1])\n end\n\n face_border = edge_ref\n # Make a face out of the new circuit, and store it\n face = add_face(face_border)\n # Store the new vertices\n @vertices += vert_ref\n # Store the new edges\n @edges += edge_ref\n\n face\n end",
"def draw_face(face_name, face_index, x, y, size = 96)\n begin\n super\n rescue\n return\n end\n end",
"def fill_face( entities, points )\r\n if points.size == 4 && !TT::Geom3d.planar_points?( points )\r\n face1 = entities.add_face( points[0], points[1], points[2] )\r\n face2 = entities.add_face( points[0], points[2], points[3] )\r\n edge = ( face1.edges & face2.edges )[0]\r\n QuadFace.set_divider_props( edge )\r\n [ face1, face2 ]\r\n else\r\n entities.add_face( points )\r\n end\r\n end",
"def add_face(definitions)\n if definitions.kind_of?(Hash)\n @faces.update definitions \n end\n end",
"def add_quad( *args )\r\n entities = parent\r\n # Array Argument\r\n if args.size == 1 && args.is_a?( Enumerable )\r\n args = args[0]\r\n end\r\n if args.size == 1 && args.is_a?( Sketchup::Curve )\r\n # Curve\r\n curve = args[0]\r\n points = curve.vertices.map { |v| v.position }\r\n if points.size != 4\r\n raise( ArgumentError, 'Too many vertices in curve. Cannot create Quad.' )\r\n end\r\n elsif args.size == 4 && args.all? { |a| a.is_a?( Sketchup::Edge ) }\r\n # Edges\r\n loop = TT::Edges.sort( args )\r\n vertices = TT::Edges.sort_vertices( loop )\r\n points = vertices.map { |v| v.position }\r\n elsif args.size == 4 && args.all? { |a| a.is_a?( Geom::Point3d ) }\r\n # Points\r\n points = args\r\n elsif args.size == 3 && args.all? { |a| a.is_a?( Geom::Point3d ) }\r\n # Triangle\r\n return parent.add_face( args )\r\n else\r\n raise( ArgumentError, 'Invalid arguments. Cannot create Quad.' )\r\n end\r\n # Create triangulated Quad if the quad is not planar.\r\n if TT::Geom3d.planar_points?( points )\r\n face = entities.add_face( points )\r\n QuadFace.new( face )\r\n else\r\n face1 = entities.add_face( points[0], points[1], points[2] )\r\n face2 = entities.add_face( points[0], points[2], points[3] )\r\n edge = ( face1.edges & face2.edges )[0]\r\n QuadFace.set_divider_props( edge )\r\n QuadFace.new( face1 )\r\n end\r\n end",
"def face\n end",
"def setFace _obj, _args\n \"_obj setFace _args;\" \n end",
"def create\n @face = Face.new(face_params)\n\n respond_to do |format|\n if @face.save\n format.html { redirect_to collection_path(@face.collection), notice: \"Face was successfully created.\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @face = Face.new(face_params)\n\n respond_to do |format|\n if @face.save\n format.html { redirect_to @face, notice: 'Face was successfully created.' }\n format.json { render :show, status: :created, location: @face }\n else\n format.html { render :new }\n format.json { render json: @face.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_curve(*args)\n end",
"def draw_face(face_name, face_index, x, y, enabled = true)\n face_name = Revoked::Menu::Equip::FACE_NAME\n bitmap = Cache.face(face_name)\n rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)\n #drect = Rect.new(0, 0, 64, 64)\n contents.blt(x,y, bitmap, rect, enabled ? 255 : translucent_alpha)\n bitmap.dispose\n end",
"def face\n filter << 'Face:Face'\n self\n end",
"def create\n @face = Face.new(params[:face])\n\n respond_to do |format|\n if @face.save\n flash[:notice] = 'Face was successfully created.'\n format.html { redirect_to(@face) }\n format.xml { render :xml => @face, :status => :created, :location => @face }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @face.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def face _args\n \"face _args;\" \n end",
"def set_face\n @face = Face.find(params[:id])\n end",
"def set_face\n @face = Face.find(params[:id])\n end",
"def set_face\n @face = Face.find(params[:id])\n end",
"def create\n\n @face = Face.new(face_params)\n\n if @face.save\n render :show, status: :created, location: @face\n else\n render json: @face.errors, status: :unprocessable_entity\n end\n end",
"def create\n @enq_face = EnqFace.new(params[:enq_face])\n\n respond_to do |format|\n if @enq_face.save\n format.html { redirect_to @enq_face, notice: 'Enq face was successfully created.' }\n format.json { render json: @enq_face, status: :created, location: @enq_face }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enq_face.errors, status: :unprocessable_entity }\n end\n end\n end",
"def face_params\n params.require(:face).permit(:name, :collection_id, :image)\n end",
"def add_image(face)\n\t\t\t\ttype,bytes = get_image_bytes(face)\n\t\t\t\treturn add_image_node(type,bytes)\n\t\t\tend",
"def draw_face(face_name, face_index, x, y, size = 96)\n bitmap = Cache.face(face_name)\n rect = Rect.new(0, 0, 0, 0)\n rect.x = face_index % 4 * 96 + (96 - size) / 2\n rect.y = face_index / 4 * 96 + (96 - size) / 2\n rect.width = size\n rect.height = size\n @info.blt(x, y, bitmap, rect)\n bitmap.dispose\n end",
"def coll_1\n am_ents = Sketchup.active_model.entities\n s = 300\n f1 = [ 0, 0, 0 ] , [ 0, s, 0 ] , [ s, s, 0 ] , [ s, 0, 0 ]\n f2 = [ 0, 0, s ] , [ 0, s, s ] , [ s, s, s ] , [ s, 0, s ]\n puts \"am_ents.length = #{am_ents.length}\"\n am_ents.add_face( f1 )\n puts \"am_ents.length = #{am_ents.length}\"\n am_ents.add_face( f2 )\n puts \"am_ents.length = #{am_ents.length}\"\n end",
"def train_new_face\n\n # Temp reference number and face id must be given for the training to take place\n if params[:ref] && params[:face]\n\n # Load face image\n img = Magick::ImageList.new(@user.tmp_private_location+\"#{params[:ref]}/#{params[:file]}\")\n\n # Create new face in DB\n face = Face.create({\n :user_id => @user.id,\n })\n\n # Create directory for the face to be stored if it doesn't already exists\n FileUtils.mkdir_p(face.dir)\n\n # Copy the face image to that location\n img.write(face.location)\n\n # Remove temporary dir\n FileUtils.remove_dir(@user.tmp_private_location+params[:ref]+\"/\")\n\n end\n \n # Redirect to the previous page\n respond_to do |format|\n format.html { redirect_to :back }\n end\n \n end",
"def draw_face2(face_name, x, y, index = 0, animf = false, animf_index = 0, animf_max = 1, nofade = false)\n if animf\n # Use Animated Face\n bitmap = Cache.face(face_name)\n rect = Rect.new(0,0,0,0)\n rect.width = (bitmap.width / animf_max)\n rect.height = bitmap.height\n rect.x = animf_index * rect.width\n rect.y = 0\n @face.bitmap = Bitmap.new(rect.width,rect.height)\n @face.bitmap.blt(0,0,bitmap,rect)\n bitmap.dispose\n elsif $game_message.side == 0 or $game_message.side == -1 or EightFaces_File\n # USE 8 FACES PER FILE\n bitmap = Cache.face(face_name)\n rect = Rect.new(0,0,0,0)\n rect.width = (bitmap.width / 4)\n rect.height = (bitmap.height / 2)\n rect.x = index % 4 * rect.width\n rect.y = index / 4 * rect.height\n @face.bitmap = Bitmap.new(rect.width,rect.height)\n @face.bitmap.blt(0,0,bitmap,rect)\n bitmap.dispose\n else\n # USE 1 FACES PER FILE\n @face.bitmap = Cache.face(face_name)\n end\n # SET X/Y OF FACE DEPENDS ON FACE SIDE\n if $game_message.side == 1\n @face.mirror = false\n @face.x = x + 6\n @face.y = y - 6 + height - @face.height\n elsif $game_message.side == 2\n @face.mirror = true\n @face.x = x + ((self.width - 6) - @face.width)\n @face.y = y - 6 + height - @face.height\n elsif $game_message.side == 0\n @face.mirror = false\n @face.x = x + 16\n @face.y = y - 16 + height - @face.height\n elsif $game_message.side == -1\n @face.mirror = true\n @face.x = x + self.contents.width - @face.width + 16\n @face.y = y - 16 + height - @face.height\n end\n @face.x += FACE_X_PLUS\n @face.y += FACE_Y_PLUS\n @face_data = [face_name, index, $game_message.side]\n if @face_data != @face_data_old and FADE_MOVE_WHEN_USE_NEW_FACE; @showtime = 1; @face_data_old = @face_data; end\n @face.opacity = 0 if !nofade and ($nms.face_fade == true and ((FADE_ONLY_FIRST and @showtime <= 1) or (FADE_ONLY_FIRST == false)))\n end",
"def annotate_related_faces(face)\n # Find faces at same z as selected face\n proc { |r|\n r.material = SVG.same(face.plane[3], r.plane[3]) ? FaceSVG.surface : FaceSVG.pocket\n }\n end",
"def create_face_from_section(section)\n plane=section.get_plane\n bounds=Sketchup.active_model.bounds\n entities=Sketchup.active_model.active_entities\n bmin = bounds.min\n bminx = bmin.x\n bminy = bmin.y\n bminz = bmin.z\n bmax = bounds.max\n bmaxx = bmax.x\n bmaxy = bmax.y\n bmaxz = bmax.z\n ### make group\n newgroup=entities.add_group\n newgroupentities=newgroup.entities\n c1 = [bminx, bminy, bminz]\n c2 = [bmaxx, bminy, bminz]\n c3 = [bminx, bminy, bmaxz]\n c4 = [bmaxx, bminy, bmaxz]\n c5 = [bminx, bmaxy, bmaxz]\n c6 = [bmaxx, bmaxy, bmaxz]\n c7 = [bminx, bmaxy, bminz]\n c8 = [bmaxx, bmaxy, bminz]\n e1 = newgroupentities.add_edges [ c1, c2 ]\n e2 = newgroupentities.add_edges [ c3, c4 ]\n e3 = newgroupentities.add_edges [ c5, c6 ]\n e4 = newgroupentities.add_edges [ c7, c8 ]\n e5 = newgroupentities.add_edges [ c1, c3 ]\n e6 = newgroupentities.add_edges [ c2, c4 ]\n e7 = newgroupentities.add_edges [ c7, c5 ]\n e8 = newgroupentities.add_edges [ c8, c6 ]\n e9 = newgroupentities.add_edges [ c1, c7 ]\n e10 = newgroupentities.add_edges [ c3, c5 ]\n e11 = newgroupentities.add_edges [ c4, c6 ]\n e12 = newgroupentities.add_edges [ c2, c8 ]\n line1 = e1[0].line\n line2 = e2[0].line\n line3 = e3[0].line\n line4 = e4[0].line\n line5 = e5[0].line\n line6 = e6[0].line\n line7 = e7[0].line\n line8 = e8[0].line\n line9 = e9[0].line\n line10 = e10[0].line\n line11 = e11[0].line\n line12 = e12[0].line\n e1[0].erase!\n e2[0].erase!\n e3[0].erase!\n e4[0].erase!\n e5[0].erase!\n e6[0].erase!\n e7[0].erase!\n e8[0].erase!\n e9[0].erase!\n e10[0].erase!\n e11[0].erase!\n e12[0].erase!\n ### find intersects with plane\n p1 = Geom.intersect_line_plane line1, plane\n p2 = Geom.intersect_line_plane line2, plane\n p3 = Geom.intersect_line_plane line3, plane\n p4 = Geom.intersect_line_plane line4, plane\n p5 = Geom.intersect_line_plane line5, plane\n p6 = Geom.intersect_line_plane line6, plane\n p7 = Geom.intersect_line_plane line7, plane\n p8 = Geom.intersect_line_plane line8, plane\n p9 = Geom.intersect_line_plane line9, plane\n p10 = Geom.intersect_line_plane line10, plane\n p11 = Geom.intersect_line_plane line11, plane\n p12 = Geom.intersect_line_plane line12, plane\n if p1 ### NOT z\n e1 = newgroupentities.add_line p1,p2\n e2 = newgroupentities.add_line p2,p3\n e3 = newgroupentities.add_line p3,p4\n e4 = newgroupentities.add_line p4,p1\n elsif p5 ### in z\n e1 = newgroupentities.add_line p5,p6\n e2 = newgroupentities.add_line p6,p8\n e3 = newgroupentities.add_line p8,p7\n e4 = newgroupentities.add_line p7,p5\n else\n e1 = newgroupentities.add_line p9,p10\n e2 = newgroupentities.add_line p10,p11\n e3 = newgroupentities.add_line p11,p12\n e4 = newgroupentities.add_line p12,p9\n end #if p1 etc\n face = newgroupentities.add_face [e1,e2,e3,e4]\n newgroup\n end",
"def faceify(opts)\n opts[:face] = (opts[:face].to_s.downcase == 'right')\n opts\n end",
"def add_face indices\n faces << indices.map(&:to_i)\n end",
"def initialize(faces)\n top, front, right, left, back, bottom = faces\n @faces = [[top, bottom], [front, back], [left, right]]\n end",
"def new_edge(*args)\n add_edge(build_edge(*args))\n end",
"def create_face\n @pokeface = DexWinSprite.new(@viewport)\n end",
"def initialize(face, is_shown=false)\n @face = face \n @is_shown = is_shown\n end",
"def face_params\n params.fetch(:face, {}).permit!\n end",
"def faces\r\n @types[ QuadFace ].keys + @types[ Sketchup::Face ].keys\r\n end",
"def create_box(origin, width, length, height)\r\n mod = Sketchup.active_model # open sketchup active_model\r\n ent = mod.entities # accessing the entities in mod\r\n\r\n # this is a basic code to make a simple box\r\n\r\n #define points for a rectangle in respect to origin point\r\n pt1 = Geom::Point3d.new(origin.x - width / 2, origin.y - length / 2, origin.z - height / 2)\r\n pt2 = Geom::Point3d.new(origin.x + width / 2, origin.y - length / 2, origin.z - height / 2)\r\n pt3 = Geom::Point3d.new(origin.x + width / 2, origin.y + length / 2, origin.z - height / 2)\r\n pt4 = Geom::Point3d.new(origin.x - width / 2, origin.y + length / 2, origin.z - height / 2)\r\n\r\n #create a group_ box group\r\n box_group = ent.add_group\r\n # create a rectanglar face\r\n face = box_group.entities.add_face(pt1, pt2, pt3, pt4)\r\n if face.normal.z < 0 # this code is used to flip the face if not upward\r\n face.reverse!\r\n end\r\n # pushpull the face to create the box\r\n face.pushpull(height)\r\n # end of the code\r\n return box_group\r\nend",
"def make_original_face(num_edges)\n num_edges_check(num_edges)\n # Make the vertices\n vert_ref = Array.new(num_edges) {Vertex.new}\n edge_ref = []\n\n # Connect each vertex to the one before it (including the first one :)\n (num_edges).times do |vert_id|\n edge_ref << make_connection(vert_ref[vert_id - 1], vert_ref[vert_id])\n end\n\n # Make the face and store it\n face = add_face(edge_ref)\n # Store the new vertices\n @vertices += vert_ref\n # Store the new edges\n @edges += edge_ref\n\n face\n end",
"def create_face_window\n @face_window = Window_Face.new(FACE_X, FACE_Y, @actor)\n end",
"def setFaceAnimation _obj, _args\n \"_obj setFaceAnimation _args;\" \n end",
"def initialize\n #@faces is ALL faces on the graph\n @faces = []\n super\n end",
"def train\n \n # Current state of the action\n success = false\n \n message = \"\"\n \n # Check all the parameters are available, and add face\n if !params[:face].nil? && !params[:ref].nil? && @user.add_face(params[:ref],params[:face])\n \n # Action was a success\n success = true\n \n # Notice message\n message = \"Face was successfully added to your set\"\n \n else\n \n # Notice message\n message = \"Face could not be added to your set\"\n \n end\n \n flash[:notice] = message\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render :json => { :success => success, :message => message } }\n end\n \n end",
"def add(entity)\n\t\t# TODO: set entity ID when adding to Space\n\t\t# (without a proper unique ID, serialization will not work. without serialization, we can't roll back history.)\n\t\t@entities << entity\n\t\t\n\t\t\n\t\t@cp_space.add_shape(entity.shape)\n\t\t@cp_space.add_body(entity.body)\n\tend",
"def face_info_new(img_uid, faceinfo = {})\n @client.post \"/service_json_ssl.svc/FaceInfo_New\", {img_uid:img_uid,faceinfo:faceinfo}\n end",
"def facetable(facetable)\n raise \"facetable must be a boolean.\" unless is_bool? facetable\n @facetable = facetable\n self\n end",
"def build_gr(entities,r,t)\n\ngr_group = entities.add_group\n\norigin = Geom::Point3d.new(0,0,0)\nv1 = Geom::Vector3d.new($gr_width/2,0,0)\nv2 = Geom::Vector3d.new(0,0,$gr_width*$gr_pitch/12)\nv3 = Geom::Vector3d.new(0, $gr_length,0)\n\nf1 = gr_group.entities.add_face(origin,origin-v3,origin-v3+v2+v1,origin+v2+v1)\nf1.material = $roofColor\nf2 = gr_group.entities.add_face(origin-v3+v2+v1,origin+v2+v1, origin+v1+v1, origin+v1+v1-v3)\nf2.material = $roofColor\n\nif($gr_wall[1] == 2)\n\tf5 = gr_group.entities.add_face([0,-$gr_length,0],[6, -$gr_length,0],[6, 6-$gr_length,0],[0,6-$gr_length,0])\n\tf5.pushpull $gr_height\n\tf6 = gr_group.entities.add_face([$gr_width,-$gr_length,0],[$gr_width-6, -$gr_length,0],[$gr_width-6, 6-$gr_length,0],[$gr_width,6-$gr_length,0])\n\tf6.pushpull $gr_height\nend\n\nif($gr_wall[0] == 1)\n\tf3 = gr_group.entities.add_face([0,0,0],[0,0,-$gr_height],[0,-$gr_length, -$gr_height],[0, -$gr_length,0])\n\tf3.material = $wallColor\nend\n\nif($gr_wall[2] == 1)\n\tf3 = gr_group.entities.add_face([$gr_width,0,0],[$gr_width,0,-$gr_height],[$gr_width,-$gr_length, -$gr_height],[$gr_width, -$gr_length,0])\n\tf3.material = $wallColor\nend\n\nentities.transform_entities r, gr_group\nentities.transform_entities t, gr_group\n\nend",
"def create_geometry(p1, p2, view)\n puts \"create_geometry called\"\n## puts \"create_geometry called\"\n \t\t# if @state < 2 ##then we haven't yet created any geometry, so create the cross-section face\n\t\t\t# @model = Sketchup.active_model\n\t\t\t# @model.start_operation(\"DrawFraming\")\n \t\t# @state = 2 ## Waiting for pick or VCB entry to define length of component\n \n # @@df_tool_id = @model.tools.active_tool_id ## Remember DrawFraming tool_id\n # Create an empty component definition\n # @ents = @model.definitions\n # @comp_defn = @ents.add(\"comp\")\n\n # Create an empty group to draw into\n\t\t\t# @grp = @model.active_entities.add_group()\n\t\t\t# @ents = @grp.entities\n\n # Define cross-section and name it\n\t\t\t# comp_defn_name = UI.inputbox [\"Component name \"],[\"Frame element\"],\"Name this component \" \n\t\t\t# if comp_defn_name ## inputbox was not cancelled)\n # @comp_defn.name = @n_size[@chosen_size][0] + \" \" + comp_defn_name[0].to_s\n\t\t\t\t# @comp_defn.description = @n_size[@chosen_size][0] + \" \" +comp_defn_name[0].to_s\n \n # Insert face into new component definition\n # ents = @comp_defn.entities\n# puts \"@comp_defn class = \" + @comp_defn.class.to_s \n\n # @face = ents.add_face(@profile_points3)\n\n # Insert an instance of the component at the origin\n # @model.active_entities.add_instance(@comp_defn, @tf_identity)\n# puts \"@face.vertices = \" + @face.vertices.inspect.to_s\n\n\t\t\t\t# @last_drawn = [@comp_defn]\n\n # Orient face normal to @reported_normal and correctly oriented: four steps\n # 1. Rotate the cross-section around Z_AXIS at world or component origin \n # to align with @face.normal\n\t\t\t\t# @comp_defn.instances[-1].transform!(@tf3)\n\n # 2. Revolve around normal to the Z_AZIS and the @face.normal\n # @comp_defn.instances[-1].transform!(@tf4)\n\n # 3. Rotate by 90 degrees about @reported_normal @quad times\n # i=1\n # while i <= @quad do\n # @comp_defn.instances[-1].transform!(@rotate90_la)\n # i += 1\n # end\n \n # 4. Move inserted component face from origin to pick point\n\t\t\t\t# @comp_defn.instances[-1].transform!(@tf2)\t\t\t \n\n # Select only the newly created face inside the component\n\t\t\t\t# @model.selection.clear\n\t\t\t\t# @model.selection.add @face \n\n # If operation cancelled \n\t\t\t# else\n # @model.abort_operation ## alternative way to cancel\n # self.reset(view)\n\t\t\t# end ## if comp_name\n\t\t# end ## if @state < 2 \n# ------------------------\n # if @state == 3 && @face ## a component face has been drawn\n # Pushpull cross-section to length\n# puts \"create_geometry called state 3\"\n # if @face.normal == @reported_normal\n # @face.pushpull @frame_length \n # else ## reverse direction to pushpull\n # @face.pushpull -@frame_length\n # end\n# puts \"@comp_defn.instances[-1] = \" + @comp_defn.instances[0].to_s\n # @comp_defn.name = @profile[0] + \" \" + @n_size[@chosen_size][0] + \" x \" + @frame_length.to_l.to_s\n # @model.selection.clear\n # self.reset(view)\n # @model.commit_operation\n # end ## if @state == 3\n\n end",
"def new\n @face = Face.new\n\n def @face.eye_color\n end\n def @face.hair_color\n end\n def @face.ears\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @face }\n end\n end",
"def draw_best_actor_face(actor, x, y, enabled = true)\n draw_face(actor.face_name, BEST_ACTOR_INDEX, x, y, enabled)\n end",
"def update\n respond_to do |format|\n if @face.update(face_params)\n format.html { redirect_to @face, notice: 'Face was successfully updated.' }\n format.json { render :show, status: :ok, location: @face }\n else\n format.html { render :edit }\n format.json { render json: @face.errors, status: :unprocessable_entity }\n end\n end\n end",
"def is_face?\n\n if @rank.type == CardType::FACE_TYPE\n return true\n end\n\n return false\n end",
"def create\n @face_off = FaceOff.new(face_off_params)\n\n respond_to do |format|\n if @face_off.save\n format.json { render json: @face_off, status: :created }\n else\n format.json { render json: @face_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @face.update(face_params)\n format.html { redirect_to @face, notice: \"Face was successfully updated.\" }\n format.json { render :show, status: :ok, location: @face }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @face.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_volume_faces(view, entities)\n model = view.model\n material = self.get_frustum_material\n bounds = model.bounds\n bounds.add view.camera.eye\n length = bounds.diagonal\n transform = CameraRep.get_transform_from_view(view).inverse\n pts = (0..3).collect {|i| self.view_corner view, i, length, transform}\n face = entities.add_face ORIGIN, pts[0], pts[2]\n face.material = material\n face = entities.add_face ORIGIN, pts[2], pts[3]\n face.material = material\n face = entities.add_face ORIGIN, pts[3], pts[1]\n face.material = material\n face = entities.add_face ORIGIN, pts[1], pts[0]\n face.material = material\nend",
"def initialize face, row, left\n @face, @row, @left = face, row, left\n end",
"def draw(entity)\n case entity\n when Edge then draw_edge entity\n when Box then draw_box entity\n end\n end",
"def find_faces\n end",
"def find_faces\n end",
"def check_face(face)\n raise StandardError, 'Wrong face choose between north, south, west, east' unless FACES.include?(face)\n end",
"def to_face_cube\n fc = FaceCube.new\n\n CORNERS.length.times do |i|\n j = corner_permutation[i]\n ori = corner_orientation[i]\n\n CORNER_SIZE.times do |n|\n ord = Facelet.for(i, (n + ori) % 3, type: :corner).ord\n fc.colors[ord] = FaceCube::CORNER_COLORS[j][n]\n end\n end\n\n EDGES.length.times do |i|\n j = edge_permutation[i]\n ori = edge_orientation[i]\n EDGE_SIZE.times do |n|\n ord = Facelet.for(i, (n + ori) % 2, type: :edge).ord\n fc.colors[ord] = FaceCube::EDGE_COLORS[j][n]\n end\n end\n\n fc\n end",
"def add_edge(*e)\n raise InvalidArgumentError if e.size > 2\n \n e = [e] if e.size == 2\n @edges.add(e[0])\n end",
"def face_to_lines(face)\n Kernel.raise \"non tris not supported\" if face.verts.length != 3\n v1, v2, v3 = face.verts.map { |vert| [vert.render_x, vert.render_y, vert.y] }.sort_by { |vert| vert.y }\n cross = VectorMath::normalize(VectorMath::cross3((face.verts[1] - face.verts[0]).row_vector, (face.verts[2] - face.verts[0]).row_vector))\n r = 254 * VectorMath::dot(cross,[0.0, 1.0, 0.0]).abs + 1\n g = 254 * VectorMath::dot(cross,[1.0, 0.0, 0.0]).abs + 1\n b = 254 * VectorMath::dot(cross,[0.0, 0.0, 1.0]).abs + 1\n g = b = r\n out = draw_tri(v1.x,v1.y,v2.x,v2.y,v3.x,v3.y,r,g,b)\nend",
"def add_edge(id1, id2)\n # YOUR WORK HERE\n end",
"def new_edge\n\t\t\traise NotImplementedError.new('#new_edge must be implemented')\n\t\tend",
"def add_edge(x, y, type)\n debug_msg \"adding edge #{x}, #{y}, #{type}\"\n if self[x,y]\n unless self[x,y] == type\n @contradiction = true\n debug_msg \" \\tcontradiction\"\n throw :add_edge_throw, :contradiction\n else\n debug_msg \"\\ti know\"\n throw :add_edge_throw, :i_know\n end\n else\n super(x, y, type)\n end\n end",
"def native_faces\r\n @faces_to_quads.keys + @types[ Sketchup::Face ].keys\r\n end",
"def face_params\n params.require(:face).permit(:token, :u_id)\n end",
"def add_edges(*args)\n edge = super\n edge.fontname = @font\n edge\n end",
"def add_entities(entity_characteristics)\n type, x, y, radius = entity_characteristics\n @entities << Entity.new(type, x, y, radius)\n end",
"def add_entities(entity_characteristics)\n type, x, y, radius = entity_characteristics\n @entities << Entity.new(type, x, y, radius)\n end",
"def add_material(face)\n\t\t\t\t\n\t\t\t\tmaterial = face.material\n\t\t\t\t\n\t\t\t\tindex = @materials_hash[material]\n\t\t\t\t\n\t\t\t\tif (index != nil)\n\t\t\t\t\treturn index\n\t\t\t\tend\n\n\t\t\t\tif (material == nil)\n\t\t\t\t\tif @defaultMaterial == -1\n\t\t\t\t\t\t#@defaultMaterial = add_material_node(\"default material\",0.5,0.5,0.75,1.0, 0.1,0.5,true,nil)\n\t\t\t\t\t\t@defaultMaterial = add_material_node(\"default material\",1,1,1,1.0, 0.1,0.5,true,nil) #Use white (not blue) as a default material\n\t\t\t\t\tend\n\t\t\t\t\treturn @defaultMaterial\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tdouble_sided = false\n\t\t\t\tif face.class == Sketchup::Face \t# 'face' might be an entity such as group or component\n\n\t\t\t\t\t#puts \"FRONT face material: \" + face.material.name\n\t\t\t\t\t#puts \"r:\" + face.material.color.red.to_s + \" g:\" + face.material.color.green.to_s + \" b:\" + face.material.color.blue.to_s + \" a:\" + face.material.alpha.to_s \n\n\t\t\t\t\tif face.back_material != nil\n\t\t\t\t\t\tdouble_sided = true\n\n\t\t\t\t\t\t#puts \"BACK face material: \" + face.back_material.name\n\t\t\t\t\t\t#puts \"r:\" + face.back_material.color.red.to_s + \" g:\" + face.back_material.color.green.to_s + \" b:\" + face.back_material.color.blue.to_s + \" a:\" + face.back_material.alpha.to_s \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tmetallicFactor = get_material_attribute(material, 'pbr','metallicFactor',0.1)\n\t\t\t\troughnessFactor = get_material_attribute(material, 'pbr', 'roughnessFactor',0.9)\n\t\t\t\t\n\t\t\t\t@materials_hash[material] = @materials.length\n\t\t\t\t\n\t\t\t\tname = face.material.display_name\n\t\t\t\t#puts 'Material display name: ' + name\n\n\t\t\t\ta = material.alpha\n\t\t\t\tr = material.color.red / 255.0\n\t\t\t\tg = material.color.green / 255.0\n\t\t\t\tb = material.color.blue / 255.0\n\t\t\t\t\n\t\t\t\t# In future version have lookup into common materials table?\n\t\t\t\tif name != nil\n\t\t\t\t\tlname = name.downcase\n\t\t\t\t\tif name.include? 'gold'\n\t\t\t\t\t\tmetallicFactor = 0.75\n\t\t\t\t\t\troughnessFactor = 0.0\n\t\t\t\t\tend\n\t\t\t\t\tif name.include? 'silver'\n\t\t\t\t\t\tmetallicFactor = 0.75\n\t\t\t\t\t\troughnessFactor = 0.0\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tif (lname.include? 'metal') || (lname.include? 'steel')\n\t\t\t\t\t\tmetallicFactor = 0.75\n\t\t\t\t\t\troughnessFactor = 0.0\n\t\t\t\t\tend\n\t\t\t\t\tif lname.include? 'aluminium'\n\t\t\t\t\t\tmetallicFactor = 0.75\n\t\t\t\t\t\troughnessFactor = 0.40\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif (material.texture != nil)\n\t\t\t\t\ttexture_id = @textures.add_texture(face)\n\t\t\t\t\treturn add_material_node(name, r,g,b,a, metallicFactor, roughnessFactor, double_sided, texture_id)\n\t\t\t\tend\n\n\t\t\t\treturn add_material_node(name, r,g,b,a, metallicFactor, roughnessFactor, double_sided, nil)\n\t\t\tend",
"def set_graphic(character_name, character_index, face_name, face_index)\n $game_system.add_override(\"Actor_#{@id}_character_name\", character_name)\n @character_index = character_index\n $game_system.add_override(\"Actor_#{@id}_face_name\", face_name)\n @face_index = face_index\n end",
"def add_edge(edge)\n @edges.push(edge)\n end",
"def find_start_face(entities, outside)\r\n # Ignore vertices with no faces attached.\r\n vertices = Set.new\r\n entities.grep(Sketchup::Edge) { |edge|\r\n vertices.merge(edge.vertices)\r\n }\r\n vertices.delete_if { |vertex| get_faces(vertex).empty? }\r\n return nil if vertices.empty?\r\n\r\n # 1) Pick the vertex (v) with max z component.\r\n max_z_vertex = vertices.max { |a, b|\r\n a.position.z <=> b.position.z\r\n }\r\n\r\n # 2) For v, pick the attached edge (e) least aligned with the z axis.\r\n edges = max_z_vertex.edges.delete_if { |edge| get_faces(edge).empty? }\r\n edge = edges.min { |a, b|\r\n # BUG #37: comparison of Sketchup::Edge with Sketchup::Edge failed\r\n # This throws an ArgumentError some times - which is strange. Almost\r\n # indicate that edge_normal_z_component yields NaN or something like\r\n # that. It's not been possible to reproduce this yet - so in an attempt\r\n # to get more data we throw a custom exception with more info.\r\n # This is a workaround until the Error Reporter can accept additional\r\n # custom data in its payload.\r\n val_a = edge_normal_z_component(a)\r\n val_b = edge_normal_z_component(b)\r\n result = val_a <=> val_b\r\n if result.nil?\r\n klass_a = val_a.class.name\r\n klass_b = val_b.class.name\r\n raise HeisenBug, \"A: #{a.line.inspect} (#{val_a.inspect}) #{klass_a} - B: #{b.line.inspect} (#{val_b.inspect}) #{klass_b}\"\r\n end\r\n result\r\n }\r\n\r\n # 3) For e, pick the face attached with maximum |z| normal component.\r\n face = get_faces(edge).max { |a, b|\r\n face_normal(a).z.abs <=> face_normal(b).z.abs\r\n }\r\n\r\n # 4) reverse face if necessary.\r\n if outside\r\n reverse_face(face) if face_normal(face).z < 0\r\n else\r\n reverse_face(face) if face_normal(face).z > 0\r\n end\r\n\r\n face\r\n end",
"def common_face(edge2)\n end",
"def common_face(edge2)\n end",
"def initialize (value=10, face=-1) # CONSTRUCTOR\n self.value = value\n self.face = face\n end",
"def entities_of_curve?(*entities)\n if entities.first.is_a?(Sketchup::Edge) # First is an edge...\n curve = entities.first.curve\n if curve && (# ...and has part of a curve...\n entities.length == 1 ||\n entities.all? {|e| e.is_a?(Sketchup::Edge) && e.curve == curve}) # ...and all the others too.\n return true\n end\n end\n return false\n end",
"def test_is_polygon_with_curve\n m = Sketchup.active_model\n ents = m.entities\n\n # Create a curve\n pts = []\n pts.push [1, 4, 0]\n pts.push [3, 3, 0]\n pts.push [2, 3, 0]\n pts.push [0, 4, 0]\n pts.push [3, 2, 0]\n pts.push [3, -2, 0]\n pts.push [3, -3, 0]\n pts.push [2, -4, 0]\n pts.push [1, -4, 0]\n ents.add_curve pts\n\n # Check curve edges\n m.entities.each do |e|\n if e.is_a? Sketchup::Edge and e.curve.respond_to? 'is_polygon?'\n assert_equal(false, e.curve.is_polygon?,\n 'Curve of curve edge should not be polygon.')\n end\n end\n end",
"def add_party(bank, party, name = nil, klass = nil, battler = nil, bag = nil)\n @parties[bank] ||= []\n @parties[bank] << party\n @names[bank] ||= []\n @names[bank] << name if name\n @classes[bank] ||= []\n @classes[bank] << klass if klass\n @battlers[bank] ||= []\n @battlers[bank] << battler if battler\n @bags[bank] ||= []\n @bags[bank] << (bag || PFM::Bag.new)\n end",
"def add_point\n end",
"def new_edge(label,points)\n\t\ttmp=MyEdge.new\n\t\ttmp.label=label\n\t\t\n\t\t# Points should be two strings, not the Vertex objects themselves\n\t\ttmp.points=points\n\t\treturn tmp\n\tend",
"def initialize(face, suit, face_value = nil)\n @face = face.upcase\n @suit = suit.downcase\n @face_value = face_value.nil? ? Deck::FACE_VALUES[@face] : face_value\n end",
"def Com3\n @type = \"Face\"\n @name = \"Actor1\"\n @id = 0\n @x = 0\n @y = 0\n @commande_window.hide\n @window_command_command = Window_CommandFaceSelect.new(@name,@id,@x,@y)\n @window_command_command.set_handler(:CF1, method(:ComFace1))\n @window_command_command.set_handler(:CF2, method(:ComFace2))\n @window_command_command.set_handler(:CF3, method(:ComFace3))\n @window_command_command.set_handler(:CF4, method(:ComFace4))\n @window_command_command.set_handler(:cancel, method(:ComFace5))\n @window_command_command.activate\n end",
"def add_edge(from, to, character)\n validate_argument(from)\n validate_argument(to)\n\n edges = @vertices[from] || create_new(from)\n edges << { character => to }\n end",
"def add_entity(name, type, definition, x, y)\n entity = Entity.new\n entity.type = type\n entity.definition = definition\n entity.set_tool_tip_text definition\n\n if name.empty? || name.nil?\n name = \"untitled\"\n else\n entity.name = name\n end\n\n entity.set_bounds x, y, ENTITY_WIDTH, ENTITY_HEIGHT\n @panel.add entity\n\n entity.add_mouse_listener @select_action\n entity.add_component_listener @move_action\n @entities << entity\n @cm.register_component entity\n\n @panel.repaint\n entity\n end",
"def position_faces!\n offset_x = [padding + d + 3 * thickness, metadata.x + 2 * thickness + padding].max\n offset_y = [padding + d + 3 * thickness, metadata.y + 2 * thickness + padding].max\n\n # X Coordinate\n left.x = offset_x - d - 2 * thickness - padding\n right.x = offset_x + w + 2 * thickness + padding\n\n [bottom, front, top, back].each { |s| s.x = offset_x }\n\n # Y Coordinate\n top.y = offset_y - d - 2 * thickness - padding\n bottom.y = offset_y + h + 2 * thickness + padding\n back.y = bottom.y + d + 2 * thickness + padding\n\n [left, front, right].each { |s| s.y = offset_y }\n\n faces.each(&:relocate!)\n end",
"def update\n @face = Face.find(params[:id])\n\n respond_to do |format|\n if @face.update_attributes(params[:face])\n flash[:notice] = 'Face was successfully updated.'\n format.html { redirect_to(@face) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @face.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_edge(*edge_details)\r\n if (edge_details.length <3)||(edge_details.length>4)\r\n raise \"Error: Incorrect number of arguments in add_edge\"\r\n end # end if length\r\n @edges.push edge_details\r\n end",
"def interior_steel(entities)\n#draw_rectangle(\"EW1\",70*12, 14*12+8, 20*12, entities)\n\n\tif($interior_steel != \"\")\n\t\n\t\tif($oh1 >= $oh2)\n\t\ta = entities.add_line([0,0,$height],[0,$width,$height])\n\t\tb = entities.add_line([0,0,$height],[0,0,$height1])\n\t\t\t\t\ta.faces[0].back_material = $interior_steel\n\t\t# if($oh1 <= $oh2)\n\n\t\t# else\n\t\t\t# a.faces[1].back_material = $interior_steel\n\t\t# end\n\t\t\n\t\t#entities.add_line([$length,0,$height],[$length,0,$height1])\n\n\n\t\tf = entities.add_line([$length,0,$height],[$length,0,$height1])\n\t\te = entities.add_line([$length,0,$height],[$length,$width,$height])\n\t\te.faces[1].back_material = $interior_steel\n\n\t\tentities.add_line([0,0,$height],[$length,0,$height])\n\t\td = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1])\n\t\t\n\t\t\n\t\t\n\t\td.find_faces\n\t\td.faces[0].back_material = $interior_steel\n\t\td.faces[2].back_material = $interior_steel\n\t\tif($height1 == $height2)\n\t\t\td.faces[2].erase!\n\t\tend\n\n\t\tc = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2])\n\t\tc.faces[0].back_material = $interior_steel\n\t\tend\n\t\t\n\t\tif($oh1 < $oh2)\n\t\ta = entities.add_line([0,0,$height],[0,$width,$height])\n\t\tb = entities.add_line([0,$width,$height],[0,$width,$height2])\n\t\t\t\t\ta.faces[0].back_material = $interior_steel\n\t\t# if($oh1 <= $oh2)\n\n\t\t# else\n\t\t\t# a.faces[1].back_material = $interior_steel\n\t\t# end\n\t\t\n\t\t#entities.add_line([$length,0,$height],[$length,0,$height1])\n\n\n\t\tf = entities.add_line([$length,$width,$height],[$length,$width,$height2])\n\t\te = entities.add_line([$length,0,$height],[$length,$width,$height])\n\t\te.faces[1].back_material = $interior_steel\n\n\t\tentities.add_line([0,0,$height],[$length,0,$height])\n\t\td = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1])\n\t\t\n\t\t\n\t\t\n\t\td.find_faces\n\t\td.faces[1].back_material = $interior_steel\n\t\t\t\td.faces[0].back_material = $interior_steel\n\t\t#d.faces[2].back_material = $interior_steel\n\t\tif($height1 == $height2)\n\t\t\td.faces[2].erase!\n\t\tend\n\n\t\tc = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2])\n\t\tc.faces[0].back_material = $interior_steel\n\t\tend\n\t\t\n\t\t\n\t\t\n\tend\nend",
"def detect!\n faces = [ ]\n results = @client.faces_detect(file: File.new(@image_path, \"rb\"))\n photo = results[\"photos\"][0]\n\n photo[\"tags\"].each do |face_tags|\n faces << Face.new(face_tags, photo)\n end\n\n faces\n end",
"def source_face\n return unless face\n return unless local_position.on_plane?(face.plane)\n\n face\n end",
"def add_shape shape\n\t\tif shape.class == Rectangle or shape.class == Triangle or shape.class == Circle\n\t\t\[email protected] shape\n\t\telse\n\t\t\tputs \"Not a shape\"\n\t\tend\n\tend",
"def draw_feature( image, feature, x, y )\n if feature.feature_type == \"exon\" and not feature.feature_name.match(/En2/)\n if feature.feature_name.match(/fragment/)\n draw_exon_fragment( image, x, y )\n else\n draw_exon( image, x, y )\n end\n elsif feature.feature_type == \"promoter\"\n draw_promoter( image, feature, [x, y] )\n else\n case feature.feature_name\n when \"FRT\"\n draw_frt( image, feature, x, y )\n when \"loxP\"\n draw_loxp( image, feature, x, y )\n when \"Rox\"\n draw_rox( image, feature, x, y )\n when \"AttP\"\n draw_attp( image, feature, x, y )\n when \"intervening sequence\"\n draw_intervening_sequence( image, x, y )\n when \"F3\"\n draw_f3( image, feature, x, y )\n when \"AsiSI\"\n draw_asisi( image, feature, [x, y] )\n when \"ori\"\n draw_ori( image, x, y )\n when \"En2 SA (ATG)\"\n draw_en2_k_frame( image, feature, [x, y] )\n when \"PGK_DTA_pA\"\n draw_pgk_dta_pa( image, feature, [x, y] )\n when \"pA_DTA_PGK\"\n draw_pa_dta_pgk( image, feature, [x, y] )\n # Any non-speciall feature is probably a cassette feature\n # and can be rendered with the feature.render_options()\n else\n draw_cassette_feature( image, feature, x, y )\n end\n end\n end",
"def get_face\n \n @face = Face.find(params[:id]) unless params[:id].nil?\n \n # Only continue action if a face was associated with the request, otherwise, redirect user\n if @face.nil?\n \n message = \"Something went wrong\"\n \n # Notice message\n flash[:notice] = message\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render :json => { :success => false, :message => message } }\n end\n \n end\n \n end",
"def create\n @curve = Curve.new(params[:curve])\n\n respond_to do |format|\n if @curve.save\n format.html { redirect_to @curve, notice: 'Curve was successfully created.' }\n format.json { render json: @curve, status: :created, location: @curve }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_add_edge\n assert_equal(\"e1\", @e[0][:name])\n assert_equal(\"v1\", @e[1][:name])\n assert_equal(\"v2\", @e[2][:name])\n assert_equal(1, @e[0][:id])\n assert_equal(1, @g.e_id)\n assert_equal(1, @g.size)\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", {:name=>\"v2\"}) }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, {:name=>\"v1\"}, \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( {:name=>\"e1\"}, \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", \"v1\", \"v2\") }\n assert_raise(ArgumentError) { @g.add_edge( \"e1\", {:name=>\"v1\"}, \"v2\") }\n end",
"def draw_table_with_dimensions(place_at_x, place_at_y, place_at_z, top_length, top_width, top_thickness, leg_height, leg_thickness)\n # Get handles to our model and the Entities collection it contains.\n model = Sketchup.active_model\n entities = model.entities\n\n \n x1 = place_at_x\n x2 = place_at_x + top_length\n y1 = place_at_y\n y2 = place_at_y + top_width\n z = place_at_z\n \n # Create a series of \"points\", each a 3-item array containing x, y, and z.\n pt1 = [x1, y1, z]\n pt2 = [x2, y1, z]\n pt3 = [x2, y2, z]\n pt4 = [x1, y2, z]\n \n new_face = entities.add_face pt1, pt2, pt3, pt4\n new_face.pushpull top_thickness\n \n pt1 = [x1, y1, z]\n pt2 = [x1 + leg_thickness, y1, z]\n pt3 = [x1 + leg_thickness, y1 + leg_thickness, z]\n pt4 = [x1, y1 + leg_thickness, z]\n\n leg_1 = entities.add_face pt1, pt2, pt3, pt4\n leg_1.pushpull leg_height\n\n pt1 = [x2, y1, z]\n pt2 = [x2, y1 + leg_thickness, z]\n pt3 = [x2 - leg_thickness, y1 + leg_thickness, z]\n pt4 = [x2 - leg_thickness, y1, z]\n\n leg_2 = entities.add_face pt1, pt2, pt3, pt4\n leg_2.pushpull leg_height\n\n\n pt1 = [x2, y2, z]\n pt2 = [x2 - leg_thickness, y2, z]\n pt3 = [x2 - leg_thickness, y2 - leg_thickness, z]\n pt4 = [x2, y2 - leg_thickness, z]\n\n leg_3 = entities.add_face pt1, pt2, pt3, pt4\n leg_3.pushpull leg_height\n \n pt1 = [x1, y2, z]\n pt2 = [x1, y2 - leg_thickness, z]\n pt3 = [x1 + leg_thickness, y2 - leg_thickness, z]\n pt4 = [x1 + leg_thickness, y2, z]\n\n leg_4 = entities.add_face pt1, pt2, pt3, pt4\n leg_4.pushpull leg_height\n\nend",
"def add_edge( edge )\n super( edge.source, edge.target, edge )\n __add_edge__( edge )\n end",
"def add(*add_args, &add_block_arg)\n add_options = if add_args.last.is_a?(Hash) then add_args.pop else {} end\n\n (add_options[:features] ||= []) << :default if add_options.delete(:default)\n\n unless add_options.empty? || ADD_OPTION_NAMES.any? {|o| add_options.include?(o)}\n add_options = {:dependencies => add_options}\n end\n\n if add_args.first.is_a?(Symbol)\n extra_named_feature = add_args.shift\n add_options[:method_name] ||= extra_named_feature\n (add_options[:features] ||= []) << extra_named_feature\n end\n\n main_arg = add_args.shift\n case main_arg\n when Factory::Interface\n add_options[:args] = add_args unless add_args.empty?\n add_factory(main_arg, add_options, &add_block_arg)\n when ::Module\n add_options[:class] = main_arg\n add_options[:args] = add_args unless add_args.empty?\n add_new_factory(add_options, &add_block_arg)\n when NilClass\n add_new_factory(add_options, &add_block_arg)\n else\n add_instance(main_arg, add_options)\n end\n end",
"def add(*add_args, &add_block_arg)\n add_options = if add_args.last.is_a?(Hash) then add_args.pop else {} end\n\n (add_options[:features] ||= []) << :default if add_options.delete(:default)\n\n unless add_options.empty? || ADD_OPTION_NAMES.any? {|o| add_options.include?(o)}\n add_options = {:dependencies => add_options}\n end\n\n if add_args.first.is_a?(Symbol)\n extra_named_feature = add_args.shift\n add_options[:method_name] ||= extra_named_feature\n (add_options[:features] ||= []) << extra_named_feature\n end\n\n main_arg = add_args.shift\n case main_arg\n when Factory::Interface\n add_options[:args] = add_args unless add_args.empty?\n add_factory(main_arg, add_options, &add_block_arg)\n when ::Module\n add_options[:class] = main_arg\n add_options[:args] = add_args unless add_args.empty?\n add_new_factory(add_options, &add_block_arg)\n when NilClass\n add_new_factory(add_options, &add_block_arg)\n else\n add_instance(main_arg, add_options)\n end\n end"
] | [
"0.607945",
"0.60227543",
"0.5995705",
"0.5837093",
"0.5825671",
"0.5808011",
"0.57096916",
"0.56808853",
"0.56699985",
"0.5653808",
"0.5548002",
"0.5521735",
"0.55049133",
"0.54570574",
"0.5452992",
"0.5452992",
"0.54105735",
"0.53751147",
"0.53482234",
"0.5342139",
"0.53377014",
"0.53147346",
"0.52238256",
"0.51181",
"0.50876826",
"0.507252",
"0.50473905",
"0.50279677",
"0.5012382",
"0.5011194",
"0.49958816",
"0.49726412",
"0.4910558",
"0.49006554",
"0.48985684",
"0.4879659",
"0.48746023",
"0.48425046",
"0.48268676",
"0.48162216",
"0.47880456",
"0.47741455",
"0.4755116",
"0.47428104",
"0.47040918",
"0.4684921",
"0.46800137",
"0.46662164",
"0.46382505",
"0.4637763",
"0.4634461",
"0.4632729",
"0.46252266",
"0.46173677",
"0.4610733",
"0.46063745",
"0.46063745",
"0.46057722",
"0.46040127",
"0.4594255",
"0.4592701",
"0.456614",
"0.45573834",
"0.45547745",
"0.45372978",
"0.4530037",
"0.45252386",
"0.45235407",
"0.45235407",
"0.45173818",
"0.44928265",
"0.44927305",
"0.44856486",
"0.4481486",
"0.4481486",
"0.44688576",
"0.4468438",
"0.446703",
"0.44638038",
"0.44635853",
"0.44478062",
"0.4445654",
"0.44280276",
"0.44258243",
"0.439518",
"0.4385741",
"0.4367332",
"0.43527696",
"0.43501586",
"0.4343443",
"0.43106",
"0.43057305",
"0.43048432",
"0.43042803",
"0.4297767",
"0.4279761",
"0.4277191",
"0.426368",
"0.42629626",
"0.42626557"
] | 0.73204786 | 0 |
The add_group method is used to create an empty group or a group with entities. | def add_group(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_group( group )\n type_check( group, Elements::Group )\n assert( !name_defined?(name), \"name [#{name}] is already in use\" )\n \n @groups[group.name] = group\n end",
"def add_group!( group )\n save if add_group( group )\n end",
"def add_group(group, gid=nil)\n\t\t\tend",
"def add_group( group )\n raise TypeError.new('not a group') unless group.is_a?(Ecore::Group)\n tmp_group_ids = self.group_ids.split(',')\n tmp_group_ids.delete(group.id)\n tmp_group_ids << group.id\n self.group_ids = tmp_group_ids.join(',')\n true\n end",
"def add_group(group_id)\n\t\t\n\t\t# ADD ERROR CHECKING HERE FOR INVALID GROUP -> TEST\n\n\t\tself.group_list |= [group_id]\n\t\tself.update_attribute(:group_list, self.group_list)\n\t\t\n\tend",
"def add_group(name)\n unless group_exists?(name)\n self.groups.create(:name => name)\n else\n raise GroupAlreadyExists, \"The group '\" + name + \"' already exists.\"\n end\n end",
"def create\n entity = Entity.find_by(id: group_params[:entity_id]) || not_found\n group = Group.new(\n group_name: \"#{entity.entity_name} Group\",\n entity_id: group_params[:entity_id],\n creator_id: current_user.id\n )\n if group.save\n group.entity.seatgeek_import if group.events.future.empty?\n group.join_group current_user, 'admin'\n flash.keep\n flash[:notice] = 'Group created!'\n redirect_to action: 'show', id: group.id\n else\n flash.keep\n flash[:error] = 'Group could not be created.'\n redirect_to action: 'new', entity_id: params[:entity_id]\n end\n end",
"def add_to_group(group)\n self.memberships.create(group_id: group.id)\n end",
"def add_new_groups(params = {})\n post(\"/groups\", params)\n end",
"def add_ce_group\n self.refresh_access_token!\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'group.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new)\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/groups/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n group_id = GROUP_REGEX.match(@response.body)[1]\n\n @response.status == 201 ? group_id : nil\n end",
"def add_group(group)\n login unless authenticated?\n existing_group = find_group(group['name'])\n return existing_group if existing_group\n group = JSON.parse(RestClient.post(resource_url('groups'), group.to_json, :content_type => :json, :cookies => @cookies).body)\n logger.info(\"Added group: #{group['name']}\")\n group\n end",
"def add_group_as_member(group)\n self.groups.push group\n end",
"def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend",
"def createGroup\n call :createGroup\n end",
"def add_group(key)\n key = key.to_sym\n if group_or_permission(key).nil?\n @groups[key] = PermissionGroup.new(@schema, self, key)\n else\n raise Error, \"Group or permission with key of #{key} already exists\"\n end\n end",
"def group(name)\n return false unless present?(name)\n\n model.group = name\n\n Vedeu.groups.by_name(name).add(model.name)\n end",
"def group(name)\n return false unless present?(name)\n\n model.group = name\n\n Vedeu.groups.by_name(name).add(model.name)\n end",
"def add_group(name)\n return nil unless @document\n group = Xcodeproj::Workspace::GroupReference.new(name)\n elem = @document.root.add_element(group.to_node)\n yield group, elem if block_given?\n group\n end",
"def <<(group) \n @groups[group.name] = group\n end",
"def add_group(group_name, filter_argument = nil)\n groups[group_name] = filter_argument\n end",
"def new_group(group_data)\n [:id, :name].each { |attr| raise(ArgumentError, \"Missing or Invalid Parameter(s)\") unless group_data.key?(attr) }\n set_values group_data\n end",
"def group(name, &blk)\n add_child(:groups, Hubcap::Group.new(self, name, &blk))\n end",
"def add_to_group(group_path, group_name)\n group = RubyAem::Resources::Group.new(@client, group_path, group_name)\n group.add_member(@call_params[:name])\n end",
"def add_group(groupname, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{groupname}\\\"\", 'destructive') {\n\t\t\t\t\t`/usr/bin/niutil -create . /groups/#{groupname}`\n\n\t\t\t\t\tnewgroupid = gid\n\t\t\t\t\tif(newgroupid == nil)\n\t\t\t\t\t\tlastgid = `/usr/bin/nidump group . | /usr/bin/cut -d: -f3 | /usr/bin/sort -n | /usr/bin/tail -n 1`\n\t\t\t\t\t\tnewgroupid = lastgid.to_i() + 1\n\t\t\t\t\tend\t\t\t\t\n\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} gid #{newgroupid}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} users`\n\t\t\t\t}\n\t\t\tend",
"def new_group(name, sub_group_path = nil)\n group = project.new(PBXGroup)\n group.name = name\n\n target = find_subpath(sub_group_path, true)\n target.children << group\n group\n end",
"def new_group(name, sub_group_path = nil)\n group = project.new(PBXGroup)\n group.name = name\n\n target = find_subpath(sub_group_path, true)\n target.children << group\n group\n end",
"def create_entity_group\n @entity_group = EntityGroup.create!(client_id: @client_id,\n uuid: Util::Encryption::Admin.get_uuid,\n creator_admin_id: @admin_id,\n status: GlobalConstant::EntityGroup.active_status,\n activated_at: Time.now.to_i)\n end",
"def create #:nodoc:\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n if params[:create_and_new_button]\n format.html { redirect_to new_group_url }\n else\n format.html { redirect_to groups_url }\n # format.xml { render :xml => @group, :status => :created, :location => @group }\n end\n else\n format.html { render :action => \"new\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n @group = Group.new(group_params)\n @group.owner_id = current_user.id\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_node_group( node, group )\n node_obj = self.get_node_obj( node )\n group = group.to_a\n \n # verify that group(s) exists in dashboard\n group.each do |g|\n unless NodeGroup.find_by_name(g)\n return \"SKIPPED: #{node_obj.name}. No group found for #{g}\"\n end\n end\n \n # obtaining dasboard group objects \n my_groups = []\n group.each { |n| my_groups << self.get_group_obj(n) }\n \n node_obj.node_groups = my_groups\n begin\n node_obj.save!\n return \"#{node_obj.name} added to group(s) #{group.inspect}\"\n rescue Exception => e\n return \"FAILED to add #{node_obj.name} to #{group.inspect} group: #{e.message}\"\n end\n \n end",
"def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end",
"def group(name = nil)\n if name\n @groups << name\n self.class.groups[name] ||= []\n self.class.groups[name] << self\n else\n @groups\n end\n end",
"def add(name_, opts_={})\n @group._add(name_, opts_)\n end",
"def create\n\t\t@group = Group.new(params[:group])\n\t\trespond_to do |format|\n\t\t\tif fonct_new_dup?\n\t\t\t\tobject_orig=Group.find(params[:object_orig_id])\n\t\t\tst = @group.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @group.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tflash[:notice] = t(:ctrl_object_created, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tparams[:id][email protected]\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { render :xml => @group, :status => :created, :location => @group }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created, :typeobj => t(:ctrl_group), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n cu = User.find params[:user_id]\n\n @group = Group.new(params[:group])\n cu.groups << @group\n\n case params[:group_type].to_i\n when 1\n @group.groupable = ArtistGroup.create\n\n if defined?(params[:instr_id]) && (not params[:instr_id].nil?)\n m = Membership.where \"group_id = #{@group.id}\n AND userable_id = #{cu.id}\n AND userable_type = 'User'\"\n params[:instr_id].each do |i|\n m.first.instruments << Instrument.find(i)\n end\n end\n when 2\n @group.groupable = FanGroup.create :artist_group => ArtistGroup.find(params[:art_group_id].to_i)\n when 3\n @group.groupable = HostGroup.create\n end\n\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Die Gruppe wurde erfolgreich angelegt.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_group(group)\n gm = Fl::Framework::Actor::GroupMember.query_for_actor_in_group(self, group).first\n if gm.nil?\n gm = self.actor_containers.create(:group => group, :actor => self)\n end\n\n gm\n end",
"def find_or_create_group(group_data)\n @groups.each do |group|\n return group if group.id == group_data[:id]\n end\n\n new_group = OctoFeed::EventGroup.new group_data\n @groups.push new_group\n new_group\n end",
"def create\n create_params = params_for_create\n\n if group_exists?(create_params[:name])\n render_error_with_message(t('controllers.api.v1.groups.group_found'), :bad_request)\n return\n end\n\n group = @project.groups.new(name: create_params[:name])\n errors = update_article_groups(group, create_params)\n if errors\n render_errors(errors)\n return\n end\n\n respond_with @project do |format|\n format.json { render json: decorate_group(group) }\n end\n end",
"def add_group(opts)\n raise ArgumentError, \"Expected Hash or Keepassx::Group, got #{opts.class}\" unless valid_group?(opts)\n\n if opts.is_a?(Keepassx::Group)\n # Assign parent group\n parent = opts.parent\n index = last_sibling_index(parent) + 1\n @groups.insert(index, opts)\n\n # Increment counter\n header.groups_count += 1\n\n # Return group\n opts\n\n elsif opts.is_a?(Hash)\n opts = deep_copy(opts)\n opts = build_group_options(opts)\n\n # Create group\n group = create_group(opts)\n\n # Increment counter\n header.groups_count += 1\n\n # Return group\n group\n end\n end",
"def create\n @group = @group_model.new(group_params)\n respond_to do |format|\n if @group.save\n @course.groups<< @group\n format.html { redirect_to course_group_path(@course,@group), notice: \"#{@group_model.to_s} was successfully created.\" }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def group new_collection, collection, options\n @@graph.add(new_collection, collection, options.merge(operation: :group))\n end",
"def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end",
"def create\n if params[:member_id].nil?\n @group = Group.new(params[:group])\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n else\n # Add member to an group.\n # POST /members/:member_id/groups\n RAILS_DEFAULT_LOGGER.debug(\"Add member #{params[:member_id]} to group #{params[:post][:group_id]}.\")\n @member = Member.find(params[:member_id])\n @member.group << Group.find(params[:post][:group_id])\n\n respond_to do |format|\n flash[:notice] = 'Group was successfully added.'\n format.html { redirect_to(@member) }\n format.xml { render :xml => @member, :status => :created, :location => @member }\n end\n end\n end",
"def group\n @group ||= Group.new @instance, group_id\n end",
"def instructor_create_grp(course, group)\n load_course_grps course\n\n # Create new group set\n logger.info \"Creating new group set called '#{group.group_set}'\"\n (button = button_element(xpath: '//button[@id=\"add-group-set\"]')).when_present Utils.short_wait\n js_click button\n wait_for_element_and_type(text_area_element(id: 'new_category_name'), group.group_set)\n checkbox_element(id: 'enable_self_signup').check\n button_element(id: 'newGroupSubmitButton').click\n link_element(xpath: \"//a[@title='#{group.group_set}']\").when_present Utils.short_wait\n\n # Create new group within the group set\n logger.info \"Creating new group called '#{group.title}'\"\n js_click button_element(class: 'add-group')\n wait_for_element_and_type(edit_group_name_input_element, group.title)\n button_element(id: 'groupEditSaveButton').click\n link_element(xpath: \"//a[contains(.,'#{group.title}')]\").when_present Utils.short_wait\n (link = link_element(xpath: \"//a[contains(.,'#{group.title}')]/../following-sibling::div[contains(@class,'group-actions')]//a\")).when_present Utils.short_wait\n logger.info \"Group ID is '#{group.site_id = link.attribute('id').split('-')[1]}'\"\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n respond_to do |format|\n if @group.save && @group.add_user!(current_user, :admin)\n audit(@group, \"create\", @group.name)\n format.html { redirect_to :back, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_group(group)\n raise 'InvalidGroup' unless group.respond_to?(:add_user)\n # just be lazy and hand off to the group to do the work...\n group.add_user(self)\n end",
"def create\n params[:group].delete(:domain) unless current_group.shapado_version.has_custom_domain?\n @group = Group.new\n if params[:group][:languages]\n params[:group][:languages].reject! { |lang| lang.blank? }\n end\n @group.safe_update(%w[languages name legend description default_tags subdomain logo forum enable_mathjax enable_latex custom_favicon language theme signup_type custom_css wysiwyg_editor], params[:group])\n\n @group.safe_update(%w[isolate domain private], params[:group]) if current_user.admin?\n\n @group.owner = current_user\n @group.state = \"active\"\n\n respond_to do |format|\n if @group.save\n @group.create_default_widgets\n\n Jobs::Images.async.generate_group_thumbnails(@group.id)\n @group.add_member(current_user, \"owner\")\n flash[:notice] = I18n.t(\"groups.create.flash_notice\")\n format.html { redirect_to(domain_url(:custom => @group.domain, :controller => \"admin/manage\", :action => \"properties\")) }\n format.json { render :json => @group.to_json, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def insert_group(group, opts = {})\n data, _status_code, _headers = insert_group_with_http_info(group, opts)\n data\n end",
"def add_group(group, model, parent)\n group.subgroups.sort { |a,b| a[0] <=> b[0] }.each do |k, v|\n p = model.append(parent)\n p[0] = ListItem.new(k.to_s, NilClass)\n add_group(v, model, p)\n end\n group.components.sort.each do |component|\n c = model.append(parent)\n c[0] = component\n end\n end",
"def create_group(name, description, visible, owner_id=nil)\n url = \"/groups/#{name}\"\n body = {\n description: description,\n visible_to_all: visible,\n }\n body[:owner_id] = owner_id unless owner_id.nil? || owner_id.empty?\n put(url, body)\n end",
"def << group\n group.set_fleet @fleet.name\n end",
"def create(id, user_id, name)\n user = get_user(user_id)\n group = Group.new(id, user.id, name)\n @@group[id] = group\n group.add(user.id)\n return \"Group Created\"\n end",
"def create\n @group = Group.new(group_params)\n @group.owner = current_user\n\n if @group.save\n @group.add!(current_user)\n \n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def add_user_to_group(user, group)\n\t\t\tend",
"def create_entity_group\n\n @entity_group = EntityGroup.create!(\n client_id: @client_id,\n uuid: Util::Encryption::Admin.get_uuid,\n creator_admin_id: @admin_id,\n status: GlobalConstant::EntityGroup.incomplete_status\n )\n\n published_entity_group_id_to_draft_id_hash = PublishedEntityGroup.fetch_published_draft_ids(@client_id)\n\n published_entity_group_id_to_draft_id_hash.each do |entity_type, draft_id|\n\n EntityGroupDraft.create!(entity_group_id: @entity_group.id,\n entity_type: entity_type,\n entity_draft_id: draft_id\n )\n\n end\n\n success\n end",
"def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@group = Group.new(params[:group])\n\t\trespond_to do |format|\n\t\t\tif params[:fonct] == \"new_dup\"\n\t\t\t\tobject_orig=Group.find(params[:object_orig_id])\n\t\t\tst = @group.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @group.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tflash[:notice] = t(:ctrl_object_created, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { redirect_to(@group) }\n\t\t\t\tformat.xml { render :xml => @group, :status => :created, :location => @group }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created, :typeobj => t(:ctrl_group), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def group_add(client, options)\n if options[:group].nil? or options[:email].nil?\n puts \"Missing arguments\"\n return\n end\n\n group = client.groups.get options[:group]\n account = get_account(client, options)\n\n if account.nil? or group.nil?\n puts \"Account or group not found\"\n return\n end\n\n account.add_group group\n puts \"Account added to group.\"\nend",
"def add_group(group_name, filter_argument = T.unsafe(nil), &filter_proc); end",
"def create\n if(params[:group][:name].nil?) or (params[:group][:name] == \"\")\n flash[:notice] = \"Group must have a name and description\"\n redirect_to new_group_path\n else\n \n #create a new group\n @group = Group.new(group_params)\n user = User.find(session[:user_id]) \n respond_to do |format|\n if @group.save\n #generate a code for the group\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n new_code = (0...8).map { o[rand(o.length)] }.join\n @group.update(code: new_code)\n #after group is created add creator to group as leader\n Membership.create!(user_id: session[:user_id], group_id: @group.id, member_type: 'leader', username: user.username)\n format.html {redirect_to @group, notice: \"Group was successfully created.\"}\n format.json {render :show, status: :created, location: @group}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @group.errors, status: :unprocessable_entity}\n end\n end\n end\n end",
"def add_group(user)\n cmd_args = [\"'#{user.group}'\"]\n cmd_args.unshift '--system' if user.is_system\n\n groupadd_args = cmd_args.join \"\\s\"\n groupmod_args = (cmd_args - [\"--system\"]).join \"\\s\"\n\n return <<-HERE.undent\n if getent group '#{user.group}' > /dev/null 2>&1; then\n /usr/sbin/groupmod #{groupmod_args}\n else\n /usr/sbin/groupadd #{groupadd_args}\n fi\n HERE\n end",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend",
"def __mk_group(gdoc)\n @disp_dic.ext_grp unless @disp_dic.is_a? Disp::Grouping\n gatt = gdoc.to_h\n return if gatt[:enable] == 'false'\n sub = @disp_dic.add_grp(gatt.delete(:id), gatt.delete(:label))\n gdoc.each { |e| __mk_sub_db(e, sub, gatt.dup) }\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def contact_add_to_group(contact_id, group_id)\n response = xmlrpc('ContactService.addToGroup', contact_id, group_id)\n end",
"def add(type, body)\n if expired?(@begin_time)\n @auth = get_auth(@api_key)\n end\n if type == \"MozyPro\"\n body['name'] ||= 'New group'\n body =<<HERE\n {\n \"name\": \"#{body['name']}\",\n \"partner_id\": #{body['partner_id']}\n \"enable_stash\": \"Yes\"\n }\nHERE\n else\n body['name'] ||= 'New group'\n body = <<HERE\n {\n \"default_quotas\": [{\n \"type\": \"GrandFathered\",\n \"quota\": -1\n },\n {\n \"type\": \"Desktop\",\n \"quota\": -1\n },\n {\n \"type\": \"Server\",\n \"quota\": -1\n }],\n \"name\": \"#{body['name']}\",\n \"partner_id\": #{body['partner_id']}\n }\nHERE\n end\n\n Log.debug body\n\n user_group = RestClient.post \"#{@base_url}#{@add_url}\", body, header\n Log.debug('add 1 user_group')\n user_group_id = JSON.parse(user_group.body)['items'][0]['data']['id']\n end",
"def create\n ::ActiveRecord::Base.transaction do\n if group.save!\n membership = add_creator_as_group_admin!\n @side_effects << membership\n end\n end\n rescue ActiveRecord::RecordInvalid => _exception\n raise if group.valid?\n group\n end",
"def create\n @user = User.find(current_user.id)\n @group = Group.new(group_params)\n\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n respond_to do |format|\n if @group.save\n @user.groups << @group\n\n GroupCategory.new(group_id: @group.id , category_id: params[:category]).save\n\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n if @group.save\n flash[:notice] = t('flash_msg46')\n @groups = Group.all\n else\n @error = true\n end\n end",
"def create_group(attributes)\n post(\"/v1/groups\", attributes)\n end",
"def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:success] = \"Группа успешно добавлена.\"\n format.html { redirect_to @group }\n format.json { render json: @group, status: :created, location: @group }\n else\n flash.now[:error] = \"Группа с таким названием не может быть добавлена!\"\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.user = current_user\n\n respond_to do |format|\n if @group.save\n @group.add_member current_user\n flash[:notice] = '{object} was successfully {action}.'[:object_action_notice, \"Group\"[], \"created\"[]]\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_to_group group_identifier, object_identifier_or_array\n group = self.get group_identifier\n group += identifier_collect(object_identifier_or_array)\n return group\n end",
"def create\n @group = Group.new(new_group_params)\n if @group.save\n redirect_to groups_url\n else\n render :template => \"groups/new\"\n end\n end",
"def add_default_group_membership!\n return if guest?\n return if Account.global_tenant?\n\n Hyrax::Group.find_or_create_by!(name: Ability.registered_group_name).add_members_by_id(id)\n end",
"def create_group(group_name, path = '/')\n request(\n 'Action' => 'CreateGroup',\n 'GroupName' => group_name,\n 'Path' => path,\n :parser => Fog::Parsers::AWS::IAM::CreateGroup.new\n )\n end",
"def create\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.create(group_params)\n @owner = current_user\n if @group.persisted?\n flash[:green] = \"Group created!\"\n redirect_to groups_path\n else\n render root_path\n end\n end",
"def insert_group_with_http_info(group, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.insert_group ...'\n end\n # verify the required parameter 'group' is set\n if @api_client.config.client_side_validation && group.nil?\n fail ArgumentError, \"Missing the required parameter 'group' when calling UserApi.insert_group\"\n end\n # resource path\n local_var_path = '/user/groups'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(group)\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GroupResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#insert_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @group = Group.new(group_params)\n unless @group.save\n render :new and return\n end\n msg = [\"Created group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def create_group(group_node)\n name_ru = group_node.text.delete(\"0-9\")\n Group.create(name_ru: name_ru)\n end",
"def add(g)\n\t\t\[email protected](&:reset_colour)\n\t\t\t@groups << g\n\t\tend",
"def create_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :comments\n\t\t\targs[:query]['Comments'] = optional[:comments]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n @group = Group.new(group_params)\n #On vérifie que la liste de droits d'un groupe est effacé\n @group.rights.clear\n\n #On ajoute les droits choisis par un utilisateur\n params[:group][:right_ids] ||= []\n params[:group][:right_ids].each do |right|\n if !(right.blank?)\n @group.add_right(Right.find_by_id(right))\n end\n end\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: t('group.created_msg') }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_group(group, rule)\n return false unless rule.is_a?(Rule)\n @groups ||= {}\n (@groups[group] ||= []) << rule\n end",
"def save\n deleted! if @deleted\n # If there is an ID, update that entry\n if @id\n Cli.edit_group( @id, name: @name )\n else # If no ID, that means this is a new entry\n Cli.add_group( @name )\n set_id_after_save\n end\n self\n end",
"def create\n group = params[:group] || {}\n group.delete(:locales)\n group.delete(:domains)\n @group = GROUP.new(group)\n @group.current_user = current_user\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(group_url(@group.id)) }\n format.xml { render :xml => @group, :status => :created, :location => group_url(@group.id) + \".xml\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_group_array(group)\n @groups.push(group) unless @groups.include?(group)\n end",
"def create\n #redirect_to new_grouping_path if params[:grouping][:name] == ''\n #@grouping = Grouping.new(params[:grouping])\n @grouping.company_id = current_user.company_id\n\n if @grouping.save\n gflash :success => 'Group created.' \n else\n @users = []\n @root = false\n end\n \n #redirect_to edit_grouping_path(@grouping)\n respond_with(@grouping)\n end",
"def create\n @group = Group.new(group_params)\n member = Member.create\n @group.members << member\n current_user.members << member\n\n @group.owner = member\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group(name, options={})\n body = {:name => name}.merge(options)\n post(\"/groups\", :body => body)\n end",
"def create\n @add_to_group = AddToGroup.new(params[:add_to_group])\n\n respond_to do |format|\n if @add_to_group.save\n format.html { redirect_to(@add_to_group, :notice => 'Add to group was successfully created.') }\n format.xml { render :xml => @add_to_group, :status => :created, :location => @add_to_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @add_to_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.users << current_user\n \n respond_to do |format|\n if @group.save\n @group.groups_users.first.update_attribute :level, 2\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_group(name)\n join_button_for(name).fire_event(\"onclick\")\n self.linger_for_ajax(1)\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if !current_user || (!current_user.is_admin)\n format.html { redirect_to(@group, :notice => 'No permissions to create groups.')}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n elsif @group.save\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.json { render json: @group, status: :created }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_groupmember(member)\n group = @group_class.new :name => member, :node => self.node\n raise unless group.exists?\n self[:groupmembers] << group.generateduid.first \n self[:groupmembers].uniq!\n end"
] | [
"0.78047645",
"0.7677617",
"0.7557781",
"0.7521314",
"0.73256797",
"0.7212642",
"0.7210618",
"0.70623183",
"0.704614",
"0.7026123",
"0.70187205",
"0.6972481",
"0.697163",
"0.69654095",
"0.6946533",
"0.6923229",
"0.6923229",
"0.69113827",
"0.6904953",
"0.6870857",
"0.68462944",
"0.682076",
"0.67799103",
"0.67740977",
"0.6674066",
"0.6674066",
"0.6642677",
"0.6631462",
"0.662115",
"0.6614185",
"0.66040355",
"0.65986985",
"0.6590345",
"0.65883774",
"0.65764725",
"0.65661293",
"0.6535308",
"0.6534345",
"0.6528983",
"0.65133005",
"0.650511",
"0.6495324",
"0.64817864",
"0.6474875",
"0.6466708",
"0.64642984",
"0.645449",
"0.6453173",
"0.64523333",
"0.6450681",
"0.64392275",
"0.6437201",
"0.64368516",
"0.6436606",
"0.64362895",
"0.6434778",
"0.6424807",
"0.64225936",
"0.6418453",
"0.64182645",
"0.6414873",
"0.641392",
"0.64083827",
"0.64005643",
"0.6398352",
"0.63914806",
"0.6391171",
"0.6379495",
"0.6374051",
"0.63678414",
"0.6367722",
"0.6356944",
"0.63567513",
"0.6350052",
"0.6341899",
"0.6336929",
"0.63360626",
"0.63335896",
"0.6312177",
"0.6307558",
"0.62996334",
"0.62949497",
"0.62929475",
"0.6292891",
"0.62901455",
"0.62830955",
"0.6280365",
"0.62765115",
"0.6255132",
"0.6250329",
"0.62435514",
"0.624339",
"0.624289",
"0.62428254",
"0.62426966",
"0.6241897",
"0.62418306",
"0.62403345",
"0.62392354",
"0.6233733"
] | 0.7453941 | 4 |
The add_image method is used to add an image to the collection of entities. The width and height are measured in model units (i.e. inches). If the height is not given, then it is computed from the width to preserve the aspect ratio of the image. | def add_image(path, point, width, height = 0.0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(image, width:, height:, row:)\n img = Image.read(image[:filename]).first.resize_to_fill(width, height)\n @rows[row] ||= ImageList.new\n @rows[row].push(img)\n end",
"def add(image_name, type)\n image = Image.read(@folder+\"/\"+image_name)[0]\n # @width ||= image.columns\n # @height ||= image.rows\n add_type(image,type)\n @images << image\n end",
"def add_image(img)\n unless images.include?(img)\n images << img\n self.thumb_image = img unless thumb_image\n self.updated_at = Time.zone.now\n save\n notify_users(:added_image)\n reload\n end\n img\n end",
"def add(image)\n allow image\n # fix relative paths\n image.path = File.expand_path(image.path)\n @images << image\n @cache_valid = false\n nil\n end",
"def put_image(_x, _y, _image)\n @reacs[:images] << [_x, _y, _image]\n end",
"def add_image\n obtain_product_image_params\n pi = ProductImage.new(picture: @image_params)\n @product.product_images << pi\n render json: @product.simple_info, status: :ok\n rescue => e\n render json: { error: e }, status: :bad_request\n end",
"def setImage(image, width: nil, height: nil)\n @image = Asset.new(image)\n @image.resize(width, height) if (width != nil && height != nil)\n @image.applyOn(@imageBox)\n end",
"def add_image(name, data)\n elem = ElemImage.new(name, data)\n add_element(elem)\n end",
"def add_image(name, path)\n @image_manager.add_existing_image(name, path)\n end",
"def add_existing_image(name, path)\n @images << Image.new(name, path)\n end",
"def add_image(image)\n # checking for duplicates\n unless @images.has_key?(image.id)\n # add to hash map\n @images[image.id] = image\n end\n end",
"def add_image( id, image_name, x_position, speed, width, height )\n OSX::NSLog(\"Received image ##{id} (#{image_name})\")\n# image_name = OSX::NSBundle.mainBundle.pathForImageResource( image_name )\n image_name = \"/Users/alpha/src/cyberart/images/#{image_name}.jpg\"\n image = CAImage.new( id, image_name, x_position, speed, width, height )\n @semaphore.synchronize { temp_images = @images.dup }\n temp_images << image\n @semaphore.synchronize { @images = temp_images }\n end",
"def associate_image\n if !self.image_url.blank?\n self.images = []\n add_image_from_url self.image_url\n end\n end",
"def add_image(face)\n\t\t\t\ttype,bytes = get_image_bytes(face)\n\t\t\t\treturn add_image_node(type,bytes)\n\t\t\tend",
"def add_image(options={})\n if options[:end_at]\n TwoCellAnchor.new(self, options).add_pic(options)\n else\n OneCellAnchor.new(self, options)\n end\n @anchors.last.object\n end",
"def add_image\n image_url = @row[:image]\n return if image_url.blank?\n\n variant = Spree::Variant.find_by(is_master: true, product_id: @product.id)\n raise 'Product variant not found' unless variant\n\n image = Spree::Image.find_or_initialize_by viewable_id: variant.id\n return if image.id\n\n local_image = get_local_image image_url\n image.attachment = File.open(local_image, 'r')\n image.viewable_type = 'Spree::Variant'\n image.save\n end",
"def add_image(value)\n @children['image'][:value] << value\n end",
"def add_image\n pass_query_params\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n\n if !check_permission!(@observation)\n redirect_with_query(controller: \"observer\",\n action: \"show_observation\", id: @observation.id)\n elsif request.method != \"POST\"\n @image = Image.new\n @image.license = @user.license\n @image.copyright_holder = @user.legal_name\n @image.user = @user\n # Set the default date to the date of the observation\n # Don't know how to correctly test this.\n @image.when = @observation.when\n @licenses = License.current_names_and_ids(@image.license)\n init_project_vars_for_add_or_edit(@observation)\n elsif params[:upload].blank?\n flash_warning(:runtime_no_changes.t)\n redirect_with_query(controller: \"observer\",\n action: \"show_observation\", id: @observation.id)\n else\n args = params[:image]\n i = 1\n while i < 5 || params[:upload][\"image#{i}\"].present?\n process_image(args, params[:upload][\"image#{i}\"])\n i += 1\n end\n redirect_with_query(controller: \"observer\",\n action: \"show_observation\", id: @observation.id)\n end\n end",
"def add_image(name, image_path, options = {})\n image = TkPhotoImage.new(file: image_path)\n add_widget Tk::Tile::Label, name, nil, options.merge(image: image)\n end",
"def create_image(image)\n self.images.create(image: image) if image.present?\n end",
"def course_image_medium(entity, add_options = {})\n return '' if entity.image.blank?\n\n alt_text = entity.image_alt_text.to_s\n versions = \"#{entity.image.big.url} 2x\"\n options = { alt: alt_text, srcset: versions }.merge(add_options)\n image_tag(entity.image.medium.url, options)\n end",
"def image=(img)\n @image_view.image = img\n #@image_view.sizeToFit\n end",
"def set_image\n @image = Image.find(params[:id]).decorate\n end",
"def resizeImage(width,height)\n if @image != nil\n @image.resize(width,height)\n @image.applyOn(@imageBox)\n end\n end",
"def add_image_node(imageType, image_bytes)\n\t\t\t\tif imageType == 'jpg'\n\t\t\t\t\timageType = 'jpeg'\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif imageType != 'jpeg' && imageType != 'png'\n\t\t\t\t\t# it is generally fatal to the glTF viewer if the image is not a JPEG or PNG.\n\t\t\t\t\[email protected](\"image/\" + imageType + ' ' + TRANSLATE('UnsupportedImage'))\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t#puts \"Writing image buffer with index \" + @buffer_index.to_s\n\t\t\t\toffset = @buffers.add_or_append_buffer(@buffer_index, image_bytes, 1)\n\t\t\t\tview = @buffer_views.add_buffer_view(@buffer_index, offset, image_bytes.length, nil, nil)\n\t\t\t\t#@buffer_index = @buffer_index + 1\n\t\t\t\t\n\t\t\t\timage =\n\t\t\t\t{\n\t\t\t\t\t\"bufferView\" => view,\n\t\t\t\t\t\"mimeType\"=> \"image/\" + imageType\n\t\t\t\t}\n\t\t\t\tindex = @images.length\n\t\t\t\[email protected](image)\n\t\t\t\treturn index\n\t\t\tend",
"def append_image(image)\n image_ele = @image_ele.clone\n image_ele.at(\".//v:shape\").attributes[\"style\"].value = \"width:#{image.width}pt;height:#{image.height}pt\"\n image_ele.at(\".//v:imagedata\").attributes[\"id\"].value = \"rId#{@rid_index}\"\n image_rel = @image_rel.clone\n image_rel.attributes[\"Id\"].value = \"rId#{@rid_index}\"\n image_rel.attributes[\"Target\"].value = \"media/image#{@rid_index}.#{image.file_type}\"\n FileUtils.cp(image.file_name, \"public/downloads/#{@filename}/blank_doc/word/media/image#{@rid_index}.#{image.file_type}\")\n @rel_doc.at('.//xmlns:Relationships').add_child(image_rel)\n @rid_index += 1\n\n last_para = @main_doc.xpath('.//w:p')[-1]\n last_para.add_child(image_ele)\n end",
"def image=(img)\n @image__ = img\n end",
"def create_image(name, options = {})\n ImageCollection.new(:config => config).\n create(options.merge(:instance_id => id,\n :name => name))\n end",
"def image(key, image_path, options = {})\n # Idea from here http://itext.ugent.be/library/question.php?id=31 \n # Thanks Bruno for letting me know about it.\n img = Image.get_instance(image_path)\n coords = @form.get_field_positions(key.to_s)\n rect = coords[0].position\n img.set_absolute_position(rect.left, rect.bottom)\n img.scale_to_fit(rect)\n image_content = @stamp.get_over_content(options.fetch(:page, 1))\n image_content.add_image(img)\n end",
"def register_new_image(image, xml_node, data_item)\n image.set_path(data_item)\n image.is_new = true\n image.id, image.target = @relationship_manager.new_relationship(:image, image.path)\n image.replace_new_image_id!(xml_node, data_item)\n @images << image\n image\n end",
"def add_images( record )\n\n #save_if_new\n\n # different versions have moved images around from Prod to Variant\n owner = DataShift::SpreeHelper::get_image_owner(record)\n\n get_each_assoc.each do |image|\n\n #TODO - make this Delimiters::attributes_start_delim and support {alt=> 'blah, :position => 2 etc}\n\n path, alt_text = image.split(Delimiters::name_value_delim)\n\n path = @options[:image_prefix] + path\n\n puts \"DEBUG : Creating attachment #{path} (#{alt_text})\"\n # create_attachment(klass, attachment_path, record = nil, attach_to_record_field = nil, options = {})\n attachment = create_attachment(@@image_klass, path, nil, nil, :alt => alt_text)\n\n owner.images << attachment\n\n logger.debug(\"Product assigned Image from : #{path.inspect}\")\n end\n\n record.save\n\n end",
"def add_image(pic, img_loc_text, stock_images=nil)\n pic.photo = File.open(Rails.root.join('db', 'images', get_stock_image(img_loc_text, stock_images)))\n pic\n end",
"def getImg(width=64, height=64)\n if self.image\n self.image+\"?width=#{width}&height=#{height}\"\n else\n \"no_image.png\"\n end\n end",
"def add_image(title, text, filename)\n image = File.open(filename, \"rb\") { |io| io.read }\n hashFunc = Digest::MD5.new\n hashHex = hashFunc.hexdigest(image)\n\n data = Evernote::EDAM::Type::Data.new()\n data.size = image.size\n data.bodyHash = hashHex\n data.body = image\n\n resource = Evernote::EDAM::Type::Resource.new()\n resource.mime = \"image/png\"\n resource.data = data;\n resource.attributes = Evernote::EDAM::Type::ResourceAttributes.new()\n resource.attributes.fileName = filename\n\n note = Evernote::EDAM::Type::Note.new()\n note.title = title\n note.notebookGuid = self.guid\n note.content = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' +\n '<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">' +\n '<en-note>' + text +\n '<en-media type=\"image/png\" hash=\"' + hashHex + '\"/>' +\n '</en-note>'\n note.resources = [ resource ]\n\n Everton::Remote.note_store.createNote(Everton::Remote.access_token, note)\n end",
"def create\n flash[:notice] = 'Image Created' if @owner.images << @image\n respond_with @owner, @image\n end",
"def course_image_small(entity, add_options = {})\n return '' if entity.image.blank?\n\n alt_text = entity.image_alt_text.to_s\n versions = \"#{entity.image.medium.url} 2x\"\n options = { alt: alt_text, srcset: versions }.merge(add_options)\n image_tag(entity.image.small.url, options)\n end",
"def attach\n return unless (@observation = find_observation!)\n\n return unless check_observation_permission!\n\n image = Image.safe_find(params[:img_id])\n unless image\n flash_error(:runtime_image_reuse_invalid_id.t(id: params[:img_id]))\n # redirect_to(:reuse) and return\n render(:reuse,\n location: reuse_images_for_observation_path(@observation.id))\n return\n end\n\n attach_image_to_observation(image)\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_add_image_to_review\n @add_image_to_review = AddImageToReview.find(params[:id])\n end",
"def add_photo(img_url)\n self.photos << img_url\n end",
"def initialize_image_resource image, x, y, width, height, z_index\n resource = ImageResource.new\n resource.x = x\n resource.y = y\n resource.type = \"image\"\n resource.image = image\n resource.z_index = z_index\n resource.scale_x = width / image.width\n resource.scale_y = height / image.height\n\n resource\nend",
"def fit_image(*args)\n @p.fit_image(self, *args)\n end",
"def image\n end",
"def image\n end",
"def create_listing_image(params)\n image = self.listing_images.create!(params)\n image.update_attributes(publicly_visible: false, category: 'home', caption: '')\n\n image\n end",
"def ajouterImage(image,position)\r\n\t\tposition = @justification[position]\r\n\t\t\r\n\t\[email protected] = position\r\n\t\t\r\n\t\[email protected](\r\n\t\t\tfileName = image,\r\n\t\t\tlinkToFile = false,\r\n\t\t\tsaveWithDocument = true\r\n\t\t)\r\n\tend",
"def insert_image(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n row = args[0]\n col = args[1]\n image = args[2]\n x_offset = args[3] || 0\n y_offset = args[4] || 0\n scale_x = args[5] || 1\n scale_y = args[6] || 1\n\n raise \"Insufficient arguments in insert_image()\" unless args.size >= 3\n raise \"Couldn't locate #{image}: $!\" unless test(?e, image)\n\n @images[row] = {\n col => [ row, col, image, x_offset, y_offset, scale_x, scale_y]\n }\n\n end",
"def add_image # :prefetch: :norobots:\n pass_query_params\n if @observation = find_or_goto_index(Observation, params[:id].to_s)\n if !check_permission!(@observation)\n redirect_to(:controller => 'observer', :action => 'show_observation',\n :id => @observation.id, :params => query_params)\n elsif request.method != :post\n @image = Image.new\n @image.license = @user.license\n @image.copyright_holder = @user.legal_name\n @image.user = @user\n # Set the default date to the date of the observation\n # Don't know how to correctly test this.\n @image.when = @observation.when\n @licenses = License.current_names_and_ids(@image.license)\n init_project_vars_for_add_or_edit(@observation)\n else\n args = params[:image]\n i = 1\n while i < 5 or !params[:upload][\"image#{i}\"].blank?\n process_image(args, params[:upload][\"image#{i}\"])\n i += 1\n end\n redirect_to(:controller => 'observer', :action => 'show_observation',\n :id => @observation.id, :params => query_params)\n end\n end\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def set_image\n @image = Image.find(params[:id])\n end",
"def add_images\n\t\tif @current_user.present?\n\t\t\t@property = Property.find(params[:property_id])\n\t\t\tif @property.present?\n\t\t\t\t# if @property.images.present?\n\t\t\t\t# \[email protected]_all\n\t\t\t\t# end\n\t\t\t\tparams[:images].each { |image|\n\t i = @property.images.create(image: image)\n\t if i.save\n\t else\n\t \trender_json({\"status\" => \"Fail\", \"message\" => i.errors.full_messages.first}.to_json)\n\t \treturn\n\t end\n\t }\n\t @property.images.first.update_attributes(is_starred: true)\n\t render :file => 'api/v1/property/add_image'\n\t else\n\t \trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n\t end\n\t\tend\n\tend",
"def putImage(imgPath, &block)\n mimeType = MimeMagic.by_magic(File.open(imgPath))\n if mimeType.subtype == \"svg+xml\"\n # Special handling for SVG images -- no width/height\n return { asset_id: putAsset(imgPath, {}),\n image_type: mimeType.subtype\n }\n else\n mimeType && mimeType.mediatype == \"image\" or raise(\"Non-image file #{imgPath}\")\n dims = FastImage.size(imgPath)\n block and block.yield(dims)\n return { asset_id: putAsset(imgPath, { width: dims[0].to_s, height: dims[1].to_s }),\n image_type: mimeType.subtype,\n width: dims[0],\n height: dims[1]\n }\n end\nend",
"def add_image \n image = CARMD.image(self.vin)\n if image == \"\"\n image = \"http://clipart-library.com/img/2050778.png\"\n end\n self.auto_image = image \n self.save \n end",
"def image\n image = Weatherman::Image.new(attribute('image'))\n do_convertions(image, [:width, :to_i], [:height, :to_i], :title, :link, :url)\n end",
"def add_image(image_path, page, x, y, scale=1.0)\n raise ReadOnlyError.new('Previously saved pdfs are read-only') if @saved\n canvas = @stamper.getOverContent(page)\n image = Image.getInstance(image_path)\n image.setAbsolutePosition(x, y)\n image.scalePercent(scale * 100)\n canvas.addImage(image, false)\n end",
"def add_images(branch, dest, image_files, author)\n repo = satelliterepo\n repo.checkout(branch) unless repo.empty?\n new_images repo, dest, image_files\n commit_id = satellite_commit(\n repo,\n get_message(image_files),\n author,\n branch\n )\n f = File.join(dest.to_s, image_files.last.original_filename)\n generate_thumbnail f, commit_id\n inspire_image if branch == 'master'\n repo.checkout('master')\n end",
"def add_images(branch, dest, image_files, author)\n repo = satelliterepo\n repo.checkout(branch) unless repo.empty?\n new_images repo, dest, image_files\n commit_id = satellite_commit(\n repo,\n get_message(image_files),\n author,\n branch\n )\n f = File.join(dest.to_s, image_files.last.original_filename)\n generate_thumbnail f, commit_id\n repo.checkout('master')\n end",
"def create_nested_image\n issue_image = Image.create!(image_params)\n issue_image.imageable = @issue\n end",
"def drawimage(xmin, xmax, ymin, ymax, width, height, data, model = 0)\n super(xmin, xmax, ymin, ymax, width, height, uint(data), model)\n end",
"def drawimage(xmin, xmax, ymin, ymax, width, height, data, model = 0)\n super(xmin, xmax, ymin, ymax, width, height, uint(data), model)\n end",
"def create\n @image = Image.new(image_params)\n\n # fetch tags from google vision API\n helpers.fetch_tags(image_params)\n\n @image.image_file.attach(image_params[:image_file])\n\n respond_to do |format|\n if @image.save()\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_picture(picture)\n end",
"def add_image_to_review_params\n params.require(:add_image_to_review).permit(:name, :description, :image)\n end"
] | [
"0.67709774",
"0.66723883",
"0.65400517",
"0.64525163",
"0.6210892",
"0.61730367",
"0.6156595",
"0.6053683",
"0.60005337",
"0.5987973",
"0.59079516",
"0.59069675",
"0.58782625",
"0.58615",
"0.5793552",
"0.5763738",
"0.5761043",
"0.5760526",
"0.56819385",
"0.56551224",
"0.56413555",
"0.5569218",
"0.55317897",
"0.54858077",
"0.54723775",
"0.54723585",
"0.54599756",
"0.5445013",
"0.54424024",
"0.5428772",
"0.54279226",
"0.54227716",
"0.53963506",
"0.53802896",
"0.5377859",
"0.53702366",
"0.5359848",
"0.534861",
"0.53352517",
"0.5329467",
"0.5324565",
"0.53095037",
"0.5300962",
"0.5300962",
"0.52988464",
"0.5297356",
"0.5295661",
"0.5293412",
"0.52852213",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284764",
"0.5284332",
"0.5284092",
"0.5280189",
"0.5277649",
"0.52759886",
"0.5266076",
"0.5265183",
"0.52638555",
"0.5263104",
"0.52473587",
"0.52473587",
"0.5245551",
"0.52433014",
"0.5240997"
] | 0.65669537 | 2 |
The add_instance method adds a component instance to the collection of entities. | def add_instance(definition, transform)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_instance(instance)\n self.save unless self.persisted?\n instance.ie = self\n self.instances << instance\n instance.save && self.save\n end",
"def add_component(component)\n\t\t@components << component\n\tend",
"def add_component(component)\n add_to(component, @components)\n end",
"def add_instance(instance)\n register_response = client.register_instances_with_load_balancer(load_balancer_name: name,\n instances: [{instance_id: instance.ec2_instance_id}])\n remaining_instance_count = register_response.instances.size\n puts \"Added #{instance.hostname} to ELB #{name}. Attached instances: #{remaining_instance_count}\".light_blue\n _wait_for_instance_health_check(instance)\n end",
"def ui_add(component)\n add component\n end",
"def add_component( component, **init_values )\n\t\tself.world.add_component_to( self, component, **init_values )\n\tend",
"def add(entity)\n\t\t# TODO: set entity ID when adding to Space\n\t\t# (without a proper unique ID, serialization will not work. without serialization, we can't roll back history.)\n\t\t@entities << entity\n\t\t\n\t\t\n\t\t@cp_space.add_shape(entity.shape)\n\t\t@cp_space.add_body(entity.body)\n\tend",
"def add_to_instances\n instances.each do |ins|\n if ins.ie.nil?\n ins.ie = self\n ins.save\n end\n end\n end",
"def add_instance_item(item)\n container = item_container(item.class)\n container[item.template_id] ||= 0\n container[item.template_id] += 1\n container[item.id] = 1\n container_list = item_container_list(item)\n container_list.push(item)\n end",
"def add( component_type, *init_args )\n\t\tself.components[ component_type ] = init_args\n\tend",
"def <<(entity)\n reg_id = entity.registry_id\n if old = self[reg_id]\n fire_duplicate_id(old, entity)\n old\n else\n @registry[reg_id] = entity\n entity_list(entity) << entity\n add_entity_to_grid(entity)\n entities_bordering_entity_at(entity.x, entity.y).each(&:wake!)\n entity\n end\n end",
"def add(klass, position = registered_items.size)\n self.instance.add(klass, position)\n end",
"def add_instance(instance, options={})\n features = options[:features]\n factory = case features\n when nil then Factory::FromInstance.new(instance)\n when Array then Factory::FromInstance.new(instance, *features)\n else Factory::FromInstance.new(instance, features)\n end\n add_factory_instance(factory, options)\n end",
"def add_instance(instance, options={})\n features = options[:features]\n factory = case features\n when nil then Factory::FromInstance.new(instance)\n when Array then Factory::FromInstance.new(instance, *features)\n else Factory::FromInstance.new(instance, features)\n end\n add_factory_instance(factory, options)\n end",
"def add_instance(params)\n Fog::Logger.deprecation(\n \"#{self.class}.#{__method__} is deprecated, use Fog::Compute::Google::InstanceGroup.#{__method__} instead [light_black](#{caller(0..0)})[/]\"\n )\n params[:instance] = [params[:instance]] unless params[:instance] == Array\n service.add_instance_group_instances(params[:group], params[:zone], params[:instance])\n end",
"def add(component, options = {})\n case component\n when Hash\n component.each_with_object({}) { |pair, r| r[pair[0]] = add(*pair) }\n when Symbol\n @world.add_component(self, Component.manager.fetch(component).new(options))\n else\n @world.add_component(self, component)\n end\n end",
"def attach_component(entity, component)\n\t\tinterface = component.class.interface\n\t\t\n\t\texisting_component = entity[interface]\n\t\tif existing_component\n\t\t\tentity.delete_component(interface)\n\t\tend\n\t\t\n\t\tentity.add_component(component)\n\tend",
"def add_instance(opts)\n unless %w[app util].include?(opts[:role].to_s)\n # Fail immediately because we don't have valid arguments.\n raise InvalidInstanceRole, \"Instance role must be one of: app, util\"\n end\n\n # Sanitize the name to remove whitespace if there is any\n if opts[:name]\n name = opts[:name].gsub(/\\s+/, '')\n end\n\n if opts[:role] == 'util'\n unless name && name.length > 0\n raise InvalidInstanceName, \"When specifying a util instance you must also specify a name.\"\n end\n end\n \n request = { \"role\" => opts[:role], \"name\" => opts[:name] }\n request['snapshot_id'] = opts[:snapshot_id] if opts.key?(:snapshot_id)\n request['instance_size'] = opts[:instance_size] if opts.key?(:instance_size)\n\n # We know opts[:role] is right, name can be passed straight to the API.\n # Return the response body for error output, logging, etc.\n return api.post(\"/environments/#{id}/add_instances\", :request => request)\n end",
"def <<(instance)\n @extent << instance\n end",
"def add_component(component)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if component.handle.ptr == nil\n raise \"component is disposed\"\n end\n Native.LayoutEditor_add_component(@handle.ptr, component.handle.ptr)\n component.handle.ptr = nil\n end",
"def add(component)\n @children.push(component)\n component.parent = self\n end",
"def add(component)\n @children.append(component)\n component.parent = self\n end",
"def add_room_instance_id room_instance_id\n raise \"#{room_instance_id} is already a room_instance_id and must be unique\" if get_attribute(:room_instance_ids).include? room_instance_id\n get_attribute(:room_instance_ids) << room_instance_id\n nil\n end",
"def add(component)\n raise NotImplementedError, \"#{self.class} has not implemented method '#{__method__}'\"\n end",
"def add(component)\n raise NotImplementedError, \"#{self.class} has not implemented method '#{__method__}'\"\n end",
"def add item, config={}\n @components ||= []\n @components << item\n if config\n @item_config[item] = config\n end\n self\n end",
"def add entity\n @body.push(entity)\n end",
"def _add_component comp #:nodoc:\n end",
"def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end",
"def add_component(child_component)\n @child_components << child_component\n\n on_component_added(child_component)\n\n child_component\n end",
"def add component, title\n component.row = @row+@row_offset+0 # FFI changed 1 to 0 2011-09-12 \n component.col = @col+@col_offset+0 # FFI changed 1 to 0 2011-09-12 \n component.width = @width-2\n component.height = @height-2\n component.form = @form\n component.override_graphic(@graphic)\n @current_component = @bmanager.add component, title\n set_current_component\n set_form_row ## FFI added 2011-09-12 to get cursor at start when adding\n $log.debug \" ADD got cb : #{@current_component} \"\n end",
"def add(*elmts)\n elmts.each do |elmt|\n @components.add(elmt)\n end\n end",
"def create_instance_children(instance)\n # Add children to component\n if children\n children.each do |child|\n instance.add_child(child.create())\n end\n end\n end",
"def addComponents components\r\n\t\t\r\n\t\t\tif components.is_a? IncrementalValue\r\n\t\t\t\tcomponents = components.get_value self\r\n\t\t\tend\r\n\t\t\r\n\t\t\tcomponents.each do |x|\r\n\t\t\t\[email protected] x\r\n\t\t\tend\r\n\t\t\r\n\t\tend",
"def save(instance)\n @pstore.transaction do\n @registry << instance\n @pstore[:registry] = @registry\n end\n end",
"def add_available_component(component)\n if available_components.include?(component.name)\n raise ArgumentError, \"Component already '#{component.name}' already defined\"\n end\n available_components[component.name] = component\n end",
"def push(component)\n case component\n when Vevent, Vtodo, Vjournal\n @components << component\n else\n raise ArgumentError, \"can't add a #{component.type} to a calendar\"\n end\n self\n end",
"def add_entity\n e = NSEntityDescription.new\n yield e\n register_entity(e)\n end",
"def add_other(instance)\n # Throw error when instance has empty channel\n fail ::ArgumentError, 'Channel is required' unless instance.channel\n\n # Add\n requests << instance\n end",
"def add(el)\n raise NotImplementedError\n end",
"def add!(tenant_id,entity_type_id,entity_id,tags)\n @instance.add!(tenant_id,entity_type_id,entity_id,tags)\n update_tag_count(tenant_id,tags)\n end",
"def add_child(component)\n \[email protected](component)\n \tputs \"Adding parent of #{component.class} to #{self.class}\"\n \tcomponent.parent = self\n end",
"def addVehicle _obj, _args\n \"_obj addVehicle _args;\" \n end",
"def add(obj)\n @set.addObject obj\n end",
"def add(o); addObject o end",
"def add(object)\n @inventory << object\n\n object.container = @game_object_id\n\n if object.is_a? Player or object.is_a? Mobile\n object.update_display\n end\n end",
"def add_song(song_instance)\n songs << song_instance\n end",
"def add_element\n @inner_page = Embeddable::InnerPage.find(params['id'])\n @page = Page.find(params['page_id'])\n @container = params['container'] || 'elements_container'\n\n # dynamically instantiate the component based on its type.\n component_class = params['class_name'].constantize\n if component_class == Embeddable::DataCollector\n if probe_type_id = session[:last_saved_probe_type_id]\n probe_type = Probe::ProbeType.find(probe_type_id)\n @component = Embeddable::DataCollector.new\n @component.probe_type = probe_type\n @component.save\n else\n @component = Embeddable::DataCollector.create\n end\n session[:last_saved_probe_type_id] = @component.probe_type_id\n else\n @component = component_class.create\n end\n @component.pages << @page\n @component.user = current_visitor\n @component.save\n @element = @page.element_for(@component)\n @element.user = current_visitor\n @element.save\n # @element.update_investigation_timestamp\n @page.reload\n if params['static']\n render :partial => \"static_page\", :locals => {:page => @page, :inner_page => @inner_page}\n else\n render :partial => \"page\", :locals => {:page => @page, :inner_page => @inner_page}\n end\n end",
"def add_child(component)\n @children.push(component)\n component.parent = self\n end",
"def add_instance_hook(hook, &block)\n instance_hooks(hook).send(BEFORE_HOOKS.include?(hook) ? :unshift : :push, block)\n end",
"def add_to_products\n \t@@products << self\n \tend",
"def add(tag, klass, position = -1)\n self.instance.add(tag, klass, position)\n end",
"def add(object)\n @objects << object\n end",
"def register(instance)\n key = build_key(instance)\n key_registry[key] = instance\n end",
"def add_entity(name, type, definition, x, y)\n entity = Entity.new\n entity.type = type\n entity.definition = definition\n entity.set_tool_tip_text definition\n\n if name.empty? || name.nil?\n name = \"untitled\"\n else\n entity.name = name\n end\n\n entity.set_bounds x, y, ENTITY_WIDTH, ENTITY_HEIGHT\n @panel.add entity\n\n entity.add_mouse_listener @select_action\n entity.add_component_listener @move_action\n @entities << entity\n @cm.register_component entity\n\n @panel.repaint\n entity\n end",
"def object=(obj)\n if obj\n @object = obj\n obj.components << self\n end\n end",
"def add_new_instances(count)\n Output.new(current_instances + parent.create_instances(count), []) \n end",
"def add(klass)\n @models << klass\n end",
"def run_instance options = {}\n instances = InstanceCollection.new(:config => config)\n instances.create(options.merge(:image => self))\n end",
"def insert_object g\n @objects.add g\n end",
"def add\n end",
"def add\n end",
"def insert(entity)\n @service.insert_entity(self, entity)\n end",
"def add(item)\n raise I18n.t('error.bad_class') unless item.instance_of?(Item)\n raise I18n.t('error.empty') if item.empty?\n\n @data.push(item)\n end",
"def add( *args )\n args.each do |arg|\n case( arg )\n when Symbol\n @contents << arg unless @contents.include?( arg )\n when Component\n @contents << arg\n else\n raise \"Invalid host #{name} addition: #{arg.inspect}\"\n end\n end\n end",
"def add_game game\n @game_objects.push game\n update_record game\n end",
"def register domain_model_instnace\n\t\t@domain_model_instnaces.push domain_model_instnace\n\tend",
"def add_tag\n\t type=params['class']\n\t id=params['id']\n\t obj=Object.const_get(type).find(id)\n\t obj.tag_list.add(params['tag'])\n\t obj.save\n\t redirect_to :back \n end",
"def add_entity(klass, parent_id, params={})\n path = \"add_#{klass.basename}/#{parent_id}\"\n return klass.new(client.post(path, params))\n end",
"def <<(value)\n raise ArgumentError unless value.kind_of?(ValidKlass)\n list[value.name] = value\n end",
"def add_entity(entity)\n key = \"contacts_for:#{entity.id}\"\n @redis.sadd(key, self.id)\n end",
"def add_item(item, amount)\n # Check if the Entity already has that item\n # in the inventory. If so, just increase\n # the amount.\n @inventory.each do |couple|\n if (couple.first == item)\n couple.second += amount\n return\n end\n end\n # If not already in the inventory, push a Couple.\n @inventory.push(Couple.new(item, amount))\n end",
"def add(course_object)\n self.items << course_object\n end",
"def _add(plugin)\n @plugins << PluginWrapper.new(plugin)\n end",
"def add_to_instances\n # Store only those interceptions that are not marked to be used for existing methods only\n return if options[:existing_methods_only]\n\n interceptions_storage = context.instance_variable_get(:@interceptions_storage)\n unless interceptions_storage\n interceptions_storage = InterceptionsStorage.new\n context.instance_variable_set(:@interceptions_storage, interceptions_storage)\n end\n interceptions_storage << self\n end",
"def add_item(title, price, quantity = 1)\n @total += price*quantity\n @instance_items << [title, price, quantity]\nend",
"def add_entity_to_grid(entity)\n cells_overlapping(entity.x, entity.y).each {|s| s << entity }\n end",
"def add( item)\n\t\titem.addtag self.gettag\n\tend",
"def instance=(instance); end",
"def << *list\n @collection ||= []\n if invalid = list.reject {|record| valid_target_instance?(record)} and !invalid.empty?\n raise ArgumentError, \"invalid object, expecting #{target.class_name} got #{invalid}\"\n end\n @collection += list\n end",
"def add(*args, &block)\n all << new(*args, &block)\n end",
"def add(menu_component)\n\t\traise UnssoportedOperationError, \"this operation must be implemented in subclasses\"\n\tend",
"def add_component(name, level)\n descriptor = @loader.find(name)\n end",
"def _active_add_facade! cls, new_target = nil\n @mutex.synchronize do\n target = new_target || \n (Proc === @target ? @target.call : @target.dup)\n @target_list << cls.new(target)\n end\n end",
"def add(content)\n raise NotImplementedError\n end",
"def add_product(product)\n products << product\n # save\n end",
"def add(attribute, value)\n update(attribute => public_send(attribute).dup << value)\n end",
"def add_pet(pet)\n\t\t@pets_list << pet\n\tend",
"def copy(entity)\n entity.components.each do |component|\n add(component.as_inheritance)\n end\n end",
"def add_entities(entity_characteristics)\n type, x, y, radius = entity_characteristics\n @entities << Entity.new(type, x, y, radius)\n end",
"def add_entities(entity_characteristics)\n type, x, y, radius = entity_characteristics\n @entities << Entity.new(type, x, y, radius)\n end",
"def add(interactor)\n interactors << interactor\n end",
"def add(*arguments)\n Element.parse(arguments.flatten, @options).each do |element|\n data << element.added_to_bibliography(self)\n end\n self\n end",
"def add!(code)\n product = @store.find_product(code)\n fail 'ProductInvalid' unless product\n @products << product\n product\n end",
"def add(class_name, object)\n @data = get_all()\n \n @data[class_name].push(object.to_hash())\n \n save()\n end",
"def addItem(item)\n @items << item\n end",
"def element_add\r\n @env.issue.element_add @meta.element_add ElementAdd.new(@env).insert @is.element_add\r\n end",
"def add (person)\n if person.is_a? Person\n @lists << person\n else\n raise \"Only objects that are relate to class Person can only be entered in the address book.\"\n end\n end",
"def add_this(instance)\n if (@state & SELF_RECURSION_IN_THIS) == 0\n @state = @state | SELF_RECURSION_IN_THIS if map_put(this_map, instance)\n end\n @state\n end",
"def add obj\n\t\t\t@objs2 += [obj] \n\t\tend"
] | [
"0.70564353",
"0.6376215",
"0.61957175",
"0.59978765",
"0.5875745",
"0.58658016",
"0.57949764",
"0.5740524",
"0.5708422",
"0.5647735",
"0.5628591",
"0.5605202",
"0.55653596",
"0.55653596",
"0.55502313",
"0.5512318",
"0.55114806",
"0.54937786",
"0.54903364",
"0.54449373",
"0.5428186",
"0.542563",
"0.5420413",
"0.5380789",
"0.5380789",
"0.5368791",
"0.5296911",
"0.52608746",
"0.52342206",
"0.5228929",
"0.5198603",
"0.5197952",
"0.51911455",
"0.5173779",
"0.51704025",
"0.51369846",
"0.510849",
"0.50810224",
"0.5073959",
"0.5016067",
"0.49996492",
"0.49899182",
"0.49850783",
"0.49723658",
"0.49714056",
"0.49650276",
"0.49493915",
"0.49441284",
"0.4934782",
"0.49341866",
"0.4914993",
"0.49118093",
"0.49111557",
"0.49106264",
"0.49105838",
"0.48982394",
"0.4883992",
"0.48795092",
"0.4871527",
"0.4868699",
"0.4840581",
"0.4840581",
"0.4826932",
"0.48268387",
"0.4796022",
"0.47947034",
"0.47936448",
"0.47909883",
"0.47737852",
"0.47736782",
"0.47733438",
"0.4761193",
"0.47596708",
"0.4756794",
"0.47489062",
"0.47474933",
"0.47441748",
"0.4742945",
"0.474015",
"0.4732479",
"0.47318128",
"0.4719759",
"0.47123682",
"0.4710707",
"0.47036615",
"0.46917295",
"0.46747848",
"0.46733156",
"0.4650879",
"0.46506748",
"0.46506748",
"0.4650406",
"0.46498778",
"0.46371424",
"0.46367297",
"0.463572",
"0.4633375",
"0.46311533",
"0.46274194",
"0.4626976"
] | 0.551347 | 15 |
The add_line method is used to add an edge to the collection of entities. This is not to be confused with the concept of a "line" from a geometric sense, which is an invisible object represented by an Array of a point and a vector. (See the Array class for more information on geometric lines in SketchUp.) This method is the same as add_edges method, but returns a single edge. | def add_line(point1, point2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_line(line)\n @lines << line\n line\n end",
"def add_line(line)\n\t\t@lines << line\n\tend",
"def add_edge(e)\n @edges[e.from] << e\n end",
"def add_line\n @layout.add_widget(HLine.new)\n end",
"def add_line_item(args=nil)\n line_item = Wheretocard::LineItem.new(args)\n line_items << line_item\n return line_item\n end",
"def find_edge_intersecting_with_line(poly_verts, line_start, line_end)\n count = poly_verts.count\n\n poly_verts.each_with_index do |face_start, i|\n face_end = poly_verts[(i+1) % count]\n\n contact_loc = line_line_intersection(face_start, face_end, line_start, line_end)\n\n if contact_loc\n edge = Edge.new(face_start, face_end)\n edge.contact_loc = contact_loc\n return edge\n end\n end\n\n nil\n end",
"def add_edge(*e)\n raise InvalidArgumentError if e.size > 2\n \n e = [e] if e.size == 2\n @edges.add(e[0])\n end",
"def add(context, line)\n\t\t\t@lines << @line.new(context, line)\n\t\tend",
"def add_edge(edge)\n @edges.push(edge)\n end",
"def add_line(line)\n @entries << line\n end",
"def add_edge(source, target, edge = Edge.new)\n _clear_cache\n @pathway.append(Bio::Relation.new(source, target, edge))\n edge\n end",
"def line(&block)\n attributes[:lines] << Line.build(&block)\n end",
"def add(edge)\n source = edge.source\n if @contained_vertices.include? source\n @vertex_array.at(source).add_edge(edge)\n else\n new_vertex = Vertex.new(source)\n new_vertex.add_edge(edge)\n @contained_vertices.push(source)\n if @vertex_array.size < source\n @vertex_array.insert(source, new_vertex)\n else\n @vertex_array[source] = new_vertex\n end\n end\n end",
"def add_line_item(line_item)\n raise(TypeError) unless line_item.is_a?(LineItem)\n @line_items << line_item if line_item.validate\n end",
"def line\n @line ||= Line.get(@attrs['Line'])\n end",
"def addline(line, order)\n\t\t#steps.create(installation_id: self, line_id: line.id, order: order)\n\t\tactive_steps.create(line_id: line.id, order: order)\n\tend",
"def line\n @line ||= Line.get(@attrs['LineCode'])\n end",
"def get_telephony_providers_edges_line_with_http_info(line_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TelephonyProvidersEdgeApi.get_telephony_providers_edges_line ...\"\n end\n \n \n # verify the required parameter 'line_id' is set\n fail ArgumentError, \"Missing the required parameter 'line_id' when calling TelephonyProvidersEdgeApi.get_telephony_providers_edges_line\" if line_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/telephony/providers/edges/lines/{lineId}\".sub('{format}','json').sub('{' + 'lineId' + '}', line_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Line')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TelephonyProvidersEdgeApi#get_telephony_providers_edges_line\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_edge(x, y, cost: 1)\n raise\n end",
"def get_intersecting_line entity, connnectLine\n entity_x = entity.get_x\n entity_y = entity.get_y\n\n edges = []\n\n #Top edge\n edges << (Line2D::Double.new entity_x, entity_y, entity_x + ENTITY_WIDTH, entity_y)\n #Bottom edge\n edges << (Line2D::Double.new entity_x, entity_y + ENTITY_HEIGHT, entity_x + ENTITY_WIDTH, entity_y + ENTITY_HEIGHT)\n #Left edge\n edges << (Line2D::Double.new entity_x, entity_y, entity_x, entity_y + ENTITY_HEIGHT)\n #Right edge\n edges << (Line2D::Double.new entity_x + ENTITY_WIDTH, entity_y, entity_x + ENTITY_WIDTH, entity_y + ENTITY_HEIGHT)\n\n edges.each do |e|\n return e if connnectLine.intersects_line e\n end\n\n end",
"def add_edge(e)\n add_vertex(e.from); add_vertex(e.to)\n (@from_store[e.from].add?(e) && @to_store[e.to].add(e) && e) || edge(e.from, e.to)\n end",
"def add_edge(edge)\n @edges << edge\n add_node(edge.n1) unless @nodes.find_index(edge.n1)\n add_node(edge.n2) unless @nodes.find_index(edge.n2)\n @incident_map[edge.n1] << edge\n @incident_map[edge.n2] << edge\n end",
"def add_edge(x, y, type)\n debug_msg \"adding edge #{x}, #{y}, #{type}\"\n if self[x,y]\n unless self[x,y] == type\n @contradiction = true\n debug_msg \" \\tcontradiction\"\n throw :add_edge_throw, :contradiction\n else\n debug_msg \"\\ti know\"\n throw :add_edge_throw, :i_know\n end\n else\n super(x, y, type)\n end\n end",
"def add_edge(id1, id2)\n # YOUR WORK HERE\n end",
"def add_edge( edge )\n super( edge.source, edge.target, edge )\n __add_edge__( edge )\n end",
"def draw_line(start, endpoint)\n start = start.to_coords if start.respond_to?(:to_coords)\n start = start.to_ary # ... end\nend",
"def get_telephony_providers_edges_line(line_id, opts = {})\n data, _status_code, _headers = get_telephony_providers_edges_line_with_http_info(line_id, opts)\n return data\n end",
"def line(id, from:[0,0], **attrs)\n draw_init\n unless to = attrs.delete(:to)\n raise ArgumentError, \"Argument 'to' is required\"\n end\n n1_id, n2_id = [1, 2].map { |i| \"#{id}#{i}\".to_id }\n point(n1_id, x:from[0], y:from[1],\n color:\"#FFFFFF00\", fillcolor:\"#FFFFFF00\")\n point(n2_id, x:to[0], y:to[1],\n color:\"#FFFFFF00\", fillcolor:\"#FFFFFF00\")\n attrs.update(arrowhead:\"none\")\n edge(:\"#{n1_id}_#{n2_id}\", attrs)\n end",
"def add_line(x, y, label=\"data #{@dataxy.length + 1}\")\n @dataxy << [label, x, y]\n end",
"def to_line(*args)\n raise NotImplementedError.new 'No line conversion method defined!'\n end",
"def parallel_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n Line.new(point, point + self.direction.to_point)\n end",
"def line\n lines.line(y)\n end",
"def add_edge(source, dest, weight)\n edges << Edge.new(source, dest, weight)\n end",
"def linechart(*args)\n Line.new(self, *args)\n end",
"def add_edge(vertex1, vertex2)\n if !@graph[vertex1] || !@graph[vertex2]\n raise InvalidVertexException, \"That vertex doesn't exist in the graph\"\n end\n @graph[vertex1].push(vertex2)\n @graph[vertex2].push(vertex1)\n self\n end",
"def new_line\n @source_lines << []\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def line(x, y)\n [x.value, y.value]\n end",
"def add_edge(u, v)\n raise NotImplementedError\n end",
"def new_edge(*args)\n add_edge(build_edge(*args))\n end",
"def add_directed_edge(id1,id2)\n @g[id1] ||= Array.new\n @g[id1] << id2\n end",
"def add_lineto(endPoint)\n pathElement = { :elementtype => \"pathlineto\", :endpoint => endPoint }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def add_edge(start_vertex_name, end_vertex_name)\n\n # Check if graph is not empty\n if (@vertices.length == 0)\n raise GraphError.new('No edges can be added to an empty graph', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n first_vertex_index = find_index_for_vertex(start_vertex_name)\n second_vertex_index = find_index_for_vertex(end_vertex_name)\n\n if (first_vertex_index == nil)\n raise GraphError.new('Edge cannot be added. First vertex could not be found', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n if (second_vertex_index == nil)\n raise GraphError.new('Edge cannot be added. Second vertex could not be found', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n add_edge_by_indexes(first_vertex_index,second_vertex_index)\n end",
"def add_edge(from, to, cost)\n @edges << Edge.new(from, to, cost)\n end",
"def safe_add_edge(x, y, type)\n catch(:add_edge_throw) do \n add_edge(x, y, type)\n end\n end",
"def add_edge(x, y)\n\t\traise if @x_connections[x] != -1\n\t\traise if @y_connections[yIdx(y)] != -1\n\t\t\n\t\t@x_connections[x] = y\n\t\t@y_connections[yIdx(y)] = x\n\t\t\n\t\t@unconnected_x_vertices -= 1\n\t\t\n#\t\traise if @x_connected_vertices.member?(xy[0])\n#\t\traise if @y_connected_vertices.member?(xy[1])\n\t\n\tend",
"def add_edge(node)\n @adj_nodes.push(node.position)\n end",
"def add_edge(direction, edge)\n opposite_adjacencies(direction, edge) << edge\n end",
"def add_edge(edge)\n edge.each { |node| add_vertex(node) }\n @structure[edge[0]] << edge[1]\n end",
"def append_line(line)\n @entries.last.line << line\n end",
"def add_edge(x, y) # from x to y\n if @nodes.key?(x) and @nodes.key?(y)\n if @edges.key?(x)\n unless @edges[x].include?(y)\n @edges[x] << y\n end\n end\n if @back_edges.key?(y)\n unless @back_edges[y].include?(x)\n @back_edges[y] << x\n end\n end\n else\n raise RuntimeError.new \"#{x} and #{y} not both present\"\n end\n end",
"def addEdge( from_vertex, to_vertex)\n addVertex( from_vertex )\n addVertex( to_vertex )\n @vertices[from_vertex] << to_vertex\n end",
"def add_edge(edge)\n # pp @access_paths\n # pp edge\n added = false\n return added if @edges.include?(edge)\n visited_path = @access_paths.each_with_index.select{|p,idx| !(p & edge).empty? }\n if visited_path.count == 2\n # if the two vertexes are visited in 2 paths\n # We'll combine the 2 paths\n new_path =[]\n to_del_idx =[]\n visited_path.each do |p|\n idx = p[1]\n v_path = p[0]\n new_path = new_path + v_path\n to_del_idx << idx\n end\n @access_paths.delete_if.with_index{|p,idx| to_del_idx.include?(idx)}\n @access_paths << new_path\n @edges << edge unless @edges.include?(edge)\n added = true\n elsif visited_path.count == 1\n v_path = visited_path[0][0]\n # binding.pry\n if (v_path & edge).count() == 2\n # binding.pry\n # add edge only when it does not create cycle\n puts \"Refuse to add edge #{edge.to_s} as it create cycle\"\n else\n # v_path = visited_path[0][1]\n vertext = edge - v_path\n v_path = v_path + vertext\n idx = visited_path[0][1]\n @access_paths.delete_at(idx)\n @access_paths << v_path\n @edges << edge unless @edges.include?(edge)\n added = true\n end\n elsif visited_path.count == 0\n @access_paths << edge\n @edges << edge unless @edges.include?(edge)\n added = true\n end\n # puts \"added is #{added}\"\n\n return added\n\tend",
"def connect_endpoint(collection, edge)\n if collection.any? { |o| ! edge.equal?(o) && edge.similar?(o) }\n raise DuplicateEdgeError.new(self, edge)\n end\n\n collection.add(edge)\n end",
"def set_line\r\n @line = Line.find_by_id(params[:id])\r\n end",
"def line(x1, y1, x2, y2, opts = {})\n Shoes::Line.new app, Shoes::Point.new(x1, y1), Shoes::Point.new(x2, y2), style.merge(opts)\n end",
"def append_line(line)\n @lines.push(line)\n @current = false\n @current_pos = 0\n end",
"def set_line_item\n @line_items = LineItem.find(params[:id])\n end",
"def add_edge(source, destiny, weigth)\n source, destiny, weigth = convert_values(source, destiny, weigth)\n\n add_vertex(source)\n add_vertex(destiny)\n\n make_edge(source, destiny, weigth)\n end",
"def add_edge(a,b)\n @adj_list[a][b] = 1\n end",
"def append_edge(edge)\n @meeting_edges << edge\n end",
"def set_line\n @line = Line.find(params[:id])\n @node = @line.node\n @diagram = @node.diagram\n head :forbidden unless @line.user_id == current_user.id\n end",
"def element_line(element); end",
"def addDirectedEdge(edge_value)\n\t\tedge_vertices = []\n\t\tedge_vertices = edge_value.split(',')\n\t\t# Validate the user input\n\t\tif edge_vertices.size == 2\n\t\t\tsource = edge_vertices[0]\n\t\t\tdest = edge_vertices[1]\n\t\tif !hasVertex(source)\n\t\t\taddVertex(source);\n\t\tend\n\t\tif !hasVertex(dest)\n\t\t\taddVertex(dest)\n\t\tend\n\t\[email protected]!(\"#{source}\" => @graphSet.fetch(source)<< edge_vertices[1])\n\t\telse\n\t\t\tputs \"Invalid entry. Enter only alphabets\".red\n\t\tend\n\tend",
"def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end",
"def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end",
"def add_edge(from_vertex, to_vertex)\n begin\n self[from_vertex].out_edges << to_vertex\n self[to_vertex].in_edges << from_vertex\n rescue NoMethodError => e\n err_suffix = \"in add_edge(#{from_vertex}, #{to_vertex}).\"\n if self[from_vertex].nil?\n puts(\"No vertex with id #{from_vertex} \" << err_suffix)\n else\n puts(\"No vertex with id #{to_vertex} \" << err_suffix)\n end \n end\n end",
"def add_edge(*edge_details)\r\n if (edge_details.length <3)||(edge_details.length>4)\r\n raise \"Error: Incorrect number of arguments in add_edge\"\r\n end # end if length\r\n @edges.push edge_details\r\n end",
"def insert_line\n down\n\n @lines = lines.insert_line(Vedeu::Editor::Line.new, y)\n\n bol\n\n refresh\n end",
"def add_line(line)\n @tip.string_content += line.slice(@offset, line.length) + '\\n'\n end",
"def source_edge\n return unless edge\n return unless local_position.on_line?(edge.line)\n\n edge\n end",
"def create_line(frag)\n who = fragments.find_by order: frag.order - 1, f_type: 24\n Line.create! fragment_id: frag.id, who: (who.nil? ? nil : who.orig_text), content: frag.orig_text\n 1\n end",
"def addEdge (node, dist)\n\t\[email protected]([node, dist])\n\t\tnode.addOtherEdge(self, dist)\n\tend",
"def link_line_item(line_item)\n self.spree_line_item_id = line_item.id\n self.save!\n end",
"def drawLine _obj, _args\n \"_obj drawLine _args;\" \n end",
"def eulerline\n return self.orthocenter if self.is_equilateral?\n Line.new(self.orthocenter, self.circumcenter)\n end",
"def check_add_edge(anEdge)\n anEdge\n end",
"def add_edge(source, target = nil, label = nil)\n @reversal = nil\n if target\n edge = Puppet::Relationship.new(source, target, label)\n else\n edge = source\n end\n [edge.source, edge.target].each { |vertex| setup_vertex(vertex) unless vertex?(vertex) }\n @vertices[edge.source].add_edge :out, edge\n @vertices[edge.target].add_edge :in, edge\n @edges << edge\n true\n end",
"def geometry\n linestring\n end",
"def raster_line\n @cr[4] << 1 | @cr[3][7]\n end",
"def add_vertices_from(edge)\n unless (@vertices << (@apical_vertices << edge.protein_1_id).last unless @vertices.include? edge.protein_1_id)\n @vertices << (@apical_vertices << edge.protein_2_id).last unless @vertices.include? edge.protein_2_id\n end\n edge\n end",
"def entry_edge\n self.entry_edges.first\n end",
"def set_lines\n set_line(:line_item, OLE_QA::Framework::OLEFS::Line_Item)\n end",
"def as_line_string\n GeoRuby::SimpleFeatures::LineString.from_points(@points)\n end",
"def add_edge(src, dest, weight)\n @v << src if [email protected]?(src)\n @v << dest if [email protected]?(dest)\n new_edge = Edge.new(src,dest, weight)\n src.out_edges << new_edge\n dest.in_edges << new_edge\n @e << new_edge\n end",
"def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end",
"def polyline\n @polyline ||= Automatic::Client::Polyline.new(self.path)\n end",
"def set_line_item\n @line_item = order.line_items.find(params[:id])\n end",
"def get_line\n raise NotImplementedError\n end",
"def add(new_line_items)\n new_line_items = Array.wrap(new_line_items).reject{ |li| li.product.supplier_id.nil? || li.product.supplier_id != self.supplier_id }\n new_line_items.each do |new_line_item|\n if line_item = self.drop_ship_line_items.find_by_line_item_id(new_line_item.id)\n else\n self.drop_ship_line_items.create({line_item_id: new_line_item.id}, without_protection: true)\n end\n end\n # TODO: remove any old line items?\n self.save ? self : nil\n end",
"def add_vertex(x)\n raise\n end",
"def line (distance, direction=nil)\n x1, y1 = position\n move distance, direction\n x2, y2 = position\n canvas.line(x1, y1, x2, y2, color)\n end",
"def line(x1, y1, x2, y2)\n CGContextAddLines(@ctx, [NSPoint.new(x1, y1), NSPoint.new(x2, y2)], 2)\n CGContextDrawPath(@ctx, KCGPathStroke) # apply stroke\n endpath\n\n end",
"def line(points, colour)\n\tpoints.each do |point|\n\t paint(point[0], point[1], colour)\n\tend\n end",
"def draw_line(start_x, start_y, end_x, end_y, image)\n line = Magick::Draw.new\n line.polyline(start_x, start_y, end_x, end_y)\n line.draw(image)\nend",
"def get_telephony_providers_edge_lines_with_http_info(edge_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TelephonyProvidersEdgeApi.get_telephony_providers_edge_lines ...\"\n end\n \n \n # verify the required parameter 'edge_id' is set\n fail ArgumentError, \"Missing the required parameter 'edge_id' when calling TelephonyProvidersEdgeApi.get_telephony_providers_edge_lines\" if edge_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/telephony/providers/edges/{edgeId}/lines\".sub('{format}','json').sub('{' + 'edgeId' + '}', edge_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'EdgeLineEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TelephonyProvidersEdgeApi#get_telephony_providers_edge_lines\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_line\n @lines.shift\n end",
"def line(x, y, angle, length)\n cur_page.line(x, y, angle, length)\n end"
] | [
"0.6186641",
"0.6117533",
"0.6075791",
"0.6063363",
"0.60037655",
"0.5978198",
"0.59622014",
"0.5943116",
"0.59406054",
"0.5815336",
"0.5799128",
"0.57898295",
"0.57838506",
"0.56966764",
"0.5694128",
"0.56643456",
"0.5600377",
"0.5590597",
"0.5576941",
"0.5545393",
"0.5543755",
"0.55152196",
"0.55128205",
"0.5455183",
"0.5450729",
"0.54155433",
"0.53864914",
"0.5375597",
"0.5374419",
"0.53650165",
"0.53632575",
"0.53521085",
"0.5348616",
"0.53451884",
"0.531522",
"0.52882177",
"0.52803475",
"0.52803475",
"0.52803475",
"0.5269393",
"0.5265573",
"0.5251743",
"0.5236937",
"0.5210779",
"0.5203963",
"0.52010465",
"0.5198525",
"0.51930904",
"0.5189163",
"0.51856345",
"0.5185368",
"0.5169012",
"0.5168496",
"0.51521015",
"0.5145141",
"0.51419914",
"0.51336116",
"0.51325154",
"0.5131866",
"0.511773",
"0.5117557",
"0.51093507",
"0.5105422",
"0.5104822",
"0.50959843",
"0.50930476",
"0.50915176",
"0.50915176",
"0.5087356",
"0.50816447",
"0.50788915",
"0.50773954",
"0.50766295",
"0.5066429",
"0.5061661",
"0.5058605",
"0.50564796",
"0.50526947",
"0.50355977",
"0.50340855",
"0.5026996",
"0.5026273",
"0.5016215",
"0.4990243",
"0.49848804",
"0.4976286",
"0.49622136",
"0.49609134",
"0.4960532",
"0.4957903",
"0.49551332",
"0.49520707",
"0.4951496",
"0.49490595",
"0.4939863",
"0.49387643",
"0.49338377",
"0.49267176",
"0.4925481",
"0.49208266"
] | 0.6305823 | 0 |
The add_ngon method is used to create a multisided polygon. | def add_ngon(center, normal, radius, numsides = 24)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_polygon(options)\n polygon = Google::OptionsHelper.to_polygon(options)\n \n self.add_overlay polygon\n polygon.added_to_map self\n \n unless polygon.encoded?\n self.extend_track_bounds polygon.vertices\n end\n \n polygon\n end",
"def test_is_polygon_with_polygon\n m = Sketchup.active_model\n ents = m.entities\n\n # Create a polygon\n center = [0, 0, 0]\n normal = [0, 0, 1]\n radius = 20\n nsides = 8\n ents.add_ngon center, normal, radius, nsides\n\n # Check poly edges\n m.entities.each do |e|\n if e.is_a? Sketchup::Edge and e.curve.respond_to? 'is_polygon?'\n assert_equal(true, e.curve.is_polygon?,\n 'Curve of polygon edge should be polygon.')\n end\n end\n end",
"def initialize(options = {})\n options.default! :var => 'polygon', \n :vertices => [],\n :editable => false,\n :border_colour => '#00F',\n :border_thickness => 2,\n :border_opacity => 0.5,\n :fill_colour => '#66F',\n :fill_opacity => 0.5,\n # Encode options\n :encoded => nil, \n :fill => true,\n :outline => true\n\n super\n\n if create_var?\n self.encoded = options.extract(:encoded)\n\n if self.encoded?\n self.encoded = self.encoded.arify\n else\n self.vertices = options.extract(:vertices).arify.collect do |vertex|\n Google::OptionsHelper.to_location(vertex)\n end\n end\n \n editable = options.extract(:editable)\n \n border_colour = options.extract(:border_colour) \n border_thickness = options.extract(:border_thickness) \n border_opacity = options.extract(:border_opacity)\n\n fill_colour = options.extract(:fill_colour)\n fill_opacity = options.extract(:fill_opacity)\n \n fill = options.extract(:fill)\n outline = options.extract(:outline)\n \n tooltip_options = options.extract(:tooltip)\n \n remaining_options = options\n \n if self.encoded?\n encode_options = {:polylines => Google::OptionsHelper.to_encoded_polylines(:lines => self.encoded,\n :color => border_colour,\n :opacity => border_opacity,\n :weight => border_thickness),\n :color => fill_colour, :opacity => fill_opacity,\n :fill => fill, :outline => outline}\n\n self << \"#{self.var} = new GPolygon.fromEncoded(#{encode_options.to_google_options(:dont_convert => [:polylines])});\"\n else\n self << \"#{self.var} = new GPolygon([#{self.vertices.join(', ')}], #{border_colour.to_js}, #{border_thickness.to_js}, #{border_opacity.to_js}, #{fill_colour.to_js}, #{fill_opacity.to_js}, #{remaining_options.to_google_options});\"\n end\n\n self.enable_editing! if editable\n self.set_tooltip(tooltip_options) if tooltip_options\n end\n end",
"def polygon(options={},&block)\n set RGhost::Polygon.new(options,&block)\n end",
"def polygon *points, color\n points << points.first\n points.each_cons(2) do |p1, p2|\n w.line(*p1, *p2, color)\n end\n end",
"def georss_simple_representation(options)\r\n georss_ns = options[:georss_ns] || \"georss\"\r\n geom_attr = options[:geom_attr]\r\n \"<#{georss_ns}:polygon#{geom_attr}>\" + self[0].georss_poslist + \"</#{georss_ns}:polygon>\\n\"\r\n end",
"def as_polygon\n GeoRuby::SimpleFeatures::Polygon.from_points([@points[0] == @points[-1] ? @points : (@points + [@points[0].clone])])\n end",
"def create\n @polygon_mark = PolygonMark.new(:name => params[:name], :layer_id => params[:layer_id])\n \n respond_to do |format|\n if @polygon_mark.save\n @polygon_mark.the_geom = Polygon.from_coordinates([params[:coordinates]], 4269)\n @polygon_mark.save!\n format.html { redirect_to @polygon_mark, :notice => 'polygon mark was successfully created.' }\n format.json { render :json => @polygon_mark, :status => :created, :location => @polygon_mark }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @polygon_mark.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_polylines\n if @itinerary.legs.nil?\n return []\n end\n\n polylines = []\n @itinerary.legs.each_with_index do |leg, index|\n polylines << {\n \"id\" => index,\n \"geom\" => leg['legGeometry'].nil? ? [] : leg['legGeometry'],\n \"options\" => get_leg_display_options(leg)\n }\n end\n\n return polylines\n end",
"def draw\n glClear(GL_COLOR_BUFFER_BIT) # Pulizia dei buffer\n polygons = [] # Inizializzazione dell'insieme dei poligoni\n @genestring.each_slice(Polygon::SIZE) do |pstring| # Inizializzazione dei poligoni tramite estrazione dalla stringa del gene\n polygons << Polygon.new(pstring)\n end\n polygons.sort!{|x,y| x.weight <=> y.weight} # Ordinamento dei poligoni in base al loro peso\n polygons.each do |p|\n glColor4f(p.rgba[0], p.rgba[1], p.rgba[2], OPACITY) # Definisce il colore del poligono\n glBegin(GL_POLYGON)\n Polygon::VERTEX_NUM.times do |i| # Definisce i vertici del poligono\n glVertex2f(p.vertex_x[i], p.vertex_y[i])\n end\n glEnd\n end\n end",
"def mill_hex_pocket(mill, cent_x, cent_y, diam, depth=nil)\r\n#####################################\r\n aPoly = CNCShapePolygon.new(mill, cent_x, cent_y, nil, diam=diam, num_sides=6, depth=depth, degree_inc=nil)\r\n aPoly.do_mill()\r\n return aPoly\r\nend",
"def spawn_polygons\n\n @args.state.vertices.polygons.each do |polygon|\n\n # If we have a path defined, find it in our polygon list and update locations\n if polygon.key?(:path)\n\n # Then we need to create a new one\n else\n\n # Spawn it, and save the path of it\n new_poly = RegularPolygon.new(args, 64, polygon[:vertices])\n polygon[:path] = new_poly.path\n\n # Finally add it to our internal list\n @polygons << new_poly\n\n end\n\n end\n\n end",
"def new_poly_body(opts)\n data = {\n :space => @space_holder.space,\n :draw_polygon => true,\n :mass => 50,\n :group => :slider_assembly\n }.merge(opts)\n PolyBody.new(data)\n end",
"def polygon\n respond_to?(:constituencyAreaExtent) ? constituencyAreaExtent : []\n end",
"def polygon (sides, length)\n sides.times do\n line length\n turn (360.0/sides).degrees\n end\n end",
"def add_point\n end",
"def polymarker(x, y, markersize = nil, marker_z = nil)\n # GR.jl - Multiple dispatch\n n = equal_length(x, y)\n if markersize.nil? && marker_z.nil?\n super(n, x, y)\n else\n markersize ||= GR.inqmarkersize\n markersize = if markersize.is_a?(Numeric)\n Array.new(n, markersize * 100)\n else\n raise ArgumentError if n != markersize.length\n\n markersize.map { |i| (100 * i).round }\n end\n marker_z ||= GR.inqcolor(989) # FIXME\n color = if marker_z.is_a?(Numeric)\n Array.new(n, marker_z)\n else\n raise ArgumentError if n != marker_z.length\n\n to_rgb_color(marker_z)\n end\n z = markersize.to_a.zip(color).flatten # to_a : NArray\n gdp(x, y, GDP_DRAW_MARKERS, z)\n end\n end",
"def polygon\n raise OSMLib::Error::NoDatabaseError.new(\"can't create Polygon from relation if it is not in a OSMLib::Database\") if @db.nil?\n raise OSMLib::Error::NoDatabaseError.new(\"can't create Polygon from relation if it does not represent a polygon\") if self['type'] != 'multipolygon' and self['type'] != 'polygon'\n\n c = []\n member_objects.each do |way|\n raise TypeError.new(\"member is not a way so it can't be represented as Polygon\") unless way.kind_of? OSMLib::Element::Way\n raise OSMLib::Error::NotClosedError.new(\"way is not closed so it can't be represented as Polygon\") unless way.is_closed?\n raise OSMLib::Error::GeometryError.new(\"way with less then three nodes can't be turned into a polygon\") if way.nodes.size < 3\n c << way.node_objects.collect{ |node| [node.lon.to_f, node.lat.to_f] }\n end\n GeoRuby::SimpleFeatures::Polygon.from_coordinates(c)\n end",
"def add_layer\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def build_polygons_definition(p_hexagons)\n hexagons_source = p_hexagons.split(',')\n polygons = Array.new\n hexagons = Array.new\n hexagons_source.each { |h| hexagons << h.to_i}\n\n until hexagons.empty?\n polygon = Hash.new\n enveloppe = Array.new\n connections = Array.new\n node_stack = Array.new [hexagons.first]\n \n until node_stack.empty?\n connection_string = \"\"\n current_node = node_stack.pop\n enveloppe << current_node \n hexagons.delete(current_node)\n\n EDGES.each do |direction|\n adjacent_hexagon = adjacent(current_node, direction)\n\n if adjacent_hexagon == -1 then\n connection_string << \"0\"\n else \n if hexagons_source.include?(adjacent_hexagon.to_s) then\n connection_string << \"1\"\n node_stack << adjacent_hexagon unless node_stack.include?(adjacent_hexagon) or enveloppe.include?(adjacent_hexagon) \n else\n connection_string << \"0\"\n end \n end\n end \n \n connections << connection_string\n end\n\n polygon[:enveloppe] = enveloppe\n polygon[:connections] = connections\n polygons << polygon\n end \n\n return polygons \n end",
"def sample_polygon\n polygon(200, [[10.0, 10.0], [180.0, 20.0], [160.0, 150.0], [100.0, 50.0], [20.0,180.0]])\nend",
"def create_geometry(p1, p2, view)\n view.model.entities.add_cline(p1,p2)\nend",
"def getPolygonPoints(n, rx = 50,ry=50,a=0,tx=Graphics.width/2,ty=Graphics.height/2)\n points = []\n ang = 360/n\n n.times do\n b = a*(Math::PI/180)\n r = rx*Math.cos(b).abs + ry*Math.sin(b).abs\n x = tx + r*Math.cos(b)\n y = ty - r*Math.sin(b)\n points.push([x,y])\n a += ang\n end\n return points\nend",
"def initialize(state, county, polygon_points)\n @state = state\n @county = county\n @polygon_points = []\n polygon_points.each do |p|\n @polygon_points.push(Point.new(p[0],p[1]))\n end\n end",
"def polygon(x, y, r, sides, options={})\n cur_page.polygon(x, y, r, sides, options)\n end",
"def geometry_n(n)\n raise Error::UnsupportedOperation, \"Method GeometryCollection#geometry_n not defined.\"\n end",
"def poly_line\n Hash['lng', longitude , 'lat', latitude, \"strokeColor\", plan.color, \"strokeWeight\", 3]\n end",
"def add_layer\n puts \"made it to PL add layer\"\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def append_geom( geom, **other_attrs )\n if geom.is_a?(GeoRuby::SimpleFeatures::Geometry)\n geom = RGeo::WKRep::WKBParser.new.parse(geom.as_wkb) rescue nil\n end\n new_geom = geom\n self.place_geometry.reload\n if place_geometry && !place_geometry.geom.nil?\n union = place_geometry.geom.union(new_geom)\n new_geom = if union.geometry_type == ::RGeo::Feature::MultiPolygon\n union\n else\n f = place_geometry.geom.factory\n f.multi_polygon([union])\n end\n end\n self.save_geom( new_geom, **other_attrs )\n end",
"def poly_line\n Hash['lng', longitude , 'lat', latitude, \"strokeColor\", \"#00000\", \"strokeWeight\", 3]\n end",
"def postgis_polygon_format(coordinates)\n ordinates = 'POLYGON (('\n ordinates += coordinates.gsub(\"0.0\", \" \").gsub(\",-\",\" -\").gsub(/, $/, \")\")\n ordinates += ')'\n end",
"def the_geom_from_points=(coordinate_pairs)\n points = coordinate_pairs.map do |coordinates|\n Point.from_x_y( coordinates[0], coordinates[1], 4326 )\n end\n\n write_attribute :the_geom, MultiPolygon.from_polygons( [ Polygon.from_points([points]) ] )\n end",
"def new\n @polygon_mark = PolygonMark.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @polygon_mark }\n end\n end",
"def getPolyCoordinates(radius, lat, lon, num_sides)\r\n # Create array to the radian values of the regular polygon\r\n rads = (0..2*Math::PI).step((2 * Math::PI) / num_sides.to_f).to_a\r\n\r\n # Compute angular distance (meters)\r\n ang_dist = (radius.to_f / EARTH_RAD_M.to_f) #*(Math::PI/180.0)\r\n lat_rad = lat * Math::PI/180.0\r\n lon_rad = lon * Math::PI/180.0\r\n\r\n # Constants\r\n a = Math.sin(lat_rad) * Math.cos(ang_dist)\r\n b = Math.cos(lat_rad) * Math.sin(ang_dist)\r\n\r\n # Loop over radians (clockwise) to compute geo points of the polygon\r\n points = Array.new\r\n cnt = 0\r\n rads.each do |r|\r\n # new point latitude (in radians)\r\n new_lat = Math.asin(a + b * Math.cos(r)) \r\n\r\n # new point longitude (in radians)\r\n c = Math.cos(ang_dist) - Math.sin(lat_rad) * Math.sin(new_lat)\r\n new_lon = lon_rad + Math.atan2(Math.sin(r) * Math.sin(ang_dist) * Math.cos(lat_rad), c)\r\n\r\n # Store (in degrees)\r\n points[cnt] = {:lat => new_lat*180.0/Math::PI, :lon => new_lon*180.0/Math::PI}\r\n cnt += 1\r\n end\r\n\r\n return points\r\n end",
"def mill_polygon(mill, cent_x, cent_y, diam, \r\n no_sides, depth=nil, cutter_comp=false)\r\n#############################################\r\n if cutter_comp == true\r\n diam -= mill.bit_radius\r\n end #if\r\n #mill.retract()\r\n side_count = 0\r\n curr_angle = 0.0\r\n radius = diam / 2\r\n degree_inc = 360 / no_sides\r\n while (curr_angle <= 360)\r\n cp = calc_point_from_angle(cent_x, cent_y, curr_angle, radius)\r\n mill.move(cp.x, cp.y)\r\n if (side_count == 0)\r\n mill.plung(depth)\r\n end #if\r\n side_count = side_count + 1\r\n curr_angle += degree_inc\r\n end #while\r\nend",
"def draw(type=1,index=1)\n DCL.sgplzv(vx,vy,type,index)\n end",
"def add_neuron(n)\n neurons << n\n end",
"def addPoints coordinates\n coordinates.split(',').each_with_index do |coordinate, index|\n border_points.build(:latitude => coordinate[0..coordinate.index(' ')-1], :longitude => coordinate[coordinate.index(' ')+1 .. coordinate.length-1], :local_index => index)\n end\n end",
"def ajoutPont(n1,n2)\n\n # incrémente le nombre de pont sur les iles\n n1.inc()\n n2.inc()\n\n # Récupère les cases entre les deux iles ( le pont )\n ponts = getPontEntre(n1,n2)\n\n # Ile Nord\n if n1.northNode == n2 \n\t\t\tn1.northEdge = n1.northEdge + 1\n\t\t\tn2.southEdge = n2.southEdge + 1 \n n1.update\n n2.update\n\n elsif n1.eastNode == n2 #Ile droit\n n1.eastEdge = n1.eastEdge + 1\n\t\t\tn2.westEdge = n2.westEdge + 1\n n1.update\n n2.update\n\n elsif n1.westNode == n2 # Ile gauche\n\n n1.westEdge = n1.westEdge + 1 \n\t\t\tn2.eastEdge = n2.eastEdge + 1\n n1.update\n n2.update\n\n elsif n1.southNode == n2 # Ile bas\n\n n1.southEdge = n1.southEdge + 1\n\t\t\tn2.northEdge = n2.northEdge + 1\n n1.update\n n2.update\n \n else \n p \"Erreur: n2 n'est pas un noeud valide pour n1\"\n\t\tend\n \n n1.pontRestants\n n2.pontRestants\n\n # Ajoute le pont entre deux iles\n ponts.each do |pont|\n pont.set_typePont( pont.get_typePont() + 1)\n pont.estDouble = true\n pont.update\n end\n\t \n return self\n end",
"def test_is_polygon_api_example\n # For backwards compatibility, only run test if curve instance has\n # is_polygon? method\n if Sketchup::Curve.new().public_methods.include? 'is_polygon?'\n assert_nothing_raised do\n # Create a polygon and check its edge\n ents = Sketchup.active_model.entities\n ents.add_ngon [0, 0, 0], [0, 0, 1], 10, 6\n curve = nil\n ents.each { |e| curve = e.curve if e.is_a? Sketchup::Edge }\n is_poly = curve.is_polygon?\n end\n end\n end",
"def add_line(point1, point2)\n end",
"def draw_voronoi\nend",
"def create\n @polygon = Polygon.new(params[:polygon])\n\n respond_to do |format|\n if @polygon.save\n format.html { redirect_to @polygon, notice: 'Polygon was successfully created.' }\n format.json { render json: @polygon, status: :created, location: @polygon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polygon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def genShapeJson()\n shape = [] ;\n @shape.pointList.each{|point|\n pos = [point.x, point.y] ;\n shape.push(pos) ;\n }\n return shape ;\n end",
"def new_vertex(label, value)# - Insert a new isolated vertex into graph G\n $label << \"#{value}\";\n end",
"def drawPolygon(pointList, fillp=false, color=\"black\")\n @device.drawPolygon(pointList, fillp, color) ;\n end",
"def nine_point_circle\n # Circle.new(*self.medial.vertices)\n end",
"def plot_polygon(vertices = [])\n return self.plot if vertices.empty?\n plot_lines([vertices + [vertices[0]]])\n end",
"def add_polynomynal(polynomynal)\n raise ArgumentError, 'The input should be a polynomynal' unless polynomynal.instance_of? Polynomynal\n self.add_two_coefficients_arrays(@coefficient_arr, polynomynal.coefficient_arr)\n end",
"def lines\n raise 'invalid polygon' unless valid?\n 0.upto(points.size - 1).collect do |i|\n Line.new(points[i % n], points[(i + 1) % n])\n end\n end",
"def __spatial_column_name=(geom); end",
"def create_point(lng, lat)\n Rails.logger.debug \"RgeoGeometryAdapter Creating point geometry from lng = #{lng}, lat = #{lat}\"\n @geometry_factory.point(lng, lat)\n end",
"def to_geojson\n coordinates = @points.map { |point| [point.longitude, point.lattitude] }\n { 'type' => 'Polygon', 'coordinates' => [coordinates] }.to_json\n end",
"def create_projected_point(lng, lat)\n Rails.logger.debug \"RgeoGeometryAdapter Creating point geometry from lng = #{lng}, lat = #{lat}\"\n @geometry_factory.project(create_point(lng, lat))\n end",
"def build_start_end_for(aNonTerminal)\n return if start_vertex_for.include?(aNonTerminal)\n\n new_start_vertex = StartVertex.new(aNonTerminal)\n start_vertex_for[aNonTerminal] = new_start_vertex\n add_vertex(new_start_vertex)\n\n new_end_vertex = EndVertex.new(aNonTerminal)\n end_vertex_for[aNonTerminal] = new_end_vertex\n add_vertex(new_end_vertex)\n end",
"def to_multipoint\n point1, point2 = self.to_utm \n GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([ [ point1.e, point1.n ], [ point2.e, point2.n ] ])\n end",
"def build_geometry\n @outp = []\n @normp = []\n @inp = Array.new(NI){|i| Array.new(NJ){|j| Vec3D.new(i, j, rand(-3.0..3))}}\n uitang = Vec3D.new\n ujtang = Vec3D.new\n\n (0 ... RESI).each do |i|\n mui = i.fdiv(RESI - 1)\n row = []\n row_n = []\n (0 ... RESJ).each do |j|\n muj = j.fdiv(RESJ - 1)\n vect = Vec3D.new\n uitang.x, uitang.y, uitang.z = 0, 0, 0\n ujtang.x, ujtang.y, ujtang.z = 0, 0, 0\n (0 ... NI).each do |ki|\n bi = bezier_blend(ki, mui, NI)\n dbi = d_bezier_blend(ki, mui, NI)\n (0 ... NJ).each do |kj|\n bj = bezier_blend(kj, muj, NJ)\n dbj = d_bezier_blend(kj, muj, NJ)\n\n vect += inp[ki][kj] * bi * bj\n\n uitang += inp[ki][kj] * dbi * bj\n\n ujtang += inp[ki][kj] * bi * dbj\n end\n end\n vect += Vec3D.new(-NI / 2, -NJ / 2, 0)\n vect *= 100\n row << vect.to_a\n uitang.normalize!\n ujtang.normalize!\n row_n << uitang.cross(ujtang).to_a\n end\n @outp << row\n @normp << row_n\n end\nend",
"def add_geometry_column(table)\n sql = <<-SQL\n SELECT AddGeometryColumn('%s', 'geom', 4326, 'GEOMETRY', 2);\n\n ALTER TABLE %s ADD CONSTRAINT constraint_geom_no_geometrycollection\n CHECK (GeometryType(geom) != 'GEOMETRYCOLLECTION');\n\n CREATE INDEX ON %s USING gist (geom);\n SQL\n\n run sql % ([table.to_s] * 3)\n end",
"def create\n points.insert(coordinates: attribute)\n end",
"def add_gladiator(g)\n if gladiators.count < 2\n gladiators << g\n end\n end",
"def envelope_to_polygon\n exp = /^\\s*ENVELOPE\\(\n \\s*([-.\\d]+)\\s*,\n \\s*([-.\\d]+)\\s*,\n \\s*([-.\\d]+)\\s*,\n \\s*([-.\\d]+)\\s*\n \\)\\s*$/x # uses 'x' option for free-spacing mode\n bbox_match = exp.match(geom)\n minx, maxx, maxy, miny = bbox_match.captures\n \"POLYGON ((#{minx} #{maxy}, #{minx} #{miny}, #{maxx} #{miny}, #{maxx} #{maxy}, #{minx} #{maxy}))\"\n end",
"def to_nef(z = 0)\n\t\t\tpolygons = root.to_a.collect{|poly|\n\t\t\t\tpoly.to_a.collect{|p| \n\t\t\t\t\tPoint_3.new p.to_a.push(z)\n\t\t\t\t}\n\t\t\t}\n\t\t\tnef = Nef_polyhedron_3.new polygons.shift\n\t\t\tpolygons.each{|polygon|\n\t\t\t\tnef -= Nef_polyhedron_3.new polygon\n\t\t\t}\n\t\t\tnef\n\t\tend",
"def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end",
"def create_country_specific_gon_variables\n employee_country = current_employee.present? ? current_employee.operating_country : nil\n yard_uid_management = employee_country.nil? ? nil : UidManagement.uid_manager_for(Yard, employee_country)\n gon.copartYards =\n if yard_uid_management.present?\n Yard.for_country_uid(yard_uid_management.min_number, yard_uid_management.max_number)\n .copart_yards\n .for_employee(current_employee).as_json(include_basic: 'yes', list: true)\n else\n []\n end\n gon.showYardFilter = gon.copartYards.size > 1\n gon.facilities = Facility.includes(:country).for_country(employee_country)\n .non_residential.ordered_by(\"name\", Facility::SORT_ASCENDING).as_json(include_basic: \"yes\") #this should become a current_user based scope when that is all set up\n gon.sellers = Seller.for_country(employee_country)\n .ordered_by(\"name\", Seller::SORT_ASCENDING).as_json\n gon.members = MemberResource.find_by_ids(@vehicles.map(&:member_id)\n .compact.uniq).map {|m| {id: m.id, member_name: m.full_name}} if params[:state_as_string].present? && Vehicle.is_requesting_for_post_auction_stage?(params[:state_as_string])\n gon.showSellerFilter = gon.sellers.size > 1\n end",
"def polymarker(x, y)\n n = equal_length(x, y)\n super(n, x, y)\n end",
"def add(new_element)\n\n case new_element\n when DrawingGroup\n @drawingArray = (@drawingArray << new_element.drawingArray).flatten\n when Drawing\n @drawingArray << new_element\n else\n raise Argument \"New_element (#{@new_element}) is not a valid input\"\n end\n \n end",
"def gmap_add_point(map,iconpaz,obj,venue,title,window,iconsize=45)\n map.icon_global_init( gmaps_gicon(iconpaz,iconsize), \"icon_#{obj.id}\" )\n map.overlay_init(\n GMarker.new( venue.coordinates, \n :title => title,\n :icon => Variable.new(\"icon_#{obj.id}\"),\n :info_window => window # (obj.gmaps_info_window rescue \"'Warning! Object #{obj} (class: #{obj.class}) doesnt define method 'gmaps_info_window'!!! Clieck here for details: <HR/> #{link_to(obj,obj)}\" )\n )\n )\n end",
"def [](index)\n return nil unless index.between?(0, vertex_count - 1)\n vertex = Vector.zero\n FMOD.invoke(:Geometry_GetPolygonVertex, @geometry, @index, index, vertex)\n vertex\n end",
"def [] (index)\n if (@points.length == 0)\n raise \"cannot get any points from an empty polygon\"\n end\n while (index < 0)\n index += @points.length\n end\n while (index > @points.length - 1)\n index -= @points.length\n end\n @points[index]\n end",
"def _update!\n self.class.repository_or_fail.createPolygon self\n end",
"def new\n @polygon = Polygon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polygon }\n end\n end",
"def create _marker=[], _special=\"FORM\"\n #raise \"No side set\" unless @side\n @group ||= Rarmalib::SQF::Group.new(@side)\n _grp = @group.this\n _mrka = _marker.to_a\n @this = SQF.createUnit _grp, @classname, @posASL, _mrka, 0, _special\n update_unit\n end",
"def add(opt)\n ipaddr_modify(RTM_NEWADDR, NLM_F_CREATE|NLM_F_EXCL, opt)\n end",
"def points_for_polygon(x, y, r, sides, options={})\n cur_page.points_for_polygon(x, y, r, sides, options)\n end",
"def add_neuron(neuron)\r\n\t\[email protected](neuron)\r\n\tend",
"def post_page_polygon_annotations_with_http_info(name, page_number, annotations, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.post_page_polygon_annotations ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.post_page_polygon_annotations\"\n end\n # verify the required parameter 'page_number' is set\n if @api_client.config.client_side_validation && page_number.nil?\n fail ArgumentError, \"Missing the required parameter 'page_number' when calling PdfApi.post_page_polygon_annotations\"\n end\n # verify the required parameter 'annotations' is set\n if @api_client.config.client_side_validation && annotations.nil?\n fail ArgumentError, \"Missing the required parameter 'annotations' when calling PdfApi.post_page_polygon_annotations\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/pages/{pageNumber}/annotations/polygon\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'pageNumber' + '}', page_number.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n post_body = @api_client.object_to_http_body(annotations)\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#post_page_polygon_annotations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_geometry(pt1, pt2, view)\n model = view.model\n model.start_operation $exStrings.GetString(\"Create Cylinder\")\n entities = model.entities\n \n # First create a circle\n vec = pt2 - pt1\n length = vec.length\n if( length == 0.0 )\n UI.beep\n puts \"Cannot create a zero length cylinder\"\n return\n end\n circle = entities.add_circle pt1, vec, @radius, @numsegs\n\n # Now do a pushpull to create the cylinder\n face = entities.add_face circle\n normal = face.normal\n length = -length if( (normal % vec) < 0.0 )\n face.pushpull length\n\n model.commit_operation\nend",
"def initialize(polygons_num ,genestring=nil)\n @genestring_size = Polygon::SIZE * polygons_num\n if genestring.nil?\n @genestring = (0...@genestring_size).map do \n block_given? ? yield : rand # Verifica se e' stato passato un blocco: SI) esegue blocco NO) valore casuale\n end\n else\n @genestring = genestring\n end\n end",
"def add_vertex coords\n vertices << coords.map(&:to_f)\n end",
"def trapezoidal(gpna0,gpna1,dt,n=1,filter=nil,&f)\n\t\t\tt0 = gpna0[0].coord(-1) ; t1 = gpna1[0].coord(-1) # 時間軸(長さ1)を取り出す\n\t\t var_num = gpna0.length\n\t\t n.times{\n\t\t \tgpna_tmp = gpna0 + f.call(gpna1,t1)*dt*2\n\t\t gpna2 = gpna0*0 + gpna1 + (f.call(gpna1, t1) + f.call(gpna_tmp, t1+dt))*dt/2 # なぜか最初の項がないと時刻がおかしくなる\n\t\t if (filter == \"asselin\") then\n\t\t \tgpna1 = asselin(gpna0, gpna1, gpna2)\n\t\t elsif (filter == \"williams\") then\n\t\t \tgpna1, gpna2 = williams(gpna0, gpna1, gpna2)\n\t\t elsif (filter == nil ) then\n\t\t else raise \"value of 'filter' is invalid.\"\n\t\t end\n\t\t t0 = t0 + dt; t1 = t1 + dt\n\t\t gpna0 = gpna1 ; gpna1 = gpna2\n\t\t }\n\t\t var_num.times{|v|\n\t\t gpna0[v].axis(-1).set_pos(t0)\n\t\t gpna1[v].axis(-1).set_pos(t1)\n\t\t }\n return gpna0, gpna1\n end",
"def add_cpoint(point)\n end",
"def draw_line(grids, length)\n grid(grids[0], grids[1]).bounding_box() do\n stroke_horizontal_line 0, 470*length, at: 5\n end\n end",
"def svg_element(index, type, list)\n\t\tid = \"e#{index}\"\n\t\tcoords = list.map { |pair| svg_coord(*pair) }\n\t\tsvgel = case type\n\t\twhen :point\n\t\t\tpoint = coords.first\n\t\t\t# work around a bug in a lot of rendering engines, that\n\t\t\t# prevents zero-length paths from being displayed\n\t\t\tfakepoint1 = [point.first-0.01, point.last]\n\t\t\tfakepoint2 = [point.first+0.01, point.last]\n\t\t\tSVGLINE % [id, *fakepoint1, *fakepoint2]\n\t\twhen :line\n\t\t\tSVGLINE % [id, *coords.flatten]\n\t\twhen :path\n\t\t\tnodes = coords.map { |pair| pair.join(',') }\n\t\t\tif path_open? index\n\t\t\t\t# unclosed polyline\n\t\t\t\tSVGPL % [id, nodes.join(' ')]\n\t\t\telse\n\t\t\t\t# polygon\n\t\t\t\tSVGGON % [id, nodes.join(' ')]\n\t\t\tend\n\t\twhen :ellipse\n\t\t\txmin, xmax = coords.map { |pair| pair.first }.minmax\n\t\t\tymin, ymax = coords.map { |pair| pair.last }.minmax\n\t\t\tcenter = [(xmin + xmax)/2, (ymin + ymax)/2]\n\t\t\trx = (xmax - xmin)/2\n\t\t\try = (ymax - ymin)/2\n\t\t\tSVGELLIPSE % [id, *center, rx, ry]\n\t\telse\n\t\t\traise NotImplementedError, type.to_s\n\t\tend\n\n\t\treturn svgel\n\tend",
"def add_circle(center, normal, radius, numsegs = 24)\n end",
"def point( *args ) @g.class.new( *args ); end",
"def polygon_vertices(sides, size)\n return [CP::Vec2.new(-size, size), CP::Vec2.new(size, size), CP::Vec2.new(size, -size), CP::Vec2.new(-size, -size)]\n end",
"def geographic_oregon(subject, data)\n geographic(subject, data, RDF::Vocab::DC[:spatial], {:adminCode1 => \"OR\", :countryBias => \"US\"})\n end",
"def create_new_addr_bounds(addr_codes)\n\t\t\taddr_codes.each do |ac|\n\t\t\t\[email protected]_bounds.create(addr_code: ac)\n\t\t\tend\n\t\tend",
"def geom_type\n# \tself.geom.geometry_n(0).geometry_type\n \"Point\" # Hard-coding for non-spaital database deployment\n end",
"def points\n object.polygon.points\n end",
"def polygons_points(p_polygon)\n # initialization\n points = \"\"\n i_polygon = 0\n current_hexagon = p_polygon[:enveloppe][0]\n i_connection = p_polygon[:connections][0].index(\"0\")\n initial_vertex = \"#{current_hexagon.to_s},#{VERTICES[i_connection].to_s}\"\n done = false\n \n until done\n while not done and p_polygon[:connections][i_polygon][i_connection] == \"0\"\n done = initial_vertex == \"#{current_hexagon.to_s},#{VERTICES[i_connection].to_s}\" unless points.empty?\n unless done\n vertex = VERTICES[i_connection]\n points << \"#{x_vertex(current_hexagon, vertex).floor},#{y_vertex(current_hexagon, vertex).floor} \"\n i_connection == 5 ? i_connection = 0 : i_connection += 1\n end\n end\n \n if not done and i_connection < 6 then\n current_hexagon = adjacent(current_hexagon, EDGES[i_connection])\n i_polygon = p_polygon[:enveloppe].index(current_hexagon)\n i_connection -= 2\n i_connection += 6 unless i_connection >= 0\n end \n end\n \n return points.chop\n end",
"def add_vertex!(vertex)\n\tend",
"def add_vertex!(vertex)\n\tend",
"def simple_poly tolerance=0.001, precision = 4, bbox = false \n self.class.find_simple_geojson self.id, tolerance, precision, bbox\n end",
"def simple_poly tolerance=0.001, precision = 4, bbox = false \n self.class.find_simple_geojson self.id, tolerance, precision, bbox\n end",
"def remove_polygon(options)\n polygon = Google::OptionsHelper.to_polygon(options)\n \n self.remove_overlay polygon\n polygon.removed_from_map self \n end",
"def geographic_item_params\n params.require(:geographic_item).permit(:point, :line_string, :polygon, :multi_point, :multi_line_string, :multi_polygon, :geometry_collection, :created_by_id, :updated_by_id)\n end",
"def addPoints(points) \n\t\t@points += points\n\tend",
"def add_element(list, multi)\n\t\tel_class = list.length == 1 ? :point :\n\t\t\t(!multi ? :path : (list.length == 2 ? :line : :ellipse))\n\t\treturn [el_class, list.dup]\n\tend",
"def add_element(list, multi)\n\t\tel_class = list.length == 1 ? :point :\n\t\t\t(!multi ? :path : (list.length == 2 ? :line : :ellipse))\n\t\treturn [el_class, list.dup]\n\tend"
] | [
"0.6050541",
"0.5236279",
"0.52342427",
"0.52223665",
"0.51577336",
"0.50539905",
"0.5018183",
"0.50071836",
"0.5003961",
"0.49998453",
"0.4993382",
"0.4926919",
"0.49248546",
"0.49017492",
"0.4863987",
"0.4862236",
"0.48568124",
"0.4855763",
"0.48097065",
"0.4762247",
"0.47603694",
"0.47577366",
"0.46856892",
"0.46844718",
"0.46782902",
"0.46556997",
"0.46321496",
"0.46257308",
"0.4616048",
"0.45953637",
"0.45873734",
"0.45775774",
"0.456796",
"0.45520458",
"0.45519146",
"0.45272052",
"0.45131955",
"0.44795397",
"0.44712317",
"0.4467329",
"0.44340196",
"0.44332698",
"0.44211432",
"0.4394387",
"0.4386067",
"0.43832636",
"0.43808502",
"0.43685797",
"0.43581846",
"0.43384632",
"0.43287486",
"0.4328703",
"0.43272868",
"0.4321703",
"0.43193716",
"0.43157816",
"0.43119326",
"0.42992502",
"0.42867142",
"0.42809173",
"0.4279477",
"0.42741933",
"0.4272098",
"0.42713088",
"0.42630562",
"0.42550403",
"0.425487",
"0.4253236",
"0.4225786",
"0.42094588",
"0.42053443",
"0.41967815",
"0.41950783",
"0.41924667",
"0.41820905",
"0.4179868",
"0.41765577",
"0.41717368",
"0.4167882",
"0.416398",
"0.41590348",
"0.41530818",
"0.4151906",
"0.41427153",
"0.41395032",
"0.41287625",
"0.41282836",
"0.41266018",
"0.41177735",
"0.41134316",
"0.41052362",
"0.4104212",
"0.4104212",
"0.41040576",
"0.41040576",
"0.4100878",
"0.4097796",
"0.40915385",
"0.40857166",
"0.40857166"
] | 0.65977114 | 0 |
The add_section_plane method adds a section plane object to the entities. | def add_section_plane(plane)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_plane(plane)\n @planes << plane\n end",
"def add_plane()\n planes << Plane.new(\n gen_location,\n 0,\n width,\n height,\n gen_speed(),\n true\n )\n end",
"def active_section_plane=(sec_plane)\n end",
"def add_section_with_http_info(firewall_section, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.add_section ...'\n end\n # verify the required parameter 'firewall_section' is set\n if @api_client.config.client_side_validation && firewall_section.nil?\n fail ArgumentError, \"Missing the required parameter 'firewall_section' when calling ManagementPlaneApiServicesFirewallApi.add_section\"\n end\n if @api_client.config.client_side_validation && !opts[:'id'].nil? && opts[:'id'].to_s.length > 64\n fail ArgumentError, 'invalid value for \"opts[:\"id\"]\" when calling ManagementPlaneApiServicesFirewallApi.add_section, the character length must be smaller than or equal to 64.'\n end\n\n if @api_client.config.client_side_validation && opts[:'operation'] && !['insert_top', 'insert_bottom', 'insert_after', 'insert_before'].include?(opts[:'operation'])\n fail ArgumentError, 'invalid value for \"operation\", must be one of insert_top, insert_bottom, insert_after, insert_before'\n end\n # resource path\n local_var_path = '/firewall/sections'\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(firewall_section)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#add_section\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def has_plane(plane)\n @planes.include?(plane)\n end",
"def add_rule_in_section_with_http_info(section_id, firewall_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.add_rule_in_section ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.add_rule_in_section\"\n end\n # verify the required parameter 'firewall_rule' is set\n if @api_client.config.client_side_validation && firewall_rule.nil?\n fail ArgumentError, \"Missing the required parameter 'firewall_rule' when calling ManagementPlaneApiServicesFirewallApi.add_rule_in_section\"\n end\n if @api_client.config.client_side_validation && !opts[:'id'].nil? && opts[:'id'].to_s.length > 64\n fail ArgumentError, 'invalid value for \"opts[:\"id\"]\" when calling ManagementPlaneApiServicesFirewallApi.add_rule_in_section, the character length must be smaller than or equal to 64.'\n end\n\n if @api_client.config.client_side_validation && opts[:'operation'] && !['insert_top', 'insert_bottom', 'insert_after', 'insert_before'].include?(opts[:'operation'])\n fail ArgumentError, 'invalid value for \"operation\", must be one of insert_top, insert_bottom, insert_after, insert_before'\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}/rules'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(firewall_rule)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#add_rule_in_section\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_section(firewall_section, opts = {})\n data, _status_code, _headers = add_section_with_http_info(firewall_section, opts)\n data\n end",
"def setup_add_plane\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 3\n file = @acts[1]\n sox = @acts[2] # Scroll X\n soy = @acts[3] # Scroll Y \n z = (@acts[4] ? Graphics.height + 10 : 4)\n dur = @acts[5] || 2\n opac = @acts[6] || 255\n get_spriteset.battle_plane.set(file,sox,soy,z,dur,opac)\n end",
"def active_section_plane\n end",
"def active_section_plane\n end",
"def create_face_from_section(section)\n plane=section.get_plane\n bounds=Sketchup.active_model.bounds\n entities=Sketchup.active_model.active_entities\n bmin = bounds.min\n bminx = bmin.x\n bminy = bmin.y\n bminz = bmin.z\n bmax = bounds.max\n bmaxx = bmax.x\n bmaxy = bmax.y\n bmaxz = bmax.z\n ### make group\n newgroup=entities.add_group\n newgroupentities=newgroup.entities\n c1 = [bminx, bminy, bminz]\n c2 = [bmaxx, bminy, bminz]\n c3 = [bminx, bminy, bmaxz]\n c4 = [bmaxx, bminy, bmaxz]\n c5 = [bminx, bmaxy, bmaxz]\n c6 = [bmaxx, bmaxy, bmaxz]\n c7 = [bminx, bmaxy, bminz]\n c8 = [bmaxx, bmaxy, bminz]\n e1 = newgroupentities.add_edges [ c1, c2 ]\n e2 = newgroupentities.add_edges [ c3, c4 ]\n e3 = newgroupentities.add_edges [ c5, c6 ]\n e4 = newgroupentities.add_edges [ c7, c8 ]\n e5 = newgroupentities.add_edges [ c1, c3 ]\n e6 = newgroupentities.add_edges [ c2, c4 ]\n e7 = newgroupentities.add_edges [ c7, c5 ]\n e8 = newgroupentities.add_edges [ c8, c6 ]\n e9 = newgroupentities.add_edges [ c1, c7 ]\n e10 = newgroupentities.add_edges [ c3, c5 ]\n e11 = newgroupentities.add_edges [ c4, c6 ]\n e12 = newgroupentities.add_edges [ c2, c8 ]\n line1 = e1[0].line\n line2 = e2[0].line\n line3 = e3[0].line\n line4 = e4[0].line\n line5 = e5[0].line\n line6 = e6[0].line\n line7 = e7[0].line\n line8 = e8[0].line\n line9 = e9[0].line\n line10 = e10[0].line\n line11 = e11[0].line\n line12 = e12[0].line\n e1[0].erase!\n e2[0].erase!\n e3[0].erase!\n e4[0].erase!\n e5[0].erase!\n e6[0].erase!\n e7[0].erase!\n e8[0].erase!\n e9[0].erase!\n e10[0].erase!\n e11[0].erase!\n e12[0].erase!\n ### find intersects with plane\n p1 = Geom.intersect_line_plane line1, plane\n p2 = Geom.intersect_line_plane line2, plane\n p3 = Geom.intersect_line_plane line3, plane\n p4 = Geom.intersect_line_plane line4, plane\n p5 = Geom.intersect_line_plane line5, plane\n p6 = Geom.intersect_line_plane line6, plane\n p7 = Geom.intersect_line_plane line7, plane\n p8 = Geom.intersect_line_plane line8, plane\n p9 = Geom.intersect_line_plane line9, plane\n p10 = Geom.intersect_line_plane line10, plane\n p11 = Geom.intersect_line_plane line11, plane\n p12 = Geom.intersect_line_plane line12, plane\n if p1 ### NOT z\n e1 = newgroupentities.add_line p1,p2\n e2 = newgroupentities.add_line p2,p3\n e3 = newgroupentities.add_line p3,p4\n e4 = newgroupentities.add_line p4,p1\n elsif p5 ### in z\n e1 = newgroupentities.add_line p5,p6\n e2 = newgroupentities.add_line p6,p8\n e3 = newgroupentities.add_line p8,p7\n e4 = newgroupentities.add_line p7,p5\n else\n e1 = newgroupentities.add_line p9,p10\n e2 = newgroupentities.add_line p10,p11\n e3 = newgroupentities.add_line p11,p12\n e4 = newgroupentities.add_line p12,p9\n end #if p1 etc\n face = newgroupentities.add_face [e1,e2,e3,e4]\n newgroup\n end",
"def add_section(section)\n @section_counter[section] += 1\n end",
"def add_section(section, selected_page_layout=nil, attrs={})\n # check section.section_piece.is_container?\n obj = nil\n if section.root? \n section_instance = 1\n if selected_page_layout.present?\n raise ArgugemntError, 'only container could has child section' unless selected_page_layout.section.section_piece.is_container \n whole_tree = selected_page_layout.root.self_and_descendants\n section_instance = whole_tree.select{|xnode| xnode.section_id==section.id}.size.succ\n end\n attrs[:title]||=\"#{section.title}#{section_instance}\" \n obj = PageLayout.create do|obj|\n obj.section_id, obj.section_instance=section.id, section_instance\n obj.assign_attributes( attrs )\n obj.root_id = selected_page_layout.root_id if selected_page_layout.present?\n obj.site_id = SpreeTheme.site_class.current.id\n obj.is_full_html = section.section_piece.is_root?\n end\n if selected_page_layout.present?\n obj.move_to_child_of(selected_page_layout)\n else\n obj.update_attribute(\"root_id\",obj.id)\n end\n #copy the default section param value to the layout\n obj.add_param_value(self)\n end\n obj\n end",
"def add_new_section\n @section = Section.new\n end",
"def add_section(fields={})\n section_data = fields.merge({\n :suite_id => data.id,\n })\n return add_entity(Section, data.project_id, section_data)\n end",
"def active_section_plane\n end",
"def add_section(s_ident, off=0, sz=nil, name=nil, \n flgs=Section::DEFAULT_FLAGS, arch_info=nil)\n sz ||= size - off\n s = Bgo::Section.new(s_ident, name, image, image_offset + off, off, sz, \n flgs)\n s.arch_info = arch_info if arch_info\n add_section_object s\n end",
"def add_rule_in_section(section_id, firewall_rule, opts = {})\n data, _status_code, _headers = add_rule_in_section_with_http_info(section_id, firewall_rule, opts)\n data\n end",
"def use_section_planes=(setting)\n end",
"def <<(section)\n @sections << section\n self\n end",
"def create\n @section = Section.new(params[:section])\n\n Course.find(params[:section][:add_section]).sections << @section if params[:section][:add_section]\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_section(section_name)\n section_spec = %(\n {\n \"display_name\": \"#{section_name}\",\n \"section_type\": \"LAYER3\",\n \"stateful\": true\n }\n )\n section_id = @nsx_client.post(@url_sections, section_spec)\n result = section_by_id(section_id)\n raise 'Section was not created in DFW' unless result\n\n result\n end",
"def plane_params\n params.require(:plane).permit(:name, :model, :year, :description, :matricula, :status)\n end",
"def update_section_with_http_info(section_id, firewall_section, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.update_section ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.update_section\"\n end\n # verify the required parameter 'firewall_section' is set\n if @api_client.config.client_side_validation && firewall_section.nil?\n fail ArgumentError, \"Missing the required parameter 'firewall_section' when calling ManagementPlaneApiServicesFirewallApi.update_section\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(firewall_section)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#update_section\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @plane = Plane.new(params[:plane])\n\n respond_to do |format|\n if @plane.save\n format.html { redirect_to @plane, notice: 'Plane was successfully created.' }\n format.json { render json: @plane, status: :created, location: @plane }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plane.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_section(position = nil, section_type = nil)\n section = self.sections.create(Section::DEFAULT_PARAMS)\n section.move_to_bottom\n end",
"def add_section(project_id, data = {})\n post(\"add_section/#{project_id}\", body: data.to_json)\n end",
"def sell_shop_item_section_add(item_id, section_name, params={})\r\n url = api_url \"/sell/shop/items/#{item_id}/add_section\"\r\n req = request_params({currency: @currency, locale: @locale}.merge(params))\r\n load = MultiJson.dump section: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end",
"def add_section_with_rules_create_with_rules_with_http_info(firewall_section_rule_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.add_section_with_rules_create_with_rules ...'\n end\n # verify the required parameter 'firewall_section_rule_list' is set\n if @api_client.config.client_side_validation && firewall_section_rule_list.nil?\n fail ArgumentError, \"Missing the required parameter 'firewall_section_rule_list' when calling ManagementPlaneApiServicesFirewallApi.add_section_with_rules_create_with_rules\"\n end\n if @api_client.config.client_side_validation && !opts[:'id'].nil? && opts[:'id'].to_s.length > 64\n fail ArgumentError, 'invalid value for \"opts[:\"id\"]\" when calling ManagementPlaneApiServicesFirewallApi.add_section_with_rules_create_with_rules, the character length must be smaller than or equal to 64.'\n end\n\n if @api_client.config.client_side_validation && opts[:'operation'] && !['insert_top', 'insert_bottom', 'insert_after', 'insert_before'].include?(opts[:'operation'])\n fail ArgumentError, 'invalid value for \"operation\", must be one of insert_top, insert_bottom, insert_after, insert_before'\n end\n # resource path\n local_var_path = '/firewall/sections?action=create_with_rules'\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(firewall_section_rule_list)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSectionRuleList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#add_section_with_rules_create_with_rules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_sector(name,map,profile,total=1e+6,verbose=nil)\n @sectors << name\n sec = AscMap.new(map)\n sec.normalize!(total)\n yshift = (sec.params[\"yllcorner\"].to_i-@src_map.params[\"yllcorner\"].to_i) / @src_map.params[\"cellsize\"].to_i\n xshift = (sec.params[\"xllcorner\"].to_i-@src_map.params[\"xllcorner\"].to_i) / @src_map.params[\"cellsize\"].to_i\n puts \"add #{name} to space allocation - yshift #{yshift} - xshift #{xshift}\" if verbose\n @src_map.each_data do |row,col|\n if row-yshift<0 || col-xshift<0 ||\n row-yshift>=sec.params[\"nrows\"] ||\n col-xshift>=sec.params[\"ncols\"] ||\n sec.cells[row-yshift][col-xshift]==sec.params[\"NODATA_value\"]\n @sec_map << 0\n else\n @sec_map << sec.cells[row-yshift][col-xshift]\n end\n end\n @sec_prf << YAML.load_file(profile)\n end",
"def zone_add(zone,member)\n obj_add(zone,Zone,member)\n end",
"def <<(section)\n @sections << section.to_s\n end",
"def sell_shop_section_create (section_name, params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\n end",
"def add_section_piece(section_piece, default_param_values={})\n raise \"section_piece is nil\" if section_piece.blank?\n # section_piece = SectionPiece.find(section_piece_id)\n tree = self.root.self_and_descendants\n section_piece_instance = tree.select{|xnode| xnode.section_piece_id==section_piece.id}.size.succ\n atts = { :section_piece_id=>section_piece.id}\n section = nil\n self.class.transaction do\n section = self.class.create!(atts)do|obj|\n obj.root_id= self.root_id\n obj.section_piece_instance=section_piece_instance\n end\n section.move_to_child_of(self)\n section.add_section_piece_param(default_param_values)\n end\n section\n end",
"def section=(section)\n section = Section.find_or_create_by(name: section[:name])\n self.section_id = section.id\n end",
"def landing (plane)\n\t\tfail 'This plane has already landed' if plane.flying? == false\n\t\tfail 'The airport is full. No landings are possible.' if full?\n\t\tplane = plane.landed?\n\t\t@planes << plane\n\t\tputs 'Your flight has landed'\n\n\tend",
"def use_section_planes?\n end",
"def add(entity)\n\t\t# TODO: set entity ID when adding to Space\n\t\t# (without a proper unique ID, serialization will not work. without serialization, we can't roll back history.)\n\t\t@entities << entity\n\t\t\n\t\t\n\t\t@cp_space.add_shape(entity.shape)\n\t\t@cp_space.add_body(entity.body)\n\tend",
"def delete_section_with_http_info(section_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.delete_section ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.delete_section\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cascade'] = opts[:'cascade'] if !opts[:'cascade'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#delete_section\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def allow_landing(plane)\n\t\traise \"This Airport is full\" if full?\n\t\traise \"This flight cannot land due to weather conditions\" if weather_stormy?\n\t\t# check your language, landed sounds like a question rather than a command\n\t\t# what about \"land!\" ?\n\t\tplane.landed!\n\t\t@planes << plane\n\tend",
"def distance_to_plane(plane)\n end",
"def plane\n end",
"def add_section(name, *fields)\n send(\"#{name}=\", Struct.new(*fields).new)\n end",
"def append_segment(seg)\n update_meta_data(seg)\n @segments << seg\n end",
"def add_tab text, component = nil, aconfig={}, &block\n index = @tabs.size\n tab = insert_tab text, component, index, aconfig, &block\n return tab\n end",
"def add_segment(segment)\n @segments.push(segment)\n @minimal_segment_count += 1\n end",
"def intersects_plane?(inst1,t1,plane_group,t2)\n #we will perform a test intersection to see if any new edges were created.\n if @helper_group==nil\n @helper_group=Sketchup.active_model.active_entities.add_group #this group will contain the edges from the test intersection\n @helper_group.entities.add_cpoint([0,0,0]) #adding a construction point to ensure that this group contains something to avoid automatic deletion by SketchUp\n end\n ents1=get_entities(inst1)\n ents2=@helper_group.entities\n new_edges=ents1.intersect_with(false,t1,ents2,@helper_group.transformation,false,[plane_group])\n\n if new_edges.length>0 #if new edges were created by the intersection\n return true\n else\n return false\n end\n end",
"def addBackgroundOrColoredPlane(sprites,planename,background,color,viewport=nil)\n bitmapName=pbResolveBitmap(\"Graphics/Pictures/#{background}\")\n if bitmapName==nil\n # Plane should exist in any case\n sprites[planename]=ColoredPlane.new(color,@viewport)\n else\n sprites[planename]=AnimatedPlane.new(viewport)\n sprites[planename].setBitmap(bitmapName)\n for spr in sprites.values\n if spr.is_a?(Window)\n spr.windowskin=nil\n end\n end\n end\nend",
"def addBackgroundPlane(sprites,planename,background,viewport=nil)\n sprites[planename]=AnimatedPlane.new(viewport)\n bitmapName=pbResolveBitmap(\"Graphics/Pictures/#{background}\")\n if bitmapName==nil\n # Plane should exist in any case\n sprites[planename].bitmap=nil\n sprites[planename].visible=false\n else\n sprites[planename].setBitmap(bitmapName)\n for spr in sprites.values\n if spr.is_a?(Window)\n spr.windowskin=nil\n end\n end\n end\nend",
"def is_on_plane?(plane)\n plane.substitute(self) == 0\n end",
"def add_section(name, file)\n raise \"A section with name #{name} already exists\" if include?(name)\n result = Section.new(name, file)\n @files[file] ||= []\n @files[file] << result\n result\n end",
"def add_tab(*args)\n tabs << args\n end",
"def add_element_to_section(section,type,data)\n url = @base + \"elements.json\"\n params = {\"item\"=>{\"element_type\"=> type, \"data\"=>data, \"container_type\"=>\"ExperimentProcedure\", \"container_id\"=>section[\"id\"], \"field_name\"=>section[\"section_type\"]},token: @token}\n response = JSON.parse(RestClient.post(url,params))\nend",
"def get_section_with_http_info(section_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.get_section ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.get_section\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#get_section\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_battle_planes\n @battle_plane = Battle_Plane.new(@viewport1)\n end",
"def distance_to_plane(plane)\n plane.substitute(self).abs / (plane.find_normal_vector.length)\n end",
"def add_section_params\n sections = Section.where(:section_piece_id=>self.section_piece_id)\n for section in sections\n section.section_params.create do|section_param|\n section_param.section_root_id = section.root_id\n section_param.section_piece_param_id = self.id\n end\n end\n end",
"def section(elem_id, elem_title)\n section(elem_id, elem_title, :elem_name=>'section')\n end",
"def update\n @plane = Plane.find(params[:id])\n\n respond_to do |format|\n if @plane.update_attributes(params[:plane])\n format.html { redirect_to @plane, notice: 'Plane was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plane.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_section title, comment = nil\n if section = @sections[title] then\n section.add_comment comment if comment\n else\n section = Section.new self, title, comment\n @sections[title] = section\n end\n\n section\n end",
"def add_layer_object( object )\n layers.push( object )\n end",
"def add_element_to_section(section,type,data)\n url = @base + \"/api/v1/elements.json\"\n params = {\"item\"=>{\"element_type\"=> type, \"data\"=>data, \"container_type\"=>\"ExperimentProcedure\", \"container_id\"=>section[\"id\"], \"field_name\"=>section[\"section_type\"]},token: @token}\n response = JSON.parse(RestClient.post(url,params))\nend",
"def add_subsection(fields={})\n _suite = suite\n subsection_data = fields.merge({\n :suite_id => _suite.id,\n :parent_id => data.id\n })\n return add_entity(Section, _suite.project_id, subsection_data)\n end",
"def create\n @section = Section.new(params[:section])\n @section.account = @account\n \n # This serves to retreive any article attached to this new section so we can access that article's apge\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.js { redirect_to(account_article_sortings_url(@account, @article, :format=>:js)) if @article}\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { render :xml => [@account, @section], :status => :created, :location =>[@account, @section] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def delete_rule_with_http_info(section_id, rule_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.delete_rule ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.delete_rule\"\n end\n # verify the required parameter 'rule_id' is set\n if @api_client.config.client_side_validation && rule_id.nil?\n fail ArgumentError, \"Missing the required parameter 'rule_id' when calling ManagementPlaneApiServicesFirewallApi.delete_rule\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}/rules/{rule-id}'.sub('{' + 'section-id' + '}', section_id.to_s).sub('{' + 'rule-id' + '}', rule_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#delete_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_section_with_rules_update_with_rules_with_http_info(section_id, firewall_section_rule_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.update_section_with_rules_update_with_rules ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.update_section_with_rules_update_with_rules\"\n end\n # verify the required parameter 'firewall_section_rule_list' is set\n if @api_client.config.client_side_validation && firewall_section_rule_list.nil?\n fail ArgumentError, \"Missing the required parameter 'firewall_section_rule_list' when calling ManagementPlaneApiServicesFirewallApi.update_section_with_rules_update_with_rules\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}?action=update_with_rules'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(firewall_section_rule_list)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSectionRuleList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#update_section_with_rules_update_with_rules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def revise_section_revise_with_http_info(section_id, firewall_section, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.revise_section_revise ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.revise_section_revise\"\n end\n # verify the required parameter 'firewall_section' is set\n if @api_client.config.client_side_validation && firewall_section.nil?\n fail ArgumentError, \"Missing the required parameter 'firewall_section' when calling ManagementPlaneApiServicesFirewallApi.revise_section_revise\"\n end\n if @api_client.config.client_side_validation && !opts[:'id'].nil? && opts[:'id'].to_s.length > 64\n fail ArgumentError, 'invalid value for \"opts[:\"id\"]\" when calling ManagementPlaneApiServicesFirewallApi.revise_section_revise, the character length must be smaller than or equal to 64.'\n end\n\n if @api_client.config.client_side_validation && opts[:'operation'] && !['insert_top', 'insert_bottom', 'insert_after', 'insert_before'].include?(opts[:'operation'])\n fail ArgumentError, 'invalid value for \"operation\", must be one of insert_top, insert_bottom, insert_after, insert_before'\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}?action=revise'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'operation'] = opts[:'operation'] if !opts[:'operation'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(firewall_section)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#revise_section_revise\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_planet(planet)\n\t\t@planets << planet\n\tend",
"def op_add!(field, objects)\n operate_field! field, { __op: :Add, objects: objects }\n end",
"def addVehicle _obj, _args\n \"_obj addVehicle _args;\" \n end",
"def on_plane?(plane)\n end",
"def add(room)\r\n raise \"Illegal room: #{room.inspect}\" unless room.class == Room\r\n puts \"Room #{room.id} already exists.\" if @rooms[room.id]\r\n @rooms[room.id] = room\r\n @current_room = room unless @current_room\r\n end",
"def get_section_with_rules_list_with_rules_with_http_info(section_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.get_section_with_rules_list_with_rules ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.get_section_with_rules_list_with_rules\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}?action=list_with_rules'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSectionRuleList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#get_section_with_rules_list_with_rules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def <<(anchor)\n @anchors << anchor\n\n @sections << Section.new( @anchors[@anchors.length-2], @anchors.last )\n\n balance_at @anchors.length - 2\n balance_at @anchors.length - 1\n\n @length += @sections.last.compute_length(@steps)\n @sections.last.compute_key_lengths(@steps)\n end",
"def add_planet(planet_to_add)\n @planets << planet_to_add\n end",
"def add_course_section_to_schedule\n section_id = params[:section_id]\n @course_section = CourseSection.find_by(:id => section_id)\n\n @course_schedule = CourseSchedule.find_or_create_by(:user => current_user)\n if(@course_schedule.course_sections.none? { |section| section.code_slug == @course_section.code_slug })\n @course_schedule.course_sections << @course_section\n @course_schedule.save\n end\n\n respond_to do |format|\n format.js\n end\n end",
"def create\n @section = Section.new(section_params)\n if @section.save\n render json: SectionSerializer.new(@section)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def update_rule_with_http_info(section_id, rule_id, firewall_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.update_rule ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.update_rule\"\n end\n # verify the required parameter 'rule_id' is set\n if @api_client.config.client_side_validation && rule_id.nil?\n fail ArgumentError, \"Missing the required parameter 'rule_id' when calling ManagementPlaneApiServicesFirewallApi.update_rule\"\n end\n # verify the required parameter 'firewall_rule' is set\n if @api_client.config.client_side_validation && firewall_rule.nil?\n fail ArgumentError, \"Missing the required parameter 'firewall_rule' when calling ManagementPlaneApiServicesFirewallApi.update_rule\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}/rules/{rule-id}'.sub('{' + 'section-id' + '}', section_id.to_s).sub('{' + 'rule-id' + '}', rule_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(firewall_rule)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#update_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def acquire_new_plane(aircrafttype)\n home_airport = self.home_airport_game\n param_array = [aircrafttype,self,home_airport]\n new_plane = PlaneCreator.new(param_array).manufacture\n finalize_acquisition_and_save(new_plane)\n end",
"def section=(section)\n self[:section] = section\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end"
] | [
"0.74655074",
"0.6930494",
"0.5915646",
"0.5457149",
"0.54046077",
"0.5373522",
"0.5364024",
"0.5331536",
"0.52687496",
"0.52687496",
"0.5228261",
"0.5190453",
"0.51862484",
"0.5051143",
"0.504725",
"0.5021157",
"0.49847895",
"0.488438",
"0.48611373",
"0.48524427",
"0.4842374",
"0.4839017",
"0.48275614",
"0.480792",
"0.47875077",
"0.4774592",
"0.4763098",
"0.47321957",
"0.4727932",
"0.47214738",
"0.4709179",
"0.46864888",
"0.46294728",
"0.46240503",
"0.46102753",
"0.4588462",
"0.45642564",
"0.45632702",
"0.45550644",
"0.45422408",
"0.45245245",
"0.44857973",
"0.44485644",
"0.4423993",
"0.43995845",
"0.43903556",
"0.43828574",
"0.4376905",
"0.43762466",
"0.43639907",
"0.43614012",
"0.43597898",
"0.43587342",
"0.43497688",
"0.4328546",
"0.43185058",
"0.43163627",
"0.4310713",
"0.43097886",
"0.43092686",
"0.4293767",
"0.42837995",
"0.42765996",
"0.42757738",
"0.42721424",
"0.42463657",
"0.42459667",
"0.42192447",
"0.4207912",
"0.4206976",
"0.4204252",
"0.4194976",
"0.41921473",
"0.41911495",
"0.41901377",
"0.41891634",
"0.4183014",
"0.41702586",
"0.4169598",
"0.4167942",
"0.41628602",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694",
"0.4140694"
] | 0.8068956 | 0 |
The clear! method is used to remove all entities from the collection of entities. | def clear!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear\n @dao.collection.remove\n end",
"def clear\n return self if empty?\n\n entities = @entities.dup\n inverse_metadata = metadata.inverse_metadata\n\n @entities.clear\n\n entities.each do |deleted|\n if inverse_metadata\n deleted.send(inverse_metadata.writer_name, nil)\n end # if\n end # each\n\n self\n end",
"def clear\n @entity_list = {}\n @context_list = {}\n @last_unique_id = 0\n @entity_names = {} # Internal cache of context names for quick key retrieval\n end",
"def clear(collection)\n blk = Proc.new {}\n query(collection, blk).each { |entity| delete(collection, entity) }\n end",
"def finalize\n @entities.clear\n end",
"def clear!\n @all = Set.new\n end",
"def clear!\n items.clear\n save\n end",
"def clear!\n @items.clear\n end",
"def clear\n do_clear\n end",
"def clear\n\n end",
"def clear\n @adapter.clear(collection)\n end",
"def clear!\n @items.clear\n end",
"def clear_all\n data.delete_all\n self\n end",
"def clear_model\n @panel.remove_all\n @connections.clear\n @entities.clear\n end",
"def clear\n @items.clear\n end",
"def clear!\n @items.clear\n save\n end",
"def remove_all()\n @items.clear()\n end",
"def clear\n store.clear\n end",
"def clear\n @object_id_to_object.clear\n registered_exceptions.clear\n manager.clear\n end",
"def clear\n end",
"def clear() end",
"def clear() end",
"def clear() \n @obj.clear() \n end",
"def delete_all\n records.clear\n end",
"def clear\n end",
"def clear\n end",
"def clear\n @items = []\n end",
"def clear\n @cache.clear\n entries.clear\n self\n end",
"def clear!\n @documents = {}\n @attributes = {}\n @lookup_map = nil\n @all_loaded = false\n @all = []\n end",
"def clear\n @products.clear\n end",
"def clear\n\t\tend",
"def clear\n instance.clear\n end",
"def clear\n self.class.empty\n end",
"def clear\n end",
"def clear\n end",
"def clear\n end",
"def clear\n @imgs.clear\n @tilesets.clear\n @sounds.clear\n @songs.clear\n @fonts.clear\n end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear!\n registered_items.clear\n end",
"def clear!\n registered_items.clear\n end",
"def clear\n hashed.clear\n list.clear\n end",
"def clear\r\n @cache.flush\r\n end",
"def clear!; end",
"def clear!; end",
"def clear!; end",
"def clear\n ingredients.clear\n Recipe.clear\n end",
"def clear!\n @posts = nil\n end",
"def clear\r\n @resources.clear\r\n end",
"def clear!\n @columns.clear\n @columns_hash.clear\n @primary_keys.clear\n @tables.clear\n @version = nil\n end",
"def clear\n @list = []\n end",
"def erase_all\n entities_to_erase = []\n for entity in Sketchup.active_model.entities\n entities_to_erase.push entity\n end\n\n for entity in entities_to_erase\n if entity.valid?\n entity.erase!\n end\n end\n end",
"def clear()\n merge(clear: 'true')\n end",
"def clear\n run_hook(:before_clear)\n db.clear\n run_hook(:after_clear)\n end",
"def clear\n @by_id.values.each{|x| x.clear }\n end",
"def clear_cache\n @all = nil\n end",
"def clear!()\n @list = nil\n end",
"def destroy_entities entities; end",
"def clear_all\n clear\n clear_stored_requests\n end",
"def clear\n\n self.list=([])\n end",
"def clear_all!\n @cache = Cache.new\n end",
"def clear\n instrument(:clear, nil, nil) do\n failsafe(:clear) do\n with(&:flushdb)\n end\n end\n end",
"def clear\n @db.clear\n self\n end",
"def clear\n return\n end",
"def delete_all\n @objects.each do |o|\n o.delete \n end\n\n @objects.clear\n end",
"def clear_all\n NotImplementedError\n end",
"def delete_all\n target.clear\n end",
"def clear\n @tasks.clear\n @rules.clear\n end",
"def clear_world\n @all_persons.clear\n @all_monsters.clear\n @all_strawberries.clear\n @all_mushrooms.clear\n\n @iteration = 0\n end",
"def clear\n @fetch = nil\n reset_query\n self\n end",
"def clear\n EmptyList\n end",
"def clear\n raise \"not implemented\"\n end",
"def clear\n raise NotImplementedError\n end",
"def clear\n raise NotImplementedError\n end",
"def flush\n @lists = nil\n end",
"def clear!\n @tracking.drop\n @user_data.drop\n create_indices\n end",
"def clear\n @mutex.synchronize do\n @tuples.clear\n @objects.clear\n @catdata.clear\n end\n self\n end",
"def clear!\n context_manager.clear!\n breadcrumbs.clear!\n end",
"def clear\n @cache.clear\n end",
"def reset\n @collection = []\n end",
"def clear\n self.rows = nil\n end",
"def clear\n\t\t@first = nil\n\t\t@last = nil\n\tend",
"def clear_changes!\n @changes.clear\n end",
"def clear\n update_attribute :items, []\n end",
"def clear\n @values.each { |v| v.deleted = true }\n end",
"def clear\n if loaded?\n orphan_resources(self)\n end\n super\n end",
"def clear\n @table.clear\n end",
"def clear\n @dataset.clear\n end",
"def clear\n self.map.clear\n end",
"def clear_all()\n User.destroy_all\n Hashtag.destroy_all\n Mention.destroy_all\n Tweet.destroy_all\n Follow.destroy_all\n # Hashtag_tweets.destroy_all\nend",
"def clear\n\t\[email protected]\n\t\t@modified = true\n\tend",
"def clear\n\t\twhile self.length > 0\n\t\t\tremove self.head\n\t\tend\n\tend",
"def clear\n\t\twhile self.length > 0\n\t\t\tremove self.head\n\t\tend\n\tend",
"def clear\n\t\twhile self.length > 0\n\t\t\tremove self.head\n\t\tend\n\tend",
"def clear\n @list = []\n end"
] | [
"0.7814463",
"0.76319367",
"0.75952125",
"0.756631",
"0.7449117",
"0.7440509",
"0.74106777",
"0.7398808",
"0.73742366",
"0.73490655",
"0.73130244",
"0.7295041",
"0.7252483",
"0.7195889",
"0.7173491",
"0.71661794",
"0.71569973",
"0.71354115",
"0.7090501",
"0.7082043",
"0.70763063",
"0.70763063",
"0.7055536",
"0.70402795",
"0.7028509",
"0.7028509",
"0.70260537",
"0.70188665",
"0.7000394",
"0.6981976",
"0.6975082",
"0.6937562",
"0.69371057",
"0.69305515",
"0.69305515",
"0.69305515",
"0.6930511",
"0.69060147",
"0.69060147",
"0.69060147",
"0.69060147",
"0.69060147",
"0.69060147",
"0.69060147",
"0.6897881",
"0.6897881",
"0.6884901",
"0.6879705",
"0.6877923",
"0.6877923",
"0.6877923",
"0.6830147",
"0.6817361",
"0.6814966",
"0.68110204",
"0.67617583",
"0.6751174",
"0.6748846",
"0.673685",
"0.6733428",
"0.67257714",
"0.671526",
"0.6715123",
"0.6714975",
"0.6696658",
"0.6689842",
"0.66889477",
"0.66754866",
"0.66647226",
"0.66621786",
"0.6661633",
"0.6658328",
"0.66551435",
"0.6653878",
"0.66398615",
"0.6612563",
"0.66099185",
"0.6594143",
"0.6594143",
"0.6569463",
"0.6561908",
"0.6560082",
"0.6556839",
"0.6547317",
"0.6532624",
"0.65232044",
"0.65197533",
"0.6511407",
"0.65104485",
"0.6510241",
"0.6510223",
"0.65097797",
"0.65080667",
"0.65016556",
"0.64972323",
"0.64949113",
"0.64908004",
"0.64908004",
"0.64908004",
"0.6488447"
] | 0.6771032 | 55 |
The intersect_with method is used to intersect an entities, component instance, or group object with a entities object. | def intersect_with(recurse, transform1, entities1, transform2, hidden, entities2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersects_with(&block)\n [:intersects_with, block]\n end",
"def intersects_with(&block)\n [:intersects_with, block]\n end",
"def intersect(tenant_id,entity_type_id_1,entity_id_1,entity_type_id_2,strict_number)\n @instance.intersect(tenant_id,entity_type_id_1,entity_id_1,entity_type_id_2,strict_number)\n end",
"def intersect _obj, _args\n \"_obj intersect _args;\" \n end",
"def intersect(dataset, opts=OPTS)\n raise(InvalidOperation, \"INTERSECT not supported\") unless supports_intersect_except?\n raise(InvalidOperation, \"INTERSECT ALL not supported\") if opts[:all] && !supports_intersect_except_all?\n compound_clone(:intersect, dataset, opts)\n end",
"def __intersect__(object)\n object.__intersect_from_array__(self)\n end",
"def intersect(other)\n set_operation(other, :intersect, distinct: true)\n end",
"def intersect(other)\n intersections(other)\n .with_object(self.class.new) { |(b, e), a| a << create_item(b, e) }\n end",
"def intersect_all(other)\n set_operation(other, :intersect, distinct: false)\n end",
"def entities_overlapping(x, y)\n entities_at_points(corner_points_of_entity(x, y))\n end",
"def intersect(other)\n Intersection.new(self, other)\n end",
"def intersect(other)\n\t\t\tc = Xmms::Collection.new(Xmms::Collection::TYPE_INTERSECTION)\n\t\t\tc.operands << self\n\t\t\tc.operands << other\n\t\t\tc\n\t\tend",
"def intersect(boundingbox)\n end",
"def intersect(dataset, all = false)\n clone(:intersect => dataset, :intersect_all => all)\n end",
"def intersect(other)\n new(to_ary & other)\n end",
"def lineIntersectsWith _args\n \"lineIntersectsWith _args;\" \n end",
"def test_intersect1\n # Testing pathological cases: Intersect one cube against another offset.\n model = Sketchup.active_model\n entities = model.entities\n pts = []\n pts[0] = [0, 0, 0]\n pts[1] = [100, 0, 0]\n pts[2] = [100, 100, 0]\n pts[3] = [0, 100, 0]\n\n #Test instance.intersect\n definition = model.definitions.add(\"component\")\n # Add the face to the entities in the group\n face = definition.entities.add_face pts\n status = face.pushpull -100, true\n\n origin = Geom::Point3d.new 0, 0, 0\n transform = Geom::Transformation.new origin\n point = Geom::Point3d.new 0, 25, 0\n t = Geom::Transformation.new point\n\n golden = entities.add_group\n\n pts1 = []\n pts1[0] = [0, 0, 0]\n pts1[1] = [100, 0, 0]\n pts1[2] = [100, 75, 0]\n pts1[3] = [0, 75, 0]\n\n # Add the face to the entities in the group\n face = golden.entities.add_face pts1\n\n status = face.pushpull -100, true\n\n golden.transform! t\n instance1 = entities.add_instance definition, transform\n instance2 = instance1.copy\n instance2.move! t\n\n intersection = instance1.intersect(instance2)\n assert(golden.equals?(intersection), 'instance.intersect failed')\n end",
"def intersection\n self.reduce(&:intersection)\n end",
"def test_e123_include_intersect\n verify_method :e123_include_intersect,\n :with =>\n [\n {\n params: [2, 1, 2],\n predicate: Proc.new { |all, intersect, include| check_included_intersected(2, 1, 2, all, intersect, include) }\n },\n {\n params: [5, 1, 10],\n predicate: Proc.new { |all, intersect, include| check_included_intersected(5, 1, 10, all, intersect, include) }\n }\n ]\n\n end",
"def fetch_intersection(json_a, json_b)\n return json_b.kind_of?(Array) ? json_a & json_b : json_a.intersection(json_b)\n end",
"def with(with={})\n @options[:with].merge!(with) if with.kind_of?(Hash)\n end",
"def intersection(fa)\n perform_set_operation(:intersection, fa)\n end",
"def e123_include_intersect (n, min, max)\n end",
"def intersection(other)\n self.class.from_a(to_a & other.to_a)\n end",
"def intersectWithSegmentAsLineResult seg\n # self is the intersection \n self\n end",
"def highlight(*entities)\n @entities.clear\n @transformations_active.clear\n @transformations_inactive.clear\n model = Sketchup.active_model\n entities.each{ |entity|\n if entity.is_a?(Sketchup::Drawingelement) ||\n entity.is_a?(Sketchup::Curve) ||\n entity.is_a?(Sketchup::Vertex)\n @entities << entity\n # Find all occurences of the entity (in instances) and collect their transformations.\n @transformations_active[entity] = collect_all_active_occurences(entity)\n @transformations_inactive[entity] = collect_all_inactive_occurences(entity)\n model = entity.model\n elsif entity.is_a?(Geom::Point3d) ||\n entity.is_a?(Geom::Vector3d) ||\n entity.is_a?(Geom::BoundingBox)\n @entities << entity\n # Point3d, Vector3d, Geom::BoundingBox have no instance path (no position in\n # model nesting hierarchy). So we draw them always relative to the active context.\n @transformations_active[entity] = [model.edit_transform]\n @transformations_inactive[entity] = []\n end\n }\n model.active_view.invalidate\n end",
"def with(*features)\n pos, neg = mangle_args(*features)\n self.class.new(Hash[@sets.select do |key, val|\n !key.intersection(pos).empty?\n end]).without_any(neg)\n end",
"def intersection(other)\n raise ArgumentError, \"value must be a #{self.class.name}\" unless other.is_a?(VersionRange)\n result = @ranges.map { |range| other.ranges.map { |o_range| range.intersection(o_range) } }.flatten\n result.compact!\n result.uniq!\n result.empty? ? EMPTY_RANGE : VersionRange.new(result, nil)\n end",
"def intersect(set, options = {}, &block)\n result = intersected = RedisModel::Intersected.new([self, set], options[:seed])\n\n if block_given?\n intersected.generate\n result = yield(intersected)\n intersected.clear\n end\n\n result\n end",
"def vt_intersect(instant=Time.zone.now, range_end=nil)\n where(arel_vt_intersect(instant, range_end))\n end",
"def include_by entity_type, entity_id, user_id\n if entity = entity_type.singularize.camelize.constantize.find(entity_id)\n include entity, user_id\n end\n end",
"def tt_intersects?(*args)\n tt_range.intersects?(*args)\n end",
"def intersect(other)\n @bits & bits_from_object(other)\n end",
"def merge(with); end",
"def tt_intersect(instant=Time.zone.now, range_end=nil)\n where(arel_tt_intersect(instant, range_end))\n end",
"def intersect(other)\n begin_at = self.begin >= other.begin ? self.begin : other.begin\n end_at = self.end <= other.end ? self.end : other.end\n\n begin_at <= end_at ? self.class.new(begin_at..end_at) : nil\n end",
"def vt_intersects?(*args)\n vt_range.intersects?(*args)\n end",
"def arel_tt_intersect(instant, range_end)\n arel_intersect(:ttstart_at, :ttend_at, instant, range_end)\n end",
"def lineIntersectsObjs _args\n \"lineIntersectsObjs _args;\" \n end",
"def intersection_with(other)\n r1,r2 = matched_range_types(self, other)\n max_begin = [r1.begin,r2.begin].max\n min_end = [r1.end, r2.end ].min\n excl = ( r1.end == min_end && \n r1.respond_to?(:exclude_end?) && r1.exclude_end?\n ) ||\n ( r2.end == min_end && \n r2.respond_to?(:exclude_end?) && r2.exclude_end?\n )\n unless max_begin > min_end\n Range.new(max_begin, min_end, excl).extend(DateTimeRange)\n end\n end",
"def intersection(other)\n if other.is_a?(Point)\n return points_intersection(self, other)\n end\n\n if other.respond_to?(:intersection)\n return other.intersection(self)\n end\n\n raise TypeError, \"Intersection between Point and #{ other.class } is not defined\"\n end",
"def intersection\n @grpc.intersection\n end",
"def intersection(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#intersection not defined.\"\n end",
"def arel_vt_intersect(instant, range_end)\n arel_intersect(:vtstart_at, :vtend_at, instant, range_end)\n end",
"def get_intersection\n end",
"def bt_intersect(*args)\n where(arel_bt_intersect(*bt_temporal(*args)))\n end",
"def intersection(other)\n intersection_result = []\n \n if other.is_a?(Polygon) \n k = other.sides \n else \n k = [other]\n end\n\n self.sides.each do |side|\n k.each do |side1|\n intersection_result += side.intersection(side1)\n end\n end\n\n intersection_result.uniq! do |a|\n if a.is_a?(Point)\n [a.x, a.y]\n else\n [a.p1, a.p2].sort_by {|p| [p.x, p.y]} \n end\n end\n points = []; segments = []\n\n intersection_result.each do |entity|\n points << entity if entity.is_a?(Point)\n segments << entity if entity.is_a?(Segment)\n end\n\n if !points.empty? && !segments.empty?\n points_in_segments = []\n\n points.each do |point|\n segments.each do |segment|\n points_in_segments << point if segment.contains?(point)\n end\n end\n\n points_in_segments.uniq! {|a| [a.x, a.y]}\n if !points_in_segments.empty?\n points_in_segments.each do |p|\n points.delete(p)\n end\n end\n\n return points.sort + segments.sort\n end\n\n return intersection_result.sort\n end",
"def Range3dIntersect(arg0, arg1)\n ret = _invoke(1610744089, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def intersects?(other)\n !!intersection_with(other)\n end",
"def intersecting_with_bbls(bbls_geom)\n @dataset.distinct.select(:geom, :district, :subdistrict).where{st_intersects(st_geomfromtext(\"#{bbls_geom}\", \"#{bbls_geom.srid}\"), :geom)}\n end",
"def intersect(ray)\n # Must be overriden be subclasses\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def &(predicate)\n predicate.is_a?(Predicate) ? Predicate::Intersection.new(self, predicate) : self\n end",
"def intersection(other)\n mapping_function = 'lambda{|item| [item, nil]}'\n filter_function = 'lambda{|(key, values)| values.size > 1}'\n\n self.map(mapping_function)\n .cogroup(other.map(mapping_function))\n .filter(filter_function)\n .keys\n end",
"def intersection( to )\n\n # Bullet line between box center and to-point.\n bline = Gseg.new( self.pos.to_gpos, to )\n\n # Find which side of self intersects with bline.\n side = nil\n [ :r, :l, :u, :d ].each do |sidesym|\n trial = self.sideline_seg( sidesym )\n if trial.intersects_with?( bline )\n side = trial\n break\n end\n end\n\n side.intersection_point_with( bline )\n end",
"def update!(**args)\n @intersection = args[:intersection] if args.key?(:intersection)\n end",
"def lineIntersects _args\n \"lineIntersects _args;\" \n end",
"def supports_intersect_except?\n false\n end",
"def supports_intersect_except?\n false\n end",
"def supports_intersect_except_all?\n false\n end",
"def set_contains\n @contain = Contain.find(params[:id])\n end",
"def tags_shared_with(taggable, context = 'tags')\n tags.find(:all, :conditions => [\"id IN (SELECT tag_id FROM taggings WHERE taggable_id = ? AND taggable_type = ? AND context = ?)\", taggable.id, taggable.class.name, context])\n end",
"def intersection(range)\n cmp = self.begin <=> range.end\n if cmp > 0\n nil\n elsif cmp == 0\n exclude_begin? || range.exclude_end? ? nil : EqRange.new(self.begin)\n else\n cmp = range.begin <=> self.end\n if cmp > 0\n nil\n elsif cmp == 0\n range.exclude_begin? || exclude_end? ? nil : EqRange.new(range.begin)\n else\n cmp = self.begin <=> range.begin\n min = if cmp < 0\n range\n elsif cmp > 0\n self\n else\n self.exclude_begin? ? self : range\n end\n\n cmp = self.end <=> range.end\n max = if cmp > 0\n range\n elsif cmp < 0\n self\n else\n self.exclude_end? ? self : range\n end\n\n if !max.upper_bound?\n min\n elsif !min.lower_bound?\n max\n else\n MinMaxRange.new(min, max)\n end\n end\n end\n end",
"def with\n @with\n end",
"def *(rhs)\n intersection(rhs)\n end",
"def intersectLineSegment seg\n # this is the intersect defined in method calling on \n # intersectlinesegment\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegmentAsLineResult seg\n end",
"def include(*args)\n include_or_extend(:include, *args)\n end",
"def intersection(other)\n other = Point.new(other[0], other[1]) if other.is_a?(Array)\n\n # Other is a Point.\n if other.is_a?(Point)\n return [other] if self.contains?(other)\n return []\n end\n\n # Other is a LinearEntity\n if other.is_a?(LinearEntity)\n # break into cases based on whether\n # the lines are parallel, non-parallel intersecting, or skew\n rank = Point.affine_rank(self.p1, self.p2, other.p1, other.p2)\n if rank == 1\n # we're collinear\n return [other] if self.is_a?(Line)\n return [self] if other.is_a?(Line) \n \n if self.is_a?(Ray) && other.is_a?(Ray)\n return intersect_parallel_rays(self, other)\n end\n\n if self.is_a?(Ray) && other.is_a?(Segment)\n return intersect_parallel_ray_and_segment(self, other)\n end\n\n if self.is_a?(Segment) && other.is_a?(Ray)\n return intersect_parallel_ray_and_segment(other, self)\n end\n\n if self.is_a?(Segment) && other.is_a?(Segment)\n return intersect_parallel_segments(self, other)\n end\n\n elsif rank == 2\n # we're in the same plane\n l1 = Line.new(self.p1, self.p2)\n l2 = Line.new(other.p1, other.p2)\n\n # check to see if we're parallel. If we are, we can't\n # be intersecting, since the collinear case was already\n # handled\n return [] if l1.parallel_to?(l2)\n \n # Use Cramers rule:\n # https://en.wikipedia.org/wiki/Cramer%27s_rule\n det = l1.a * l2.b - l2.a * l1.b\n det = det\n x = (l1.b * l2.c - l1.c * l2.b) / det\n y = (l2.a * l1.c - l2.c * l1.a ) / det\n\n intersection_point = Point.new(x, y)\n\n # if we're both lines, we can skip a containment check\n return [intersection_point] if self.is_a?(Line) && other.is_a?(Line)\n \n if self.contains?(intersection_point) && other.contains?(intersection_point)\n return [intersection_point] \n end\n \n return []\n else\n # we're skew\n return []\n end\n end\n\n if other.respond_to?(:intersection)\n return other.intersection(self)\n end\n\n raise TypeError, \"Intersection between LinearEntity and #{ other.class } is not defined\"\n end",
"def intersection(nums1, nums2)\n nums1 & nums2\n end",
"def nearEntities _obj, _args\n \"_obj nearEntities _args;\" \n end",
"def merge(attributes)\n @service.merge_entity(self, attributes)\n end",
"def intersections(*paths)\n Finder.new(world, paths).intersections\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def intersectWithSegmentAsLineResult seg\n self\n end",
"def GetRegionIntersection(arg0, arg1, arg2, arg3 = nil)\n ret = _invoke(1610744154, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_ARRAY | VT_BYREF | VT_DISPATCH, VT_BYREF | VT_ARRAY | VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def Range3dIntersect2(arg0, arg1, arg2)\n ret = _invoke(1610744276, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def include? entity, user_or_id, with_pullins=true\n # Trivial accept if the entity is physically in among the list items\n return true if @list.stores? entity\n user_id = user_or_id.is_a?(Integer) ? user_or_id : user_or_id.id\n ts = TaggingServices.new entity\n # It's included if the owner or this user has tagged it with the name tag\n return true if ts.exists? @list.name_tag_id, (user_id == @list.owner_id ? user_id : [user_id, @list.owner_id])\n # If not directly tagged, it's included if it's tagged with any of the list's tags, BY ANYONE (?)\n return false unless with_pullins && @list.pullin\n ts.exists? pulled_tag_ids\n end",
"def items\r\n unless params[:tags].blank?\r\n if params[:type] === 'intersect'\r\n @items = Item.joins(:tags).where(tags: {id: params[:tags]}).group('items.id').having(\"count(tags.id) = #{ params[:tags].count }\").order(:name)\r\n else # 'union'\r\n @items = Item.joins(:tags).where(tags: {id: params[:tags]}).order(:name)\r\n end\r\n end\r\n end",
"def include_objects\n ActsAsVotable::Vote.includes(:votable)\n end",
"def include_objects\n ActsAsVotable::Vote.includes(:votable)\n end",
"def intersection(set1, set2)\n # p set1\n # p set2\n intarray=[]\n for object in set1 #for each object in set1\n # p object\n if set2.include?(object) #check if the object is included in set2\n intarray.push(object) #if it is then push it to intarray\n end\n end\n return intarray\n\t# set1 and set2 are arrays\n\t# return the intersection\nend",
"def Segment3dPlane3dIntersect(arg0, arg1, arg2, arg3)\n ret = _invoke(1610744270, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def intersection( to )\n cp = self.pos.to_gpos\n\n line = cp.to_vec( to )\n uline = line.unit\n radius = uline * size.x\n\n ( cp.to_vec + radius ).to_gpos\n end",
"def find_entities(*query)\n query = create_query(*query)\n ids = find_entity_ids(query)\n load_resources \"entities/#{query.type}\", ids do |id, data|\n create_entity(query.type, id, data)\n end\n end",
"def includes(*args)\n fresh.tap do |criteria|\n criteria.includes_values = (includes_values || []) + args\n end\n end",
"def intersect(results_list)\n intersection_hits = self.all & results_list.all\n keywords = used_keywords | results_list.used_keywords\n \n ResultsList.new(intersection_hits, keywords.uniq)\n end",
"def intersection(a, b)\n negate(union(negate(a), negate(b)))\n end",
"def intersect(other)\n set = MyHashSet.new\n to_a.each { |el| set.insert(el) if other.include?(el) }\n set\n end",
"def intersect(xs, ys)\n result = []\n result = xs & ys\n puts result\nend",
"def with(*args)\n spawn.with!(*args)\n end",
"def select_with(entity, material, &block)\n case entity.typename\n when 'Face'\n if entity.material && entity.material.display_name == material.display_name\n yield entity # invoke the block\n # select this face's parents so you can see where the material is used\n select_parents_of entity, &block\n end\n # recursively call this method for this entity's children to fina a match\n when 'Group'\n entity.entities.each { |sub_entity| select_with sub_entity, material, &block }\n when 'ComponentInstance'\n entity.definition.entities.each { |sub_entity| select_with sub_entity, material, &block }\n end\n end",
"def fully_includes?(other)\n overlaps?(other) && other == intersection(other)\n end",
"def Segment3dSegment3dIntersectXY(arg0, arg1, arg2, arg3, arg4, arg5)\n ret = _invoke(1610744251, [arg0, arg1, arg2, arg3, arg4, arg5], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_R8, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def enableCollisionWith _obj, _args\n \"_obj enableCollisionWith _args;\" \n end",
"def getTagIntersection\n\t\tplaylistids = params[:playlistids]\n\t\tplaylists = []\n\t\tuserid = current_user.uid\n\t\tplaylistids.each do |playlistid|\n\t\t\tsongs = Playlist.get_playlist_songs(playlistid, userid)\n\t\t\tplaylists.push(songs)\n\t\tend\t\t\n\t\tintersection = Playlist.intersect_playlists(playlists)\n\t\trender json: intersection\n\tend",
"def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\n end",
"def entities(options = {})\n @redis.keys('contacts_for:*').inject({}) {|ret, k|\n if @redis.sismember(k, self.id)\n if k =~ /^contacts_for:([a-zA-Z0-9][a-zA-Z0-9\\.\\-]*[a-zA-Z0-9])(?::(\\w+))?$/\n entity_id = $1\n check = $2\n\n entity = nil\n\n if ret.has_key?(entity_id)\n entity = ret[entity_id][:entity]\n else\n entity = Flapjack::Data::Entity.find_by_id(entity_id, :redis => @redis)\n ret[entity_id] = {\n :entity => entity\n }\n # using a set to ensure unique check values\n ret[entity_id][:checks] = Set.new if options[:checks]\n ret[entity_id][:tags] = entity.tags if entity && options[:tags]\n end\n\n if options[:checks]\n # if not registered for the check, then was registered for\n # the entity, so add all checks\n ret[entity_id][:checks] |= (check || (entity ? entity.check_list : []))\n end\n end\n end\n ret\n }.values\n end",
"def tagged_with(_tags)\n _tags = convert_string_tags_to_array(_tags) if _tags.is_a? String\n criteria.all_in(tags_field => _tags)\n end",
"def intersectLineSegment seg\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegmentAsLineResult seg\n end"
] | [
"0.64842725",
"0.64842725",
"0.59735906",
"0.58747905",
"0.5810154",
"0.5734227",
"0.5639444",
"0.55327284",
"0.5342367",
"0.52856725",
"0.5261538",
"0.5208548",
"0.5147041",
"0.50624955",
"0.503874",
"0.4997759",
"0.49476013",
"0.484487",
"0.4839971",
"0.47795996",
"0.47227344",
"0.4689475",
"0.46647203",
"0.46470314",
"0.46461165",
"0.4642418",
"0.46245497",
"0.4617277",
"0.4595716",
"0.45822686",
"0.45737106",
"0.45519617",
"0.4550321",
"0.45451808",
"0.45435527",
"0.4538867",
"0.45291716",
"0.4508545",
"0.4475842",
"0.44654724",
"0.44557923",
"0.4450603",
"0.44099295",
"0.43803483",
"0.43794864",
"0.43764424",
"0.4363172",
"0.43475258",
"0.4339654",
"0.4339557",
"0.4325768",
"0.4323572",
"0.43064678",
"0.42902347",
"0.4281496",
"0.42811558",
"0.42761755",
"0.42744368",
"0.42744368",
"0.42721748",
"0.42621976",
"0.4255273",
"0.42520833",
"0.4206038",
"0.4205149",
"0.42050534",
"0.4196136",
"0.4195611",
"0.41940424",
"0.41929013",
"0.41700011",
"0.4159917",
"0.4158525",
"0.4158525",
"0.4158525",
"0.41574144",
"0.41558033",
"0.41439968",
"0.41360578",
"0.4133",
"0.4133",
"0.41262457",
"0.41068187",
"0.40990758",
"0.409134",
"0.40649366",
"0.40629125",
"0.4062348",
"0.4060811",
"0.4058206",
"0.40575692",
"0.40559316",
"0.40539792",
"0.40465957",
"0.40400207",
"0.40345052",
"0.40264976",
"0.40246725",
"0.4015536",
"0.40111676"
] | 0.5907767 | 3 |
The model method is used to retrieve the model that contains the collection of entities. | def model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model\n return @model\n end",
"def model\n return @model\n end",
"def model\n return @model\n end",
"def model\n @model ||= Model.new(self)\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def obj\n @model\n end",
"def model\n @model ||= resource.model\n end",
"def collection_data\n @model || []\n end",
"def model\n self.class.model\n end",
"def model\n self.class.model\n end",
"def model\n self\n end",
"def model\n provider.model\n end",
"def model\n @filtered_rset.model\n end",
"def all\n @collection ||= Collection.new model_name\n end",
"def model\n options.key?(:collection) ? call(:collection).klass : collection\n end",
"def load_collection\n model_class.all(find_options)\n end",
"def model\n __getobj__\n end",
"def model\n @model ||= operation.run\n end",
"def model\n self::Model\n end",
"def model\n @model ||= @fact_model.model\n end",
"def model\n end",
"def fetch_model_list\n if parent_model\n return parent_model.send(\"#{model_name.pluralize.downcase}\")\n else\n return model_name.camelize.constantize.find(:all)\n end\n end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def models\n @@models\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def to_model\n self\n end",
"def to_model\n self\n end",
"def collection(model = name.to_s.classify.constantize)\n model\n end",
"def model()\n @props[:model]\n end",
"def models\n @models ||= Prepares.models\n end",
"def model_class\n self.class.const_get('MODEL')\n end",
"def model_class\n @model_class ||= mapping.to\n end",
"def to_model\n self\n end",
"def to_model\n self\n end",
"def to_model\n self\n end",
"def to_model\n self\n end",
"def to_model\n self\n end",
"def to_model\n self\n end",
"def models\n @models ||= []\n end",
"def to_model\n __getobj__\n end",
"def model\n parts.first\n end",
"def all( model )\n model( model ).all\n end",
"def models\n @models ||= {}\n end",
"def represented\n model\n end",
"def models\n work_classes + collection_classes\n end",
"def models\n @models.dup\n end",
"def managed_models\n @managed_models\n end",
"def get_models(model_type)\n model_store.get_collection class_for_type(model_type)\n end",
"def entities\n @entities ||= Entity.from_models(self, @models)\n end",
"def model_class\n return @model_class || self.class.model_class\n end",
"def elements\n model = self.model.constantize\n model.respond_to?(:generic_listing_elements) ? model.generic_listing_elements : model.all\n end",
"def models\r\n\r\n end",
"def model\n self.class.const_get(:MODEL)\n end",
"def model_associations\n @model_associations ||= Prepares.model_associations\n end",
"def model\n nil\n end",
"def model\n nil\n end",
"def collection\n klass.collection\n end",
"def model\n node_value = at_node(doc)\n lookup_model(node_value)\n end",
"def model\n self.public_send(self.class._attributes.first)\n end",
"def to_model\n self\n end",
"def to_model\n self\n end",
"def managedObjectModel\n @managedObjectModel ||= NSManagedObjectModel.mergedModelFromBundles(nil)\n end",
"def managedObjectModel\n @managedObjectModel ||= NSManagedObjectModel.mergedModelFromBundles(nil)\n end",
"def models_list\n ModelsList.to_a\n end",
"def model\n # A bit of 'caching': lookups based on namespace can be quite slow\n unless @model.nil?\n return @model\n end\n \n # Should return nil if this is not an association\n if property?\n return nil\n end\n\n if @model = model_from_options || model_from_namespace\n @model\n else\n raise RuntimeError, 'Could not find association model for %s (%s :%s)' % [@cls, @options[:association], @name]\n end\n end",
"def concrete_model\n self.class\n end",
"def class\n @model.class\n end",
"def base_class\n S::Model\n end",
"def model_class; end",
"def model=(value)\n @model = value\n end",
"def model\n @model ||= if self.class.path_to_model\n m = eval(self.class.path_to_model)\n if m\n if m.respond_to?(:_controller=)\n m.send(:_controller=, self)\n end\n else\n fail \"No model object found at path: #{self.class.path_to_model}\"\n end\n m\n end\n end",
"def collection\n self.class.collection\n end",
"def collection\n self.class.collection\n end",
"def model=(value)\n @model = value\n end",
"def model=(value)\n @model = value\n end",
"def models\n [::AdminSet, Hyrax::AdministrativeSet, ::Collection, Hyrax.config.collection_class].uniq.compact\n end",
"def model\n @model ||= ::Video.find model_id\n end",
"def model\n @_model ||=\n if self.class == Edgarj::EdgarjController\n # dummy model for 'top' action:\n Edgarj::Sssn\n else\n self.class.name.gsub(/Controller$/, '').singularize.constantize\n end\n end",
"def models\n ModelHtmlUnitCollection.by_make(make)\n end",
"def model\n @opts[:model]\n end",
"def collection\n klass.collection\n end",
"def get_model\n return model_classes[item_type].new()\n end",
"def render_model\n model.render\n end",
"def each_model\n result = []\n ole_obj.Models.each do |el|\n model = model_from_ole(el)\n if block_given?\n yield model\n else\n result << model\n end\n end\n result unless block_given?\n end",
"def entities\n @entities\n end",
"def records_base(_options = {})\n _model_class.all\n end"
] | [
"0.76461667",
"0.764185",
"0.764185",
"0.74050045",
"0.72520393",
"0.72520393",
"0.72520393",
"0.72520393",
"0.7201894",
"0.7195283",
"0.71876884",
"0.7071273",
"0.7071273",
"0.69585973",
"0.6912392",
"0.6906445",
"0.68518835",
"0.6836928",
"0.6827868",
"0.6805163",
"0.68050426",
"0.67994267",
"0.6776623",
"0.66712487",
"0.66449106",
"0.6644567",
"0.6644567",
"0.6644567",
"0.6644567",
"0.6644567",
"0.6644567",
"0.6644567",
"0.6644567",
"0.6644567",
"0.6644567",
"0.6517989",
"0.6510144",
"0.6505555",
"0.6478197",
"0.6474435",
"0.64697254",
"0.6469517",
"0.64528996",
"0.64321095",
"0.64266425",
"0.64230347",
"0.64230055",
"0.64216405",
"0.64216405",
"0.64216405",
"0.6411157",
"0.6380148",
"0.6355762",
"0.6355226",
"0.63265926",
"0.6324759",
"0.6292094",
"0.6284911",
"0.625978",
"0.62493765",
"0.6218215",
"0.62124014",
"0.6202471",
"0.6192352",
"0.61893344",
"0.61635333",
"0.61628973",
"0.61628973",
"0.61459976",
"0.6144769",
"0.61301225",
"0.6122703",
"0.6122703",
"0.61124897",
"0.61124897",
"0.6106744",
"0.60985386",
"0.60829186",
"0.6074267",
"0.6050576",
"0.6048157",
"0.6045214",
"0.6037214",
"0.6037033",
"0.6037033",
"0.6018962",
"0.6018962",
"0.60002804",
"0.5971937",
"0.5955347",
"0.5951728",
"0.59499985",
"0.5944379",
"0.59282225",
"0.59269136",
"0.59181666",
"0.59071106",
"0.5906835"
] | 0.62577885 | 60 |
The parent method is used to retrieve the parent or object that contains the collection of entities. A parent can be either a Model or ComponentDefinition object. | def parent
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent\n o = Object.const_get(parent_model) rescue nil\n o && o.get(parent_id)\n end",
"def parent\n self\n end",
"def parent\n _parent\n end",
"def parent\n return @parent\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent\n object.try(:loaded)&.[](:parents)&.first || wayfinder.decorated_parent\n end",
"def parent\n self\n end",
"def parent\n @parent ||= resource.decorate.parent\n end",
"def parent_object\n @parent_object ||= parent? && !parent_singleton? ? parent_model.find(parent_param) : nil\n end",
"def parent\n owner\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent_model_class\n self.class.parent_model_class\n end",
"def getParentCollection() \n return XMLDB::Base::Collection.getInstance(@obj.getParentCollection())\n end",
"def parent\n self.class.find_in_nested_set(self[parent_col_name]) if self[parent_col_name]\n end",
"def parent\n @parent || NullResource.new\n end",
"def parent\n nil\n end",
"def parent\n send(parent_type)\n end",
"def get_parent\n return nil\n end",
"def get_parent_object\n nil\n end",
"def parent_list\n self.parent_lists[0]\n end",
"def parent\n\t\tself.residue_at_position(@parent_position)\n\tend",
"def parent\n dataset.nested.filter(self.primary_key => self.parent_id).first if self.parent_id\n end",
"def parent\n @parent or raise LifecycleException.new(\"can't call parent until you materialize the resource\")\n end",
"def parent_object\n if has_parent?\n actual_class = parent_class_name.camelize.constantize\n actual_class.find(parent_id)\n else\n nil\n end\n end",
"def parent\n self.class.find_by_id(self.parent_id) unless self.parent_id.nil?\n end",
"def parent_model\n parent_type.to_s.camelize.constantize\n end",
"def parent_object\n # hack by sean to allow permalink parents\n parent? && !parent_singleton? ? parent_model_find(parent_param) : nil\n end",
"def parent\n base_set_class.find(self[parent_col_name]) if self[parent_col_name]\n end",
"def parent\n return persistence_strategy.parent if\n persistence_strategy.respond_to?(:parent)\n\n nil\n end",
"def parent_model\n return @parent_model if @parent_model\n\n if parent_model_name && parent_model_class\n parent_id_param = \"#{parent_model_name}_id\"\n if params[parent_id_param]\n @parent_model = parent_model_class.find_by(find_parent_by => params[parent_id_param])\n end\n end\n\n @parent_model\n end",
"def parent_model\n @parent_model ||= (@child_model || Object).find_const(parent_model_name)\n rescue NameError\n raise NameError, \"Cannot find the parent_model #{parent_model_name} for #{child_model_name} in #{name}\"\n end",
"def component\n @parent.component\n end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent_model\n parent_type.to_s.camelize.constantize\n end",
"def _parent; end",
"def parent\n if parent_id.blank? then nil else unscoped_find(parent_id) end\n end",
"def parent\n rep = options[:parent]\n return rep unless rep.respond_to?(:becomes, true)\n\n klass = rep.class.try(:base_class)\n klass && (klass != rep.class) ? rep.becomes(klass) : rep\n end",
"def parent\n DataStore::Base.find(identifier: identifier)\n end",
"def parent\n nil\n end",
"def parent\n @parent ||= new_or_create? ? find_parent_by_id : lookup_parent_from_child\n end",
"def polymorph_parent(parent=nil)\n\t\t@parent ||= parent\n\t\treturn @parent\n\tend",
"def parent\n Shoppe::Product.unscoped{ super }\n end",
"def find_creator_parent_item\n ModelReference.find_where_referenced_from(self).first&.from_record\n end",
"def parent\n @controller.instance_variable_get(:\"@#{parent_name}\")\n end",
"def parents\n respond_to?(:collectionHasParent) ? collectionHasParent : []\n end",
"def parent()\n bag.get(bag.parent(path))\n end",
"def product\n case self._parent.class\n when Product\n self._parent\n when OrderItem\n self._parent.product\n end\n end",
"def parent(reload:false)\n if reload || !defined?(@parent)\n @parent = self.class.where({\n document_id: document_id,\n child_ids: id\n }).first\n end\n @parent\n end",
"def parent\n @parent ||= self.class.current_parent_block_helper\n end",
"def get_parent_collection()\n return XMLDBApi::RedCollection.new(@db_id, @coll_service.get_collection_id, @coll_service.get_collection_name)\n end",
"def parent_model_name\n self.class.parent_model_name\n end",
"def parent_resource\n @parent_resource ||=\n begin\n return nil if resource.try(:imported_metadata).present?\n Wayfinder.for(resource).parent\n end\n end",
"def parent\n p = (@context.parent.nil? || (@context == @context.parent)) ? nil : R2Doc.all_references[parent_name]\n # guard against pollution of all_references with methods having conflicting names\n (p.respond_to?(:is_method_context?) && p.is_method_context?) ? nil : p\n end",
"def parent\n parents.empty? ? nil : parents[0]\n end",
"def parent\n \tif self.parent_id == -1\n \t\treturn nil\n \telse\n \t\treturn Category.find(self.parent_id)\n \tend\n end",
"def get_parent\n\n get_expression_pool.fetch_expression(@parent_id)\n end",
"def parent\n return nil unless catalog\n\n unless defined?(@parent)\n if parents = catalog.adjacent(self, :direction => :in)\n # We should never have more than one parent, so let's just ignore\n # it if we happen to.\n @parent = parents.shift\n else\n @parent = nil\n end\n end\n @parent\n end",
"def parent_name\n self.class.parent_name\n end",
"def parent\n\t\tpardn = self.parent_dn or return nil\n\t\treturn self.class.new( self.directory, pardn )\n\tend",
"def context\n @parent&.context\n end",
"def parent\n return @parent if defined?(@parent)\n\n @parent = nil\n\n @parent = issue.parent if issue\n end",
"def parent_for(obj)\n obj._composition_reflections.map { |_, composition| obj.send(composition.name).presence }.compact.first\n end",
"def parent\n @parent ||= @parent_id ? @book.find_account_by_id(@parent_id) : nil\n end",
"def parent\n return @parent if @parent\n return nil unless @parent_name\n\n if @parent_class == RDoc::TopLevel then\n @parent = @store.add_file @parent_name\n else\n @parent = @store.find_class_or_module @parent_name\n\n return @parent if @parent\n\n begin\n @parent = @store.load_class @parent_name\n rescue RDoc::Store::MissingFileError\n nil\n end\n end\n end",
"def parent_association\n # needed for the show view\n @parent_object = parent_object\n parent_object.names\n end",
"def base\n @parent ? @parent.model_instance.send(@name.to_s.pluralize) : model_class\n end",
"def parent\n\t\treturn parent_of @current_node\n\tend",
"def scope_parent_association\n @scope_association ||= scoping_object.send(parent_model_to_method_sym).find(parent_param).send(model_name_to_method_sym)\n end",
"def parentage\n get_parents unless @already_fetched_parents\n @already_fetched_parents = true\n super\n end",
"def parent_lists\n self.parents(List)\n end",
"def parent\n\n h.parent_id ?\n Ruote::Exp::FlowExpression.fetch(@context, h.parent_id) :\n nil\n end",
"def parent\n @parent ||= Object.module_eval(self.source_xml.parent.name).new(:source_xml => self.source_xml.parent)\n rescue\n nil\n end",
"def parent\n if @obj.parent\n LazyEvaluator.new(@obj.parent)\n else\n nil\n end\n end",
"def parent_resource\n return @parent_resource if defined?(@parent_resource)\n @parent_resource = if @mediator.through\n if @controller.instance_variable_defined? :\"@#{@mediator.through}\"\n @controller.instance_variable_get(:\"@#{@mediator.through}\")\n elsif @controller.respond_to?(@mediator.through, true)\n @controller.send(@mediator.through)\n end\n end\n end",
"def parent\n raise \"undefined parent Organization\" unless organization?\n organization\n end",
"def parent_document\n pi = parent_item\n return if pi == nil\n pi_id = pi.id\n return if pi_id == nil\n DocumentRepository.find(pi_id)\n end",
"def parent\n @parent ||= begin\n parent_id = data[\"parentId\"]\n client.categories.find(parent_id) if parent_id\n end\n end",
"def get_parent\n note = self\n return Note.first(:id=>note.parent)\n end",
"def trackable_parent_class\n association_chain.first['name'].constantize\n end",
"def parent\n folder || @list\n end",
"def parent(refresh = false)\n if refresh or @parent_cache.nil?\n [:comment, :journal, :photograph, :page].each do |p|\n if self.respond_to?(p) and parent = self.send(p)\n # We found an applicable parent.\n @parent_cache = parent\n return parent\n end\n end\n # We didn't find any parent\n nil\n else\n @parent_cache\n end\n end",
"def parent_collection?\n parent.collection?\n end"
] | [
"0.7400933",
"0.7380317",
"0.7379695",
"0.7371369",
"0.7333313",
"0.7333313",
"0.7333313",
"0.7333313",
"0.73116726",
"0.7306924",
"0.7280754",
"0.7201338",
"0.71324664",
"0.71219975",
"0.71219975",
"0.7095051",
"0.7070756",
"0.70679814",
"0.706707",
"0.696214",
"0.69466484",
"0.6869763",
"0.6852246",
"0.68436885",
"0.682342",
"0.6818503",
"0.6817036",
"0.68134475",
"0.6798367",
"0.6780364",
"0.67798173",
"0.67789173",
"0.6762543",
"0.673779",
"0.67320627",
"0.6719835",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67191756",
"0.67148834",
"0.67051715",
"0.6682731",
"0.6666259",
"0.6612698",
"0.66020507",
"0.6580445",
"0.6572653",
"0.65556526",
"0.6552668",
"0.65357673",
"0.65309393",
"0.6528749",
"0.65059954",
"0.6497229",
"0.64725626",
"0.6459188",
"0.64490473",
"0.6426307",
"0.6407121",
"0.63988346",
"0.63938445",
"0.6388683",
"0.6386151",
"0.6380029",
"0.6376249",
"0.63623154",
"0.6356862",
"0.63511115",
"0.6336169",
"0.63277555",
"0.63232",
"0.6294111",
"0.6292457",
"0.6291898",
"0.6283224",
"0.6281789",
"0.6281362",
"0.6278985",
"0.62738854",
"0.62727195",
"0.6259973",
"0.6257813",
"0.6250236",
"0.6242946",
"0.62399054",
"0.62351704",
"0.62349033",
"0.6234442"
] | 0.6705777 | 52 |
The transform_entities method is used to apply a transform to several subentities all at once. If you are transforming entities in the active drawing context or any of its parent drawing contexts, the transformation will be interpreted as relative to the global coordinate system. Otherwise the transformation will be interpreted as being on the local coordinate system. | def transform_entities(transform, entities)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_entities( transformation, entities )\r\n if @vertex_cache.empty?\r\n raise 'No verticed cached!'\r\n end\r\n unless transformation.is_a?( Geom::Transformation )\r\n raise ArgumentError, 'Not a transformation.'\r\n end\r\n return false if entities.empty?\r\n # Transform given entities.\r\n # (?) Should this method expect local transformation?\r\n local_transform = local_transformation( transformation )\r\n for control_point in entities\r\n control_point.position.transform!( local_transform )\r\n end\r\n update_after_transformation()\r\n true\r\n end",
"def transformations_for_entity(entity)\n path = entity.model.active_path || []\n \n if group?(entity.parent)\n parents = [entity.parent]\n elsif definition?(entity.parent)\n parents = entity.parent.instances\n else\n parents = nil\n end\n \n path_index = path.index(entity)\n \n if path_index\n #puts path_index\n t = Geom::Transformation.new\n path.slice(path_index, path.length).each do |g|\n t = g.transformation.inverse * t\n end\n return [t]\n elsif parents\n transformations = []\n parents.each do |p|\n transformations.concat transformations_for_entity(p).map {|t| t * p.transformation }\n end\n return transformations\n else\n t = Geom::Transformation.new\n path.each do |g|\n t = g.transformation * t\n end\n return [t]\n end\n end",
"def transform\n entries.each { |entry| entry.transform user }\n @state = :transformed\n @account_id = nil\n true\n end",
"def transform_all!(otherProjection, collection)\r\n collection.each do |point|\r\n transform!(otherProjection, point)\r\n end\r\n collection\r\n end",
"def highlight(*entities)\n @entities.clear\n @transformations_active.clear\n @transformations_inactive.clear\n model = Sketchup.active_model\n entities.each{ |entity|\n if entity.is_a?(Sketchup::Drawingelement) ||\n entity.is_a?(Sketchup::Curve) ||\n entity.is_a?(Sketchup::Vertex)\n @entities << entity\n # Find all occurences of the entity (in instances) and collect their transformations.\n @transformations_active[entity] = collect_all_active_occurences(entity)\n @transformations_inactive[entity] = collect_all_inactive_occurences(entity)\n model = entity.model\n elsif entity.is_a?(Geom::Point3d) ||\n entity.is_a?(Geom::Vector3d) ||\n entity.is_a?(Geom::BoundingBox)\n @entities << entity\n # Point3d, Vector3d, Geom::BoundingBox have no instance path (no position in\n # model nesting hierarchy). So we draw them always relative to the active context.\n @transformations_active[entity] = [model.edit_transform]\n @transformations_inactive[entity] = []\n end\n }\n model.active_view.invalidate\n end",
"def transforms\n @transforms ||= [\n NullTransform, NormalizationTransform, CasingTransform,\n NamedTransform, BreakInternalTransform\n ]\n end",
"def transform\n # Pass through\n @target.transform\n end",
"def transform_all(otherProjection, collection)\r\n newcollection = collection.dup.clear\r\n collection.each do |point|\r\n newcollection << transform(otherProjection, point)\r\n end\r\n newcollection\r\n end",
"def transform_matrix\n @transformation_array.each do |transformation|\n adder_value = transformation[0]\n rows_to_transform = transformation[1][0]\n columns_to_transform = transformation[1][1]\n\n # only given rows or columns to transform, but not both.\n # then assume transformation of all columns or rows\n # e.g. R5+2; would mean that row 5 was specified to be \n # transformed. so assume all columns get transformed as well\n if rows_to_transform.empty?\n for index in 1..@number_of_rows\n rows_to_transform << index\n end\n elsif columns_to_transform.empty?\n for index in 1..@number_of_columns\n columns_to_transform << index\n end\n end\n\n # cartesian product between rows and columns to be transformed\n areas = rows_to_transform.product(columns_to_transform)\n\n # apply transformation\n areas.each do |tuple|\n row = tuple[0].to_i - 1\n column = tuple[1].to_i - 1\n @matrix[row][column] = @matrix[row][column] + adder_value\n end\n\n end\n end",
"def transform!\n raise NotImplementedError, \"You have to implement #transform! in your transformer\"\n end",
"def apply_to_children(&block)\n self.entities.each do |entity|\n block.call(entity)\n entity.apply_to_children(&block)\n end\n end",
"def apply_transforms(query, transforms)\n transforms.reduce(query) do |q, transform|\n transform.call(q)\n end\n end",
"def transforms( inputs, type )\n return inputs.map {|abs| self.transform( abs )}\n end",
"def transforms; end",
"def trm_transform(x, y)\n trm = text_rendering_matrix\n if x == 0 && y == 0\n [trm.e, trm.f]\n else\n [\n (trm.a * x) + (trm.c * y) + (trm.e),\n (trm.b * x) + (trm.d * y) + (trm.f)\n ]\n end\n end",
"def transform(tree); end",
"def transform(transformation)\n if transformation.from == self.from\n transform_quantity(transformation)\n transform_units(transformation)\n # TODO: else raise exception\n end\n end",
"def apply_transform(tree)\n raise \"Abstract method called\"\n end",
"def ctm_transform(x, y)\n [\n (ctm.a * x) + (ctm.c * y) + (ctm.e),\n (ctm.b * x) + (ctm.d * y) + (ctm.f)\n ]\n end",
"def normalize(input, entities = T.unsafe(nil), entity_filter = T.unsafe(nil)); end",
"def transform(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, &rendering_code); end",
"def transform\n end",
"def apply(transform)\n CGRectApplyAffineTransform(self, transform)\n end",
"def entities(body, headers, expectation = nil)\n expectation ||= Occi::Core::Entity\n logger.debug \"Parsing #{expectation} from #{body.inspect} and #{headers.inspect}\" if logger_debug?\n\n entity_parser = Text::Entity.new(model: model)\n entity = entity_parser.plain transform(body, headers)\n unless entity.is_a?(expectation)\n raise Occi::Core::Errors::ParsingError, \"Entity is not of type #{expectation}\"\n end\n\n setify(entity)\n end",
"def apply_transform!\n @location = @dy.transformPoint( @location )\n end",
"def clone_entity_to_domain(entities)\n entities.each do |entity|\n hash = entity.attributes\n hash[:id] = nil\n hash[:domain_id] = self.id\n entity = Entity.create!(hash)\n entity.create_entity_columns\n end\n end",
"def manipulable_entities\r\n result = []\r\n result.concat( patches )\r\n result.concat( edges )\r\n result.concat( vertices )\r\n result.concat( handles )\r\n result.concat( manual_interior_points )\r\n result\r\n end",
"def flattened_entities\n results = []\n \n # Add this organization's entities\n entities.where(:type == 'Person').each do |e|\n results << e\n end\n\n # Add all children organization's entities\n child_organizations.all.each do |o|\n o.flattened_entities.each do |e|\n results << e\n end\n end\n\n # Only return a unique list\n results.uniq{ |x| x.id }\n end",
"def transform(from, to)\n configurable_frames(from, to)\n\t needed_transformations.push(NeededTransformation.new(from.to_s, to.to_s))\n\tend",
"def transform(transformers)\n if not @@transformers_registered\n #transformers << WrapWithSections.new\n @@transformers_registered = true\n end\n end",
"def collate_geometry(nodeId, transformation, entities, group, group_with_material)\n\t\t\t\t\n\t\t\t\tface_by_material = {}\n\t\t\t\tgroup_with_mat = group_with_material\n\n\t\t\t\tentities.each { |e|\n\t\t\t\t#for e in entities #Lev: 'for' is marginally slower than 'each'\n\t\t\t\t\t#next if e.deleted? == true\n\t\t\t\t\t#next if e.valid? == false\n\t\t\t\t\t#next if e.hidden? == true # skip this entity if it is hidden\n\t\t\t\t\t\n\t\t\t\t\t#Lev: commented out for performance reasons ->\n\t\t\t\t\tif (e.hidden? == true || e.deleted? == true || e.valid? == false)\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\n\t\t\t\t\t# Do not export faces/groups/components on hidden layers\n\t\t\t\t\tif (e.layer != nil && e.layer.visible? == false)\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\t\t#<-\n\t\t\t\t\t\n\t\t\t\t\tmaterialNotNil = e.material != nil #Lev: to optimize the object checks against nil (seems like they are expensive in Ruby)\n\n\t\t\t\t\tif (e.class == Sketchup::Group)\n\t\t\t\t\t\t#puts \"e.class == Sketchup::Group\"\n\t\t\t\t\t\tgroup_node_id = @nodes.add_node(e.name, e.transformation, @use_matrix)\n\t\t\t\t\t\[email protected]_child(nodeId, group_node_id)\n\t\t\t\t\t\ttrn = transformation * e.transformation\n\t\t\t\t\t\tif @use_matrix\n\t\t\t\t\t\t\ttrn = e.transformation\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif materialNotNil\n\t\t\t\t\t\t\tcollate_geometry(group_node_id, trn, e.entities, e, e)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcollate_geometry(group_node_id, trn, e.entities, e, group_with_material)\n\t\t\t\t\t\tend\n\t\t\t\t\telsif (e.class == Sketchup::ComponentInstance)\n\t\t\t\t\t\t#puts \"e.class == Sketchup::ComponentInstance\"\n\t\t\t\t\t\tgroup_node_id = @nodes.add_node(e.definition.name, e.transformation, @use_matrix)\n\t\t\t\t\t\[email protected]_child(nodeId, group_node_id)\n\t\t\t\t\t\ttrn = transformation * e.transformation\n\t\t\t\t\t\tif @use_matrix\n\t\t\t\t\t\t\ttrn = e.transformation\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif materialNotNil\n\t\t\t\t\t\t\tgroup_with_mat = e\n\t\t\t\t\t\t\tcollate_geometry(group_node_id, trn, e.definition.entities, e, e)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcollate_geometry(group_node_id, trn, e.definition.entities, e, group_with_material)\n\t\t\t\t\t\tend\n\t\t\t\t\telsif (e.class == Sketchup::Face)\n\t\t\t\t\t\tface = e\n\t\t\t\t\t\tfaceWithMaterial = face\n\t\t\t\t\t\tif !materialNotNil\n\t\t\t\t\t\t\tif group_with_mat != nil\n\t\t\t\t\t\t\t\tif group_with_mat.material != nil\n\t\t\t\t\t\t\t\t\tfaceWithMaterial = group_with_mat\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif (face.material.alpha == 0.0)\n\t\t\t\t\t\t\t\t# Special case: a material with alpha of zero is sometimes used for blending groups together... don't export it.\n\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Lev: commenting out the hack below as it results in valid geomerty also being removed from CET exported scenes.\n\t\t\t\t\t\t\t# It looks like the CET's SU exporter generates the material face names automatically based on either the assigned texture file name or, if there's no texture assigned, on the diffuse color RGB values\n\t\t\t\t\t\t\t# (e.g. 5H11_1_999 (d01c678dcb795fe0fce65c67e754be7bac9505c54932b973).JPG or Color_#7f7f7f). This naming schema is used equally for both the regular 'outer shell' geometry,\n\t\t\t\t\t\t\t# as well as the 'inner shell' geometry and thus can't be used to differentiate between the two. We'll have to look into geometry topology and/or occlusion heruistics in the future to address this problem. \n\t\t\t\t\t\t\t# ====>\n\t\t\t\t\t\t\t# # Lev: a hack to filter out CET exported geometry representing the insides of objects. Such geometry has a double-sided materials with certain properties:\n\t\t\t\t\t\t\t# # Front faces will have a material named \"Color_#xxxxxx\", where xxxxxx is a hexadecimal RGB value.\n\t\t\t\t\t\t\t# # Back faces will have a material name staring the \"Transparent\" and the opacity value of 0.0.\n\t\t\t\t\t\t\t# # Note, that skipping all of the faces of a mesh will likely produce empty parent nodes in the resulting glTF file.\n\t\t\t\t\t\t\t# # It's not a big deal (this is not classified as an error in the glTF spec), but we should address it at some point (likely in the common glTF exporter back-end implementation).\n\t\t\t\t\t\t\t# if (face.back_material != nil)\n\t\t\t\t\t\t\t# \t# Put the easiest to evaluate conditions on the left for performance reasons\n\t\t\t\t\t\t\t# \tif (#face.back_material.alpha == 0.0 &&\n\t\t\t\t\t\t\t# \t\tface.back_material.name.match(/^Transparent/) && \n\t\t\t\t\t\t\t# \t\tface.material.name.match(/^Color_#([a-fA-F0-9]{6})/))\n\t\t\t\t\t\t\t# \t\t#puts \"CET face match found: \" + face.material.name \n\t\t\t\t\t\t\t# \t\tnext\n\t\t\t\t\t\t\t# \tend\n\t\t\t\t\t\t\t# end\n\t\t\t\t\t\t\t# <====\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tmaterial_id = @materials.add_material(faceWithMaterial)\n\t\t\t\t\t\t\n\t\t\t\t\t\t#if face.material != nil\n\t\t\t\t\t\t#\tmaterial_id = @materials.add_material(face)\n\t\t\t\t\t\t#else\n\t\t\t\t\t\t#\t# material is nil, check if the group or component has a material\n\t\t\t\t\t\t#\tif group.class == Sketchup::ComponentInstance\n\t\t\t\t\t\t#\t\tputs 'Face is inside a component instance'\n\t\t\t\t\t\t#\t\tmaterial_id = @materials.add_material(group.definition)\n\t\t\t\t\t\t#\telse\n\t\t\t\t\t\t#\t\t# use the group material if it has one\n\t\t\t\t\t\t#\t\tputs 'Face is inside a group'\n\t\t\t\t\t\t#\t\tmaterial_id = @materials.add_material(group)\n\t\t\t\t\t\t#\tend\n\t\t\t\t\t\t#end\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tfaces = face_by_material[material_id]\n\t\t\t\t\t\tif faces == nil\n\t\t\t\t\t\t\tfaces = []\n\t\t\t\t\t\t\tface_by_material[material_id] = faces\n\t\t\t\t\t\tend\n\t\t\t\t\t\tfaces.push(face)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t#end\n\t\t\t\t\n\t\t\t\tif (face_by_material.length == 0)\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t#if @mesh_per_material == false\n\t\t\t\tmesh_id = @meshes.add_mesh(nil)\n\t\t\t\[email protected]_mesh(nodeId, mesh_id)\n\t\t\t\t#puts \"Added a mesh with ID \" + mesh_id.to_s + \" and a node with ID \" + nodeId.to_s\n\t\t\t\t#end\n\t\t\t\t\n\t\t\t\tface_by_material.each_key { |material_id|\n\t\t\t\t\n\t\t\t\t\t# mesh per material is required for the current buggy version of Microsoft Paint 3D\n\t\t\t\t\t# todo: remove this once Microsoft gets out a fix.\n\t\t\t\t\t\n\t\t\t\t\t#if @mesh_per_material == true\n\t\t\t\t\t#\tsub_node_id = @nodes.add_node(nil, Geom::Transformation.new, @use_matrix)\n\t\t\t\t\t#\[email protected]_child(nodeId, sub_node_id)\n\t\t\t\t\t#\tmesh_id = @meshes.add_mesh(nil)\n\t\t\t\t\t#\[email protected]_mesh(sub_node_id, mesh_id)\n\t\t\t\t\t#end\n\t\t\t\t\n\t\t\t\t\tfaces = face_by_material[material_id]\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\thas_texture = false\n\t\t\t\t\tif (faces[0].material != nil && faces[0].material.texture != nil)\n\t\t\t\t\t\thas_texture = true\n\t\t\t\t\tend\n\t\t\t\t\tif (has_texture == false)\n\t\t\t\t\t\tif (group_with_mat != nil && group_with_mat.material != nil && group_with_mat.material.texture != nil)\n\t\t\t\t\t\t\thas_texture = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\tkPoints = 0\n\t\t\t\t\tkUVQFront = 1\n\t\t\t\t\tkUVQBack = 2\n\t\t\t\t\tkNormals = 4\n\t\t\t\t\tflags = kPoints | kUVQFront | kNormals\n\t\t\t\t\tfaces.each { |face|\n\t\t\t\t\t\tmesh = face.mesh(flags) \n\t\t\t\t\t\t\n\t\t\t\t\t \tdet = 1.0\n\t\t\t\t\t \tif (@use_matrix == false)\n\t\t\t\t\t \t\tmesh.transform! transformation\n\t\t\t\t\t \t\ta = transformation.to_a\n\t\t\t\t\t \t\tdet = determinant(a)\n\t\t\t\t\t \tend\n\t\t\t\t\t\t\n\t\t\t\t\t \t#has_texture = material_has_texture(group,face)\n\n\t\t\t\t\t\tnumber_of_polygons = mesh.count_polygons\n\t\t\t\t\t\t#puts \"Mesh has \" + number_of_polygons.to_s + \" polygons\"\n\t\t\t\t\t \tfor i in (1..number_of_polygons)\n\t\t\t\t\t \t\tpolygon = mesh.polygon_at(i)\n\t\t\t\t\t \t\tidx0 = polygon[0].abs\n\t\t\t\t\t \t\tidx1 = polygon[1].abs\n\t\t\t\t\t \t\tidx2 = polygon[2].abs\n\n\t\t\t\t\t \t\tp0 = mesh.point_at(idx0)\n\t\t\t\t\t \t\tp1 = mesh.point_at(idx1)\n\t\t\t\t\t \t\tp2 = mesh.point_at(idx2)\n\t\t\t\t\t\t\n\t\t\t\t\t \t\tn0 = mesh.normal_at(idx0)\n\t\t\t\t\t \t\tn1 = mesh.normal_at(idx1)\n\t\t\t\t\t \t\tn2 = mesh.normal_at(idx2)\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t#if(det < 0.0)\n\t\t\t\t\t\t\t#\tn0 = Geom::Vector3d.new(-n0.x,-n0.y,-n0.z)\n\t\t\t\t\t\t\t#\tn1 = Geom::Vector3d.new(-n1.x,-n1.y,-n1.z)\n\t\t\t\t\t\t\t#\tn2 = Geom::Vector3d.new(-n2.x,-n2.y,-n2.z)\n\t\t\t\t\t\t\t#end\n\t\t\t\t\t\t\t\n\t\t\t\t\t \t\tuvw0 = mesh.uv_at(idx0,true)\n\t\t\t\t\t \t\tuvw1 = mesh.uv_at(idx1,true)\n\t\t\t\t\t \t\tuvw2 = mesh.uv_at(idx2,true)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif @isWarning == false && (uvw0[2] != 1.0 || uvw1[2] != 1.0 || uvw2[2] != 1.0)\n\t\t\t\t\t\t\t\[email protected](TRANSLATE(\"badUVW\"))\n\t\t\t\t\t\t\t\t@isWarning = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (det < 0.0)\n\t\t\t\t\t\t\t\t# reverse the winding order\n\t\t\t\t\t\t\t\tidx1 = @mesh_geometry.add_geometry(mesh_id, material_id, p1.x,p1.y,p1.z, n1.x,n1.y,n1.z, uvw1[0], 1.0-uvw1[1], has_texture)\n\t\t\t\t\t\t\t\tidx0 = @mesh_geometry.add_geometry(mesh_id, material_id, p0.x,p0.y,p0.z, n0.x,n0.y,n0.z, uvw0[0], 1.0-uvw0[1], has_texture)\n\t\t\t\t\t\t\t\tidx2 = @mesh_geometry.add_geometry(mesh_id, material_id, p2.x,p2.y,p2.z, n2.x,n2.y,n2.z, uvw2[0], 1.0-uvw2[1], has_texture)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tidx0 = @mesh_geometry.add_geometry(mesh_id, material_id, p0.x,p0.y,p0.z, n0.x,n0.y,n0.z, uvw0[0], 1.0-uvw0[1], has_texture)\n\t\t\t\t\t\t\t\tidx1 = @mesh_geometry.add_geometry(mesh_id, material_id, p1.x,p1.y,p1.z, n1.x,n1.y,n1.z, uvw1[0], 1.0-uvw1[1], has_texture)\n\t\t\t\t\t\t\t\tidx2 = @mesh_geometry.add_geometry(mesh_id, material_id, p2.x,p2.y,p2.z, n2.x,n2.y,n2.z, uvw2[0], 1.0-uvw2[1], has_texture)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t \tend\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t#Test code\n\t\t\t\t\t#puts \"Indices is \" + @mesh_geometry.meshes_data[mesh_id][material_id].indices.to_s\n\t\t\t\t\t\n\t\t\t\t\t# all_geometry = @mesh_geometry.meshes_data\n\t\t\t\t\t# puts \"Mesh with ID \" + mesh_id.to_s + \" and material ID \" + material_id.to_s + \" has p: \" + all_geometry[mesh_id][material_id].positions.length.to_s \\\n\t\t\t\t\t# \t+ \"; n: \" + all_geometry[mesh_id][material_id].normals.length.to_s \\\n\t\t\t\t\t# \t#+ \"; uvs: \" + all_geometry[mesh_id][material_id].uvs.length.to_s \\\n\t\t\t\t\t# \t+ \"; h: \" + all_geometry[mesh_id][material_id].hash.length.to_s \\\n\t\t\t\t\t# \t+ \"; c: \" + all_geometry[mesh_id][material_id].count.to_s \\\n\t\t\t\t\t# \t+ \"; indices length: \" + all_geometry[mesh_id][material_id].indices.length.to_s\n\t\t\t\t}\n\t\t\tend",
"def add_transform_primitives(gc)\n @transforms.each { |transform| gc.__send__(transform[0], *transform[1]) }\n end",
"def transform(otherProjection, point)\r\n transform!(otherProjection, point.dup)\r\n end",
"def transforms\n @transforms ||= []\n end",
"def each_transformation(&block)\n if !block_given?\n return enum_for(:each_transformation)\n end\n\n seen = Set.new\n needed_transformations.each do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n transform_inputs.each_value do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n transform_outputs.each_value do |trsf|\n key = [trsf.from, trsf.to]\n if !seen.include?(key)\n seen << key\n yield(trsf)\n end\n end\n\n supercall(nil, :each_transformation, &block)\n end",
"def setTransform(transform)\n # Pass through\n @target.transform = transform\n end",
"def entity_for_transformation(transformation)\n Grape::Transformations.entity_for_transformation(@grape_transformations_target_class, transformation)\n end",
"def transform\n raise 'Implement this method in subclass'\n end",
"def intersect_with(recurse, transform1, entities1, transform2, hidden, entities2)\n end",
"def replace_entities_with_ids(collection, entity_to_id_table)\n\t\tcollection.each{ |data| data.map! &replace_according_to(entity_to_id_table) }\n\tend",
"def child_entities(entity_id)\n API::request(:get, \"entities/#{entity_id}/child_entities\")\n end",
"def transform(x)\n z = @transformers.values.map { |t| t.transform(x) }\n Numo::NArray.hstack(z)\n end",
"def apply_custom_transformation\n end",
"def transformers\n strong_memoize(:transformers) do\n defined_transformers = self.class.transformers.map(&method(:instantiate))\n\n transformers = []\n transformers << self if respond_to?(:transform)\n transformers.concat(defined_transformers)\n transformers\n end\n end",
"def transform!\n state = inc_current_state\n print_by_line transform_message if state == 1\n\n self\n end",
"def file_entities\n @world.plugins.reduce(core_file_entities) do |files, plugin|\n plugin.process(@world, files, @migration_id_generator)\n end\n end",
"def run_and_transform; end",
"def transform(transform)\n end",
"def process(transform)\n raise \"Don't know how to do the #{transform} transformation\" unless geometry = StandardImageGeometry[transform.to_sym]\n change_image do |img|\n img.change_geometry(geometry) { |cols, rows, image| image.resize!(cols, rows) }\n end\n @aspect = transform.to_s\n self\n end",
"def transform; end",
"def transform(*cols, &block)\n cols.empty? ? transform_row(&block) : transform_cols(*cols, &block)\n end",
"def to_xml(entities)\n\t content_type(\"text/xml\")\n\t\txml = Builder::XmlMarkup.new\n\t\txml.instruct!\n\t\tif entities.class.to_s == \"DataMapper::Collection\" # Bad idea!, problem to be solved another day :)\n\t\t xml.results do\n \t\t entities.each do |entity|\n \t\t convert_entity(entity, xml)\n \t\t end\n\t\t end\n\t else\n\t convert_entity(entities, xml)\n\t\tend\n\tend",
"def translate(x, y = 0)\n current_transformation.translate(x, y)\n self[\"transform\"] = current_transformation.to_s\n end",
"def transform(transformation)\n end",
"def each_transform_input(&block)\n transform_inputs.each(&block)\n supercall(nil, :each_transform_input, &block)\n end",
"def call\n rows.map.with_index do |row, row_num|\n process_entities(row, row_num, &:call)\n end\n end",
"def translate( dx, dy)\n self.move(dx, dy)\n @groupList.each { |i| i.translate( dx, dy) }\n end",
"def transformation\n end",
"def substitute_entities=(value = true)\n Document.substitute_entities = value\n end",
"def normalize\n Transformation.new(self, self, [lambda{|x|x}])\n end",
"def map(transform=nil, &block_transform)\n @transformer = block_transform || transform\n self\n end",
"def create_entities\n results = []\n if @attributes.has_key?(:entities)\n @attributes[:entities].each do |result|\n results.push Muddyit::Collections::Collection::Entities::Entity.new(@muddyit, result.merge!(:collection => @attributes[:collection]))\n end\n @attributes[:entities] = results\n end\n end",
"def move_entity entity; end",
"def load(transformed_objects)\n transformed_objects.each do |transformed_object|\n transformed_object.save\n end\n end",
"def transform(*args, &block)\n (pre, post) = \n if args.size == 1\n pre = (args[0] - 1) / 2\n post = pre\n [pre, post]\n elsif args.size == 2\n args\n else \n raise(ArgumentError, \"accepts (pre, post, &block), or (points, &block)\")\n end\n trans = self.class.new(size)\n last_i = self.size - 1\n # TODO: could implement with rolling yielded array and be much faster...\n self.each_with_index do |x,i|\n start = i - pre\n stop = i + post\n start = 0 if start < 0\n stop = last_i if stop > last_i\n trans[i] = block.call(self[start..stop])\n end\n trans\n end",
"def transforms(direction = :from)\n direction == :from ? transforms_from : transforms_to\n end",
"def on_transform(&blk)\n @transform_handler = blk\n self\n end",
"def add_entities(entity_characteristics)\n type, x, y, radius = entity_characteristics\n @entities << Entity.new(type, x, y, radius)\n end",
"def add_entities(entity_characteristics)\n type, x, y, radius = entity_characteristics\n @entities << Entity.new(type, x, y, radius)\n end",
"def transformations; end",
"def local_transformation( transformation )\r\n # Cast Vector3d into Transformation.\r\n if transformation.is_a?( Geom::Vector3d )\r\n transformation = Geom::Transformation.new( transformation )\r\n end\r\n et = @instance.model.edit_transform\r\n local_transform = (et.inverse * transformation) * et\r\n end",
"def transform(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n z = kernel_mat(x, @components)\n z.dot(@normalizer)\n end",
"def entities\r\n result = []\r\n result.concat( patches )\r\n result.concat( edges )\r\n result.concat( control_points )\r\n result\r\n end",
"def scale(xscale, yscale = xscale)\n current_transformation.scale(xscale, yscale)\n self[\"transform\"] = current_transformation.to_s\n end",
"def ordered_entities\n ids = self.entity_ids\n self.entities.sort { |a, b| ids.index(a.id) <=> ids.index(b.id) }\n end",
"def transform\n renderer.convert(content)\n end",
"def transform_and_import\n transform_files\n import\n end",
"def entities\n return bad_request unless params[:id] and request.format.json? || request.format.js?\n return not_found unless current_document\n @response = {'entities' => current_document.ordered_entity_hash}\n render_cross_origin_json\n end",
"def entities_at_points(coords)\n coords.collect {|x, y| entity_at_point(x, y) }.compact.to_set\n end",
"def enemy_transform(id, enemy_id)\n # transform all existing target enemies\n get_enemies(id).each {|e| e.transform(enemy_id) if e.battler != nil}\n end",
"def process_moving_entity(entity)\n unless @registry[entity.registry_id]\n puts \"#{entity} not in registry yet, no move to process\"\n yield\n return\n end\n\n before_x, before_y = entity.x, entity.y\n\n yield\n\n if moved = (entity.x != before_x || entity.y != before_y)\n update_grid_for_moved_entity(entity, before_x, before_y)\n # Note: Maybe we should only wake entities in either set\n # and not both. For now we'll wake them all\n (\n entities_bordering_entity_at(before_x, before_y) +\n entities_bordering_entity_at(entity.x, entity.y)\n ).each(&:wake!)\n end\n\n moved\n end",
"def transform(point, z = 1)\n trm = text_rendering_matrix\n\n point.transform(text_rendering_matrix, z)\n end",
"def entities(*values)\n values.inject(self) { |res, val| res._entities(val) }\n end",
"def transform\n self.output = converter.convert(self.content)\n end",
"def each_transform_output(&block)\n transform_outputs.each(&block)\n supercall(nil, :each_transform_output, &block)\n end",
"def Transform3dIdentity\n ret = _invoke(1610743927, [], [])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def apply_block_transforms( str, rs )\n\t\t\trs.block_transform_depth += 1\n\n\t\t\t# Port: This was called '_runBlockGamut' in the original\n\n\t\t\[email protected] \"Applying block transforms to:\\n %p\" % str\n\t\t\ttext = str\n \n\t\t\ttext = pretransform_fenced_code_blocks( text, rs )\n\t\t\ttext = pretransform_block_separators(text, rs)\n\n\t\t\ttext = transform_headers( text, rs )\n\t\t\ttext = transform_toc(text, rs)\n\n\t\t\ttext = transform_hrules( text, rs )\n\t\t\ttext = transform_lists( text, rs )\n\t\t\ttext = transform_definition_lists( text, rs ) # AoBane Extension\n\t\t\ttext = transform_code_blocks( text, rs )\n\t\t\ttext = transform_block_quotes( text, rs )\n\t\t\ttext = transform_tables(text, rs)\n\t\t\ttext = hide_html_blocks( text, rs )\n\n\t\t\ttext = form_paragraphs( text, rs )\n\n\t\t\trs.block_transform_depth -= 1\n\t\t\[email protected] \"Done with block transforms:\\n %p\" % text\n\t\t\treturn text\n\t\tend",
"def integrate_transformations( transformation_sets )\n transformation_sets.each do |transformation_set|\n rule_name = transformation_set.rule_name.text\n \n if @specifications.member?(rule_name) and @specifications[rule_name].type.name == \"rule_spec\" then\n rule_spec = @specifications[rule_name]\n rule_spec.transformation_specs = [] if rule_spec.transformation_specs.nil?\n rule_spec.transformation_specs.concat( transformation_set.transformation_specs )\n else\n nyi( \"error handling for missing transformation set target [#{rule_name}]\" )\n end\n end\n end",
"def heal_geometry(entities)\n # Collect positions of all vertices.\n vertices = entities.grep(Sketchup::Edge) { |edge|\n edge.vertices\n }\n vertices.flatten!\n vertices.uniq!\n points = vertices.map! { |vertex| vertex.position }\n # Heal vertices.\n # Create a temp group with a set of zero length edges for each vertex -\n # when exploded will trigger SketchUp's internal healing function.\n temp_group = entities.add_group\n offset_reverse = [Z_AXIS.reverse]\n for point in points\n temp_edge = temp_group.entities.add_line(point, point.offset(Z_AXIS))\n # To prevent the temp edges to merging with each other they must be\n # transformed to zero length edges immediately after creation.\n # See Issue #77.\n temp_group.entities.transform_by_vectors(\n [temp_edge.end], offset_reverse)\n end\n temp_group.explode\n points.size\n end",
"def randomize_entities\n valid_entities = @@data[:entities][:types].select { |e| e.random_spawn_chance > 0 }\n (0...@width).each do |x|\n (0...@height).each do |y|\n \n # Roll to see if any entities are created here\n chosen_entity = nil\n valid_entities.each do |e|\n roll = rand(100) / 100.0\n if roll < e.random_spawn_chance\n chosen_entity = e\n break\n end\n end\n\n # If an entity would be created here, add it to the world\n if chosen_entity\n @living_entities << chosen_entity.new(x, y)\n end\n\n end\n end\n end",
"def each_transform_port\n return enum_for(:each_transform_port) if !block_given?\n model.each_transform_port do |port, transform|\n from = selected_frames[transform.from]\n to = selected_frames[transform.to]\n yield port.bind(self), Transform.new(from, to)\n end\n end",
"def translate(x, y = 0)\n transform[:translate] = [x, y]\n end",
"def transformed_entries entries\n\t\tentries\n\tend",
"def entities\n @entities ||= Entity.from_models(self, @models)\n end",
"def transform \n \n @pixel_location = get_pixel_points \n puts \"px loc : #{@pixel_location}\"\n \n while @pixel_location.size != 0 \n transform_pixel_points(@pixel_location)\n @pixel_location.shift\n @pixel_location.shift\n end\n end",
"def transform! &block\n @transformer||=[]\n @transformer << block if block_given?\n self\n end",
"def update_grid_for_moved_entity(entity, old_x, old_y)\n cells_before = cells_overlapping(old_x, old_y)\n cells_after = cells_overlapping(entity.x, entity.y)\n\n (cells_before - cells_after).each do |s|\n raise \"#{entity} not where expected\" unless s.delete? entity\n end\n (cells_after - cells_before).each {|s| s << entity }\n end",
"def articles_related_to(entities)\n if(entities.is_a? Entity)\n articles = articles_for(entities)\n else\n articles = []\n entities.each do |entity|\n articles = articles | articles_for(entity) # set union to remove duplication\n articles.sort! { |x, y| x.published_at <=> y.published_at }.reverse!\n end\n end\n articles.uniq! { |article| article.headline } if articles.present?\n articles\n end",
"def update\r\n entities.each { |e| e.flush }\r\n call_before_player_update\r\n p_players.each { |p|\r\n p.performed nil\r\n p.scene.update\r\n }\r\n p_entities.each { |e| e.update }\r\n call_player_update\r\n call_update\r\n p_subplots.each { |s| s.update unless s.concluded? }\r\n p_subplots.delete_if { |s| s.concluded? }\r\n end",
"def transform(t)\n ovwrite_me t.vectormult(self)\n end"
] | [
"0.7570289",
"0.64129245",
"0.55503327",
"0.53404963",
"0.52807957",
"0.5140464",
"0.5129187",
"0.5115216",
"0.510098",
"0.50695354",
"0.49524334",
"0.4950563",
"0.4940448",
"0.49188778",
"0.49122536",
"0.4902287",
"0.4886456",
"0.4856752",
"0.4849546",
"0.4842377",
"0.47946957",
"0.47721887",
"0.47411796",
"0.47111884",
"0.46906894",
"0.46859744",
"0.4678139",
"0.4672278",
"0.46343923",
"0.46157384",
"0.4601782",
"0.46010736",
"0.45719823",
"0.4570714",
"0.456473",
"0.45559868",
"0.45436123",
"0.4543166",
"0.45408735",
"0.45401943",
"0.4538791",
"0.45188594",
"0.45040047",
"0.44937524",
"0.44900727",
"0.44795188",
"0.44788146",
"0.4476716",
"0.4466997",
"0.4465073",
"0.44603565",
"0.44491434",
"0.44488704",
"0.44486284",
"0.4444515",
"0.44399974",
"0.4418045",
"0.44029236",
"0.44002873",
"0.43867928",
"0.43803442",
"0.43743694",
"0.43706432",
"0.43522975",
"0.43310553",
"0.43234804",
"0.4303577",
"0.4298494",
"0.4298494",
"0.42724094",
"0.42677307",
"0.42672887",
"0.42352885",
"0.4232641",
"0.42324412",
"0.42315334",
"0.42261887",
"0.4225213",
"0.4224338",
"0.42159405",
"0.42039713",
"0.42007145",
"0.41869637",
"0.41831127",
"0.41693482",
"0.4166341",
"0.4159565",
"0.41563916",
"0.4152635",
"0.41525838",
"0.41506532",
"0.41505367",
"0.4146546",
"0.41452268",
"0.413667",
"0.41296127",
"0.41234183",
"0.41126052",
"0.4109737",
"0.41067168"
] | 0.74724543 | 1 |
scope :all_boys, > select("") | def full_name
"#{first_name} #{last_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_all; end",
"def for_dropdown\n ActiveRecord::Base.connection.select_all(\n select('brands.name, brands.id').group('1, 2').order('1').to_sql\n ).map { |r| [r['name'], r['id']] }\n end",
"def select_all\n\t\treturn self.clone( :select => [] )\n\tend",
"def select_all\n clone(:select => nil)\n end",
"def select_list; end",
"def shopping_list\n self.ingredients.select do |ingred_calor|\n ingred_calor.name\n\n\n binding.pry \n end\n\nend",
"def select_all\n buffer_current.select_all\n end",
"def select_all(arel, name = nil, binds = [])\n select(to_sql(arel), name, binds)\n end",
"def select\n execute_only(:select)\n end",
"def select\n (@select ||= (defaults[:select] || [])).collect { |c| c == '*' ? all_columns.keys : c }.flatten\n end",
"def select(scope) # abstract\n end",
"def select_all(arel, name = nil, binds = [], &block)\n exec_query(arel, name, binds)\n end",
"def select; end",
"def select; end",
"def index\n @lobbies = Lobby.all\n end",
"def select_by(how, what); end",
"def selects_all_female_bears_return_name_and_age\n 'SELECT bears.name, bears.age FROM bears WHERE gender = \"F\"'\nend",
"def selects_all_bears_names_and_orders_in_alphabetical_order\n 'SELECT bears.name FROM bears ORDER BY name'\nend",
"def do_select_all\n return nil unless @data.size > 0\n select_range([email protected])\n refresh\n end",
"def all_bp_roaming\n plan = Plan.select('id, name').where('(plan_type = ? OR plan_type = ?) AND item= ?',\n 'plan', 'bag', 'roaming')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.name] }\n return plans\n end",
"def select(*) end",
"def selects_all_bears_names_and_orders_in_alphabetical_order\n \"SELECT name FROM bears ORDER BY name ASC\"\nend",
"def select_accounts\n @accounts = Account.find(:all, :order => \"hizuke DESC\")\n if params[:boy]\n @accounts = Account.find(:all, :conditions=>['boy_id=?',params[:boy]], :order => \"hizuke DESC\")\n end\n end",
"def select_names\n q = make_work\n # binding.pry\n names = []\n names.push(q.collect{|xx| xx[\"drinks\"][0][\"strDrink\"]})\n #names.push(q.collect{|xx| xx[\"drinks\"][0][\"strDrink\"]})\n names.push(q.collect{|xx| xx[\"drinks\"][1][\"strDrink\"]})\n #binding.pry\n #count +=1\n # end\n \n names\n end",
"def initialize\n super\n select @all\n end",
"def select_all\n # FIXME\n driver.operaAction('Select all')\n end",
"def select_all(sql, name = nil) end",
"def list_names # :nologin:\n query = create_query(:Name, :all, :by => :name)\n show_selected_names(query)\n end",
"def index\n @kind_of_boats = KindOfBoat.all\n end",
"def index\n @boats = Boat.all\n end",
"def index\n @boats = Boat.all\n end",
"def breweries_list \n Brewery.all.each.with_index(1) do |brewery, i|\n puts \"\"\n puts \"\"\n puts \"#{i}. #{brewery.name}\"\n end \n brewery_selection\n end",
"def index\n @bronies = Brony.all\n end",
"def selects_all_female_bears_return_name_and_age\n <<-SQL \n SELECT \n bears.name, \n bears.age \n FROM bears \n WHERE sex='F';\n SQL\nend",
"def pending_of_assignation\n p \"LOADING-PENDING-OF-ASSIGNATION\"\n BookingDataSystem::Booking.by_sql{ |b| [select_pending_of_assignation(b)] }.all(order: :date_from) \n\n end",
"def battery_select\n p params[\"building_id\"]\n @batteries = Battery.where(building_id: params[\"building_id\"])\n respond_to do |format |\n format.json {\n render json: {\n batteries: @batteries\n }\n }\n end\n end",
"def index\n @boredoms = Boredom.all\n end",
"def observations_by_name # :nologin: :norobots:\n query = create_query(:Observation, :all, by: :name)\n show_selected_observations(query)\n end",
"def select_all(sql, name = nil)\n select(sql, name)\n end",
"def select\n self[:select] ||= associated_class.table_name.*\n end",
"def index\n @buoys = Buoy.all\n end",
"def robo\n #@bicicleta = Bicicletum.find_by ciclista_id: current_user.id\n @bicicleta = Bicicletum.where ([\"bic_estado_robo = 'V'\"])\n #@bicicleta =Bicicletum.all \n end",
"def blood_oaths\n # First, get all of the blood oaths and then from them, select only the ones that belong to this cult\n BloodOath.all.select { |blood_oath| blood_oath.cult == self }\n end",
"def select &blck\n @projects.select(&blck)\n end",
"def select &blck\n @projects.select(&blck)\n end",
"def selects_all_female_bears_return_name_and_age\n\" SELECT name, age\n FROM bears \n WHERE gender = 'F';\"\nend",
"def select(*args)\n Criteria.new(:all, self).select(*args)\n end",
"def available_bams(country)\n bm = Bam.select('id, model, code, price').where('state= ? AND country= ?','catalog',\n country)\n # Format to show in view\n bam = bm.map { |m| [m.model, m.id] }\n return bam\n end",
"def select(&block)\n scope.select(*build_attributes(true, &block))\n end",
"def candies\n # all_candies = Candy.all\n Candy.all.select do |candy|\n candy.bucket == self && candy.name.downcase != \"penny\"\n end\n\n # my_candies.reject do |candy|\n # candy.name.downcase == \"penny\"\n # end\n end",
"def blood_oaths #<-- blood oath selects all cult members in bloodOath Class file\n BloodOath.all.select { |blood_oath| blood_oath.cult == self}\n end",
"def index\n @boks = Bok.all\n end",
"def index\n @britts = Britt.all\n end",
"def filter companies \n companies.select do |company|\n company.size > 100 \n end\nend",
"def bikes_owned\n DATABASE.execute(\"SELECT bikes.bike_name FROM bikes JOIN cyclists ON bikes.cyclist_id = cyclists.id WHERE cyclists.id = #{id}\")\n end",
"def bikes_owned\n DATABASE.execute(\"SELECT bikes.bike_name FROM bikes JOIN cyclists ON bikes.cyclist_id = cyclists.id WHERE cyclists.id = #{id}\")\n end",
"def select_none; end",
"def select\n @equipment = Equipment.all\n end",
"def selects_all_bears_names_and_ages_that_are_alive_and_order_youngest_to_oldest\n 'SELECT bears.name, bears.age\n FROM bears WHERE alive = 1\n ORDER BY age'\nend",
"def index\n @boats = Boat.all\n #filtering, may suffer from SQL injection.\n #https://www.justinweiss.com/articles/search-and-filter-rails-models-without-bloating-your-controller/\n @boats = @boats.state(params[:state]) if params[:state].present?\n @boats = @boats.city(params[:city]) if params[:city].present?\n @boats = @boats.capacity(params[:capacity]) if params[:capacity].present?\n end",
"def index\n @hobbies = Hobby.all\n end",
"def index\n @bunnies = Bunny.all\n end",
"def index\n @bowlings = Bowling.all\n end",
"def index\n @bounties = Bounty.all\n end",
"def roaming_bags(country)\n plan = Plan.select('id, name, detail, price').where('country= ? AND plan_type = ? AND item= ?',\n country, 'bag', 'roaming')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.id] }\n # Format to display details of plans\n details = plan.map {|m| [m.id, m.detail]}\n return [plans, details]\n end",
"def select_all\n map(&:select).all?\n end",
"def prepare_select\n @group_items = GroupItem.all\n end",
"def select_options\n all.map {|e| [e.name, e.to_s] }\n end",
"def select_options\n all.map {|e| [e.name, e.to_s] }\n end",
"def employees_select_by(group)\n employees\n end",
"def complete_name_list\n #User.select(:name).map{|user_record| user_record.name}\n end",
"def get_genre_list\n @genre_names = Genre.select('name')\n end",
"def find_some(names,options={})\n return Postal.driver.selectLists(names,'')\n end",
"def index\n @bingo_halls = BingoHall.all\n end",
"def all_items\n \t\tall(:xpath, \"//select[@id='ctl00_LC_drop3']//option\").map { |a| a.text}\n \tend",
"def select_statement\n \"select \" + selected_field_names.map { |field_name| zuora_field_name(field_name) }.join(', ')\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def index\n @brand_names = BrandName.all\n end",
"def query_all(args = {})\n query(args.merge(select: \"DISTINCT #{model.table_name}.*\"))\n end",
"def index\n @buisinesses = Buisiness.all\n end",
"def get_strawberries\n @all_strawberries\n end",
"def raw_all\n query_all\n end",
"def select_all_link\n button_to(t(\"layout.select_all\"), \"#\", :onclick => \"batch_select_all(); return false\", :id => \"select_all_link\")\n end",
"def all \n @auctions\n end",
"def bylaws_passed_collection\n bylaw_table_rows = select_table(BYLAWS_PASSED_TITLE, 2)\n\n bylaw_table_rows.map do |bylaw_row|\n bylaw_builder(bylaw_row)\n end\n end",
"def eighties_b_movies\n # List all the movies from 1980-1989 with scores falling between\n # 3 and 5 (inclusive).\n # Show the id, title, year, and score.\n Movie.select(:id, :title, :yr, :score).where(score: 3..5, yr: 1980..1989)\nend",
"def scrooge_select_sql( set )\n set.map{|a| attribute_with_table( a ) }.join( ScroogeComma )\n end",
"def all\n where\n end",
"def list_lobbies\n @lobby_class.all.map do |lobby|\n { :id => lobby.id, :lobby_name => lobby.lobby_name }\n end\n end",
"def index\n @boat_types = params[:ids].blank? ? BoatType.active : BoatType.where(id: params[:ids])\n if params[:ids].blank? \n @boat_types = BoatType.active\n #parameter_filter_data = BoatParameterType.filter_data\n #option_filter_data = BoatOptionType.filter_data \n # @filter_data = parameter_filter_data.merge(option_filter_data)\n # @default_boats = BoatForSale.active.ids \n else\n @boat_types = BoatType.with_bfs.where(id: params[:ids])\n end\n end",
"def select_all(arel, name = nil, binds = [])\n add_column_types(select(to_sql(arel, binds), name, binds))\n end",
"def select_agent agent\n select agent, :from => \"staffID_1\"\n end",
"def get_genre_dropdown()\n collection_select(\"project\", \"genres\", genre_list(), :first, :last, {:prompt => \"Please select\"})\n end",
"def show\n @borrows = Borrow.joins(:indentify, :book).where(user_id: current_user).select(\"borrows.*,indentifies.*,books.*,borrows.id\",)\n\n end",
"def index\n @hobby_sotrs = HobbySotr.all\n end",
"def select_type\n\t\t\t@select_all_type = TypeEquipament.all\n\t\tend",
"def options_for_user_select\n query = policy_scope(User.all.where(cleared: false)).order(:first_name, :last_name)\n options = query.map{|user| [user.full_name, user.id, {\n data: { tokens: \"#{user.username} #{user.full_name}\" }}]}\n options_for_select(options)\n end",
"def index\n @buddies = Buddy.all\n end",
"def index\n @bids = Bid.all\n end",
"def index\n @bids = Bid.all\n end",
"def index\n @bids = Bid.all\n end"
] | [
"0.68538845",
"0.6361582",
"0.6218723",
"0.6181595",
"0.6164318",
"0.60797745",
"0.59027886",
"0.5865492",
"0.57511795",
"0.5698874",
"0.56713897",
"0.5662996",
"0.564028",
"0.564028",
"0.55843306",
"0.55749255",
"0.55706054",
"0.5568498",
"0.5555624",
"0.55348027",
"0.55037636",
"0.54969376",
"0.5488989",
"0.54778177",
"0.5469496",
"0.5459009",
"0.54585606",
"0.5442233",
"0.5439828",
"0.5429989",
"0.5429989",
"0.5429335",
"0.5420955",
"0.54169154",
"0.54102844",
"0.5380107",
"0.53462946",
"0.53181934",
"0.53031945",
"0.5295361",
"0.529153",
"0.52814436",
"0.5267175",
"0.5264649",
"0.5264649",
"0.5264057",
"0.5251815",
"0.52510977",
"0.52400404",
"0.5234185",
"0.52288896",
"0.522245",
"0.52199596",
"0.52187604",
"0.52146757",
"0.52146757",
"0.5206982",
"0.5201752",
"0.5190378",
"0.5186969",
"0.5180432",
"0.5178749",
"0.5173538",
"0.5171947",
"0.5159514",
"0.51576835",
"0.5155132",
"0.51522815",
"0.51522815",
"0.5150596",
"0.51505524",
"0.5143241",
"0.5142299",
"0.51412016",
"0.5137257",
"0.51282126",
"0.51280403",
"0.51256436",
"0.51181763",
"0.51072824",
"0.51042795",
"0.5102788",
"0.50982213",
"0.50972176",
"0.5096964",
"0.50875294",
"0.50853634",
"0.50835526",
"0.5069004",
"0.5068813",
"0.506868",
"0.506802",
"0.5063074",
"0.5059206",
"0.50583607",
"0.5037298",
"0.50351614",
"0.50337076",
"0.5028713",
"0.5028713",
"0.5028713"
] | 0.0 | -1 |
Clearly these user_ and user_token_ methods should be extracted to... a) Token class? b) Auth module/class? | def user_present?
user_token_present? && User.find_by(auth_token: user_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend",
"def token_auth(*args, &block); end",
"def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end",
"def auth_methods; end",
"def token\n authenticated\n end",
"def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end",
"def user_authentication!\n if params[:auth_token].present? or params[:token_authentication]== \"true\"\n #this is for api authentication and access\n authenticate_user_from_token!\n else\n #normal devise authentication\n authenticate_user!\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n # else\n # authentication_error\n end\n end",
"def login_by_token\n\n end",
"def current_user\n authenticate_token\n end",
"def authenticate_user (temp = false)\r\n token = request.headers['token']\r\n user_token = Token.find_by(access_token: token)\r\n @current_user = nil\r\n if params[:hashtoken].present?\r\n if params[:id].present?\r\n hash_token = TokenEventInvite.where(access_token: params[:hashtoken], event_id: params[:id].to_i).first\r\n if hash_token.present?\r\n user_id = hash_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n else\r\n @current_user = authenticate_old_event( params[:hashtoken], params[:id].to_i)\r\n end\r\n else\r\n hash_token = TokenUserConfirmation.where(access_token: params[:hashtoken]).first ||\r\n TokenPasswordReset.where(access_token: params[:hashtoken]).first\r\n if hash_token != nil\r\n user_id = hash_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n else\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Missing token. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n end\r\n elsif user_token.present?\r\n user_id = user_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n if @current_user.present? && request.path.include?(\"/ambassador/\")\r\n @current_user = @current_user.admin.present? ? @current_user.admin : @current_user.av_user\r\n end\r\n else\r\n if token.present?\r\n @current_user = authenticate_old( token)\r\n if @current_user.present?\r\n if @current_user.present? && request.path.include?(\"/ambassador/\")\r\n @current_user = @current_user.admin.present? ? @current_user.admin : @current_user.av_user\r\n end\r\n return nil\r\n else\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'User not found. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n end\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Missing token. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n if @current_user.blank?\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Bad Request: User not found'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n nil\r\n end\r\n end",
"def userauth_request(username, next_service, auth_method, *others); end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end",
"def token(request)\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def user\n @user ||= User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n @user || errors.add(:token, 'Invalid Token') && nil\n end",
"def token_auth\n Hash['type' => 'token',\n 'token' => @token,]\n end",
"def authentication_token\n object.authentication_token if !current_user || object.id == current_user.id\n end",
"def authenticate_user_from_token2!\n puts request.format\n return true if request.format != \"application/json\"\n log_headers\n\n authenticate_or_request_with_http_token do |token, options|\n puts \"#\"*40\n # User.find_by(auth_token: token)\n user = token && User.find_by_authentication_token(token.to_s)\n # puts user.to_yaml\n if user\n sign_in user, store: false\n end\n user\n end\n\n # Notice how we use Devise.secure_compare to compare the token\n # in the database with the token given in the params, mitigating\n # timing attacks.\n end",
"def authenticate_token\n authenticate_with_http_token do |token, options|\n User.find_by(auth_token: token)\n end\n end",
"def call\n Utils::TokenManager.encode(user_id: user.id) if user\n end",
"def user_authentication\n end",
"def authenticate_token\n authenticate_with_http_token do |token, options|\n @current_user = User.find_by(token: token)\n @current_user\n end\n end",
"def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end",
"def authenticated_user_with_token\n ApiKey.find_user_with_token(decoded_token)\n end",
"def authenticate_user_from_token!\n\t\t@api_token = ApiToken.find_by_token(params[:token])\n @user = @api_token.try(:user)\n if @user.nil?\n render json: { error: 'Not authorized' }, status: 401\n end\n end",
"def model_class\n AuthenticationToken\n end",
"def auth\n\t\trequest_token = OAuth::RequestToken.from_hash(oauth_consumer, \n\t\t\t:oauth_token => session[:request_token], \n\t\t\t:oauth_token_secret => session[:request_secret])\n\t\tbegin\n\t\t\t@access_token = request_token.get_access_token\n\t\t\tsession.delete(:request_token)\n\t\t\tsession.delete(:request_secret)\n\t\t\tresponse = @access_token.get('/api/auth_user')\n\t\t\tdoc = Nokogiri::XML(response.body)\n\t\t\tuser_xml = doc.at_xpath('//user')\n\t\t\tgoodreads_user_id = user_xml.attributes[\"id\"].value\n\t\t\tname_xml = doc.at_xpath('//name')\n\t\t\tgoodreads_username = name_xml.children[0].inner_text\n\t\t\t@user = User.find_by(\tgoodreads_name: goodreads_username)\n\t\t\tif @user\n\t\t\t\tsession[:user_id] = @user.id\n\t\t\t\tredirect_to :home\n\t\t\telse\n\t\t\t\t@user = User.create( goodreads_name: goodreads_username,\n\t\t\t\t\tgoodreads_user_id: goodreads_user_id, \n\t\t\t\t\tauth_token: @access_token.token, \n\t\t\t\t\tauth_secret: @access_token.secret)\n\t\t\t\tsession[:user_id] = @user.id\n\t\t\t\tredirect_to :welcome\n\t\t\tend\n\t\trescue\n\t\t\tsession.delete(:request_token)\n\t\t\tsession.delete(:request_secret)\n\t\t\t@not_authorized = true\n\t\t\tredirect_to :home\n\t\tend\t\t\n\tend",
"def token\n end",
"def auth_token\n AuthToken.new payload: { sub: user.id }\n end",
"def token\n authenticate_username_password || render_unauthorized\n end",
"def token_secret; end",
"def token_secret; end",
"def token_secret; end",
"def user; end",
"def user; end",
"def authenticate_user_from_token!\n # Set the authentication params if not already present\n if username = params[:username].blank? && request.headers[\"X-Username\"]\n params[:username] = username\n end\n if authn_token = params[:authn_token].blank? && request.headers[\"X-User-Token\"]\n params[:authn_token] = authn_token\n end\n\n username = params[:username].presence\n user = username && self.class.token_authentication_class.find_by(username: username)\n\n # Notice how we use Devise.secure_compare to compare the token\n # in the database with the token given in the params, mitigating\n # timing attacks.\n if user &&\n ::Devise.secure_compare(user.authn_token, params[:authn_token]) &&\n DateTime.current < (user.current_sign_in_at + Devise.timeout_in)\n\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n\n # Set current user\n @current_user = user\n else\n # TODO: @giosakti investigate better behaviour for authentication during\n # testing\n raise LoginRequiredException unless ::Rails.env.test?\n end\n end",
"def auth\n end",
"def auth\n end",
"def authenticate_with_token\n # get the token from the header\n # get the token from the post body\n # get the token from json post\n \n token = request.headers[\"HTTP_AUTHORIZATION\"]\n \n if (!token)\n if (not_protected self.controller_name, self.action_name)\n return nil\n end\n\n redirect_to controller: 'application', action: 'index' \n end\n\n #@user = get_user_by_token(token)\n end",
"def request_token(auth, opts)\n case auth[:method]\n when 'token'\n auth_token(auth)\n when 'userpass'\n auth_userpass(auth, opts)\n else\n raise ValidationError, \"Unknown auth method: #{auth[:method]}\"\n end\n end",
"def tokenizing\n authenticate_api || unauthorized_api\n end",
"def authorize_request\n\t\tauthenticate_with_http_token do |token, options|\n\t\t\tUser.find_by(token: token)\n\t\tend\n\tend",
"def authenticate_user_from_token!\n raise AuthorizationError unless http_auth_token.present?\n result = find_user\n raise BadRequestError, result.errors if result.failure?\n @current_user = result.current_user\n end",
"def generate_auth_token\n \tbegin\n \t\tself.auth_token = User.new_token\n \tend while self.class.exists?(auth_token: auth_token)\n end",
"def token\n authenticate_username_password || render_unauthorized\n end",
"def check_authenticate_user\n if request.headers[:token].present?\n @auth_token = AuthToken.find_by(token: request.headers[:token])\n @current_user = auth_token.user if @auth_token.present?\n unless @auth_token && @current_user\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n else\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n end",
"def token_handler(token, options)\n authentication = TokenAuthenticateMe::Authentication.new(token: token)\n authentication.authenticate(options)\n end",
"def oauth_authentication; end",
"def token(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end",
"def processToken(token, context=nil)\n if token.nil? or token.empty?\n debug(\"Error: processToken: Null/empty token.\")\n return\n end\n stoken = decodeToken token\n stoken = validateToken stoken\n stoken = parse stoken\n unless stoken\n debug(\"Error: processToken: Failed to decode/validate token: #{token}\")\n return\n end\n sappid = stoken['appid']\n unless sappid == appid\n debug(\"Error: processToken: Application ID in token did not match ours: #{sappid}, #{appid}\")\n return\n end\n begin\n user = User.new(stoken['ts'], stoken['uid'], stoken['flags'], \n context, token)\n return user\n rescue Exception => e\n debug(\"Error: processToken: Contents of token considered invalid: #{e}\")\n return\n end\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end",
"def authenticate\n #Hace el llamado de la clase AuthenticaUser, manda los parametros de :username y :password\n #Realiza el metodo call para obtener el Token del user_id\n #Arroja el token como Json_response\n auth_token = AuthenticateUser.new(auth_params[:username], auth_params[:password]).call \n json_response(auth_token: auth_token)\n end",
"def authenticate_user_from_token!\n user_token = params[:user_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n client_id = request.headers['Client-ID']\n\n if auth_token\n authenticate_with_auth_token(auth_token, client_id)\n else\n authentication_error\n end\n end",
"def access_token_user_finder(&blk)\n define_method(:_find_user_by_access_token, &blk)\n end",
"def call\n fetch_user_from_auth_token\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n unless user\n render json: { errors: 'user must signed in' }, status: :unprocessable_entity\n end\n end",
"def send_token_for_valid_login_of(user)\n\t\trender json: {token: user.auth_token }\n\tend",
"def w000thenticate!\n check_token\n authenticate_user!\n end",
"def user_provider; end",
"def generate_authentication_token!\n\tbegin\n\t\tself.auth_token = Devise.friendly_token\n\tend while self.class.exists?(auth_token: auth_token)\nend",
"def auth(value); end",
"def authenticate\n #render :text => params[:action]\n if (params[:controller] != \"api/sessions\")\n if (params[:controller] == \"api/users\" && params[:action] == \"create\")\n return\n end\n user = User.find_by(token: params[:token])\n if !user || user.valid_up < DateTime.now\n render json: '{\"error\":\"Unauthorized\"}', status: 401\n end\n end\n if (params[:controller] == \"api/sessions\" && params[:action] == \"chekToken\")\n user = User.find_by(token: params[:token])\n if !user || user.valid_up < DateTime.now\n render json: '{\"error\":\"Unauthorized\"}', status: 401\n end\n end\n #\"controller\":\"users\",\"action\":\"show\",\"id\":\"login\" si se va a registrar dejar pasar\n #@product = '[{\"mytoken\":\"'+params[:token]+'\"}]'\n # if !User.find_by(token: params[:token])\n # #render json: '[{\"error\":\"Unauthorized\"}]', status: 401\n # end\n end",
"def authenticate\n \n authenticate_or_request_with_http_token do |token|\n begin\n decoded = decode(token)\n @current_user = User.find_by(id: decoded[0][\"user_id\"]) \n \n rescue JWT::DecodeError\n render json: {authorized: false }, status: 401 \n end\n end \n end",
"def auth_token_for(key)\n @username_auth_tokens[secure_auth_token_key(key)]\n end",
"def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end",
"def authenticate!(level = 0, methods: [:token])\n user =\n if methods.include?(:token) && valid_token?\n logger.info 'Auth using token'\n env['gritsos.auth.method'] = :token\n \n find_user_with_token env['HTTP_TOKEN']\n \n elsif methods.include?(:password) && valid_user?\n logger.info 'Auth using username and password'\n env['gritsos.auth.method'] = :password\n\n find_user params['username'], params[:password]\n else\n halt 400, 'A token or password is required for authentication'\n end\n\n halt 401 unless user # Unauthorized\n halt 403 unless user.privileged? # Forbidden\n \n env['gritsos.user'] = user\n end",
"def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend",
"def user\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n if user_token\n user = User.where(authentication_token: user_token.to_s).first\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n else\n render status: 401, json: {success: false, error: \"invalid token\" }\n end\n end\n end",
"def ensure_auth_token\n unless self.auth_token\n self.auth_token = User.generate_token\n end\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def authenticate_user_from_token!\n # user_id = params[:user_id].presence\n # user = user_id && User.find(user_id)\n # api_token = params[:api_token] || env['HTTP_API_TOKEN']\n # if user && Devise.secure_compare(user.api_token, api_token)\n # sign_in user, store: false and return\n # end\n\n # render_error({ :error => \"Please sign in first.\" })\n end",
"def token\n return self[:token] if self[:token] # <- Will not generate a token more than once.\n begin\n byte_string = [self.user_id, rand(2**32)].pack('L*') << rand(256)\n self[:token] = Base64.urlsafe_encode64(byte_string)\n end while UserAuthToken.exists?(token: self[:token])\n end",
"def fetch_user_from_auth_token\n @user = decode_auth_token ? User.find(decode_auth_token['user_id']) : nil\n errors.add(:token, 'invalid token') if @user.nil?\n @user\n end",
"def authenticate_request!\n\t\t# unless is if in reverse. If user_id_in_token == false then render error\n\t unless user_id_in_token?\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\t return\n\t end\n\t @current_user = User.find(auth_token[:user_id])\n\trescue JWT::VerificationError, JWT::DecodeError\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\tend",
"def authenticate_user_from_token!\n user_token = params[:user_token].presence\n user = user_token && User.find_by_authentication_token(user_token)\n\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def validation_login\n validate_token User, params[:token]\n end",
"def token!\n raise \"#{username} is not signed in, (token is set to nil).\" unless token\n\n token\n end",
"def access_token; self; end",
"def set_user_token(token)\n @user_token = token\n end",
"def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end",
"def call\n if user\n {access_token:JsonWebToken.encode(user_id: user.id),\n user_role: user.role}\n end \n end",
"def auth_param; end",
"def auth_token\n @@auth_token\n end",
"def token_or_current_or_guest_user\n token_user || current_or_guest_user\n end",
"def generate_auth_token!\n \tbegin\n \t\tself.auth_token = Devise.friendly_token\n \tend while User.exists?(auth_token: auth_token)\n\tend",
"def logged_user\n if decoded_token\n user_id = decoded_token[0].to_i\n @user = User.find user_id\n end\n end",
"def assign_token(user)\n\t\t0\n\tend",
"def token\n\n authenticate_with_http_basic do |email, password|\n user = User.find_by(email: email)\n if user && user.authenticate(password) \n render json: { token: user.api_token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def call\n\t\tJsonWebToken.encode(user_id: user.id) if user\t\n\tend",
"def authenticate_user\n @token = Token.find_by(auth_token: request.headers['HTTP_AUTH_TOKEN'])\n return render json: { message: 'token invalid' }, status: 422 unless @token\n\n @current_user = @token.user\n end",
"def access_token\n end",
"def authenticate_user!\n payload = decode_token\n return unless payload.is_a? Hash\n\n @current_user = User.find payload[:user_id]\n end",
"def current_user\n @_current_user ||= authenticate_token\n end"
] | [
"0.67964697",
"0.6784665",
"0.6580735",
"0.64821875",
"0.6389003",
"0.63376534",
"0.63287437",
"0.63265795",
"0.6316272",
"0.6305606",
"0.6304899",
"0.6282124",
"0.62708926",
"0.62708926",
"0.6241428",
"0.62406737",
"0.6239061",
"0.62383944",
"0.62111104",
"0.6211065",
"0.61987185",
"0.6187919",
"0.6174409",
"0.6165625",
"0.61519855",
"0.6149933",
"0.61419654",
"0.61230385",
"0.6108746",
"0.6085043",
"0.608087",
"0.6076556",
"0.6070049",
"0.6067492",
"0.6067492",
"0.6067492",
"0.60556304",
"0.60556304",
"0.6048144",
"0.60408294",
"0.60408294",
"0.6034046",
"0.6030775",
"0.60129726",
"0.6010819",
"0.6008878",
"0.6007932",
"0.6005728",
"0.60029805",
"0.6001078",
"0.59858125",
"0.59833264",
"0.59832704",
"0.5983016",
"0.59829736",
"0.59720516",
"0.59559834",
"0.5943065",
"0.5934304",
"0.5934087",
"0.5930298",
"0.59271896",
"0.5925031",
"0.59211516",
"0.5919696",
"0.59073496",
"0.5903601",
"0.5901614",
"0.5893543",
"0.58906496",
"0.5888957",
"0.5882944",
"0.58809793",
"0.5879068",
"0.58748955",
"0.5873956",
"0.58626896",
"0.58529925",
"0.5852043",
"0.5850774",
"0.58484083",
"0.5848388",
"0.5845978",
"0.58430475",
"0.5842627",
"0.58410716",
"0.58390754",
"0.58389413",
"0.5831881",
"0.58314824",
"0.58275807",
"0.5824864",
"0.5822469",
"0.58207715",
"0.5815532",
"0.5815532",
"0.58107936",
"0.58089215",
"0.5807541",
"0.5805752",
"0.5804427"
] | 0.0 | -1 |
having to tail a log in a separate terminal window. | def redirect_log(options={})
ActiveRecord::Base.logger = Logger.new(options.fetch(:to, STDERR))
ActiveRecord::Base.clear_active_connections!
ActiveRecord::Base.colorize_logging = options.fetch(:colorize, true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tail_last\n log_name = last_log\n File.open log_name do |f|\n f.extend File::Tail\n f.interval = 2\n f.backward(2)\n f.return_if_eof = true\n loop do\n f.tail { |line| color_print line }\n break unless last_log == log_name\n end\n end\nend",
"def logs tail=nil\n f = tail ? '-f ' : ''\n\n if tail\n @prompter.print 'Fetching logs...'\n @prompter.print 'Use Ctrl-C to stop'\n end\n\n @cli.system_call \"kubectl logs #{f}#{self.name} --namespace=#{self.namespace} -c=#{self.app}\"\n end",
"def do_tail( session, ssh_tail_command )\n session.open_channel do |channel|\n channel.on_data do |ch, data|\n puts \"Fetched SSH Log using Tail Command :\"\n puts \"[#{ssh_tail_command}] -> #{data}\"\n if \"[#{ssh_tail_command}] -> #{data}\".include? 'Completedtrue' or \"[#{ssh_tail_command}] -> #{data}\".include? @log_time_stamp.strftime('%Y-%m-%d %H:%M:%S')\n tail_log = data.scan(/.*/)\n tail_log.rindex('Completedtrue')\n completed_tail_log = tail_log[tail_log.rindex('Completedtrue') - 2]\n puts \"\\nFetched Completed Tail Log :\\nCompleted Log: #{completed_tail_log}\"\n $ssh_fetched_success_log = tail_log[tail_log.rindex('Completedtrue') - 2].scan(/Distribute.*/)[0].delete('Distribute').split(':')\n puts \"Fetched SSH ESME Address from tail log :#{$ssh_fetched_success_log[0]}\"\n puts \"Fetched SSH MID from tail log :#{$ssh_fetched_success_log[1]}\"\n else\n puts \"SSH Email File Processor is not working or FTP files are not uploaded\"\n end\n end\n sleep 5\n puts channel.exec \"tail #{ssh_tail_command}\"\n end\nend",
"def log_tail(options = {}, &block)\n raise \"no log host specified for #{self}\" unless log_host\n raise \"no log file patterns specified for #{self}\" unless log_file_patterns\n\n unless options.has_key? :discard_stderr\n options[:discard_stderr] = !$DEBUG\n end\n\n tail_command = TailCommand.new log_file_patterns, options\n\n command = \"ssh -oClearAllForwardings=yes '#{host}' \" +\n \"'sudo sh -c \\\"#{tail_command}\\\"'\" +\n (options[:discard_stderr] ? ' 2>/dev/null' : '')\n\n IO.popen(command) do |pipe|\n if block_given?\n yield pipe\n else\n begin\n while line = pipe.readline\n puts line\n end\n rescue EOFError\n # ignore\n end\n end\n end\n end",
"def showTail()\n puts \"tail is #{@tail.data}\"\n end",
"def tail_log(quiet: false)\n log_config = {\n log_group_name: stack_name,\n log_stream_name: LOG_NAME\n }\n log_config[:next_token] = @@log_token unless @@log_token.nil?\n # Return silently if we can't get the log events for any reason.\n resp = logs.get_log_events(log_config) rescue return\n resp.events.each do |event|\n CDO.log.info(event.message) unless quiet\n end\n @@log_token = resp.next_forward_token\n end",
"def tail_pglog(n)\n log_dir = datadir + '/pg_log'\n status, out = run 'root', \"ls -t #{log_dir}|head -1\", datadir\n if out !~ /(No such file)|^$/\n log_file = log_dir + '/' + out\n command = \"tail -#{n} #{log_file}\"\n status, out = run 'root', command, datadir\n if status\n logger.info out\n end\n end\n end",
"def tail(logfilepath)\n raise RuntimeError, \"Error, I cant seem to locate the EventMonitor logfile?\" unless File.exists?(logfilepath)\n File.open(logfilepath) do |log|\n log.extend(File::Tail)\n log.interval = 2\n log.backward(0)\n log.tail do |line|\n alert = XmlSimple.xml_in(line)\n pattern_matcher(alert)\n end\n end\n end",
"def show_kannel_log\n @header = 'Kannel Log'\n @lines = `tail -200 log/kannel.log`\n render(:template => \"admin/show_lines\")\n end",
"def logs\n system \"tail -f ~/Library/Logs/Pow/access.log\"\n end",
"def reopen_logs; end",
"def viewconsole\n wd = session[:working_dir]\n log_path = File.join(wd + \"/../#{session[:console_filename]}\")\n @console_log = File.open(log_path) { |f| f.readlines }\n render :layout => false # don't render full layout for this page\n end",
"def watch\n File.open(@log_file) do |log|\n log.extend(File::Tail)\n log.interval = 0\n log.backward\n log.tail { |line| @stats.consider(line) }\n end\n end",
"def sub_log \n send_cmd(\"sub_log\")\n end",
"def log(text=\"\", new_line=true)\n if current_server\n current_server.log(text, new_line)\n else\n text += \"\\n\" if new_line && text[-1] != ?\\n\n print(text)\n end\n end",
"def log(msg, feeds = nil)\n open(\"#{RAILS_ROOT}/log/updatr.log\", \"a\") { |io|\n io.puts \"#{Time.now.strftime(\"%d-%m-%y %H:%M\")} — #{msg}\"\n }\n\nend",
"def tail(opts = {})\n raise \"Already tailing the oplog!\" if @cursor\n\n query = build_tail_query(opts)\n\n mongo_opts = {:timeout => false}.merge(opts[:mongo_opts] || {})\n\n oplog_collection.find(query, mongo_opts) do |oplog|\n oplog.add_option(Mongo::Constants::OP_QUERY_TAILABLE)\n oplog.add_option(Mongo::Constants::OP_QUERY_OPLOG_REPLAY) if query['ts']\n oplog.add_option(Mongo::Constants::OP_QUERY_AWAIT_DATA) unless opts[:dont_wait]\n\n log.debug(\"Starting oplog stream from #{opts[:from] || 'start'}\")\n @cursor = oplog\n end\n end",
"def tail; end",
"def dump_tail stats, log, title\n if title.empty?\n log.minor.ended 'dumping statistics'\n else\n log.liner\n end\n end",
"def event_log(msg)\n time = Time.now.strftime(\"%h %d %H:%M:%S\")\n$stdout.puts \"LOG: #{msg}\"\n# _open_sefile('server.log', 'a') { |f| f.puts \"(#{time}) #{msg}\" } rescue nil\nend",
"def stdout_received(data); end",
"def log\n count = default_log_lines(params)\n lines = get_file_lines(log: true, tail: count)\n respond_with(lines)\n end",
"def act(base, relative)\n if relative == $chat_file\n puts `tail -n 1 #{File.join('.', $chat_file)}`\n end\nend",
"def tail\n wait_for_activity do |tailer|\n tailer.pending_lines.each do |line|\n line.extend LineExtension\n line.instance_variable_set :@tailer, tailer\n yield line\n end\n end\n end",
"def tail_file\n file_watch = FileWatch::Tail.new\n file_watch.tail( \"#{@path}*\" )\n file_watch.subscribe do |_, line|\n process_line( line )\n end\n end",
"def log(text)\n\t\t\ttext = text.to_s\n\n\t\t\t# Parse ANSI escape codes.\n\t\t\ttext.scan(/([^\\e]*)(?:\\e\\[(\\d+.))?/) do |normal_text, code|\n\t\t\t\t@log_window.addstr(normal_text)\n\t\t\t\tcase code\n\t\t\t\t\twhen /3(\\d)m/\n\t\t\t\t\t\t@log_window.attron(Ncurses.COLOR_PAIR($1.to_i))\n\t\t\t\t\twhen /0m/\n\t\t\t\t\t\t@log_window.attron(Ncurses.COLOR_PAIR(7))\n\t\t\t\tend\n\t\t\tend\n\t\t\t@log_window.addstr(\"\\n\")\n\t\t\t@log_window.refresh\n\t\tend",
"def command(cmd); \"#{cmd}#{options.tail ? ' -f' : ''}\" end",
"def reader_thread_proc\n begin\n File::Tail::Logfile.tail(@path, :backward => 10) do |line|\n begin\n parse_logline(line)\n rescue Exception => e\n puts \"Malformed log line [#{line}]: #{e}\"\n end\n end\n rescue Exception => e \n puts \"LogReader is dead: #{e}\"\n end\n end",
"def monitor( timeout: nil )\n if timeout\n begin\n Timeout::timeout( timeout ) { tail_file }\n rescue Timeout::Error\n # Do nothing\n end\n else\n tail_file\n end\n end",
"def logging( log_str )\n begin\n file = open(File.expand_path('../_log_followers',__FILE__),'a')\n file.print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n #STDOUT.sync = true\n #print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n #STDOUT.sync = false\n ensure\n file.close\n end\nend",
"def read_log(search_word, selection_index, filename)\n p tail = `tail -n 24 logs/#{filename}`#.split(\" \")\n return 'EMPTY' if tail.empty?\n return if tail.length < 13\n # word_index = tail.index(search_word) || 0\n # selection = word_index + selection_index\n # tail[selection]\n p line = tail.split(\"\\n\").grep(/#{search_word}/)[0]#.split('.. ')\n p line.to_s.split('.: ')[1]\nend",
"def log(text=\"\", new_line=true)\n current_server ? current_server.log(text, new_line) : super(text, new_line)\n end",
"def re_stdout\n @logdev.re_stdout\n self\n end",
"def logging( log_str )\n begin\n file = open(File.expand_path('../_log_watcher2',__FILE__),'a')\n file.print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = true\n print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = false\n ensure\n file.close\n end\nend",
"def ssh_login(do_tail, ssh_hostname, ssh_username, ssh_password)\n if ssh_hostname == '' or ssh_username == '' or ssh_password == ''\n puts \"Invalid SSH credentials is given\"\n else\n Net::SSH.start(ssh_hostname, ssh_username, :password => ssh_password) do |session|\n puts \"\\n### OVERALL FETCHED TAIL LOG IN SSH CLIENT ###\"\n if session.closed?\n puts 'SSH Email File Processor is not working or FTP files are not uploaded'\n else\n puts \"SSH Login is successfull : #{ssh_username}\"\n do_tail session, \"/home/apps/EMAIL_FILE_PROCESSOR/log/email_file_processor.log\"\n session.loop\n end\n end\n end\nend",
"def tail(log, classes, methods, verbose, separator='|')\n result = String.new\n puts \"Tailing in #{log} I/O for line matching #{classes} classe(s) and #{methods} method(s) with separator '#{separator}'\" if verbose && !classes.nil? && !methods.nil?\n puts \"Tailing in #{log} I/O for line #{methods} method(s) with separator '#{separator}'\" if verbose && classes.nil? && !methods.nil?\n puts \"Tailing in #{log} I/O for line matching #{classes} classe(s) with separator '#{separator}'\" if verbose && !classes.nil? && methods.nil?\n puts \"Tailing in #{log} I/O for all lines\" if verbose && classes.nil? && methods.nil?\n classes =classes.split(',') unless classes.nil?\n methods =methods.split(',') unless methods.nil?\n classes.map!{|c| c.downcase} unless classes.nil?\n methods.map!{|m| m.downcase} unless methods.nil?\n @line_number = 0\n @line_match = 0\n # interrupted = false\n trap(\"INT\") do\n puts \"#{@line_match} lines matched on the #{@line_number} lines in the log\" if verbose \n break\n end\n begin\n File::Tail::Logfile.tail(log) do |line|\n @line_number += 1\n if match(line,classes,methods, separator)\n puts line \n @line_match += 1\n end\n # if interrupted\n # break\n # end\n end\n rescue\n nil\n end\n end",
"def logging( log_str )\n begin\n file = open(File.expand_path('../_log_posts',__FILE__),'a')\n file.print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = true\n print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = false\n ensure\n file.close\n end\nend",
"def re_open opts={}\n @logdev.re_open opts\n self\n end",
"def print_in_same_line(log_string)\n print log_string + \"\\r\"\n end",
"def console_session(app)\n heroku.console(app) do |console|\n console_history_read(app)\n\n display \"Ruby console for #{app}.#{heroku.host}\"\n\n break_this_shit = false\n\n while !break_this_shit\n cmd = gather_some_shit\n unless cmd.nil? || cmd.strip.empty?\n console_history_add(app, cmd)\n break if cmd.downcase.strip == 'exit'\n display console.run(cmd)\n end\n end\n\n end\n\n end",
"def save_tty\n %x{stty -g}.chomp\n rescue\n nil\n end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def autoflush_log=(_arg0); end",
"def autoflush_log=(_arg0); end",
"def dump_tail stats, out, title\n end",
"def log(msg)\n lines = msg.split(/\\n/)\n\n STDERR.puts \"** #{lines.first}\"\n lines[1..-1].each do |line|\n STDERR.puts\" #{line}\"\n end\n end",
"def log msg\n history = File.open(@current, \"a\")\n history.puts msg\n history.close\n end",
"def build_chat_log\n return \"\" unless @scrollback\n out = \"\"\n displayed_buffer = @buffer.length > 30 ? @buffer[@buffer.length-30..-1] : @buffer\n displayed_buffer.each do |msg|\n out += \"#{msg[0]}: #{msg[1]}\\n\"\n end\n return out\n end",
"def stdout(event) ; $stdout.puts event ; $stdout.flush ; end",
"def autoflush_log; end",
"def autoflush_log; end",
"def log(message)\n STDOUT.puts message\nend",
"def logthis(input)\n\t\[email protected]\n\t\tfile = File.open('./serverlog','a')\n\t\twrite = \"#{Time.now}\\t#{input}\\n\"\n\t\tfile.write(write)\n\t\tputs write\n\t\[email protected]\n\tend",
"def display_new_retweets\n\t@curr_top = @top_after_new_stream\n\tclear_screen\n\tputs \"\"\n\tputs \"*\"*50\n\tputs \"TOP RETWEETS IN LAST #{@user_defined_window} MINUTE(S)\"\n\tputs \"*\"*50\n\tputs \"\"\n\t@curr_top.each do |retweet|\n\t\ttext = @tweet_db[retweet[0]][:original].text.gsub(/\\n/,\" \")\n\t\tcount = retweet[1]\n\t\tputs \"Retweet Count: #{count} Text: #{text}\"\n\tend\nend",
"def readline_with_hist_management(prompt = \"> \")\n line = Readline.readline(prompt, true)\n return \"\" if line.nil?\n if line =~ /^\\s*$/ or Readline::HISTORY.to_a[-2] == line\n Readline::HISTORY.pop\n end\n line\nend",
"def log(text)\n puts text\n `echo \"#{text}\" >> #{$logfile}`\nend",
"def log(msg)\n if $settings[:log]\n $settings[:log].write(Time.now.inspect + \" \" + msg + \"\\n\")\n $settings[:log].flush\n end\nend",
"def read_log(search_word, selection_index, filename)\n tail = `tail -n 24 logs/#{filename}`\n return 'EMPTY' if tail.empty?\n return if tail.length < 13\n line = tail.split(\"\\n\").grep(/#{search_word}/)[0]\n line.to_s.split('.: ')[1]\nend",
"def log\n last_line = logfile.lines.to_a.last || \"\"\n last_entry = last_line.split(/\\s/)\n new_entry = \"#{date}\\t#{count}\\n\"\n if last_entry.first != date\n logfile.write new_entry\n logfile.flush\n end\n puts new_entry\n end",
"def write_history; end",
"def history_to_vi\n handling_jruby_bug do\n file = Tempfile.new(\"irb_tempfile\")\n get_lines(0..(Readline::HISTORY.size - 1)).each do |line|\n file << \"#{line}\\n\"\n end\n file.close\n system(\"vim #{file.path}\")\n end\nend",
"def log_to_console\n location = @location[1..-1] # remove file_descriptor\n details = @details.first(2) # remove additional details\n [\n ' ',\n location.join(', ').ljust(33),\n details.join(': ')\n ].join\n end",
"def log_to_stdout\n log_to STDOUT\n end",
"def stdouts; end",
"def print_message(message)\n puts message+\"\\n\"\n system('logger '+message+\"\\n\") \nend",
"def eol_preview # :nologin: :norobots:\n @timer_start = Time.now\n eol_data(['unvetted', 'vetted'])\n @timer_end = Time.now\n end",
"def log(str)\n begin\n str.split(\"\\n\").each do |str|\n puts \"#{Time.now.strftime(TIME_STRING)} pid:#{Process.pid}> #{str}\"\n end\n $stdout.flush\n rescue Exception => e\n # do nothing -- just catches unimportant errors when we kill the process\n # and it's in the middle of logging or flushing.\n end\nend",
"def log(str)\n begin\n str.split(\"\\n\").each do |str|\n puts \"#{Time.now.strftime(TIME_STRING)} pid:#{Process.pid}> #{str}\"\n end\n $stdout.flush\n rescue Exception => e\n # do nothing -- just catches unimportant errors when we kill the process\n # and it's in the middle of logging or flushing.\n end\nend",
"def setup_stdio_redirect\n $stdin.close\n $stdout.reopen(@context.logfile, 'w+') \n $stderr.reopen(@context.logfile, 'w+') \n end",
"def history_log (event, options={})\n fname= \"#{self.class.name}.#{__method__}\"\n source = options.delete(:source) || @current_user.login\n #LOG.debug (fname){\"history_log:source=#{source}\"}\n \t#LOG.debug (fname){\"history_log:options=#{options}\"}\n Ruote::Sylrplm::HistoryEntry.log!(source, event, options)\n end",
"def readline prompt='>'\n clear_last_line\n print \"\\r\"\n # do we need to clear till end of line, see ask_regex commented\n # unhide cursor\n print \"\\e[?25h\"\n system 'stty echo'\n begin\n if prompt.length > 40\n puts prompt\n prompt = '>'\n end\n target = Readline.readline(prompt, true)\n rescue Interrupt\n return nil\n ensure\n # hide cursor\n # NO LONGER HIDING cursor 2019-03-29 -\n # print \"\\e[?25l\"\n system 'stty -echo'\n end\n target.chomp\nend",
"def console; end",
"def console; end",
"def smb_pipe_audit\n\t\tprint_status(\"SMB Session Pipe Auditor\")\n\t\tprint_caution(\"Target IP: \")\n\t\tzIP=gets.chomp\n\n\t\tprint_status(\"Launching MSF SMB Session Pipe Auditor against #{zIP} in a new x-window.....\")\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 auxiliary/scanner/smb/pipe_auditor'\n\t\tf.puts \"set RHOSTS #{zIP}\"\n\t\tf.puts 'run'\n\t\tf.close\n\t\tpipe_audit=\"xterm -title 'MSF SMB Pipe Auditor' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(pipe_audit)\n\t\tprint_line(\"\")\n\tend",
"def start_log(log)\n File.open(log, 'w')\nend",
"def last_stdout\n strip_duration(@last_stdout)\n end",
"def tty?; _tty?; end",
"def terminal?; !!terminal_flag end",
"def terminal?; !!terminal_flag end",
"def output_log(log)\n puts \"\\e[32m#{log}\\e[m\\s\"\nend",
"def to_s\n \"tail #{@follow ? '-F' : ''} -n #{@last || 0} \" +\n (@quiet ? '-q ' : '') +\n @glob_patterns.join(' ') +\n (@discard_stderr ? ' 2>/dev/null' : '')\n end",
"def history_log (event, options={})\n\n source = options.delete(:source) || current_user.login\n\n OpenWFE::Extras::HistoryEntry.log!(source, event, options)\n end",
"def log_from_remote(buf)\n\t\trlog(buf, log_source)\n\tend",
"def log_from_remote(buf)\n\t\trlog(buf, log_source)\n\tend",
"def info(msg)\n $tftplog.info('tftp+') { msg }\nend",
"def cmd_history argv\n setup argv\n msg run_cmd(\"history\")\n end",
"def tail\n @tail\n end",
"def run_and_watch_prompt(cmd, regex_to_watch)\n run cmd, :pty => true do |ch, stream, data|\n watch_prompt(ch, stream, data, regex_to_watch)\n end\nend",
"def read_from_console\n puts 'Enter new tweet (not more than 140 signs)'\n @text = STDIN.gets.chomp[0..140]\n puts \"Sending your new tweet: #{@text.encode('UTF-8')}\"\n @@CLIENT.update(@text.encode('UTF-8'))\n puts 'Your tween has been sent'\n end",
"def desc\n \"Interactive TTY\"\n end",
"def handle_input(message)\n user = extract_user message\n id = message[:data][:id]\n request = message[:data][:args]\n if (term = TTY[user, id])\n term.write << request.join\n else\n message[:error] = 'Terminal does not exist.'\n end\n end",
"def foreground\n server.remote_expr(\"foreground()\")\n end",
"def get_lines_from_log(position = :last, count = 2)\n f = File.open(options.log)\n lines = f.readlines\n lines = lines.last(count) if position == :last\n lines = lines.first(count) if position == :first\n f.close\n\n lines.join(' ')\n end",
"def unix_tail_command_brute(filename, lines)\n lines_total, output = 0, \"\"\n\n file = File.open(filename,'r')\n file.each_line do |l|\n lines_total += 1\n end\n file.close\n\n start_line = lines_total - lines\n\n line_number = 0\n file = File.open(filename,'r')\n file.each_line do |l|\n\n if line_number >= start_line\n output << \"#{l}\"\n end\n line_number += 1\n end\n file.close\n\n output\nend",
"def reopen_tty\n # If the hook isn't interactive, we need to map STDIN to keyboard manually\n STDIN.reopen('/dev/tty') if STDIN.eof?\n rescue # rubocop:disable HandleExceptions\n # Happens in tests run with no console available\n end",
"def log_message(event, dict)\r\n if nil==dict then return end\r\n message = event.content.strip\r\n\r\n dict.parse_source(message, false)\r\n\r\n # Open and add the dictionary to the list of open dictionaries if not yet open.\r\n if !@openDicts[dict.filename] then\r\n if File.exists?('./dict/' + dict.filename + \".txt\")\r\n @openDicts[dict.filename] = File.open('./dict/' + dict.filename + \".txt\", \"a\")\r\n else\r\n raise FileNotFoundError.new(\"./dict/#{dict.filename}.txt does not exist!\")\r\n end\r\n end\r\n\r\n # Log chat to that open dictionary txt as normal.\r\n file = @openDicts[dict.filename]\r\n\r\n authorName = event.author.name\r\n if authorName == @lastSpeaker\r\n file.print( \" \" + message.gsub(\"\\r\\n\",\"\") + \" \")\r\n elsif dict.is_punctuated?(@lastMessage) or @lastMessage == \"\"\r\n file.print(\"\\r\\n\" + message )\r\n else\r\n file.print(\".\\r\\n\" + message )\r\n end\r\n file.flush\r\n @lastSpeaker = authorName\r\n @lastMessage = message\r\n end"
] | [
"0.71181077",
"0.64701957",
"0.6277213",
"0.6242394",
"0.62088513",
"0.59615064",
"0.5923595",
"0.58777505",
"0.5807328",
"0.57833517",
"0.578311",
"0.57165396",
"0.56639725",
"0.56601095",
"0.5655332",
"0.5630369",
"0.560447",
"0.559708",
"0.5585493",
"0.55460757",
"0.5528942",
"0.5526735",
"0.5517201",
"0.54932135",
"0.5489512",
"0.54856956",
"0.5472092",
"0.5450232",
"0.5406075",
"0.5394219",
"0.53898746",
"0.5388108",
"0.5387114",
"0.5380891",
"0.5376366",
"0.5345855",
"0.5341119",
"0.53149396",
"0.53132486",
"0.52940047",
"0.52802414",
"0.5245727",
"0.5245727",
"0.5245727",
"0.5245727",
"0.5245727",
"0.5245727",
"0.52396625",
"0.52396625",
"0.5217752",
"0.5214316",
"0.5213177",
"0.52044314",
"0.5199989",
"0.51865554",
"0.51865554",
"0.5176479",
"0.51704913",
"0.5165206",
"0.5149763",
"0.51410323",
"0.51328045",
"0.5117779",
"0.5110942",
"0.5096707",
"0.5095479",
"0.5088493",
"0.50823694",
"0.5059822",
"0.5053918",
"0.50529635",
"0.5050504",
"0.50504845",
"0.50490785",
"0.50479734",
"0.5042153",
"0.50307024",
"0.50307024",
"0.50163174",
"0.5015599",
"0.501197",
"0.5001825",
"0.5000104",
"0.5000104",
"0.49951166",
"0.49944994",
"0.4989379",
"0.4983501",
"0.4983501",
"0.49746573",
"0.49737984",
"0.49692002",
"0.49650395",
"0.49624568",
"0.4961966",
"0.49533844",
"0.49394348",
"0.49388337",
"0.49374285",
"0.49361244",
"0.49319"
] | 0.0 | -1 |
GET /categories GET /categories.json | def index
@parent_categories = ParentCategory.all.order(:display_order)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end",
"def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend",
"def categories\n get('venues/categories').categories\n end",
"def index\n categories = Category.all\n render json:categories\n end",
"def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend",
"def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end",
"def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end",
"def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end",
"def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend",
"def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def get_categories\n @categories = Category.all\n end",
"def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end",
"def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end",
"def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend",
"def categories\n parsed_json['data']\n end",
"def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end",
"def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end",
"def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end",
"def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end",
"def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end",
"def getCategories(_, _, _)\n @db.categories\n end",
"def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end",
"def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end",
"def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end",
"def show\n render json: category\n end",
"def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end",
"def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def index\n respond_with Category.all\n end",
"def index\n @categories = Category.all\n render :json => @categories, :except => [:created_at, :updated_at]\n end",
"def index\n @categories = CategoryService.index\n end",
"def show\n render json: @category\n end",
"def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CategoriesApi.get_categories ...'\n end\n # resource path\n local_var_path = '/categories'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Category>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def categories(make, year)\n make_id = get_object_id make\n response = get_url \"Categories/#{make_id}/#{year}\"\n response_obj = JSON.parse response\n response_obj[\"GetCategoriesResult\"].map{|r| Models::Category.from_response_hash(r)}\n end",
"def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end",
"def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end",
"def categories\n add_to_query restrict_kind: 'category'\n end",
"def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end",
"def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end",
"def index\n @categories = Category.all\n respond_with(@categories)\n end",
"def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end",
"def index\n @categories = Category.roots\n end",
"def get_categories(opts = {})\n data, _status_code, _headers = get_categories_with_http_info(opts)\n data\n end",
"def index\n @categories = Category.all\n end",
"def index\n\t\t@categories = Category.all\n\tend",
"def index\n @categories=Category.root\n respond_with @categories\n end",
"def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend",
"def category\n client.categories.find(data[\"categoryId\"])\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def get_categories(opts = {})\n data, _status_code, _headers = get_categories_with_http_info(opts)\n return data\n end",
"def categories\n category\n end",
"def categories\n []\n end",
"def index\n\t@categories = Category.all\n\tend",
"def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @category = category\n @posts = get_posts category.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end",
"def index\n render json: Category.order('name ASC').all\n end",
"def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end",
"def show\n render json: @categoria\n end",
"def index\n categories = Category.all\n\n if params[:limit]\n categories = categories.limit(params[:limit])\n end\n\n render json: CategorySerializer.new(categories).serializable_hash\n end",
"def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end",
"def index\n @categories = Category.all\n end",
"def get_categories(project_id_or_key)\n get(\"projects/#{project_id_or_key}/categories\")\n end",
"def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend",
"def index\n @categories = Category.paginate(:page => params[:page])\n @title = \"Категории\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend",
"def categories\n raw_categories.to_hashugar\n end",
"def event_categories(options = {})\n response = connection.get do |req|\n req.url \"events/categories\", options\n end\n return_error_or_body(response, response.body.response.categories)\n end",
"def index\n @service_categories = ServiceCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_categories }\n end\n end",
"def categories_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.categories_list ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Category>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#categories_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end",
"def all\n render json: Cat.all\n end",
"def index\n @categories = Category.all\n \n respond_with do |format|\n format.html { render :index, :layout => false}\n end\n end"
] | [
"0.83888507",
"0.8327856",
"0.83211476",
"0.78072983",
"0.7742051",
"0.75669324",
"0.75111455",
"0.74151826",
"0.7386452",
"0.7369945",
"0.7369187",
"0.73691803",
"0.73691803",
"0.73457074",
"0.73304063",
"0.7316772",
"0.72851175",
"0.72663945",
"0.72275496",
"0.7220998",
"0.721489",
"0.7214744",
"0.7191486",
"0.7170767",
"0.71196395",
"0.7099406",
"0.70744735",
"0.7046364",
"0.70421106",
"0.7034058",
"0.7032228",
"0.7031601",
"0.70285517",
"0.701469",
"0.6996653",
"0.69954544",
"0.6993141",
"0.6981535",
"0.6970529",
"0.6965789",
"0.69562495",
"0.68973124",
"0.6896462",
"0.6888122",
"0.6884991",
"0.68843496",
"0.68729085",
"0.68694204",
"0.684738",
"0.68159676",
"0.6808432",
"0.68015593",
"0.6799326",
"0.6773361",
"0.6770789",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67645466",
"0.67614204",
"0.67590016",
"0.67560863",
"0.6751845",
"0.6734348",
"0.6726548",
"0.67246544",
"0.6723478",
"0.67053044",
"0.67034256",
"0.66973054",
"0.6697162",
"0.6685197",
"0.66803694",
"0.66784716",
"0.66742986",
"0.6672338",
"0.6635933",
"0.6635794",
"0.6623354",
"0.6619753",
"0.6616208"
] | 0.0 | -1 |
GET /categories/1 GET /categories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend",
"def index\n categories = Category.all\n render json:categories\n end",
"def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def show\n render json: category\n end",
"def show\n render json: @category\n end",
"def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend",
"def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end",
"def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend",
"def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end",
"def getCategories(_, _, _)\n @db.categories\n end",
"def category\n client.categories.find(data[\"categoryId\"])\n end",
"def categories\n get('venues/categories').categories\n end",
"def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def get_categories\n @categories = Category.all\n end",
"def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end",
"def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end",
"def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end",
"def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @category = category\n @posts = get_posts category.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end",
"def index\n @categories = CategoryService.index\n end",
"def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end",
"def category(id = nil)\n res = Connection.get('categories', id)\n id.nil? ? Category.all(res) : Category.new(res)\n end",
"def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end",
"def index\n @categories = Category.all\n render :json => @categories, :except => [:created_at, :updated_at]\n end",
"def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend",
"def index\n respond_with Category.all\n end",
"def show\n render json: @categoria\n end",
"def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def index\n @categories = Category.roots\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def index\n\t\t@categories = Category.all\n\tend",
"def index\n\t@categories = Category.all\n\tend",
"def index\n @categories = Category.all\n end",
"def index\n @categories = Category.all\n end",
"def index\n render json: Category.order('name ASC').all\n end",
"def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end",
"def index\n @categories = Category.all\n respond_with(@categories)\n end",
"def category\n Category.find(params[:id])\n end",
"def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end",
"def index\n @categories=Category.root\n respond_with @categories\n end",
"def show\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def index\n @categories = Category.paginate(:page => params[:page])\n @title = \"Категории\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end",
"def show\n\t @category = Category.find(params[:id])\n\n\t respond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render json: @category }\n\t end\n\tend",
"def index\n categories = Category.all\n\n if params[:limit]\n categories = categories.limit(params[:limit])\n end\n\n render json: CategorySerializer.new(categories).serializable_hash\n end",
"def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend",
"def index\n #expires_in 24.hours\n #fresh_when last_modified: @max, public: true\n @roots = @categories.roots\n @keyword = String.new\n\n @roots.each do |r|\n @keyword << r.name << \" \"\n end\n\n if params[:id]\n if c = Category.find(params[:id])\n redirect_to c\n return\n else\n flash.now[:error] = \"Category not found.\"\n end\n end\n\n respond_to do |format|\n format.html\n format.json {render json:@categories}\n end\n\n end",
"def categories\n parsed_json['data']\n end",
"def index\n @categories = Category.order(\"name ASC\")\n @latest_reviews = Review.limit(3).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end",
"def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end",
"def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end",
"def show\n @post_category = Post::Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post_category }\n end\n end",
"def index\n @categories = Category.paginate(:page => params[:page], per_page:30)\n @number = Category.count\n\n respond_to do |format|\n format.html\n format.json { render json: Category.all }\n end\n end",
"def index\n @categorias = Categoria.where(ativo: true)\n \t\n render json: @categorias\n end",
"def index\n @categories = Category.all\n \n respond_with do |format|\n format.html { render :index, :layout => false}\n end\n end",
"def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end",
"def index\n @cover_cats = CoverCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cover_cats }\n end\n end",
"def show\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cat }\n end\n end",
"def show\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_category }\n end\n end",
"def index\n @categories = collections_config.values\n end",
"def index\n @taxonomy_categories = TaxonomyCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomy_categories }\n end\n end",
"def fetch_categories(count = ENV['DEFAULT_CATEGORY_COUNT'].to_i)\n max_category = 18418\n uri = \"http://jservice.io/api/categories?count=#{count}&offset=#{1+rand(max_category/count.to_f)}\"\n request = HTTParty.get(uri)\n data = JSON.parse(request.body)\nend"
] | [
"0.7877821",
"0.7864903",
"0.7848852",
"0.78426903",
"0.7415118",
"0.7408382",
"0.73079324",
"0.7307346",
"0.7307346",
"0.7282616",
"0.7236084",
"0.71876353",
"0.7159534",
"0.71334624",
"0.71235555",
"0.7066964",
"0.7043923",
"0.7037928",
"0.7035486",
"0.7032399",
"0.70130795",
"0.7011501",
"0.6999737",
"0.6995428",
"0.69901127",
"0.69808453",
"0.6958082",
"0.6949705",
"0.69345176",
"0.68729126",
"0.68571603",
"0.6855408",
"0.68532354",
"0.68456805",
"0.6837562",
"0.6837562",
"0.6837562",
"0.6837562",
"0.6837562",
"0.6837562",
"0.6837562",
"0.68205774",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6820024",
"0.6811055",
"0.6796261",
"0.67708766",
"0.67529017",
"0.673149",
"0.6729354",
"0.67244697",
"0.67212254",
"0.67203426",
"0.67180324",
"0.671377",
"0.6709784",
"0.6708516",
"0.67066544",
"0.6699789",
"0.66993815",
"0.66958666",
"0.6654391",
"0.6653048",
"0.6640999",
"0.6638361",
"0.6636572",
"0.66140556",
"0.66113824",
"0.66094553",
"0.65910876",
"0.65868837",
"0.65751946",
"0.6572947",
"0.65727776",
"0.6571422",
"0.65707415",
"0.65671164",
"0.65613294",
"0.65572697"
] | 0.0 | -1 |
POST /categories POST /categories.json | def create
@category = Category.new(category_params)
respond_to do |format|
if @category.save
format.html { redirect_to admin_category_path(@category), notice: 'Category was successfully created.' }
format.json { render action: 'show', status: :created, location: @category }
else
format.html { render action: 'new' }
format.json { render json: @category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n json_create(category_params, Category)\n end",
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"def create\n category = @current_user.categories.create!(category_params)\n render json: { category: category }\n end",
"def create\n if @category.save\n render json: @category, status: :created, location: @category\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"def create\n @category = Category.new(category_params)\n @category.save\n render json: { params: params, notice: 'Categoria registrada exitosamente' }\n end",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end",
"def create\n @category = current_user.categories.new(name: params[:name])\n if @category.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @category.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def create\n @category = Category.new(category_params)\n authorize! :create, @category\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"def create\n @category = current_mall.categories.new(params[:category])\n\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"def post_category(category_name, options={ })\n self.post('/categories.json',\n options.merge(\n :body => { :category => {\n :name => category_name\n } }.to_json\n )\n )['category']\n end",
"def create\n category = Category.create(category_params)\n\n \n if category\n render json:{\n status: :created,\n category: category}\n else\n render json: { status: 500 }\n end\n end",
"def user_category\n # byebug\n @user = User.where(contact: params[:contact]).first\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-data\", data: \"category saved\"}, status: :ok\n end",
"def addCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.new(name: params[:name])\n status = c.save\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end",
"def create\n @category = Category.create(params[:category])\n respond_with(@category, location: categories_url)\n end",
"def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend",
"def create\n category = Category.create!(category_params)\n render json: {\n :html => render_to_string(\n :partial => \"setups/category\",\n :layout => false,\n :locals => {:category => category})\n }\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html {\n redirect_to @category, notice: 'Category was successfully created.'\n }\n format.json {\n render json: @category, status: :created, location: @category\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n @category = Category.new(params[:category]) \n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:created_category_success)}\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :created }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categories_post = CategoriesPost.new(categories_post_params)\n\n respond_to do |format|\n if @categories_post.save\n format.html { redirect_to @categories_post, notice: 'Categories post was successfully created.' }\n format.json { render :show, status: :created, location: @categories_post }\n else\n format.html { render :new }\n format.json { render json: @categories_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n category = params[:category]\n category_name = category['name']\n \n write_log(\"category.to_s: #{category.to_s}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n cats = []\n if category_name != nil\n cats = category_name.split(\" \")\n end\n \n write_log(\"cats.size: #{cats.size}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n if cats.size > 1\n \n flag = true\n counter = 0\n \n cats.each do |cat|\n # @category = Category.new(params[:category])\n # @category = Category.new(name=cat)\n @category = Category.new({\"name\"=> cat, \"genre_id\"=> category['genre_id']})\n \n if @category.save\n else\n counter += 1\n end\n end#cats.each do |cat|\n \n respond_to do |format|\n format.html { redirect_to @category, \n notice: \"New categories: Created => #{cats.size - counter}, Failed => #{counter}\" }\n format.json { render json: @category, status: :created, location: @category }\n end\n \n else#if cats.size > 1\n @category = Category.new(params[:category])\n \n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end#if cats.size > 1\n \n \n # @category = Category.new(params[:category])\n# \n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @category = @collection.categories.new(category_params)\n\n if @category.save\n ActionCable.server.broadcast 'categories',\n title: @category.title,\n collection_id: @category.collection_id\n head :ok\n else\n\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created!!' }\n format.json { render json: @category, status: :created, location: @category }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categ = Categ.new(categ_params)\n\n respond_to do |format|\n if @categ.save\n format.html { redirect_to @categ, notice: 'Categ was successfully created.' }\n format.json { render :show, status: :created, location: @categ }\n else\n format.html { render :new }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_category = Post::Category.new(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to @post_category, notice: 'Category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully created.' }\n format.json { render json: @categoria, status: :created, location: @categoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to Category.find(@category.category_id), notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = CategoryService.create\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Категория добавлена.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # @category = Category.new(params[:category])\n @category = current_user.categories.build(params[:category])\n\n respond_to do |format|\n if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie utworzono kategorię.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n # format.html { render action: \"new\" }\n format.html { redirect_to categories_path, :flash => { :error => 'Nie udało się utworzyć kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_category\n @category = TestCategory.new(params[:category])\n @category.save\n @categories = TestCategory.find(:all)\n redraw 'categories'\n end",
"def index\n categories = Category.all\n render json:categories\n end",
"def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end",
"def create\n @categories = Category.all\n\n @category = Category.create(category_params)\n flash[:notice]=\"Catégorie créer avec succès!!!\"\n end",
"def create\n @categories = Category.where(validity: true)\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:category_created) }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categor = Categor.new(categor_params)\n\n respond_to do |format|\n if @categor.save\n format.html { redirect_to @categor, notice: 'Categor was successfully created.' }\n format.json { render :show, status: :created, location: @categor }\n else\n format.html { render :new }\n format.json { render json: @categor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end",
"def create\r\n @category = Category.new(categories_params)\r\n\r\n respond_to do |format|\r\n if @category.save\r\n format.html { redirect_to articles_path, notice: 'Profile was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @category.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n\t\t@cat = Cat.new(cat_params)\n\n\t\tif @cat.save\n\t\t\t# cat_url(@cat) == /cat/{@cat.id}\n\t\t\tredirect_to cat_url(@cat)\n\t\telse\n\t\t\trender :new\n\t\t\t# render json: @cat.errors.full_messages, status: :unprocessable_entity\n\t\tend \n\tend",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @categorization = Categorization.new(params[:categorization])\n @categories = category_list\n respond_to do |format|\n if @categorization.save\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully created.') }\n format.xml { render :xml => @categorization, :status => :created, :location => @categorization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Категория была успешно создана'}\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to root_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n flash.alert = @category.errors.full_messages\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.create(params[:category])\n \n if @category.save\n redirect_to categories_path\n else\n render 'new'\n end\n \n end",
"def create\n @category = PostCategory.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to cm_post_categories_url, notice: 'PostCategory was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end",
"def create\n admins_only do\n @category = Category.new(category_params)\n @category.name = params[:category][:name].to_s.camelcase\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to category_index_path, notice: 'Category was successfully created.' }\n format.json { render action: 'index', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n if params[:categoria_producto]\n p = Producto.find(params[:producto_id])\n c = Categoria.find(params[:categoria_id])\n\n if p.categorias << c\n render json: c, status: :created\n else\n render json: {:errors => {categoria: [\"No se ha podido agregar categoria\"]}}, status: :unprocessable_entity\n end\n\n else\n @categoria = Categoria.new(parametros_categoria)\n\n if @categoria.save\n render json: @categoria, status: :created\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end\n end",
"def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend",
"def create\n @cat = Cat.new(params[:cat])\n\n respond_to do |format|\n if @cat.save\n format.html { redirect_to @cat, notice: 'Cat was successfully created.' }\n format.json { render json: @cat, status: :created, location: @cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно создана\" }\n format.json { render :show, status: :created, location: adminpanel_categories_path }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to edit_dashboard_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n\n user = User.find(@user_id)\n post = user.posts.build(params_post)\n \n category = Category.find_by_id(params[:category])\n return render json: { error: \"Category not found\"}, status: 404 if category.nil?\n \n post.category = category\n \n \n if post.save\n render json: post, status: :created\n else \n render json: post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @category = Category.new(category_params)\n @category.user_id = current_user.id\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t('create.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @category = Category.new(params[:category])\n @user.categories << @category\n #TODO: error handling\n #TODO: AJAX this\n if @user.save\n redirect_to user_path(@user)\n else\n render \"new\"\n end\n end",
"def create\n @post_category = current_user.post_categories.build(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to [:client,:post_categories], notice: 'Post category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"index\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe_category = RecipeCategory.new(params[:recipe_category])\n\n respond_to do |format|\n if @recipe_category.save\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully created.' }\n format.json { render json: @recipe_category, status: :created, location: @recipe_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_url, notice: 'Category was successfully created.' }\n end\n end\n end",
"def create\n @category_form_url = forum_categories_path\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend",
"def create\n @category = Category.new(params[:category])\n @category.category_group_id ||= params[:category_group_id]\n\n respond_to do |format|\n if @category.save\n save_curated_items(@category)\n format.html { redirect_to(categories_path, notice: 'Category was successfully created.') }\n format.json { render json: @category, status: :created, location: @category }\n else\n set_flash_messages_from_errors(@category)\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taxonomy_category = TaxonomyCategory.new(params[:taxonomy_category])\n\n respond_to do |format|\n if @taxonomy_category.save\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully created.' }\n format.json { render json: @taxonomy_category, status: :created, location: @taxonomy_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(params[:category])\n\n if @category.save\n flash[:notice] = 'Categoria criada com sucesso.'\n else\n flash[:notice] = 'Erro ao salvar a categoria.'\n end\n\n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to categories_path}\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @category = Category.new(category_params)\n\n\n begin\n Category.transaction do # un ActiveRecord\n #@full_category.each do |f|\n #Category.create(f)\n #f.save!\n #end\n @category.save!\n end\n #Código de éxito\n rescue => e\n raise ActiveRecord::Rollback #Lanzamos el rollback de nuevo a saco\n #Seguimos con las acciones que queramos, como notificar, etc.\n end\n\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n category = Documents::Category.create(category_params)\n if category.save\n redirect_to categories_path\n else\n redirect_to categories_path, alert: I18n.t('admin.categories.validation_error')\n end\n end",
"def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end",
"def create_category_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.create_category ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'category'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#create_category\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @category = Category.new(params[:category])\n @title = \"Neue Kategorie erstellen\"\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = CategoryService.create(category_params)\n\n respond_to do |format|\n unless @category.errors.any?\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Created!', \"Category [#{@category.description}] was successfully created.\") \n }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mk_categoria = MkCategoria.new(mk_categoria_params)\n\n respond_to do |format|\n if @mk_categoria.save\n format.html { redirect_to @mk_categoria, notice: 'Mk categoria was successfully created.' }\n format.json { render :show, status: :created, location: @mk_categoria }\n else\n format.html { render :new }\n format.json { render json: @mk_categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to [:admin, @category], notice: t('messages.created', model:Category.model_name.human) }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_category = Admin::Category.new(admin_category_params)\n\n respond_to do |format|\n if @admin_category.save\n format.html { redirect_to admin_categories_url }\n format.json { render :show, status: :created, location: @admin_category }\n else\n format.html { render :new }\n format.json { render json: @admin_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def categories=(value)\n @categories = value\n end",
"def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end"
] | [
"0.7738549",
"0.74339235",
"0.72349083",
"0.71634054",
"0.7124031",
"0.70645165",
"0.705568",
"0.695861",
"0.6956783",
"0.6903891",
"0.6838659",
"0.6821712",
"0.68190134",
"0.6807838",
"0.678525",
"0.66138625",
"0.6566919",
"0.65661913",
"0.65567696",
"0.6523676",
"0.65186286",
"0.65124106",
"0.6507293",
"0.64973867",
"0.64973867",
"0.64973867",
"0.64973867",
"0.64973867",
"0.6491015",
"0.64895564",
"0.6476546",
"0.64730144",
"0.6470093",
"0.6455681",
"0.6438828",
"0.6436862",
"0.64220095",
"0.6418686",
"0.6418686",
"0.6418686",
"0.6418686",
"0.6418686",
"0.6418686",
"0.6418686",
"0.6418686",
"0.6418686",
"0.6418686",
"0.6418686",
"0.63991785",
"0.63877624",
"0.6384297",
"0.6379078",
"0.63786995",
"0.6376995",
"0.63656723",
"0.63593614",
"0.6358317",
"0.6356693",
"0.6355196",
"0.6354375",
"0.6352758",
"0.6345056",
"0.63400453",
"0.63052505",
"0.63035464",
"0.62976784",
"0.6287918",
"0.6284682",
"0.6269106",
"0.62629235",
"0.626244",
"0.6258697",
"0.6254516",
"0.62478405",
"0.62459856",
"0.62374765",
"0.62301993",
"0.62244",
"0.6219008",
"0.6210804",
"0.6199586",
"0.61989397",
"0.6196965",
"0.6195727",
"0.61901325",
"0.6185757",
"0.61840874",
"0.6181882",
"0.61759615",
"0.61596483",
"0.6154083",
"0.6150745",
"0.6144707",
"0.6140831",
"0.6128935",
"0.6128884",
"0.61209923",
"0.6117174",
"0.6109629",
"0.610358"
] | 0.6220316 | 78 |
PATCH/PUT /categories/1 PATCH/PUT /categories/1.json | def update
respond_to do |format|
if @category.update category_params
format.html { redirect_to admin_categories_url, notice: 'Category was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @category.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n json_update(category,category_params, Category)\n end",
"def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @category.update(category_params)\n render json: @category, status: :ok\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"def update\n @headline = t(:update_category)\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:updated_category_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @category.update(params[:category])\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.json { render :show, status: :ok, location: @category }\n else\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update! {admin_categories_path}\n end",
"def update\n unless @category.name == \"ROOT\"\n if @category.update(category_params)\n render 'show', :status => 200, :layout => false, notice: 'Category was successfully created.'\n else\n render :json => {:message => \"Error in updating category\"}, notice: @category.errors, :layout => false, :status => 400\n end\n else\n render :json => {:message => \"Root can't be edited.\"}, :layout => false, :status => 400\n end\n end",
"def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end",
"def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category, location: categories_url)\n end",
"def update\n @recipe = Recipe.find(params[:id])\n\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n @categories=RecipeCategory.all\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category.update_attributes(params[:category])\n respond_with(@category)\n end",
"def editCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.update(name: params[:name])\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end",
"def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end",
"def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end",
"def update\n #locates the category to be updated\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:category_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: t('update.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to :back, notice: 'category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html {\n redirect_to @category, notice: 'Category was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n # recipe_params[:ingredient_lists_attributes].each do |list|\n # list.each do |item|\n # item[:ingredient_attributes] = Ingredient.where(name: item[:ingredient_attributes].name).first_or_create\n # end\n # end\n \n # category_ids = params[:recipe][:categories_attributes].map { |k,v| v[:id] }\n # #pry.debugger\n \n # recipe_params.merge({ category_ids: category_ids })\n \n\n respond_to do |format|\n \n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_category_edit\n @user = User.where(contact: params[:contact]).first\n @user.categories.destroy_all\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-categories\", data: \"categories updated\"}, status: :ok\n end",
"def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n format.html { redirect_to @cat, notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n _update_topics \n format.html { redirect_to action: \"edit\", notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post_category = Post::Category.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to @post_category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n category= Category.find(params[:id])\n category.update(category_params)\n \n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to cm_post_categories_url, notice: 'PostCategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Sucesso - update'\n else\n flash[:notice] = 'Falha ao atualizar a categoria'\n end\n\n # respond_to do |format|\n # if @category.update_attributes(params[:category])\n # format.html { redirect_to categories_path}\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n \n # end\n # end\n end",
"def update\n authorize! :update, @category\n \n @category.modifier = current_user\n \n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_url + '#' + @category.slug, notice: t('.success') }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: \"Category was successfully updated.\" }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category.update(category_params)\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Категория изменена.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def putCategory( category_id, language, name)\n params = Hash.new\n params['category_id'] = category_id\n params['language'] = language\n params['name'] = name\n return doCurl(\"put\",\"/category\",params)\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to [:admin, @category], notice: t('messages.updated', model:Category.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backend_shop_branch_category_path(@current_shop.slug, @current_branch, @category), notice: t('Category was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to category_index_path, notice: 'Categorie was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n # format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie zaktualizowano kategorię.' }\n format.json { head :no_content }\n else\n # format.html { render action: \"edit\" }\n format.html { redirect_to units_path, :flash => { :error => 'Nie udało się zaktualizować kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @catalog_category.update(catalog_category_params)\n format.html { redirect_to catalog_categories_url }\n format.json { render :show, status: :ok, location: @catalog_category }\n else\n format.html { render :edit }\n format.json { render json: @catalog_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @categ.update(categ_params)\n format.html { redirect_to @categ, notice: 'Categ was successfully updated.' }\n format.json { render :show, status: :ok, location: @categ }\n else\n format.html { render :edit }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return unless admin?\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post_category = current_user.post_categories.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to [:client,@post_category], notice: 'Post category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # update attribute\n if @category.update_attributes(category_params)\n # flash message\n flash.now[:success] = \"更新完了しました。\"\n # get category data\n all_categories\n else\n render 'edit'\n end\n end",
"def update\n params[:book][:category_ids] = nil if params[:book][:category_ids].nil?\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_url, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n @title = 'Kategorie ' + @category.title + ' bearbeiten'\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n intent_request = @api_ai_client.create_intents_request\n response = intent_request.update(@category.intent_id, param_options)\n\n if response.is_a?(Hash) && response[:status][:code].eql?(200)\n\n contexts_templates = { contexts: category_params[:contexts].split(\",\"), templates: category_params[:templates].split(\",\") }\n\n if @category.update(category_params.merge(contexts_templates))\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n else\n @notice = response.message\n\n format.html { render :new }\n format.json { render json: { error: response.message }, status: response.code}\n end\n end\n end",
"def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to :back, notice: 'Kategori diperbarui.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n #My product belongs_to category relationship won't work so I made this so when I update it reflects changes\n category_name = set_category.name\n Product.all.each do |product|\n product.category = category_params[:name] if product.category == category_name\n product.save\n end\n \n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n category = Documents::Category.find(params[:id])\n category.update!(category_params)\n redirect_to categories_path\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Updated!', \"Category [#{@category.description}] was successfully updated.\") \n }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_group_category.update(api_v1_group_category_params)\n format.html { redirect_to @api_v1_group_category, notice: 'Group category was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_category }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to edit_dashboard_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно обновлена\" }\n format.json { render :show, status: :ok, location: adminpanel_categories_path }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @categories = Category.all.map{|c| [ c.name, c.id ] }\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Категория была успешно изменена' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_url, notice: 'Category was successfully updated.' }\n end\n end\n end",
"def update\n @kategory = Kategory.find(params[:id])\n\n respond_to do |format|\n if @kategory.update_attributes(params[:kategory])\n format.html { redirect_to @kategory, notice: 'Kategory was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schema_category.update(schema_category_params)\n format.html { redirect_to schema_categories_path, notice: 'Schema category was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema_category }\n else\n format.html { render :edit }\n format.json { render json: @schema_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category , notice: 'Información actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @category.errors , status: :unprocessable_entity }\n end\n end\n end",
"def update\n if current_category.category==\"noone\"\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n else\n render :file => \"/public/404.html\",:status => \"404\"\n end\n \n end",
"def update_categories(cats=[])\n rescue_extra_data\n cats = cats.to_i\n old_categories = categories.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")\n delete_categories = old_categories - cats\n news_categories = cats - old_categories\n term_relationships.where(\"term_taxonomy_id in (?)\", delete_categories ).destroy_all if delete_categories.present?\n news_categories.each do |key|\n term_relationships.create(:term_taxonomy_id => key)\n end\n update_counters(\"categories\")\n end",
"def update\n respond_to do |format|\n if @category.update(category_params)\n flash[:success] = 'Category was successfully updated.'\n format.html { redirect_to admin_category_url(@category) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend"
] | [
"0.76931995",
"0.7600433",
"0.721346",
"0.6943123",
"0.6914936",
"0.6817601",
"0.67816055",
"0.6713112",
"0.66984165",
"0.6693479",
"0.66566056",
"0.66523254",
"0.6651486",
"0.6645902",
"0.66068524",
"0.65989816",
"0.6571709",
"0.6571709",
"0.65543723",
"0.65349466",
"0.6500273",
"0.6476041",
"0.6465057",
"0.64642215",
"0.6447606",
"0.6447606",
"0.6447606",
"0.6447606",
"0.6447606",
"0.6447606",
"0.6447606",
"0.6446929",
"0.6445167",
"0.64354783",
"0.64269394",
"0.6404794",
"0.63986206",
"0.6397466",
"0.63869214",
"0.63710886",
"0.6369283",
"0.6361617",
"0.6361617",
"0.63606787",
"0.6350508",
"0.6350283",
"0.6349869",
"0.6345752",
"0.6333139",
"0.6325586",
"0.63239694",
"0.63143516",
"0.6313136",
"0.63053083",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.62989515",
"0.6258468",
"0.62565297",
"0.6253094",
"0.62488115",
"0.62480146",
"0.6242642",
"0.62424415",
"0.6231377",
"0.62297356",
"0.6213893",
"0.62138283",
"0.62133265",
"0.6212125",
"0.62068313",
"0.6203744",
"0.62033004",
"0.6203232",
"0.6199041",
"0.61897093",
"0.6188133",
"0.6184581",
"0.61833024",
"0.6171633",
"0.616978",
"0.61682814",
"0.61661804",
"0.61531246",
"0.614805",
"0.61377615",
"0.61349887",
"0.61325574"
] | 0.63583905 | 44 |
DELETE /categories/1 DELETE /categories/1.json | def destroy
@category.destroy
respond_to do |format|
format.html { redirect_to admin_categories_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @category.destroy\n render json: @category, status: :ok\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_categories_path }\n format.json { head :no_content }\n end\n end",
"def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.destroy\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end",
"def destroy\n @category.destroy\n render json: { notice: 'Categoria eliminada exitosamente' }\n end",
"def destroy\n category = set_category\n if category.destroy\n head :no_content\n else\n render json: { status: 500 }\n end\n \n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = @collection.category.find(params[:id])\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alien_category.destroy\n respond_to do |format|\n format.html { redirect_to alien_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cat = Cat.find(params[:id])\n @cat.destroy\n\n respond_to do |format|\n format.html { redirect_to cats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cat = Cat.find(params[:id])\n @cat.destroy\n\n respond_to do |format|\n format.html { redirect_to cats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: t('destroy.notice', name: t('activerecord.models.category')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to cm_post_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categoria_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = current_mall.categories.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to api_wmall_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n head :no_content\n end",
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to admin_good_categories_url }\n format.json { head :no_content }\n end\n end",
"def delete_category id\n\t\t\t\t\tFreshdesk::Api::Client.delete_status_wrapper do\n\t\t\t\t\t\t( @connection.delete CATEGORIES, id ).code\n\t\t\t\t\tend\n\t\t\t\tend",
"def destroy\n IndicatorCategory.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to indicator_categories_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post_category = Post::Category.find(params[:id])\n @post_category.destroy\n\n respond_to do |format|\n format.html { redirect_to post_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categ.destroy\n respond_to do |format|\n format.html { redirect_to categs_url, notice: 'Categ was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category_db.destroy\n respond_to do |format|\n format.html { redirect_to category_dbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categoria.destroy\n respond_to do |format|\n format.html { redirect_to categorias_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categorie = Categorie.find(params[:id])\n @categorie.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n end\n end",
"def destroy\n @category.delete\n end",
"def destroy\n @admin_category.destroy\n respond_to do |format|\n format.html { redirect_to admin_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_category = RecipeCategory.find(params[:id])\n @recipe_category.destroy\n\n respond_to do |format|\n format.html { redirect_to recipe_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n @taxonomy_category.destroy\n\n respond_to do |format|\n format.html { redirect_to taxonomy_categories_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: \"Journal was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_scenic_spots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @desserts_category.destroy\n respond_to do |format|\n format.html { redirect_to desserts_categories_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @level_category = LevelCategory.find(params[:id])\n @level_category.destroy\n\n respond_to do |format|\n format.html { redirect_to level_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cat.destroy\n respond_to do |format|\n format.html { redirect_to cats_url, notice: 'Cat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n begin\n @category.destroy\n rescue ActiveRecord::DeleteRestrictionError\n error = 'Эта категория не может быть удалена, пока с ней связан хоть один файл.'\n ensure\n respond_to do |format|\n format.html { redirect_to categories_url, notice: error }\n format.json { head :ok }\n end\n end\n end",
"def destroy\n @kategory = Kategory.find(params[:id])\n @kategory.destroy\n\n respond_to do |format|\n format.html { redirect_to kategories_url }\n format.json { head :ok }\n end\n end",
"def destroy\n return unless admin?\n\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_path, notice: \"Category was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categor.destroy\n respond_to do |format|\n format.html { redirect_to categors_url, notice: 'Categor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to \"index\", notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = current_user.user_categories.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categorias_tipo = CatTipo.find(params[:id])\n @categorias_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to cat_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cathegory.destroy\n respond_to do |format|\n format.html { redirect_to cathegories_url, notice: 'Cathegory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #locates the category to be destroyed\n @category = Category.find(params[:id])\n #Creates an array of all categories\n @all_categories = Category.all\n #creates an empty hash\n @all_categories_hash = {}\n #calls function to populate & sort @all_categories_hash\n sort_categories()\n #calls function to destroy the category\n destroy_category(@category)\n\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end",
"def destroy\n authorize! :destroy, @category\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to backend_shop_branch_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cat = Cat.find(params[:id])\n @cat.destroy\n\n respond_to do |format|\n format.html { redirect_to(cats_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @mk_categoria.destroy\n respond_to do |format|\n format.html { redirect_to mk_categories_url, notice: 'Mk categoria was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category_type = CategoryType.find(params[:id])\n @category_type.destroy\n\n respond_to do |format|\n format.html { redirect_to category_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categorie_droit.destroy\n respond_to do |format|\n format.html { redirect_to categorie_droits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.delete_context #there you go, this little fatty kills em all!\n #fred and post have equal methods, makes it slim and easy\n\n respond_to do |format|\n format.html { redirect_to categories_url, :method => :get, :notice => t(:deleted_category_success) }\n format.json { head :ok }\n end\n end",
"def destroy\n @activity_category.destroy\n respond_to do |format|\n format.html { redirect_to activity_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_category.destroy\n respond_to do |format|\n format.html { redirect_to dish_categories_url, notice: 'Категория блюда удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n CategoryService.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n #######\n format.html { redirect_to category_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \tauthorize! :destroy, @category\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_category.destroy\n respond_to do |format|\n format.html { redirect_to status_categories_url, notice: 'Status category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_category = current_user.post_categories.find(params[:id])\n @post_category.destroy\n\n respond_to do |format|\n format.html { redirect_to [:client, :post_categories] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course_category = CourseCategory.find(params[:id])\n @course_category.destroy\n\n respond_to do |format|\n format.html { redirect_to course_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: '分类删除成功~' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gt_category.destroy\n respond_to do |format|\n format.html { redirect_to gt_categories_url, notice: 'Gt category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cover_cat = CoverCat.find(params[:id])\n @cover_cat.destroy\n\n respond_to do |format|\n format.html { redirect_to cover_cats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n end",
"def destroy\n @category = DishCategory.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Категория удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |format|\n format.html { redirect_to(categories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category.destroy\n respond_to do |format|\n format.html { redirect_to management_categories_url, notice: 'Category was successfully removed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.78272814",
"0.77353686",
"0.76392984",
"0.7488916",
"0.74731207",
"0.74233276",
"0.7399541",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7385346",
"0.7378597",
"0.7378597",
"0.7378597",
"0.7372517",
"0.7366761",
"0.7362291",
"0.7334964",
"0.7334964",
"0.7333799",
"0.7318471",
"0.7294363",
"0.728636",
"0.7283016",
"0.72823733",
"0.7245488",
"0.7242075",
"0.72370917",
"0.71940225",
"0.7186593",
"0.7184272",
"0.71675783",
"0.7166838",
"0.7147197",
"0.71468467",
"0.7146009",
"0.71421075",
"0.712865",
"0.71269435",
"0.7125966",
"0.7122311",
"0.71151847",
"0.7114038",
"0.711263",
"0.71069294",
"0.7101981",
"0.71015203",
"0.7098744",
"0.70979154",
"0.70844114",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.708277",
"0.7077371",
"0.70768744",
"0.7076328",
"0.7075828",
"0.70738447",
"0.7071764",
"0.7064413",
"0.70556885",
"0.70518345",
"0.7051709",
"0.7048051",
"0.7047651",
"0.70454115",
"0.7042982",
"0.70411265",
"0.7030913",
"0.7013192",
"0.70061165",
"0.69993097",
"0.6998523",
"0.6996587",
"0.69943523",
"0.6993104",
"0.69879425",
"0.69879425",
"0.69879425",
"0.6978936",
"0.69772786"
] | 0.73254865 | 28 |
Use callbacks to share common setup or constraints between actions. | def set_category
@category = Category.find(params[:id])
@category.orderable :display_order, :parent_category_id # I'm already calling this in Category::initialize, but apparently `find` doesn't ever `initialize` - be a lot cooler if it did...
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def action\n end",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def category_params
params.require(:category).permit(:display_order, :name, :description, :parent_category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Given the key of the specific error and the options hash, translate the message. Options: key: The key of the error in the locales. options: The objects to pass to create the message. Returns: A localized error message string. | def translate(key, options)
I18n.translate("#{BASE_KEY}.#{key}", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_for(key,options={})\n handwritten_message || I18n.translate(key, {:scope => 'activerecord.errors.messages'}.merge(options))\n end",
"def translate(key, **options)\n I18n.t key, **options.merge(scope: :quo_vadis, raise: true) rescue nil\n end",
"def translate(key, options = {})\n I18n.t(key, options.merge(locale: @answer.questionnaire.language))\n end",
"def translate(key, options = {})\n options = options.dup\n if options.has_key?(:default)\n remaining_defaults = Array(options.delete(:default)).compact\n options[:default] = remaining_defaults unless remaining_defaults.first.kind_of?(Symbol)\n end\n\n # If the user has explicitly decided to NOT raise errors, pass that option to I18n.\n # Otherwise, tell I18n to raise an exception, which we rescue further in this method.\n # Note: `raise_error` refers to us re-raising the error in this method. I18n is forced to raise by default.\n if options[:raise] == false\n raise_error = false\n i18n_raise = false\n else\n raise_error = options[:raise] || ActionView::Base.raise_on_missing_translations\n i18n_raise = true\n end\n\n if html_safe_translation_key?(key)\n html_safe_options = options.dup\n options.except(*I18n::RESERVED_KEYS).each do |name, value|\n unless name == :count && value.is_a?(Numeric)\n html_safe_options[name] = ERB::Util.html_escape(value.to_s)\n end\n end\n translation = I18n.translate(scope_key_by_partial(key), html_safe_options.merge(raise: i18n_raise))\n if translation.respond_to?(:map)\n translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element }\n else\n translation.respond_to?(:html_safe) ? translation.html_safe : translation\n end\n else\n I18n.translate(scope_key_by_partial(key), options.merge(raise: i18n_raise))\n end\n rescue I18n::MissingTranslationData => e\n if remaining_defaults.present?\n translate remaining_defaults.shift, options.merge(default: remaining_defaults)\n else\n raise e if raise_error\n\n keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope])\n title = +\"translation missing: #{keys.join('.')}\"\n\n interpolations = options.except(:default, :scope)\n if interpolations.any?\n title << \", \" << interpolations.map { |k, v| \"#{k}: #{ERB::Util.html_escape(v)}\" }.join(\", \")\n end\n\n return title unless ActionView::Base.debug_missing_translation\n\n content_tag(\"span\", keys.last.to_s.titleize, class: \"translation_missing\", title: title)\n end\n end",
"def localize(key, options = {})\n I18n.localize(key, options.merge(:locale => self.locale))\n end",
"def translate!(key, options = {}, &block)\n I18n.translate!(*object_scoped_i18n_options(key, options.dup), &block)\n end",
"def translate(key, **options); end",
"def translate(key, **options); end",
"def t_sms_msg(key, options = {})\n # throw in the form_code if it's not there already and we have the form\n options[:form_code] ||= options[:form].current_version.code if options[:form]\n\n # get the reply language (if we have the user, use their pref_lang; if not, use default)\n lang = options[:user] && options[:user].pref_lang ? options[:user].pref_lang.to_sym : I18n.default_locale\n\n # do the translation, raising error on failure\n I18n.t(key, options.merge(locale: lang, raise: true))\n end",
"def t_sms_msg(key, options = {})\n # Get some options from Response (if available) unless they're explicitly given\n if elmo_response\n %i(user form mission).each { |a| options[a] = elmo_response.send(a) unless options.has_key?(a) }\n end\n\n # throw in the form_code if it's not there already and we have the form\n options[:form_code] ||= options[:form].current_version.code if options[:form]\n\n # get the reply language (if we have the user, use their pref_lang; if not, use default)\n lang = options[:user] && options[:user].pref_lang ? options[:user].pref_lang.to_sym : I18n.default_locale\n\n # do the translation, raising error on failure\n I18n.t(key, options.merge(locale: lang, raise: true))\n end",
"def translate!(key, **options); end",
"def translate_option_key(key, plain_key, options)\n return \"\\t#{plain_key}\\t#{options[key]}\\n\" if options.has_key?(key)\n \"\"\n end",
"def view_error_text(object, error_key, options = {})\n raise Exception.new(\"Parameter string_name may not be blank\") if error_key.blank?\n \n controller ||= options[:controller] ||= self.controller_name\n\n # If you are on the production server, you can only see strings set to live\n # mode. If you are on a development or staging server, you can see draft or ready status\n language_id = get_current_language_id(options)\n\n # First, try to look up the string in the specified controller\n # Note: we get the one with the highest version number\n translation = I18n::SingletonTranslationKey.translate( :klass => object, \n :language => language_id,\n :key => error_key )\n \n # Model errors are bound directly to an error we do not want to look for this key on the global level \n \n # if we found something, we're good\n return translation.text if translation && translation.text\n\n # if not, we can optionally return an empty string\n if options[:missing_ok] == true\n return \"\"\n else\n # Rather than fail if we can not find the translation, put the key in place of\n # the translation and log a tranlsation error in the i18n.log which is defined in\n # config/initializers/i18n_logger.rb\n language = Language.find(language_id)\n I18N_LOGGER.error \"view_text_lookup: Unable to locate string '#{error_key}' \" +\n \"for language #{language.language} that belongs to object #{object}\"\n return \"trasnlation-missing: #{error_key} - lang: #{language_id}\"\n end\n end",
"def message(key, error_symbol, options = {})\n if options[:index]\n \"#{titleize(key || 'array')}[#{options[:index]}] #{MESSAGES[error_symbol]}\"\n else\n \"#{titleize(key)} #{MESSAGES[error_symbol]}\"\n end\n end",
"def translate_or_localize(key, options = {})\n [Date, DateTime, Time].include?(key.class) ? I18n.localize(key, options) : I18n.translate(key, options)\n end",
"def translate(key, **options)\n return key.map { |k| translate(k, **options) } if key.is_a?(Array)\n key = key&.to_s unless key.is_a?(Symbol)\n\n alternatives = if options.key?(:default)\n options[:default].is_a?(Array) ? options.delete(:default).compact : [options.delete(:default)]\n end\n\n options[:raise] = true if options[:raise].nil? && TranslationHelper.raise_on_missing_translations\n default = MISSING_TRANSLATION\n\n translation = while key || alternatives.present?\n if alternatives.blank? && !options[:raise].nil?\n default = NO_DEFAULT # let I18n handle missing translation\n end\n\n key = scope_key_by_partial(key)\n\n translated = ActiveSupport::HtmlSafeTranslation.translate(key, **options, default: default)\n\n break translated unless translated == MISSING_TRANSLATION\n\n if alternatives.present? && !alternatives.first.is_a?(Symbol)\n break alternatives.first && I18n.translate(nil, **options, default: alternatives)\n end\n\n first_key ||= key\n key = alternatives&.shift\n end\n\n if key.nil? && !first_key.nil?\n translation = missing_translation(first_key, options)\n key = first_key\n end\n\n block_given? ? yield(translation, key) : translation\n end",
"def translate(locale, key, options = T.unsafe(nil)); end",
"def localize(key, error_msg='__localization_missing__', args={}, locale=nil)\n return if reserved_keys.include? key\n\n # Set a temporary Locale to support the localized_in method\n #\n unless locale.nil?\n @original_locale = Locale.code\n Locale.set_code(locale)\n end\n localized = localizations[key] || error_msg\n # Get translations from another country but in the same language if Globalite can't find a translation for my locale\n #\n if localized == error_msg\n locales.each do |t_locale|\n if t_locale.to_s.include?(\"#{current_language.to_s}-\") && t_locale != Locale.code\n localized = @@locales[t_locale][key] || error_msg\n end\n end\n end\n localized = interpolate_string(localized.dup, args.dup) if localized.class == String && localized != error_msg\n\n # let's handle pluralization if needed\n # the translation must include pluralize{count, singular string} to be translated\n # the translator can also pass the plural form if needed:\n # pluralize{3, goose, geese}\n localized = localized.gsub( /pluralize\\{(.*)\\}/){ |erb| pluralize(Regexp.last_match(1)) } if localized.is_a?(String) && (localized=~ /pluralize\\{(.*)\\}/)\n\n # Set the locale back to normal\n #\n unless locale.nil?\n Locale.code = @original_locale\n end\n\n return localized\n end",
"def translated_message\n lookups = []\n lookups << :\"activemodel.errors.template.message\"\n lookups << :\"activerecord.errors.template.message\"\n lookups << :\"case_form.errors.template.message\"\n lookups << \"There were problems with the following fields:\"\n I18n.t(lookups.shift, :default => lookups)\n end",
"def translated_error_message(identifier)\n return default_translated_error_message(identifier) if utility.nil?\n I18n.t(\n \"errors.messages.#{utility_class_name}.#{identifier}\",\n default: default_translated_error_message(identifier)\n )\n end",
"def t(key, options = {}, &block)\n options.merge!(block_to_hash(options, &block)) if block_given?\n translate_or_localize(key, options)\n end",
"def message\n options.delete(:message) || translated_message\n end",
"def get(key, options = EMPTY_HASH)\n return unless key\n\n result = t.(key, locale: options.fetch(:locale, default_locale))\n\n if result.is_a?(Hash)\n text = result[:text]\n meta = result.dup.tap { |h| h.delete(:text) }\n else\n text = result\n meta = EMPTY_HASH.dup\n end\n\n {\n text: text,\n meta: meta\n }\n end",
"def t(key, options = {})\n options[:raise] = true\n translate(key, options)\n end",
"def get_message(key)\n msg = error_messages[key]\n return msg.nil? ? 'An unspecified error occurred.' : msg\n end",
"def default_message_for(key)\n if @options[:message]\n :message\n else\n @options[:\"#{key}_message\"] = key\n :\"#{key}_message\"\n end\n end",
"def custom_error_message\n message = component.dig('errors', schema_key, 'any')\n\n message % error_message_hash if message.present?\n end",
"def th(key, options = {}, &block)\n options.merge!(block_to_hash(options, &block)) if block_given?\n options.each {|k,v| options[k] = h(v) if v.is_a?(String) }\n translate_or_localize(key, options)\n end",
"def translated_header_message\n lookups = []\n lookups << :\"activemodel.errors.template.header_message\"\n lookups << :\"activerecord.errors.template.header_message\"\n lookups << :\"case_form.errors.template.header_message\"\n lookups << \"Some errors prohibited this object from being saved\"\n I18n.t(lookups.shift, :default => lookups)\n end",
"def translate key, opts = {}\n opts = { :locale => default_locale }.update(opts)\n\n I18n.translate(key, opts)\n end",
"def flash_error(message_key,*strs)\r\n flash[:error] = sprintf(I18n.t(message_key),*strs)\r\n end",
"def build_flash_message(type, options = {})\n final_action_name = action_name.dup\n final_resource_name = i18n_resource_name\n\n if options.present?\n final_resource_name = options.keys.first.to_s\n key = options.values.first\n else\n final_action_name << 'e' unless final_action_name.ends_with?('e')\n\n key = if type == :success\n \"#{final_action_name}d_object\"\n else\n \"not_#{final_action_name}d_object\"\n end\n end\n\n flash[type] = t(\"sento.kanban.messages.#{key}\",\n name: final_resource_name)\n end",
"def translate(input, options = {})\n locale = options['locale'] || self.current_locale\n scope = options.delete('scope')\n key = scope.present? ? \"#{scope.gsub('.', '_')}_#{input}\" : input\n\n key = \"#{key}_#{pluralize_prefix(options['count'])}\" if options['count']\n\n values = find_values_by_key(key)\n\n # FIXME: important to check if the returned value is nil (instead of nil + false)\n # false being reserved for an existing key but without provided translation)\n if (translation = values[locale.to_s]).present?\n _translate(translation, options)\n elsif output = I18n.t(input, scope: scope&.split('.'), locale: locale, default: nil)\n output\n else\n Locomotive::Common::Logger.warn \"Missing translation '#{input}' for the '#{locale}' locale\".yellow\n ActiveSupport::Notifications.instrument('steam.missing_translation', input: input, locale: locale)\n input\n end\n end",
"def translate(locale, key, options = {})\n @locale = locale_in_context(locale)\n\n options[:scope] = [options[:scope]] unless options[:scope].is_a?(Array) || options[:scope].blank?\n key = \"#{options[:scope].join('.')}.#{key}\".to_sym if options[:scope] && key.is_a?(Symbol)\n count = options[:count]\n # pull out values for interpolation\n values = options.reject { |name, value| [:scope, :default].include?(name) }\n\n entry = lookup(@locale, key)\n cache_lookup = true unless entry.nil?\n\n # if no entry exists for the current locale and the current locale is not the default locale then lookup translations for the default locale for this key\n unless entry || @locale.default_locale?\n entry = use_and_copy_default_locale_translations_if_they_exist(@locale, key)\n end\n\n # if we have no entry and some defaults ... start looking them up\n unless entry || key.is_a?(String) || options[:default].blank?\n default = options[:default].is_a?(Array) ? options[:default].shift : options.delete(:default)\n return translate(@locale.code, default, options.dup)\n end\n\n # this needs to be folded into the above at some point.\n # this handles the case where the default of the string key is a space\n if !entry && key.is_a?(String) && options[:default] == \" \"\n default = options[:default].is_a?(Array) ? options[:default].shift : options.delete(:default)\n return translate(@locale.code, default, options.dup)\n end\n\n # The requested key might not be a parent node in a hierarchy of keys instead of a regular 'leaf' node\n # that would simply result in a string return. If so, check the database for possible children \n # and return them in a nested hash if we find them.\n # We can safely ignore pluralization indeces here since they should never apply to a hash return\n if !entry && (key.is_a?(String) || key.is_a?(Symbol))\n #We need to escape % and \\. Rails will handle the rest.\n escaped_key = key.to_s.gsub('\\\\', '\\\\\\\\\\\\\\\\').gsub(/%/, '\\%')\n children = @locale.translations.find(:all, :conditions => [\"raw_key like ?\", \"#{escaped_key}.%\"]).select{|child| child.raw_key =~ /^#{key}/}\n if children.size > 0\n entry = hashify_record_array(key.to_s, children)\n @cache_store.write(Translation.ck(@locale, key), entry) unless cache_lookup == true\n return entry\n end\n end\n\n # we check the database before creating a translation as we can have translations with nil values\n # if we still have no blasted translation just go and create one for the current locale!\n unless entry \n pluralization_index = (options[:count].nil? || options[:count] == 1) ? 1 : 0\n translation = @locale.translations.find_by_key_and_pluralization_index(Translation.hk(key), pluralization_index) ||\n @locale.create_translation(key, key, pluralization_index)\n entry = translation.value_or_default\n end\n\n # write to cache unless we've already had a successful cache hit\n @cache_store.write(Translation.ck(@locale, key), entry) unless cache_lookup == true\n\n entry = pluralize(@locale, entry, count)\n entry = interpolate(@locale.code, entry, values)\n entry.is_a?(Array) ? entry.dup : entry # array's can get frozen with cache writes\n end",
"def error_msg(message, keys1, keys2)\n sprintf(ERRORS[message], carrier, (keys1 - keys2).to_a.join(', '))\n end",
"def get(key, options = {})\n messages.get(key, options)\n end",
"def custom_error(name, key_error)\n @errors << \"#{name} fails to #{key_error}\"\n end",
"def custom_error(name, key_error)\n @errors << \"#{name} fails to #{key_error}\"\n end",
"def human(options = {})\n return @human if i18n_keys.empty? || i18n_scope.empty?\n\n key, *defaults = i18n_keys\n defaults << options[:default] if options[:default]\n defaults << MISSING_TRANSLATION\n\n translation = I18n.translate(key, scope: i18n_scope, count: 1, **options, default: defaults)\n translation = @human if translation == MISSING_TRANSLATION\n translation\n end",
"def replace_with_translation_keys(model_errors)\n return model_errors if internationalized?\n deep_translation_replace(model_errors)\n end",
"def express_error_context resource\n I18n.t \"errors.action.#{params[:controller]}.#{params[:action]}.#{resource.class.model_name.i18n_key}\",\n default: \"Couldn't #{params[:action]} the #{resource.class.to_s.downcase}\"\n end",
"def translate_with_consistent_case( key, options = {} )\n lower_requested = options.delete( :case ) != \"upper\"\n translation = I18n.t( key, **options )\n en = I18n.t( key, **options.merge( locale: \"en\" ) )\n default_is_lower = en == en.downcase\n lower_requested_and_default_is_lower = lower_requested && default_is_lower\n upper_requested_and_default_is_upper = !lower_requested && !default_is_lower\n if lower_requested_and_default_is_lower || upper_requested_and_default_is_upper\n return translation\n end\n\n I18n.t( \"#{key}_\", **options )\n end",
"def translate(locale, key, options = {})\n options[:lit_default_copy] = options[:default].dup if can_dup_default(options)\n content = super(locale, key, options)\n\n if on_rails_6_1_or_higher?\n @untranslated_key = key if key.present? && options[:default].instance_of?(Object)\n\n if key.nil? && options[:lit_default_copy].present?\n update_default_localization(locale, options)\n end\n end\n\n if Lit.all_translations_are_html_safe && content.respond_to?(:html_safe)\n content.html_safe\n else\n content\n end\n end",
"def error_message\n # :nocov:\n options.fetch(:messages, :valid)\n # :nocov:\n end",
"def find_message(kind, options = {})\n options[:scope] ||= translation_scope\n I18n.t(kind, **options)\n end",
"def message\n @options[:message] || \"failed validation\"\n end",
"def i18n_crm(path, options = {})\n options.store(:scope, \"helpers.crud.message.#{action_name}\")\n t path, options\n end",
"def get_translate(locale, key)\r\n I18n.t!(key, :locale => locale)\r\n rescue\r\n nil\r\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def translate(text, options = {})\n response = google_api_call(text,\"#{SERVICE}#{@from}%7C#{@to}#{TEXT_PAR}\",TranslationResponse)\n translation = options[:html] ? response.translation : CGI.unescapeHTML(response.translation)\n translation # return value\n end",
"def translate(locale, key, options = {})\n new_key = normalize_flat_keys(locale, key, options[:scope], options[:separator])\n content = super\n store_translations(locale, DynamicCopy.convert_to_hash(new_key, content), :escape => false) unless store[\"#{locale}.#{new_key}\"]\n content.respond_to?(:html_safe) ? content.html_safe : content\n end",
"def find_message(kind, options = {})\n options[:scope] ||= translation_scope\n options[:default] = Array(options[:default]).unshift(kind.to_sym)\n options[:resource_name] = resource_name\n options = devise_i18n_options(options)\n I18n.t(\"#{options[:resource_name]}.#{kind}\", **options)\n end",
"def error_messages_for(object_name, options = {})\n options = options.symbolize_keys\n object = instance_variable_get(\"@#{object_name}\")\n if object && !object.errors.empty?\n # build full_messages here with controller current language\n full_messages = []\n object.errors.each do |attr, msg|\n next if msg.nil?\n msg = msg.first if msg.is_a? Array\n if attr == \"base\"\n full_messages << l(msg)\n else\n full_messages << \"« \" + (l_has_string?(\"field_\" + attr) ? l(\"field_\" + attr) : object.class.human_attribute_name(attr)) + \" » \" + l(msg) unless attr == \"custom_values\"\n end\n end \n content_tag(\"div\",\n content_tag(\n options[:header_tag] || \"span\", lwr(:gui_validation_error, full_messages.length) + \":\"\n ) +\n content_tag(\"ul\", full_messages.collect { |msg| content_tag(\"li\", msg) }),\n \"id\" => options[:id] || \"errorExplanation\", \"class\" => options[:class] || \"errorExplanation\"\n )\n else\n \"\"\n end\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def add_templated_error(key, message)\n record.setting_errors ||= {}\n record.setting_errors[template.to_s] ||= {}\n record.setting_errors[template.to_s][key] ||= []\n record.setting_errors[template.to_s][key].push(message)\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}.#{key}\", :scope => [:devise, :mailer], :default => key)\n end",
"def t(key)\n I18n.translate(key).html_safe\n end",
"def t(key, **options)\n options.merge!({ scope: [:helpers, :person_description_helper] })\n\n I18n.t(key, options)\n end",
"def format_error_message( msg, count = nil, singular = nil, *rest )\n return super unless msg.is_a?( Symbol ) and r18n\n if limit = count and singular\n limit = t.form_input.units[ singular, count ].to_s\n end\n text = t.form_input.errors[ msg, *limit, self ].to_s\n super( text )\n end",
"def get_error_message(error)\n case error\n when Dentaku::UnboundVariableError\n vars = error.unbound_variables\n t 'errors.unbound_variable', count: vars.size,\n vars: map_to_code(vars).to_sentence,\n prefix: Bot.prefix\n when Dentaku::ParseError\n case error.reason\n when :undefined_function\n t('errors.parse.undefined_function', func: error.meta[:function_name])\n when :too_many_operands\n t('errors.parse.too_many_operands')\n when :too_few_operands\n t('errors.parse.too_few_operands')\n else\n t('errors.unknown')\n end\n when Dentaku::TokenizerError\n case error.reason\n when :too_many_opening_parentheses\n t('errors.token.open_paren')\n when :too_many_closing_parentheses\n t('errors.token.close_paren')\n else\n t('errors.unknown')\n end\n when ZeroDivisionError\n t('errors.div_zero')\n when Math::DomainError\n t('errors.domain')\n else\n t('errors.unknown')\n end\n end",
"def t(key, hash = {})\n if key.start_with?('.')\n I18n.t(\"#{@model_plural_name}.#{key}\", hash)\n else\n I18n.t(key, hash)\n end\n end",
"def t(key, hash = {})\n if key.start_with?('.')\n I18n.t(\"#{@model_plural_name}.#{key}\", hash)\n else\n I18n.t(key, hash)\n end\n end",
"def header_message\n options.delete(:header_message) || translated_header_message\n end",
"def message_tag\n options.delete(:message_tag) || CaseForm.complex_error_message_tag\n end",
"def error_message\n if @errors\n @errors.map { |(k,v)|\n \"#{k} #{v.join(',')}\"\n }.join(\"; \")\n end\n end",
"def user_message\n return _translate if description.present? || tkey.present?\n return \"#{_translate} (#{user_digests})\" unless defined?(@coaster)\n message\n rescue => e\n \"#{message} (user_message_error - #{e.class.name} #{e.message})\"\n end",
"def ajax_error_messages(resource_key)\n return \"\" if resource_key.blank?\n html = <<-HTML\n <span class=\"label label-important\">#{t(resource_key)}#{t('error_ajax')}</span>\n HTML\n html.html_safe\n end",
"def message_for_display\n issue_url = nil\n if issue_key\n issue_url = Settings.rcm_jira_issue_url % issue_key\n end\n\n [error_cause, issue_url].reject(&:blank?).join(\"\\n\")\n end",
"def message\n message = 'VKontakte returned an errors:'\n\n @errors.each_with_index do |error, index|\n message << \"\\n #{index+1}) Code #{error[:error_code]}: '#{error[:error_msg]}'\"\n message << \"\\n after calling method '#{error[:method]}'.\"\n end\n\n message\n end",
"def build_message( options = {} )\n opt = { :type => nil, :service => nil, :message => nil, :extra_parameters => nil }.merge(options)\n url = binding_select( opt[:service] )\n return message_get( opt[:type], url, opt[:message], opt[:extra_parameters] )\n end",
"def build_message( options = {} )\n opt = { :type => nil, :service => nil, :message => nil, :extra_parameters => nil }.merge(options)\n url = binding_select( opt[:service] )\n return message_get( opt[:type], url, opt[:message], opt[:extra_parameters] )\n end",
"def pretty_hash_message(msg_hash)\n message = msg_hash['message']\n if msg_hash['errors']\n msg_hash['errors'].each do |k,v|\n if msg_hash['errors'][k]\n message = \"#{message}:\\n#{k}: #{v}\"\n end\n end\n end\n message\n end",
"def translate_options(keys, scope)\n keys.map{|k| [t(k, :scope => scope), k]}\n end",
"def translate key = nil, retries: nil, timeout: nil\n require \"gcloud/translate\"\n Gcloud.translate key, retries: (retries || @retries),\n timeout: (timeout || @timeout)\n end",
"def full_messages(options = {})\n @errors.values.inject([]) do |full_messages, errors|\n full_messages + errors.map { |error| error.full_message }\n end\n end",
"def compose_message(key, **attributes)\n short_message = translate_message(key, **attributes)\n if short_message.is_a? Hash\n @problem = problem(key, **attributes)\n @summary = summary(key, **attributes)\n @resolution = resolution(key, **attributes)\n [['Problem', @problem], ['Summary', @summary], ['Resolution', @resolution]].each_with_object(+'') do |detail_array, message|\n message << \"\\n#{detail_array[0]}:\\n #{detail_array[1]}\" unless detail_array[1].blank?\n message\n end\n else\n short_message\n end\n end",
"def generate_error_from_options(options, category)\n list = \"\"\n options.each do |elem|\n list << elem + \", \"\n end\n list.chop!\n list.chop!\n \"Please enter a valid \" + category + \" out of \" + list\n end",
"def standard_validation_error options= {message: {}}\n options[:error]||= \"Unprocessable entity\"\n status = options.delete(:status)\n error!(options, status || options[:error].parameterize.underscore.to_sym || 422)\n end",
"def error_message\n self[:error_message]\n end",
"def generate_field_translations options\n params_hash = direct_translate_to_html(options)\n if options['locale'].to_sym == :de\n params_hash['source'] = 'researcher'\n else\n params_hash = GoogleTranslateCommunicator.get_translations(\n params_hash, options['locale']\n )\n params_hash['source'] = 'GoogleTranslate'\n end\n params_hash\n end",
"def []( name )\n if form and r18n\n value = opts[ name ]\n if value.is_a?( String ) or ( value.nil? and not UNLOCALIZED_OPTIONS.include?( name ) )\n text = pt( name )\n return text.to_s if text.translated?\n end\n end\n super\n end",
"def translate(message)\n @messages[message] || message\n end",
"def error_messages(resource_name: , resource: , separator:)\n sanitize_and_translate(\n resource_name: resource_name ,\n resource:resource,\n given_messages: reject_notice_messages(messages: messages)\n ).flatten.join(separator).html_safe\n end",
"def extract_name(section_options)\n return if section_options.nil?\n\n name = section_options[:name]\n unless section_options[:key].nil?\n name = I18n.t(section_options[:key], scope: section_options[:key_scope]) +\n (name.nil? ? '' : \"(#{name})\")\n end\n name\n end",
"def message\n @error['message']\n end",
"def lookup(locale, key, scope = [], options = {})\n key = normalize_flat_keys(locale, key, scope, options[:separator])\n\n return if translations.missing?(locale, key)\n\n result = translations.lookup(locale, key, options)\n translations.missing(locale, key, options) if result.nil?\n\n result\n end",
"def error_message_for(field)\n return nil unless has_errors?(field)\n \n errors = if RPH::FormAssistant::Rules.has_I18n_support?\n full_messages_for(field)\n else\n human_field_name = field.to_s.humanize\n errors = [*object.errors[field]].map do |error|\n \"#{human_field_name} #{error}\"\n end \n end\n \n RPH::FormAssistant::FieldErrors.new(errors)\n end",
"def t(string, options = {})\n I18n.t(string, **options)\nend",
"def error_messages_for(object_name, options = {})\n options = options.symbolize_keys\n object = instance_variable_get(\"@#{object_name}\")\n if object && !object.errors.empty?\n content = content_tag(\"div\",\n content_tag(\n options[:header_tag] || \"h2\",\n \"#{pluralize(object.errors.count, \"error\")} prohibited this #{object_name.to_s.gsub(\"_\", \" \")} from being saved\"\n ) +\n content_tag(\"p\", \"There were problems with the following fields:\") +\n content_tag(\"ul\", object.errors.full_messages.collect { |msg| content_tag(\"li\", msg) }),\n \"id\" => options[:id] || \"errorExplanation\", \"class\" => options[:class] || \"errorExplanation\"\n )\n render :partial => \"layouts/errors\", :locals => {:content => content}\n else\n \"\"\n end\n end",
"def flash_message(type, options = {})\n controller_path = \"flash.#{ params[:controller] }.#{ params[:action] }.#{ type }\"\n shared_path = \"flash.shared.#{ params[:action] }.#{ type }\"\n\n options[:model] = options[:model].class.model_name.human if options[:model]\n options[:default] = I18n.t(shared_path, options)\n\n flash[type] = I18n.t(controller_path, options)\n end",
"def translation_of(text, options)\n src = options[:from]\n dst = options[:to]\n raise \":from and :to are mandatory in method translation_of\" if src.nil? || dst.nil?\n\n diconame = \"#{src}_#{dst}\".to_sym\n dico = @dicts[diconame]\n if dico.is_a? String\n dico = [ dico ]\n end\n if @data[diconame].nil? && dico\n dico.each do |name|\n dico_name_ext = \"#{src}_#{dst}_dict_#{name}\"\n data = load_dictionnary(dico_name_ext).symbolize_keys\n if @data[diconame].nil?\n @data[diconame] = data[diconame]\n else\n @data[diconame].merge! data[diconame]\n end\n end\n end\n tn = @data[diconame][text] if @data[diconame]\n if tn.nil? && google?\n tn = @tr.translate :text => text, :from => src, :to => dst\n end\n if tn.nil? || tn.empty? || tn == text\n tn = text\n if @strict\n tn = \"NT - #{text}\"\n end\n end\n tn\n end",
"def t(key, default='')\n c = I18n.t(key)\n if c.match( 'translation missing' )\n c = I18n.t(key, locale: 'en') \n# Still not found. Return default if set\n c = default unless default.blank?\n end\n c\nend",
"def error_text(error_code)\n ERRORS[error_code.to_i]\n end",
"def error_context(opts, code_desc = nil, extra = {})\n ctx = {}\n ctx[:opts] = opts\n ctx[:job] = self.class\n ctx[:message] = code_desc if code_desc\n ctx.merge!(extra) if extra != nil\n ctx\n end",
"def parse_options(options)\n parsed_options = \"\"\n parsed_options << translate_option_key(:admin_email, \"ServerAdmin\", options)\n parsed_options << translate_option_key(:document_root, \"DocumentRoot\", options)\n parsed_options << translate_option_key(:aliases, \"ServerAlias\", options)\n parsed_options << translate_option_key(:directory_index,\"DirectoryIndex\", options)\n parsed_options << translate_option_key(:error_log, \"ErrorLog\", options)\n parsed_options << translate_option_key(:custom_log, \"CustomLog\", options)\n end",
"def _t(key, *args)\n I18n.t(key, *args)\n end",
"def message\n format(ERRORS.fetch(type), **params)\n end",
"def message\n format(ERRORS.fetch(type), **params)\n end",
"def resource_title(options = {})\n I18n.t(\"power_resource.titles.#{resource_name}.resource\",\n { default: \"#{resource_human_name} #{resource.id}\" }.merge(options) )\n end",
"def error_message\n if error == 'on_reserve'\n 'another user has already reserved this item'\n elsif error == 'too_many'\n \"you cannot renew a loan more than 10 times\"\n elsif code == 'PatronNotFound'\n 'problem with user id - please contact an administrator for assistance'\n end\n end"
] | [
"0.7858783",
"0.74747014",
"0.72703904",
"0.6889381",
"0.6810696",
"0.6759146",
"0.67536944",
"0.67536944",
"0.66990995",
"0.665439",
"0.66344583",
"0.6633339",
"0.6593224",
"0.6520598",
"0.6435967",
"0.6392365",
"0.6316432",
"0.62642884",
"0.62631667",
"0.62213683",
"0.61493003",
"0.6084572",
"0.6074685",
"0.6073634",
"0.58750015",
"0.5863609",
"0.5855857",
"0.57221794",
"0.5696884",
"0.56709546",
"0.5650561",
"0.5647935",
"0.56361663",
"0.56073475",
"0.55597603",
"0.5538713",
"0.55152506",
"0.55152506",
"0.54797584",
"0.54785305",
"0.5477986",
"0.5466981",
"0.54571444",
"0.54525334",
"0.54442793",
"0.5440195",
"0.5428948",
"0.5404659",
"0.5403537",
"0.53771245",
"0.5361022",
"0.53584784",
"0.53427076",
"0.5326682",
"0.5319616",
"0.52988964",
"0.5272631",
"0.5253618",
"0.5250871",
"0.5242209",
"0.5216554",
"0.5216554",
"0.52165216",
"0.51662254",
"0.51537395",
"0.5152794",
"0.513926",
"0.51379085",
"0.510277",
"0.5091016",
"0.5091016",
"0.50871956",
"0.5076734",
"0.507673",
"0.5074797",
"0.5073125",
"0.50700134",
"0.5050869",
"0.50505185",
"0.5040352",
"0.50398713",
"0.5014273",
"0.49956414",
"0.4993608",
"0.4987236",
"0.49839577",
"0.49833578",
"0.49795514",
"0.49781445",
"0.49635968",
"0.49621162",
"0.49601373",
"0.49338996",
"0.4928297",
"0.4893481",
"0.48908317",
"0.4887552",
"0.4887552",
"0.4886789",
"0.48829797"
] | 0.74233496 | 2 |
3.3 Test and build the show action create the show action in the app/controllers/profiles_controller.rb the route /users/:user_id/profile add the :user_id part of the url to the params | def show
@profile = Profile.find(:first, :conditions => {:user_id => params[:user_id]})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n # @profile = Profile.find(params[:id])\n redirect_to user_page_url(@profile.user)\n end",
"def user\n\n \n @profile = Profile.find_by_user_id(params[:id])\n\n\nend",
"def show\n p params\n p \"just herer for checking\"\n #@profile = Profile.find(params[:id])\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n\n if params[:id]\n # @photos = Photo.find_by_id(@profile.id)\n @profile = Profile.find_by!(user: params[:id])\n @photos = @profile.user.photos\n # puts \"current: #{current_profile}\"\n # puts current_profile.user.id\n # @photos = Photo.where(user_id: @profile.user)\n\n # verify that the photos below to the profile id shown in the url\n # @photos.each do |photo|\n # puts Profile.find_by(user_id: photo.user_id).id\n # end\n else\n #set_profile is run here which gives me @profile\n @photos = current_user.photos\n end\n end",
"def show\n if current_user.is_normal?\n @user = User.find( params[:id] )\n render :profile\n else\n redirect_to user_profile_path\n end\n end",
"def show\n @profile = Profile.find(params[:id]) || current_user.profile\n end",
"def profile\n @user = User.find(params[:id])\n end",
"def profile\n @user = UserService.getUserById(params[:id])\n end",
"def profile\n \t@user = UsersService.findUserById(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n @links = Link.where(user_id: @user.id)\n @link = Link.new\n render :full_profile\n end",
"def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend",
"def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def show\n op = present User::Show\n redirect_to edit_user_profile_path(current_user, op.model.profile) && return if op.new_profile?\n redirect_to user_profile_path(current_user, op.model.profile)\n end",
"def profile\r\n if params[:id] && User.exists?(params[:id])\r\n @prof = User.find(params[:id])\r\n else\r\n redirect_to_info_page t(:redir)\r\n return\r\n end\r\n end",
"def show\n \t@profile = Profile.where(profile_name: params[:id]).first\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n\n if @user.state != 'active' or @user.login == 'admin'\n return redirect_to users_path\n end\n \n @page_ancestors = [{:name=>'Community', :url=> users_path}]\n @bc_title = 'User Profile'\n \n respond_to do |format|\n format.html # show.html.erb\n format.iphone\n format.xml { render :xml => @user }\n end\n end",
"def show\n\n if @user.id == current_user.id\n add_breadcrumb \"My Profile\"\n else\n add_breadcrumb @user.name\n end\n\n # get the @prev_record_path and @next_record_path view vars\n get_next_and_prev_object_keys(@user, INDEX_KEY_LIST_VAR)\n @prev_record_path = @prev_record_key.nil? ? \"#\" : user_path(@prev_record_key)\n @next_record_path = @next_record_key.nil? ? \"#\" : user_path(@next_record_key)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user }\n end\n end",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def profile\n # grab the username from the URL as :id\n @user = User.find(session[:user_id])\n #@followers = Relationship.all.where(\"followed_id = ?\", User.find_by_username(params[\"id\"]).id)\n #@following = Relationship.all.where(\"follower_id = ?\", User.find_by_username(params[\"id\"]).id)\n #@posts = Post.all.where(\"user_id = ?\", User.find_by_username(params[\"id\"]).id)\n end",
"def show\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by :id => the_user_id\n\tend",
"def show\n if Profile.find(params[:id].to_i).public_profile == 1 || params[:id].to_i == current_user.profile.id\n @profile = Profile.find(params[:id])\n @session_id = params[:id].to_i\n else\n redirect_to '/'\n end\n end",
"def show\n @profile = @user.profile\n end",
"def show\n \n begin\n @profile = Profile.find(params[:id])\n @[email protected]\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attemp to access an invaild profile #{params[:id]}\"\n redirect_to root_url,:notice=>\"Invaild profile\"\nelse\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end\n end",
"def handle_url\n profile = ProfileId.find(params[:id])\n handle profile\n end",
"def show\n @user = User.find(params[:id])\n @tests = @user.tests.paginate(page: params[:page])\n add_breadcrumb \"Show Profile\", :user_path\n end",
"def show\n # @user = User.find(params[:user_id])\n @company_profile = CompanyProfile.find(params[:company_profile_id]) \n end",
"def show\n \tif(params[:id])\n \t\t @profile = Profile.find(params[:id])\n \telse\n \t\t@profile = Profile.find_by_user_id(current_user.id)\n \tend\n # authorize! :show, @profile\n\n add_breadcrumb @profile.first_name + \" \" + @profile.last_name, \"\"\n \n @recentposts = Post.where('user_id = ?', @profile.user.id).order('id desc')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def find_profile\n @user = User.find_by_username(params[:id])\n @profile = @user.profile\n end",
"def set_profile\n if params[:id].to_i != 0\n @profile = Profile.find(params[:id])\n # @user = User.find(params[:id])\n else\n @user = User.find_by_profile_uri(params[:id])\n end\n end",
"def show_your_profile\n if params[:id] != session[:user_id].to_s\n redirect_to user_path\n end\n end",
"def profile_url\n {:controller => 'members', :action => 'profile'}\n end",
"def set_profile\n @profile = User.friendly.find(params[:user_id]).profile\n end",
"def show\n\t\tif not user_signed_in? # if user is not signed in, they should not be allowed to view this page or be redirected\n\t \t\trespond_to do |format|\n\t \t\t\tformat.html { redirect_to root_url }\n\t \t\tend\n\t \t\treturn\n\t \tend\n\t \t\n\t \t@user_profile = Profile.where('id = ?',params[:profile_id]).first\n\t \tif @user_profile.nil? # if the current profile id does not exist, then cannot proceed; if not our profile, TODO: privacy settings\n\t \t\trespond_to do |format|\n\t \t\t\tformat.html { redirect_to root_url }\n\t \t\tend\n\t \t\treturn\n\t \tend\n\t \t\n\t \t@resume = Resume.where('id = ? AND profile_id = ?',params[:id],@user_profile.id).first # must check for nil! \t\n\t \tif @resume.nil?\n\t \tredirect_to profile_path(@user_profile.id) # for now, just go back the profile (eventually, if use index, can go back there like images does)\n\t end\n\tend",
"def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile_attribute = current_user.profile_attributes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile_attribute }\n format.json { render :json => @profile_attribute }\n end\n end",
"def show\n @profiles_all = current_user.profiles.order('lastname ASC')\n if current_user.business\n @business = current_user.business.name\n end\n @profile = current_user.profiles.find(params[:id])\n @profile_tickets = Ticket.where(:user => @user).order('date_opened DESC')\n .paginate(page: params[:page])\n @profile_assets = Asset.where(:owner => @user).order('serial ASC')\n .paginate(page: params[:page])\n end",
"def show\n @user = Admin.from_param(params[:id])\n\n respond_to do |format|\n format.html { redirect_to user_profile_path(@user) }\n format.xml { render :xml => @user }\n end\n end",
"def profile\n @user = @current_user\n\n render :show\n\n end",
"def profile\n # grab the username from the URL as :id\n @user = User.find_by_username params[:id]\n @followers = Relationship.all.where(\"followed_id = ?\", User.find_by_username(params[\"id\"]).id)\n @following = Relationship.all.where(\"follower_id = ?\", User.find_by_username(params[\"id\"]).id)\n @posts = Post.all.where(\"user_id = ?\", User.find_by_username(params[\"id\"]).id)\nend",
"def show\n unless @user==User.find(params[:id])\n flash[:notice]= \"You can only see your own profile.\"\n redirect_to root_path\n end\n @user=User.find(params[:id])\n end",
"def set_profile\n u_id = params[:user_id]\n @profile = Profile.where(user_id: u_id)\n end",
"def set_profile\n @profile = if params[:id]\n Profile.find_by!(user_id: params[:id])\n else\n Profile.find_by(user: current_user)\n end\n end",
"def show\n @user = User.find(params[:id])\n if $current_user.nil? or $current_user.id != @user.id\n redirect_to signin_path\n else\n @title = \"#{@user.userName}'s profile\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end\n end",
"def show\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end",
"def show\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n end",
"def set_user_and_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end",
"def edit\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\tend",
"def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end",
"def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @user_profile = UserProfile.find(params[:id])\n\n #refactor this code out also we can probably just\n #get the avatar url and put it into a hash to pass to the view will be faster\n #also need to load up the posts better\n @followed_users_profile_list = Array.new\n @followed_users_post_list = Array.new\n followed_users = @user_profile.user.all_follows\n followed_users.each do |followed|\n @followed_users_profile_list << User.find(followed.followable_id).user_profile\n posts = User.find(followed.followable_id).posts\n posts.each do |post|\n @followed_users_post_list << post\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def edit\n user = User.find(params[:user_id])\n @profile = user.profile\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_profile }\n end\n end",
"def show\n\n\n @params = params\n # signed_request = params[:signed_request] \n # @signed_request = decode_data(signed_request)\n \n @profile = Profile.find(params[:id])\n @pieces = @profile.user.pieces.order(\"created_at DESC\").page(params[:page]).per(6)\n \n respond_to do |format|\n if @profile\n format.html # show.html.erb\n format.json { render json: vanity_url_path(@profile) }\n else\n format.html { redirect_to root_url }\n format.json { render json: vanity_url_path(@profile).errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n if @user_profession.nil?\n @user_profession = UserProfession.new\n @user_profession.user_profiles_id = params[:id]\n render 'new'\n end\n end",
"def show\n @use = User.find(@profile.my_id)\n if @profile.user_id then\n @target = User.find(@profile.user_id)\n end\n if ((@use.id == 1) && (@use.id == @profile.my_id) && ([email protected]_id)) then\n do_it\n end\n end",
"def edit\n @user = User.find(params[:user_id])\n @profile = @user.profile\n \n end",
"def set_profile_detail\n @profile_detail = ProfileDetail.find(params[:id])\n end",
"def show\n \n #@user = User.find_by_username(params[:slug])\n @post = Post.new\n @user =\n @profile = Profile.find_by_user_id(User.find_by_username(params[:slug]).id)\n @user = User.find(@profile.user_id)\n if current_user == @user\n @posts = Post.paginate_all_by_user_id(@user.followers.map(& :id).push(@user.id), :page => params[:page], :per_page => 10, :order=>'created_at desc')\n else\n @posts = Post.paginate_all_by_user_id(@user.id, :page => params[:page], :per_page => 10, :order=>'created_at desc')\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n if current_user\n @user = User.find(params[:id])\n @user = current_user\n render :show\n else\n flash[:error] = \"Must be signed in to see your profile!!\"\n redirect_to \"/\"\n end\n end",
"def show\n @user = User.find(params[:user_id])\n \n end",
"def show \n\t\t@user = User.find_by_id(params[:id])\n\tend",
"def edit\n @user = User.find (params[:user_id])\n @profile = @user.profile\n end",
"def set_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end",
"def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end",
"def set_profile\n if params[:id]\n # A particular person’s profile page\n # e.g. /users/5\n @profile = Profile.find_by!(user_id: params[:id])\n else\n # The signed in user’s profile page\n # /profile\n @profile = Profile.find_by(user: current_user)\n end\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def show\n \t@user = User.find params[:id]\n end",
"def show\n redirect_to edit_user_path(params)\n end",
"def show\n user_profile = UserProfile.new(current_user: current_user)\n\n valid_rn = params[:resource_name]\n if valid_rn.present?\n resource_info = user_profile.resource_info(valid_rn)\n resource = user_profile.current_user_resource_instance(resource_info: resource_info)\n if resource\n resource.current_user = current_user\n # resource_info[:resource_item_name]\n render json: { resource.resource_item_name => resource }\n else\n base_route_segments = resource_info[:base_route_segments]\n unless resource_info[:model].no_master_association\n use_temp_master = \"/masters/#{Master::TemporaryMasterIds.first}\"\n end\n new_path = \"#{use_temp_master}/#{base_route_segments}/new\"\n redirect_to new_path\n end\n\n elsif request.format == :html\n @panels = user_profile.current_user_resource_infos\n render :show\n else\n render json: { user_profile: user_profile.current_user_resource_instances }\n end\n end",
"def set_profile\n @user = User.find(params[:id])\n end",
"def set_profile\n @profile = Profile.find_by_id(params[:id])\n @user = User.find_by_id(@profile.user_id)\n end",
"def show\n #@user = User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n # show me the user page\nend",
"def show\n unless params[:id].blank?\n @user = User.find_by_id(params[:id])\n else\n if logged_in?\n @user = current_user\n else\n require_login and return\n end\n end\n \n if @user.blank?\n flash[:error] = \"User not found\"\n redirect_to root_path and return\n end\n\n @own_profile = (logged_in? && (@user.id == current_user.id))\n\n @page_title = @own_profile ? \"My profile\" : \"View profile\"\n\n @memberships = @user.liga_users.approved.map(&:league)\n end",
"def show\n \t# get particular user here\n \t@user = User.find_by_id(params[:id])\n \t# if not @user\n \t# \tredirect_to \"/users\"\n \t# end\n end",
"def show\n @user = User.find_by_username(params[:username])\n if [email protected]?\n @profile = @user.profile\n else\n redirect_to vendor_root_path\n end\n\n # byebug\n end",
"def profile_path\n view.user_path(@model.id)\n end",
"def find_profile\n\t\t# Find particular Profile \n\t\t@profile = Profile.find(params[:id])\n\tend",
"def edit_profile\n @user = User.find params[:id]\n end",
"def show\n @user = if params[:user_id]\n User.find(params[:user_id])\n else\n current_user\n end\n\n @profile = @user.profile\n authorize! :show, @profile\n\n @progress_remaining = @profile.profile_progress\n @progress = Profile::PROFILE_STEPS - @progress_remaining\n @progress_percent = ((@progress/Profile::PROFILE_STEPS.to_f) * 100).round(0)\n\n #here is code for creating a \"view\" event in the Views table\n unless current_user.id == @user.id\n @view = View.new\n @view.profile_id = @profile.user_id\n @view.viewer_id = current_user.id\n @view.save\n end\n #end of code relating to the view\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show #sss2208\n @user = User.find(params[:id])\n end",
"def set_user_profile\n @user = User.find_by_id(params[:id])\n end",
"def show\n\t\t# begin\n\t\t\tprofile = Profile.find(params[:id])\n\t @conversation = current_profile.find_conversation(profile)\n\t respond_to do |format|\n\t format.html {render \"profiles/#{profile._type.underscore}_show\"}\n\t format.json { render :json => @profile }\n\t end\n\t\t# rescue => error\n\t\t# \trender \"profiles/not_found\"\n\t\t# \tputs error.message\n\t\t# end\n end",
"def show\n respond_to do |format|\n format.html { render :action => \"show_\"[email protected]_type.permalink }\n format.xml { render :xml => @profile.to_xml }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n end",
"def show\n \tif not user_signed_in? # if user is not signed in, they should not be allowed to view this page or be redirected\n \t\trespond_to do |format|\n \t\t\tformat.html { redirect_to root_url }\n \t\tend\n \t\treturn\n \tend \t\n \t\n \t@user_profile = Profile.where('id = ?',params[:profile_id]).first\n \tif @user_profile.nil? # if the current profile id does not exist, then cannot proceed; if not our profile, TODO: privacy settings\n \t\trespond_to do |format|\n \t\t\tformat.html { redirect_to root_url }\n \t\tend\n \t\treturn\n \tend\n \t\n \t@image = Image.where('id = ? AND profile_id = ?',params[:id],@user_profile.id).first # must check for nil! \t\n \tif @image.nil?\n \tredirect_to :action => :index # if there actually isn't any image to edit, must redirect them to all images to see if they can spot it\n end\n end",
"def show\n if current_user.try(:admin?)\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n else\n redirect_to :permission_error\n end\n end",
"def show\n if (is_signed_in)\n @preview=true; #the same user is viewing the profile.\n puts(\"------- DEBUG ------------\" + session[:user].to_s)\n else\n @preview = false;\n end\n\n if params[:id]== (\"sign_in\")\n redirect_to :controller => 'authentication',:action => 'show'\n end\n if params[:id]== (\"sign_out\")\n redirect_to :controller => 'authentication',:action => 'destroy'\n end\n if params[:id]== (\"uploads\")\n redirect_to :controller => 'users',:action => 'uploads'\n\n end\n\n end",
"def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end",
"def new\n @profile = Profile.new\n @profile.user = User.find(params[:user_id])\n end",
"def show\n @post = Post.new\n @user = User.find params[:id]\n @posts = Post.where(\"user_id = ?\", @user[:id])\n @title = \"Profile: \" + @user.username\n end"
] | [
"0.7740533",
"0.7578568",
"0.75608444",
"0.7509444",
"0.7373195",
"0.7369203",
"0.73151875",
"0.7293107",
"0.7261913",
"0.72493964",
"0.7239749",
"0.7235664",
"0.7212736",
"0.7168155",
"0.7154388",
"0.7126662",
"0.7126662",
"0.7126662",
"0.7126662",
"0.7126662",
"0.7126662",
"0.7119943",
"0.7118062",
"0.7035867",
"0.7032957",
"0.702963",
"0.7019092",
"0.700573",
"0.70019186",
"0.69863725",
"0.6983613",
"0.69827044",
"0.69812036",
"0.6980921",
"0.6970345",
"0.6948409",
"0.6941929",
"0.6919177",
"0.6911499",
"0.69030213",
"0.68854064",
"0.6874457",
"0.68680733",
"0.68597883",
"0.68566865",
"0.6850919",
"0.684614",
"0.6844494",
"0.68351954",
"0.6819386",
"0.68164754",
"0.6801912",
"0.67976624",
"0.67955095",
"0.67941684",
"0.6793315",
"0.6774368",
"0.67666197",
"0.67627907",
"0.6750009",
"0.6743848",
"0.67407674",
"0.6729168",
"0.67195076",
"0.6719133",
"0.6719133",
"0.6719133",
"0.6706211",
"0.67061317",
"0.67017585",
"0.6695496",
"0.66951185",
"0.66922235",
"0.66916525",
"0.6686856",
"0.6681647",
"0.6680741",
"0.6672191",
"0.6668794",
"0.6655161",
"0.66500306",
"0.6647786",
"0.6643243",
"0.6638943",
"0.6631785",
"0.6616636",
"0.66122454",
"0.6609996",
"0.66090465",
"0.66042024",
"0.660042",
"0.6592875",
"0.65907484",
"0.65822524",
"0.6581571",
"0.6580296",
"0.6579363",
"0.6572962",
"0.6570643",
"0.656861"
] | 0.7872587 | 0 |
3.4 Test and build the new action create the new action in app/controller/profiles_controller.rb | def new
@profile = Profile.new
@profile.user = User.find(params[:user_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n build_profile\n end",
"def new\n super\n resource.build_profile\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n good_change(format, :created)\n else\n bad_change(format, :new)\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team_profile = TeamProfile.new(team_profile_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_team_profile\n format.html { redirect_to redirect_target(@team_profile), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @team_profile }\n else\n 5.times { @team_profile.team_memberships.new }\n 1.times { @team_profile.subsets.new }\n format.html { render :new }\n format.json { render json: @team_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n @profile = current_user.create_profile(params[:profile])\n if @profile \n format.html { redirect_to(profile_url(@profile.user_id), :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end",
"def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile.full_name = 'System'\n profile\nend",
"def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if ! params[:profile].blank? && DeveloperProfile.to_s == params[:profile][:type]\n @profile = DeveloperProfile.new(params[:profile])\n elsif ! params[:profile].blank? && ContractorProfile.to_s == params[:profile][:type]\n @profile = ContractorProfile.new(params[:profile])\n elsif ! params[:developer_profile].blank?\n @profile = DeveloperProfile.new(params[:developer_profile])\n elsif ! params[:contractor_profile].blank?\n @profile = ContractorProfile.new(params[:contractor_profile])\n end\n @profile.user_id = current_user.id\n @profile.website = nil\n\n respond_to do |format|\n if @profile.save\n @profile.user.send_welcome_notification\n format.html { \n if(current_user.sign_in_count == 1 && current_user.project_privileges.present?)\n redirect_to(project_path(current_user.project_privileges.first.project), :notice => 'Your profile was successfully created. Here is the project you were invited to bid on.') \n elsif(current_user.sign_in_count == 1 && current_user.invited_by.present?) \n redirect_to(projects_profile_path(current_user.invited_by.profile), :notice => 'Your profile was successfully created. Here are some projects from the user that invited you.') \n else\n redirect_to(profile_path(@profile), :notice => 'Profile was successfully created.') \n end\n }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n assign_params_to_attributes\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n if @profile.save\n flash[:notice] = I18n.t('profile.create.notice')\n redirect_to user_path(current_user)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.create.error')\n render :action => \"new\"\n end\n end",
"def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { render :xml => @profile, :status => :created, :location => @user }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n current_user.profile = Profile.new(params[:profile])\n @profile = current_user.profile\n\n if [email protected]?\n flash[:error_created] = @profile.errors.full_messages.join(\"<br>\").html_safe\n redirect_to new_user_profile_path(current_user)\n else\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path(current_user), notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end \n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n authorize! :create, @profile\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile\nend",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@profile = Profile.new\n\tend",
"def new\n\t\t@profile = Profile.new\n\tend",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @profile = Profile.new\n @user = current_user\n @user.profile = @profile\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.member = self.current_member\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to [self.current_member, @profile] }\n format.xml { head :created, :location => [self.current_member, @profile] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def create\n\t\t@user = current_user\n\t\t@profile = @user.build_profile(profile_params) \n\t\tif @profile.save\n\t\t\tflash[:success] = \"Profile successfully created!\"\n\t\t\tredirect_to user_profile_path(@user)\n\t\telse\n\t\t\tflash[:notice] = 'Error: something went wrong.'\n\t\t\trender :action => \"new\" \n\t\tend\n\tend",
"def create\n @current_object = Profile.new(params[:profile])\n respond_to do |format|\n if @current_object.save\n \n @current_object.create_profile_workspace\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to admin_profile_path(@current_object.id) }\n format.xml { render :xml => @current_object, :status => :created, :location => @current_object }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @current_object.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to quit_user_profile_path, notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = @account.build_profile(profile_attributes)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Анкета успешно сохранена. Ваш магазин добавлен в очередь на оптимизацию.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t# Creating the profile for particular surgeon\n\t\tsurgeon_profile = devise_current_user.setting.build_profile(profile_params) \n\t\t# Condition checking the profile is saved or not\n\t\tif surgeon_profile.save\n\t\t\t# If Profile is save then that's take it into the profile show page\n\t\t\tredirect_to profile_path(surgeon_profile)\n\t\telse\n\t\t\t# If Profile is not save then that's take in into the same page \n\t\t\tredirect_to :back\n\t\tend #Condition End\n\tend",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @profile = Profile.new\n end",
"def new\n @profile = Profile.new\n end",
"def new\n @profile = Profile.new\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n if @profile.save!\n redirect_to profile_path(@profile.id)\n else\n render :new\n end\n end",
"def create\n build_identity\n save_identity || render(template: 'profiles/show')\n end",
"def new\n @user = User.new\n @user.build_profile\n end",
"def new\n # the create profile page is only for registered users\n # and is supposed to be completed only once..check for this two items\n if user_signed_in? and current_user.present?\n if current_user.profile.full_profile_at.present?\n redirect_to profile_path(current_user.profile)\n return\n end\n else\n # redirect to some sort of error\n redirect_to home_path\n return\n end\n\n @profile = Profile.new\n @profile.user = current_user\n @linkedin_profile = current_user.linkedin.profile #(nil,'num-connections,num-recommenders,id')\n @suggested_login = @profile.suggest_login(current_user.first_name, current_user.last_name)\n\n unless @linkedin_profile.positions.empty?\n unless @linkedin_profile.positions.first.company.nil?\n unless @linkedin_profile.positions.first.company.id.nil?\n @first_company_info = current_user.linkedin.companyLookup(@linkedin_profile.positions.first.company.id)\n end\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.build_profile(pro_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { redirect_to new_profile_path, alert: 'Please fill all fields' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to profile_url(@profile) }\n format.xml { head :created, :location => profile_url(@profile) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def click_new_profile\n click_link('Create a profile')\n end",
"def create\n # Ensure that we have the right user\n @user = User.find( params[:user_id] )\n # Create profile linked to this specific user\n @profile = @user.build_profile( profile_params )\n @profile.save\n if @profile.save\n flash[:success] = \"Profile updated!\"\n # TODO: Redirect to profile page, once there is one. \n redirect_to user_path(params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :new\n end\n end",
"def new\n @help = PageContent.find_by_name(\"profile-help\") # \"What to include in profile\" Content\n @presenter = find_presenter\n if @presenter.presenter_profile.nil?\n @presenter_profile = @presenter.build_presenter_profile(status: :new_profile)\n else\n redirect_to edit_presenter_profile_path(@presenter)\n end\n end",
"def new\n\t\t@user = current_user\n\t\t@profile = @user.build_profile\n\tend",
"def create\n @profile_detail = ProfileDetail.new(profile_detail_params)\n\t\t@profile_detail.user_id = current_user.id\n respond_to do |format|\n if @profile_detail.save\n format.html { redirect_to edit_profile_detail_path(@profile_detail), notice: 'Profile detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.profile || Profile.new\n @profile.user_id = current_user.id\n @profile.status = :start\n @profile.save(validate: false)\n session[:profile_id] = @profile.id\n redirect_to vendor_setup_store_index_path\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.my_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user=current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @profile = Profile.new(profile_params)\r\n\r\n respond_to do |format|\r\n if @profile.save\r\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\r\n format.json { render :show, status: :created, location: @profile }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n\n user = User.find(params[:user_id])\n @profile = Profile.new(params[:profile])\n @profile.user = user\n\n if @profile.save\n redirect_to user_profile_path(params[:user_id])\n else\n flash[:alert] = @profile.errors.full_messages.join(\",\")\n render :template => \"profiles/new\"\n end\n\n end",
"def create\n @presenter = find_presenter\n if @presenter.presenter_profile.nil?\n new_profile = profile_params\n new_profile[:bio_edit] = sanitize_bio(new_profile[:bio_edit])\n @presenter_profile = @presenter.build_presenter_profile(new_profile)\n #submit to admin for approval\n if params[:submit]\n @presenter_profile.status = :pending_admin\n if @presenter_profile.save\n flash[:info] = \"Profile submitted to admin for approval\"\n notify_admin_profile_changes(@presenter)\n redirect_to root_url\n else\n render 'new'\n end\n #save draft\n else\n @presenter_profile.status = :new_profile\n if @presenter_profile.save\n flash[:info] = \"Profile draft saved. Go to edit profile to continue editing.\"\n redirect_to root_url\n else\n render 'new'\n end\n end\n else\n redirect_to edit_presenter_profile_path(@presenter)\n end \n end",
"def create\n @ProfileType = ProfileType.new(params[:profile_type])\n\n respond_to do |format|\n if @ProfileType.save\n format.html { redirect_to profile_types_path, notice: 'Profile Type was successfully created.' }\n format.json { render json: @ProfileType, status: :created, location: @ProfileType }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ProfileType.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if @user.profile\n redirect_to edit_user_profile_path(@user)\n return\n end\n @profile = Profile.new\n respond_to do |format|\n format.html { render :action => \"profiles/edit\" }\n format.xml { render :xml => @profile }\n end\n end",
"def new\n @profile = Profile.new\n @profile.build_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def create\n if current_user.profile.nil?\n profile = Profile.new(profile_params)\n profile.user = current_user\n if profile.save\n redirect_to profiles_path\n return\n end\n end\n redirect_to profiles_path\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end",
"def create\n @profile = Profile.new(params[:profile])\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: t(\"controller.shared.flash.create.notice\", model: pick_model_from_locale(:profile)) }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: t(\"controller.shared.flash.create.status\") }\n end\n end\n end",
"def newprofile\n if params[\"auth_key\"] == nil or params[\"device_id\"] == nil or params[\"profile_url\"] == nil\n render :json => '{\"status\": \"failed\", \"reason\": \"incorrect parameters\"}'\n else\n device = Device.find(params[\"device_id\"])\n if device.auth_key == params[\"auth_key\"]\n device.profile_url = params[\"profile_url\"]\n if device.save\n render :json => '{\"status\": \"success\"}'\n else\n render :json => '{\"status\": \"failed\", \"reason\": \"save error\"}'\n end\n else\n render :json => '{\"status\": \"failed\", \"reason\": \"not authorized\"}'\n end\n end\n end",
"def create\n @profile = Profile.new(req_params)\n if @profile.save\n redirect_to new_partnership_path(p_id: @profile.id)\n else\n flash[:profile_attempt] = req_params\n respond_with_submission_error(@profile.errors.messages, new_dummy_profile_path)\n end\n end",
"def create\n @admin_profile = Profile.new(admin_profile_params)\n @commonplace_id = City.find(session[:current_city_id]).commonplace.id\n @is_major = @admin_profile.is_major\n redirect_path = session['previous_url'] || (@admin_profile.is_major ? admin_profiles_url(major:true) : admin_profiles_url)\n name_alias = @is_major ? 'Sindaco' : 'Giunta Comunale'\n respond_to do |format|\n if @admin_profile.save\n format.html { redirect_to redirect_path, notice: \"#{name_alias} è stato creato con successo.\" }\n format.json { render :show, status: :created, location: @admin_profile }\n else\n format.html { render :new }\n format.json { render json: @admin_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # TO DO: make this for just generic creation.\n @profile = Profile.find_by_email(params[:profile][:email])\n @profile.user_id = current_user.id\n\n if @profile.nil?\n @profile = Profile.new(params[:profile])\n add_to_list_niche(params[:profile][:fname], params[:profile][:email], params[:profile][:niche], list_id=ENV[\"MAILCHIMP_LISTID\"])\n @profile.save\n else\n @profile.update_attributes(params[:profile])\n end\n\n redirect_to profiles_path, notice: 'Profile was successfully created.' \n # format.json { render json: @profile, status: :created, location: @profile }\n end",
"def create\n @profile = Profile.new(profile_params)\n \n @profile.user_id = current_user.id\n @profile.full_name = @profile.first_name + @profile.last_name\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => t('alerts.profiles.create') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.build_profile(profile_params)\n if @profile.save\n # Show successful flash message and redirect to courses list\n flash[:notice] = \"You have created a new profile\"\n redirect_to profile_path(@profile)\n else\n # Render the new template\n render :new\n end\n end",
"def create\n @profile = current_user.build_profile(params[:profile])\n @logotype = @profile.build_logotype(params[:logotype]) \n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to :action => 'show' }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n format.atom { \n headers[\"Location\"] = formatted_user_profile_url(@user, :atom )\n render :action => 'show',\n :status => :created\n }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n format.atom { render :xml => @profile.errors.to_xml, :status => :bad_request }\n end\n end\n end",
"def create_profile\n Profile.create(user_id: self.id)\n end"
] | [
"0.73560566",
"0.7221418",
"0.68720424",
"0.6814507",
"0.6808517",
"0.67369163",
"0.6715498",
"0.67121977",
"0.6704698",
"0.6701511",
"0.6682644",
"0.66610426",
"0.6642058",
"0.6606612",
"0.66063887",
"0.66026026",
"0.6599262",
"0.6597627",
"0.65861255",
"0.65685076",
"0.65665054",
"0.6552768",
"0.6552768",
"0.6552768",
"0.6552768",
"0.6552768",
"0.6552768",
"0.6552768",
"0.65398276",
"0.6534527",
"0.6527861",
"0.6523139",
"0.6517469",
"0.6511004",
"0.6511004",
"0.6509243",
"0.6501379",
"0.6489303",
"0.6488225",
"0.64847904",
"0.647912",
"0.647912",
"0.6476258",
"0.6475034",
"0.64728886",
"0.6469568",
"0.64676017",
"0.646656",
"0.646656",
"0.646656",
"0.64651245",
"0.64646846",
"0.6464084",
"0.64634955",
"0.6462946",
"0.6459676",
"0.64571404",
"0.64571404",
"0.64571404",
"0.6453772",
"0.64532816",
"0.64495414",
"0.64495414",
"0.64495414",
"0.6445998",
"0.6444335",
"0.6441582",
"0.64375484",
"0.643431",
"0.64252955",
"0.64214134",
"0.64214134",
"0.64214134",
"0.64214134",
"0.64214134",
"0.64214134",
"0.64214134",
"0.64214134",
"0.6416374",
"0.6408051",
"0.64004505",
"0.63958704",
"0.6392326",
"0.6385515",
"0.6385063",
"0.6371479",
"0.6365866",
"0.63615793",
"0.6361394",
"0.6350553",
"0.63433564",
"0.6336555",
"0.6332938",
"0.63306606",
"0.63275135",
"0.63223463",
"0.6317534",
"0.63069785",
"0.6300732",
"0.62895405",
"0.6288233"
] | 0.0 | -1 |
3.5 Test and build the create action create the create action in the app/controllers/profiles_controller.rb | def create
user = User.find(params[:user_id])
@profile = Profile.new(params[:profile])
@profile.user = user
if @profile.save
redirect_to user_profile_path(params[:user_id])
else
flash[:alert] = @profile.errors.full_messages.join(",")
render :template => "profiles/new"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end",
"def create\n respond_to do |format|\n @profile = current_user.create_profile(params[:profile])\n if @profile \n format.html { redirect_to(profile_url(@profile.user_id), :notice => 'Profile was successfully created.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end",
"def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n good_change(format, :created)\n else\n bad_change(format, :new)\n end\n end\n end",
"def create\n if ! params[:profile].blank? && DeveloperProfile.to_s == params[:profile][:type]\n @profile = DeveloperProfile.new(params[:profile])\n elsif ! params[:profile].blank? && ContractorProfile.to_s == params[:profile][:type]\n @profile = ContractorProfile.new(params[:profile])\n elsif ! params[:developer_profile].blank?\n @profile = DeveloperProfile.new(params[:developer_profile])\n elsif ! params[:contractor_profile].blank?\n @profile = ContractorProfile.new(params[:contractor_profile])\n end\n @profile.user_id = current_user.id\n @profile.website = nil\n\n respond_to do |format|\n if @profile.save\n @profile.user.send_welcome_notification\n format.html { \n if(current_user.sign_in_count == 1 && current_user.project_privileges.present?)\n redirect_to(project_path(current_user.project_privileges.first.project), :notice => 'Your profile was successfully created. Here is the project you were invited to bid on.') \n elsif(current_user.sign_in_count == 1 && current_user.invited_by.present?) \n redirect_to(projects_profile_path(current_user.invited_by.profile), :notice => 'Your profile was successfully created. Here are some projects from the user that invited you.') \n else\n redirect_to(profile_path(@profile), :notice => 'Profile was successfully created.') \n end\n }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_profile\n Profile.create(user_id: self.id)\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.build_profile(pro_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { redirect_to new_profile_path, alert: 'Please fill all fields' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t# Creating the profile for particular surgeon\n\t\tsurgeon_profile = devise_current_user.setting.build_profile(profile_params) \n\t\t# Condition checking the profile is saved or not\n\t\tif surgeon_profile.save\n\t\t\t# If Profile is save then that's take it into the profile show page\n\t\t\tredirect_to profile_path(surgeon_profile)\n\t\telse\n\t\t\t# If Profile is not save then that's take in into the same page \n\t\t\tredirect_to :back\n\t\tend #Condition End\n\tend",
"def create\n assign_params_to_attributes\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n if @profile.save\n flash[:notice] = I18n.t('profile.create.notice')\n redirect_to user_path(current_user)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.create.error')\n render :action => \"new\"\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.user_id = current_user.id\n authorize! :create, @profile\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n build_identity\n save_identity || render(template: 'profiles/show')\n end",
"def create_profile\n build_emp_perfil\n end",
"def create\n current_user.profile = Profile.new(params[:profile])\n @profile = current_user.profile\n\n if [email protected]?\n flash[:error_created] = @profile.errors.full_messages.join(\"<br>\").html_safe\n redirect_to new_user_profile_path(current_user)\n else\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path(current_user), notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end \n end\n end",
"def create\n # Ensure that we have the right user\n @user = User.find( params[:user_id] )\n # Create profile linked to this specific user\n @profile = @user.build_profile( profile_params )\n @profile.save\n if @profile.save\n flash[:success] = \"Profile updated!\"\n # TODO: Redirect to profile page, once there is one. \n redirect_to user_path(params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :new\n end\n end",
"def create\n @profile = @account.build_profile(profile_attributes)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Анкета успешно сохранена. Ваш магазин добавлен в очередь на оптимизацию.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.profile || Profile.new\n @profile.user_id = current_user.id\n @profile.status = :start\n @profile.save(validate: false)\n session[:profile_id] = @profile.id\n redirect_to vendor_setup_store_index_path\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@user = current_user\n\t\t@profile = @user.build_profile(profile_params) \n\t\tif @profile.save\n\t\t\tflash[:success] = \"Profile successfully created!\"\n\t\t\tredirect_to user_profile_path(@user)\n\t\telse\n\t\t\tflash[:notice] = 'Error: something went wrong.'\n\t\t\trender :action => \"new\" \n\t\tend\n\tend",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_profile\n Profile.create!(member_id:self.id) if self.profile.nil?\n end",
"def create\n if current_user.profile.nil?\n profile = Profile.new(profile_params)\n profile.user = current_user\n if profile.save\n redirect_to profiles_path\n return\n end\n end\n redirect_to profiles_path\n end",
"def create\r\n @profile = Profile.new(profile_params)\r\n\r\n respond_to do |format|\r\n if @profile.save\r\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\r\n format.json { render :show, status: :created, location: @profile }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n # TO DO: make this for just generic creation.\n @profile = Profile.find_by_email(params[:profile][:email])\n @profile.user_id = current_user.id\n\n if @profile.nil?\n @profile = Profile.new(params[:profile])\n add_to_list_niche(params[:profile][:fname], params[:profile][:email], params[:profile][:niche], list_id=ENV[\"MAILCHIMP_LISTID\"])\n @profile.save\n else\n @profile.update_attributes(params[:profile])\n end\n\n redirect_to profiles_path, notice: 'Profile was successfully created.' \n # format.json { render json: @profile, status: :created, location: @profile }\n end",
"def create_profile!\n bundle_id = Sigh.config[:app_identifier]\n name = Sigh.config[:provisioning_name]\n if !name\n name = Sigh.config[:app_identifier].gsub '.' ,''\n end\n\n UI.important \"Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}'\"\n profile = profile_type.create!(name: name,\n bundle_id: bundle_id)\n profile\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user=current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n super\n resource.build_profile\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to profile_url(@profile) }\n format.xml { head :created, :location => profile_url(@profile) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def new\n build_profile\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n if @profile.save!\n redirect_to profile_path(@profile.id)\n else\n render :new\n end\n end",
"def create\n Userprofile.create(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/userprofiles\"\n end",
"def create\n @profile = Profile.new(req_params)\n if @profile.save\n redirect_to new_partnership_path(p_id: @profile.id)\n else\n flash[:profile_attempt] = req_params\n respond_with_submission_error(@profile.errors.messages, new_dummy_profile_path)\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to quit_user_profile_path, notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { render :xml => @profile, :status => :created, :location => @user }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile_detail = ProfileDetail.new(profile_detail_params)\n\t\t@profile_detail.user_id = current_user.id\n respond_to do |format|\n if @profile_detail.save\n format.html { redirect_to edit_profile_detail_path(@profile_detail), notice: 'Profile detail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile_detail }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n profile = Payments::Profile.new(profile_params)\n profile.user = current_user\n\n respond_to do |format|\n if profile.save\n format.html {redirect_to payments_profiles_path}\n else\n format.html {redirect_to :back, flash: {error: \"Error saving payment profile\"}}\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.my_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n \n @profile.user_id = current_user.id\n @profile.full_name = @profile.first_name + @profile.last_name\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => t('alerts.profiles.create') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cleaners_profile = Cleaners::Profile.new(cleaners_profile_params)\n\n respond_to do |format|\n if @cleaners_profile.save\n format.html { redirect_to after_signup_path(:preference) }\n format.json { render action: 'show', status: :created, location: @cleaners_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @cleaners_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @user = current_user\n\n @user.profile = @profile\n @profile.save\n\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile, notice: 'Profile was successfully created.' }\n format.json { render :show, profile: :created, location: profile }\n @profile.create(profile_image: image)\n\n else\n format.html { render :new }\n format.json { render json: status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n work_name\n respond_to do |format|\n if @profile.save\n format.html { redirect_to(@profile, :notice => 'Profile ha sido creado.') }\n format.xml { render :xml => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: t(\"controller.shared.flash.create.notice\", model: pick_model_from_locale(:profile)) }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: t(\"controller.shared.flash.create.status\") }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n current_user.add_role :candidate\n # Send notification to new user that his candidate profile has been created\n RegistrationMailer.registration(@profile.user.id).deliver_now\n\n # Send notification to MOBEEAS Admin that a new candidate user has been created\n RegistrationMailer.new_user_notification(@profile.user.id).deliver_now\n\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team_profile = TeamProfile.new(team_profile_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_team_profile\n format.html { redirect_to redirect_target(@team_profile), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @team_profile }\n else\n 5.times { @team_profile.team_memberships.new }\n 1.times { @team_profile.subsets.new }\n format.html { render :new }\n format.json { render json: @team_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @presenter = find_presenter\n if @presenter.presenter_profile.nil?\n new_profile = profile_params\n new_profile[:bio_edit] = sanitize_bio(new_profile[:bio_edit])\n @presenter_profile = @presenter.build_presenter_profile(new_profile)\n #submit to admin for approval\n if params[:submit]\n @presenter_profile.status = :pending_admin\n if @presenter_profile.save\n flash[:info] = \"Profile submitted to admin for approval\"\n notify_admin_profile_changes(@presenter)\n redirect_to root_url\n else\n render 'new'\n end\n #save draft\n else\n @presenter_profile.status = :new_profile\n if @presenter_profile.save\n flash[:info] = \"Profile draft saved. Go to edit profile to continue editing.\"\n redirect_to root_url\n else\n render 'new'\n end\n end\n else\n redirect_to edit_presenter_profile_path(@presenter)\n end \n end",
"def create\n @profile = Profile.new(profile_params)\n if params['internal_setting_ids'].present?\n params['internal_setting_ids'].each do |internal_setting_id|\n @profile_internal_setting = @profile.profile_internal_settings.build(:internal_setting_id => internal_setting_id)\n @profile_internal_setting.save\n end \n end\n\n if params['email_access_ids'].present?\n params['email_access_ids'].each do |email_access_id|\n @profile_email_access = @profile.profile_email_accesses.build(:email_access_id => email_access_id)\n @profile_email_access.save\n end \n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @current_object = Profile.new(params[:profile])\n respond_to do |format|\n if @current_object.save\n \n @current_object.create_profile_workspace\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to admin_profile_path(@current_object.id) }\n format.xml { render :xml => @current_object, :status => :created, :location => @current_object }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @current_object.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_DB_profile\n \n @profile = ProfileId.new\n @profile.user_name = params[:user_name]\n @profile.profile_id = @parsed[\"profileId\"]\n @profile.save\n end",
"def create\n \t@profile = Profile.new(profile_params)\n\n \trespond_to do |format|\n if @profile.save\n UserMailer.delay.registration_confirmation(@profile)\n format.json { render action: 'show', status: :create, location: @profile }\n else\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ProfileType = ProfileType.new(params[:profile_type])\n\n respond_to do |format|\n if @ProfileType.save\n format.html { redirect_to profile_types_path, notice: 'Profile Type was successfully created.' }\n format.json { render json: @ProfileType, status: :created, location: @ProfileType }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ProfileType.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.member = self.current_member\n\n respond_to do |format|\n if @profile.save\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to [self.current_member, @profile] }\n format.xml { head :created, :location => [self.current_member, @profile] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def create\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, :notice => 'Корисничкиот профил е успешно создаден.' }\n format.json { render :json => @user_profile, :status => :created, :location => @user_profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.site_identifier = params[:profile][:site_identifier]\n\n respond_to do |format|\n if @profile.save\n# current_user.default_profile = @profile\n set_banner\n format.html do\n redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: profile_home_path(@profile.site_identifier) }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(user_profile_params) \n\n respond_to do |format| \n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render :show, status: :created, location: @user_profile }\n else\n format.html { render :new }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.build_profile( profile_params )\n\t\tif @profile.save\n\t\t\tflash[:success] = \"You've created your dealership profile. Good selling!\"\n\t\t\tredirect_to user_path( params[:user_id] )\n\t\telse\n\t\t\trender action: :new\n\t\tend\n\tend",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7368892",
"0.7281008",
"0.725927",
"0.715911",
"0.715303",
"0.71288437",
"0.712776",
"0.7120326",
"0.71195096",
"0.710331",
"0.70945865",
"0.7083587",
"0.70573777",
"0.70516586",
"0.70354134",
"0.70191014",
"0.7003004",
"0.6989452",
"0.69835776",
"0.6982259",
"0.6982148",
"0.6974595",
"0.6973803",
"0.6964703",
"0.6952492",
"0.69446516",
"0.6944458",
"0.6941587",
"0.6935409",
"0.6934993",
"0.6934993",
"0.6934993",
"0.6934993",
"0.6934993",
"0.6934993",
"0.6934993",
"0.6932084",
"0.69283825",
"0.69250953",
"0.69250953",
"0.6917819",
"0.6912495",
"0.6910032",
"0.69075465",
"0.6907128",
"0.6907128",
"0.6907128",
"0.690121",
"0.690121",
"0.690121",
"0.690121",
"0.690121",
"0.690121",
"0.690121",
"0.690121",
"0.6890547",
"0.68881214",
"0.6850511",
"0.6846165",
"0.68430865",
"0.68338066",
"0.68261313",
"0.682544",
"0.68211997",
"0.6816948",
"0.68121827",
"0.6812095",
"0.6811663",
"0.6792311",
"0.6787807",
"0.67783284",
"0.67757344",
"0.67692417",
"0.676541",
"0.6761225",
"0.6761225",
"0.6761225",
"0.67440015",
"0.67340505",
"0.6724496",
"0.66982454",
"0.6697547",
"0.6677437",
"0.66731405",
"0.66720086",
"0.6661882",
"0.66598016",
"0.66541016",
"0.6645787",
"0.6641394",
"0.6634894",
"0.6625073",
"0.66247183",
"0.6623975",
"0.6620772",
"0.6619793",
"0.66014284",
"0.6596118",
"0.6590051",
"0.6586493"
] | 0.68932724 | 55 |
3.6 Test and build the edit action create the edit action in the profiles_controller remember that the user_id comes from the url /users/123/profile/edit | def edit
user = User.find(params[:user_id])
@profile = user.profile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @user = User.find(params[:user_id])\n @profile = @user.profile\n \n end",
"def edit_profile\n \t@user = UsersService.findUserById(params[:id])\n \tuser = UsersService.findUserById(params[:id])\n \t@user_profile_form = UserProfileForm.new(UserProfileForm.attributes(user, :edit_profile))\n end",
"def edit\n @user = User.find (params[:user_id])\n @profile = @user.profile\n end",
"def edit\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\tend",
"def edit_profile\n @user = UserService.getUserById(params[:id])\n @profile_form = ProfileForm.new(ProfileForm.initialize(@user, :new_profile))\n end",
"def edit_profile\n @user = User.find params[:id]\n end",
"def edit\n @profile = User.find(params[:id])\n end",
"def edit\n redirect_to action: 'edit_profile'\n end",
"def edit_profile\n end",
"def edit\n @user = current_user\n @profile = current_user.profile\n end",
"def edit\n @user.profile ||= Profile.new\n @profile = @user.profile\n end",
"def edit\n # @user = User.find(params[:id]) -- not needed bc of correct_user\n end",
"def profile_edit\n @user = User.find(current_user.id)\n end",
"def edit\n @title = \"Edit Profile\"\n @user = current_user\n @user.profile ||= Profile.new\n @profile = @user.profile\n if param_posted?(:profile)\n if @user.profile.update_attributes(params[:profile])\n flash[:notice] = \"Changes saved.\"\n # redirect_to :controller => \"profile\", :action => \"index\"\n end\n end\n end",
"def edit\n #set @profile to the current profile, which was linked from the home index view\n @profile = Profile.find(params[:id]) \n end",
"def user_profile_edit\n\n\n end",
"def edit\n @profile = Profile.find(current_user.id)\n end",
"def atest_ID_25845_edit_profile_edit_profile_details\n # Need clarification\n end",
"def edit\n @user.build_user_profile unless @user.user_profile\n end",
"def edit\n # @user = User.find(params[:id])\n # already in correct_user\n end",
"def edit\n @user.build_profile if @user.profile.blank?\n end",
"def edit\n #@user = User.find(params[:id]) \n #replced by the before_action at the top\n end",
"def edit\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end",
"def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's information in the appropriate input field.\n @id = params[:id]\n @user = User.find(@id)\n end",
"def edit_profile\n \t@user = current_user\n end",
"def edit\n # @user = User.find(params[:id]) <-- not needed; @user defined in correct_user\n end",
"def edit\n @userToEdit = User.find(params[:id])\n end",
"def edit\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end",
"def edit\n\t\tif not user_signed_in? # if user is not signed in, they should not be allowed to view this page or be redirected\n\t \t\trespond_to do |format|\n\t \t\t\tformat.html { redirect_to root_url }\n\t \t\tend\n\t \t\treturn\n\t \tend\n\t \t\n\t \t@user_profile = Profile.where('id = ?',params[:profile_id]).first\n\t \tif @user_profile.nil? or @user_profile.user_id.to_i != current_user.id.to_i # if the current profile id does not exist, then cannot proceed; if not our profile, cannot proceed: not authorized\n\t \t\trespond_to do |format|\n\t \t\t\tformat.html { redirect_to root_url }\n\t \t\tend\n\t \t\treturn\n\t \tend\n\t \t\n\t @resume = Resume.where('id = ? AND profile_id = ?',params[:id],@user_profile.id).first\n\t if @resume.nil?\n\t \tredirect_to :action => :new # if there actually isn't any image to edit, must redirect them to make a new one, as it is not recognized\n\t end\n\tend",
"def edit\n authorize! :edit, @profile\n end",
"def edit\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n end",
"def edit\n \tif not user_signed_in? # if user is not signed in, they should not be allowed to view this page or be redirected\n \t\trespond_to do |format|\n \t\t\tformat.html { redirect_to root_url }\n \t\tend\n \t\treturn\n \tend\n \t\n \t@user_profile = Profile.where('id = ?',params[:profile_id]).first\n \tif @user_profile.nil? or @user_profile.user_id.to_i != current_user.id.to_i # if the current profile id does not exist, then cannot proceed; if not our profile, cannot proceed: not authorized\n \t\trespond_to do |format|\n \t\t\tformat.html { redirect_to root_url }\n \t\tend\n \t\treturn\n \tend\n \t\n @image = Image.where('id = ? AND profile_id = ?',params[:id],@user_profile.id).first\n if @image.nil?\n \tredirect_to :action => :new # if there actually isn't any image to edit, must redirect them to make a new one, as it is not recognized\n end\n end",
"def edit\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by(:id => the_user_id)\n\tend",
"def edit\n @help = PageContent.find_by_name(\"profile-help\") # \"What to include in profile\" Content\n @presenter = find_presenter\n @presenter_profile = @presenter.presenter_profile\n if @presenter_profile.nil?\n redirect_to new_presenter_profile_path(@presenter)\n end\n #displays current profile information for editing \n if !@presenter_profile.bio_edit.nil?\n if @presenter_profile.approved? && @presenter_profile.bio_edit.empty?\n @presenter_profile.bio_edit = @presenter_profile.bio\n end\n else\n if @presenter_profile.approved?\n @presenter_profile.bio_edit = @presenter_profile.bio\n end\n end\n end",
"def edit\n # find the user we want to edit by id\n # this will send the @user to the edit page with a form\n @user = User.find(params[:id])\n end",
"def edit\n\t\t\t@user = User.find(params[:id])\n\t\t\t@jobseeker1 = Jobseeker.find_by(:user_id => @user.id)\n\n\t\tif @jobseeker1\n\t\t\t@jobseeker = @jobseeker1\n\t\t\t@title = \"Edit Profile\"\n\t\telse\n\t\t\tflash[:notice] = \"we don't have your profile yet, create one!\"\n\t\t\t#don't use render 'new' because it refers to @jobseeker from this action(and in this section of action, its nil.)\n\t\t\tredirect_to new_jobseeker_path\n\t\tend\n\t\t\n\tend",
"def edit\n \t@user = User.find params[:id]\n end",
"def edit\n #Lesson 9\n # @user = User.find(params[:id]) #commented out and moved down to correct_user\n end",
"def edit\n \n @user = User.find(params[:id])\n \n end",
"def edit\n # Listing 9.14: Finding the correct user is now handled by the correct_user before_action.\n end",
"def edit\n\t@user = User.find(params[:id])\nend",
"def update\n # Retrieve user from the database\n @user = User.find(params[:user_id])\n # Assign user profile to an instance variable\n @profile = @user.profile\n # Mass assign edited profile attributes and save. \n if @profile.update_attributes(profile_params)\n flash[:success] = \"Profile updated!\"\n # Redirect to profile page. \n redirect_to user_path(id: params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :edit\n end\n end",
"def edit\n # this finds the current user\n @user = User.find params[:id]\n end",
"def edit\n @user = User.find params[:id]\n end",
"def edit\n # @user is already set by correct_user\n # @user = User.find(params[:id])\n end",
"def edit\n\n @profile = Profile.friendly.find(params[:id])\n\n end",
"def editProfile\n user = User.find(session[:user_id])\n user.firstName = params[:user][:firstName]\n user.lastName = params[:user][:lastName]\n user.age = params[:user][:age]\n user.about = params[:user][:about]\n user.location = params[:user][:location]\n user.save\n redirect_to :controller => :users, :action => :home\n end",
"def edit\n\t\t#Find the Particular Profile\n\t\t@surgeon_profile = @profile\n\tend",
"def update\n @user = User.find( params[:user_id] ) #establish which user profile we are editing \n @profile = @user.profile #store user profile data in @profile variable \n if @profile.update_attributes(profile_params) # checking in db if data is updated\n flash[:success] = \"Profile Updated!\"\n redirect_to user_path( params[:user_id] ) # display the edited profile\n else\n render action: :edit #redirecting user to edit page\n end\nend",
"def edit\r\n\r\n @user_attributes = params[:user] ? params[:user][params[:id]].clone : {}\r\n @user_attributes.merge!(:id => params[:id]) if @user_attributes\r\n @user_attributes.delete(:active) if @user_attributes && restrict_active_for_edit_5\r\n @user_attributes.delete(:password) if @user_attributes && restrict_password_for_edit_5\r\n @user_attributes.delete(:hashed_password) if @user_attributes && restrict_hashed_password_for_edit_5\r\n @user_attributes.delete(:salt) if @user_attributes && restrict_salt_for_edit_5\r\n @user_attributes.delete(:last_login) if @user_attributes && restrict_last_login_for_edit_5\r\n @user_attributes.delete(:last_session_id) if @user_attributes && restrict_last_session_id_for_edit_5\r\n @user_attributes.delete(:user_accesses) if @user_attributes && restrict_user_accesses_for_edit_5\r\n @user_attributes.delete(:accesses) if @user_attributes && restrict_accesses_for_edit_5\r\n @user_attributes.delete(:profiles) if @user_attributes && restrict_profiles_for_edit_5\r\n @user = User.load_from_params(@user_attributes)\r\n if @user.nil?\r\n flash[:warning] ||= []\r\n flash[:warning] << _(\"Warning: %{obj} with ID %{id} does not exist!\") % {:obj => 'user', :id => params[:id]}\r\n redirect_to(:action => :index)\r\n return\r\n end\r\n\r\n render(:layout => !request.xhr?)\r\n end",
"def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n # when edit profile\n when 1\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n user.save!\n\n # Assigning form[:user] with user object\n form[:user] = user\n\n # Returning the form\n form\n # when 2 back to view profile\n when 2\n\n view_profile(form)\n else\n form[:flash_msg] = \"Wrong option entered, please retry.\"\n edit_profile(form)\n end\n view_profile(form)\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @page_title = 'Edit user'\n @user = User.find(params[:id])\n end",
"def edit\n @user = @current_user\n @web_profile = WebProfile.find(params[:id])\n \n respond_to do |format|\n format.js do\n replace_content(dom_id(@web_profile), :partial => 'edit')\n end\n end\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:user_id])\n end",
"def edit\n @user = User.find(params[:user_id])\n end",
"def atest_ID_25835_edit_profile_desc\n login_as_user1\n go_to_edit_profile_page\n verify_elements_on_edit_profile \"test_ID_25835_edit_profile_desc\"\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @user = User.find(params[:id])\n end",
"def edit\n @title = \"sipbib: edit profile\"\n @user = User.find(session[:user_id])\n @user.spec ||= Spec.new\n @spec = @user.spec\n \n if param_posted?(:spec)\n if @user.spec.update_attributes(params[:spec])\n flash[:notice] = \"Changes saved.\"\n redirect_to :controller => \"user\", :action => \"index\"\n end\n end\n end",
"def update\n @profile = Profile.find_by_user_id params[:user_id]\n\n if @profile.update_attributes(params[:profile])\n redirect_to user_profile_path(params[:user_id])\n else\n flash[:alert] = @profile.errors.full_messages.join(\",\")\n render :template => \"profiles/edit\"\n end\n\n end",
"def edit\n\t\t@user = User.find(params(:id))\n\tend",
"def edit\n @profile = @author.profile\n end",
"def edit\n # loads user from the database\n @user = User.find(params[:id])\n end"
] | [
"0.82292175",
"0.8139889",
"0.80937594",
"0.80321246",
"0.7968097",
"0.7961251",
"0.7933089",
"0.785956",
"0.7831531",
"0.77892554",
"0.7725336",
"0.76898813",
"0.76276433",
"0.7627627",
"0.7610835",
"0.75770247",
"0.75492406",
"0.75257677",
"0.75079554",
"0.74738127",
"0.74666363",
"0.7379214",
"0.7364002",
"0.7354942",
"0.7340917",
"0.7327405",
"0.7325067",
"0.73189276",
"0.72933733",
"0.727709",
"0.7275941",
"0.72667134",
"0.724149",
"0.7241441",
"0.71613836",
"0.7161132",
"0.7147606",
"0.7138988",
"0.71301883",
"0.712291",
"0.71186423",
"0.71076494",
"0.709698",
"0.70886075",
"0.70824075",
"0.7077845",
"0.707437",
"0.7056603",
"0.7048514",
"0.7031619",
"0.70292526",
"0.7020173",
"0.70148313",
"0.70095176",
"0.7005984",
"0.7005303",
"0.7005303",
"0.7003531",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.700165",
"0.70004934",
"0.6999352",
"0.69963574",
"0.69880986",
"0.69843453"
] | 0.8153776 | 1 |
3.7 Test and build the update action create the update action in the app/controllers/profiles_controller.rb | def update
@profile = Profile.find_by_user_id params[:user_id]
if @profile.update_attributes(params[:profile])
redirect_to user_profile_path(params[:user_id])
else
flash[:alert] = @profile.errors.full_messages.join(",")
render :template => "profiles/edit"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @profile = Profile.find params[:profile_id]\n @update = @profile.updates.new(update_params)\n\n respond_to do |format|\n if @update.save\n format.html { redirect_to update_path(@update), notice: 'Update was successfully created.' }\n format.json { render :show, status: :created, location: @update }\n else\n format.html { render :new }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_profile\n # login_as(:patrick)\n # put :update, :id => profiles(:profile_00006).id, :profile => { }\n # assert_redirected_to profile_path(assigns(:profile))\n end",
"def update\n # render :text => \"<pre>#{params.to_yaml}</pre>\" and return\n @profile = Profile.find(params[:id])\n # @profile = Profile.find_or_create_by_user_id(@user.id)\n unless params.empty?\n @profile.update_attributes(params[:profile])\n @profile.user.update_attributes(params[:user])\n end\n respond_to do |format|\n if @profile.errors.empty? && @profile.user.errors.empty?\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors + @profile.user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_profile\n @profile = Profile.find(params[:id])\n @profile.update_attribute(:field_name,params[:field_name])\n @profile.update_attribute(:field_type,params[:field_type])\n redirect_to(\"/profiles/create_profile/#{@profile.structure_component_id}\")\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end",
"def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n logger.debug(\"UPDATE PROFILE @profile = #{@profile.inspect}\")\n logger.debug(\"UPDATE PROFILE params = #{params[:profile].inspect}\")\n logger.debug(\"UPDATE PROFILE update_attributes #{@profile.update_attributes(params[:profile]).inspect}\")\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes profile_params\n format.html { redirect_to(@profile, notice: 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n @original_profile = Profile.find(@profile.id)\n format.html { render action: \"edit\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @update.update(update_params)\n format.html { redirect_to profile_updates_url(@update.profile), notice: 'Update was successfully updated.' }\n format.json { render :show, status: :ok, location: @update }\n else\n format.html { render :edit }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find( params[:user_id] ) #establish which user profile we are editing \n @profile = @user.profile #store user profile data in @profile variable \n if @profile.update_attributes(profile_params) # checking in db if data is updated\n flash[:success] = \"Profile Updated!\"\n redirect_to user_path( params[:user_id] ) # display the edited profile\n else\n render action: :edit #redirecting user to edit page\n end\nend",
"def update\n # Retrieve user from the database\n @user = User.find(params[:user_id])\n # Assign user profile to an instance variable\n @profile = @user.profile\n # Mass assign edited profile attributes and save. \n if @profile.update_attributes(profile_params)\n flash[:success] = \"Profile updated!\"\n # Redirect to profile page. \n redirect_to user_path(id: params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :edit\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html {\n flash[:notice] = t('Profile was successfully update.')\n redirect_to home_path\n }\n format.json { render json: {ok: true}, status: :ok }\n else\n format.html { redirect_to profile_edit_url, notice: t('Profile not saved !') }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n @profile = Profile.find_by_id(params[:id])\n @updateFor = params[:type]\n @message = \"Update successfully...\"\n if @updateFor==\"ProfileInformation\"\n @profile_update=profile_params\n @profile_update[:dob] = Date.strptime(@profile_update[:dob], '%m/%d/%Y')\n \n @profile_update[:height] = CustomMethods.convert_to_float(@profile_update[:height])\n user_type=current_user.position\n if user_type != \"Member\" && @profile.gender != @profile_update[:gender]\n ProfileMatch.delete_other_user_matches(current_user.id)\n ProfileMatch.delete_matches(current_user.user_id)\n end\n #@profile_update[:height]= convert_to_float(profile_params[:height],params[:height_inch])\n if @profile.update(@profile_update)\n \n @profile.user.first_name=user_params[\"first_name\"]\n @profile.user.last_name=user_params[\"last_name\"]\n @profile.user.region=user_params[\"region\"]\n photos= @profile.user.photos\n if photos.present?\n photos.update_all(:private_pic=>@profile.photo)\n end\n @profile.user.save \n #after updation report admin\n role=UserRole.get_roles(current_user)\n else\n @message = \"Something went wrong\"\n end\n elsif @updateFor==\"OnlyProfile\"\n @profile_update=profile_params\n if @profile.update(@profile_update) \n puts 'updated profile'\n else\n @message = \"Something went wrong\"\n end\n elsif @updateFor==\"OnlyRegion\"\n @profile.user.region=user_params[\"region\"]\n @profile.user.save \n elsif @updateFor == \"PartnerPreferences\"\n @partner_preferences = PartnerPreference.find_by_user_id @profile.user_id\n @partner_preferences_update=partner_preferences_params\n @partner_preferences_update[:height_from] = CustomMethods.convert_to_float(@partner_preferences_update[:height_from])\n @partner_preferences_update[:height_to] = CustomMethods.convert_to_float(@partner_preferences_update[:height_to])\n if !@partner_preferences.present?\n @partner_preferences = PartnerPreference.new(@partner_preferences_update)\n @partner_preferences.user_id = @profile.user_id\n @deal_breaker = DealBreaker.new\n if @partner_preferences.save\n @deal_breaker.partner_preference_id = @partner_preferences.id\n @deal_breaker.save\n end\n end\n @partner_preferences = PartnerPreference.find_by_user_id @profile.user_id\n if @partner_preferences.update(@partner_preferences_update)\n @deal_breaker = DealBreaker.find_by_partner_preference_id @partner_preferences.id \n if @deal_breaker.present?\n @deal_breaker.update(deal_breaker_params)\n end\n end \n end\n @profile=Profile.find_by(id: @profile.id)\n User.update_elastic(@profile.user)\n render json: {\n status: 200,\n message: @message,\n profile:@profile\n }.to_json\n end",
"def edit\n @title = \"Edit Profile\"\n @user = current_user\n @user.profile ||= Profile.new\n @profile = @user.profile\n if param_posted?(:profile)\n if @user.profile.update_attributes(params[:profile])\n flash[:notice] = \"Changes saved.\"\n # redirect_to :controller => \"profile\", :action => \"index\"\n end\n end\n end",
"def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n good_change(format, :ok)\n else\n bad_change(format, :edit)\n end\n end\n end",
"def update\n # @profile = Profile.find(profile_params[:id])\n @user = current_user\n @profile = @user.profile\n # @user.profile = @profile\n # redirect_to(profile_path)\n\n # @user.update(user_params) #from the private method below - whitelist check\n\n \n\n respond_to do |format|\n if @profile.update(profile_params)\n\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n # byebug\n if @profile.update(profile_params)\n format.html { redirect_to vendor_path(current_user.username), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def atest_ID_25845_edit_profile_edit_profile_details\n # Need clarification\n end",
"def update_profile(params)\n post 'account/update_profile', :post => params\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Din profil uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n # This must be update_attributes, to do validations\n if @profile.update(profile_params)\n format.html { redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n else\n format.html { render :edit }\n format.json { render json: @profiles.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @presenter = find_presenter\n @presenter_profile = @presenter.presenter_profile\n \n if @presenter_profile.nil?\n redirect_to new_presenter_profile_path(@presenter)\n else\n new_profile = profile_params\n new_profile[:bio_edit] = sanitize_bio(new_profile[:bio_edit])\n if !new_profile.has_key?(:picture_edit)\n new_profile[:picture_edit] = nil\n end\n #submit for approval\n if params[:submit]\n if @presenter_profile.update(new_profile)\n #checks profile has been changed\n if @presenter_profile.bio != @presenter_profile.bio_edit || @presenter_profile.picture_edit_stored?\n if current_user.user_type == \"admin\"\n @presenter_profile.update_attribute(:status, :pending_presenter)\n flash[:info] = \"Profile changes submitted to presenter for approval\"\n Notification.send_message(@presenter.user, \"You have pending profile changes to review from an Admin\", presenter_profile_path(@presenter), :system)\n redirect_to admin_path\n else #current user is profile owner\n @presenter_profile.update_attribute(:status, :pending_admin)\n flash[:info] = \"Profile changes submitted to admin for approval\"\n notify_admin_profile_changes(@presenter)\n redirect_to root_url\n end\n else # No changes were made\n @presenter_profile.bio_edit = ''\n @presenter_profile.picture_edit = nil\n flash[:warning] = 'No changes were made, please make changes before pressing submit'\n redirect_to edit_presenter_profile_path(@presenter)\n end\n else\n render 'edit'\n end\n #save draft\n elsif params[:save]\n if @presenter_profile.update(new_profile)\n if current_user.presenter?\n @presenter_profile.update_attribute(:status, :draft_presenter)\n flash[:info] = \"Profile draft saved. Go to edit profile to continue editing.\"\n redirect_to presenters_path\n else #current_user.admin?\n @presenter_profile.update_attribute(:status, :draft_admin)\n flash[:info] = \"Profile draft saved for #{@presenter.first_name}'s profile.\"\n redirect_to admin_path\n end\n else\n render 'edit'\n end\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Ваш профиль успешно обновлён\"\n format.html { redirect_to(profile_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @profile.update(profile_params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @profile.update(pro_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n Rails.logger.info(\"PARAMS: #{profile_params}\")\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n work_name\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile ha sido modificado.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # puts \"profile_params: #{profile_params[:sport_ids]}\"\n\n respond_to do |format|\n begin\n if current_user != @profile.user\n performing_follow?\n @profile.user.toggle_followed_by(current_user)\n # the next two lines are all about the redirecting or the 'resheshing' of a page so that you can see the result of follow and unfollow without having to refresh.\n format.html { redirect_to @profile.user }\n format.json { render :show, status: :ok, location: @profile }\n end\n\n @profile.update(profile_params)\n # add skill objects and save to db\n # profile_params[:sport_ids].each do |sport_id|\n # Skill.create!(profile_id: @profile.user.id, sport_id: sport_id)\n # end\n format.html { redirect_to profile_url, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n rescue\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to user_path, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile\n @profile = @account.employee\n \n if params[:profile].present?\n @profile.assign_attributes(profile_params)\n @profile.save\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {success: 'Profile has been updated successfully.'}\n else\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {error: 'Profile update failed. Please try again!'}\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(profile_attributes)\n format.html { redirect_to root_path, notice: 'Анкета успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n #format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n #format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateProfile\r\n errors ||= Array.new\r\n\t\tdataHash = {\r\n user_id: params[:user].id,\r\n asset_id: params[:asset_id],\r\n\t\t\tfname: params[:fname],\r\n\t\t\tlname: params[:lname],\r\n\t\t\tgender: params[:gender],\r\n\t\t\tbio: params[:bio],\r\n\t\t\tfamilyStatus: params[:familyStatus],\r\n\t\t\tbdate: params[:bdate]\r\n\t\t}\r\n\t\terrors = Api::Init.MembersControl.checkProfileParams(dataHash)\r\n\t\tif errors.count != 0 \r\n\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['profile_errors'],I18n.t(\"errors.messages.users.profile_errors\"), errors).to_json\r\n else\r\n \tuserProfileObject = UsersProfile.byUser(params[:user].id).first\r\n userProfileObject.updateProfile(dataHash)\t\r\n self.default_response\r\n end\r\n\tend",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\[email protected]_columns(profile_params)\n\t\trespond_with @profile \n\tend",
"def update\n if @profile.update_attributes(profile_params)\n redirect_to @profile, notice: \"Your profile has been updated\"\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to profile_path(@profile.user_id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if performing_follow?\n #unfollow or follow depending on what in the database\n @profile.user.toggle_followed_by(current_user)\n\n\n\n elsif @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n if @profile.update_attributes(params[:profile])\n redirect_to @profile, notice: 'Profile was successfully updated.'\n else\n render action: \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html do\n redirect_to @profile,\n notice: \"Profile was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t# Updating the details according the that particular profile\n\t\[email protected]_attributes(profile_params)\n\t\t# Redirect to the particular surgeon profile show page\n\t\tredirect_to profile_path(@profile)\n\tend",
"def update_profile\n @profile_form = ProfileForm.new(profile_params)\n if !@profile_form.valid?\n render :edit_profile\n elsif profile_params[:new_profile].present?\n dir = \"#{Rails.root}/app/assets/profiles/\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profilename = profile_params[:name]+ \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') + \".\" + ActiveStorage::Filename.new(profile_params[:new_profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f|\n f.write(profile_params[:new_profile].read)\n end\n @profile_form.profile = profilename\n update_user_profile(@profile_form)\n else\n update_user_profile(@profile_form)\n end\n end",
"def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_url, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile.update(profile_params)\n respond_with(@profile)\n end",
"def update\n @profile = Account.find(params[:id])\n\t if @profile.update_attributes!(update_params)\n\t if @profile.save\n redirect_to profile_index_path, notice: \"Account was successfully saved.\"\n end\n else\n flash[:alert] = \"Account failed to save\"\n redirect_to profile_index_path\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n \n #@profile.email = \n #puts \"ATRIBUTIIIIIIIIIIIIIi\"\n #for @enProfil in @profile.attribute_names\n # puts @enProfil\n #end\n #puts \"PARAMETRIIIIII\"\n \n #puts \"PROFILE = \" + @profile.to_s\n #puts \"USER = \" + @profile.user.to_s\n #@profile.update_attribute(:email, @profile.email)\n #@profile.update_attribute(:im, \"drekkkk\")\n #@profile.save\n #puts 'PRVI PARAMETER = '+ params[:IM]\n\t\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n \n end",
"def update\n @profile = current_user.profile\n respond_to do |format|\n if @profile\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :text => \"You currently do not have a profile.\" }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(show_user_path(current_user.username)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = self.current_member.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to [self.current_member, @profile] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def update\n authorize @profile\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to quit_user_profile_path , notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params['internal_setting_ids'].present?\n @profile.profile_internal_settings.delete_all\n params['internal_setting_ids'].each do |internal_setting_id|\n @profile_internal_setting = @profile.profile_internal_settings.build(:internal_setting_id => internal_setting_id)\n @profile_internal_setting.save\n end \n end\n\n if params['email_access_ids'].present?\n @profile.profile_email_accesses.delete_all\n params['email_access_ids'].each do |email_access_id|\n @profile_email_access = @profile.profile_email_accesses.build(:email_access_id => email_access_id)\n @profile_email_access.save\n end \n end\n\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_profile\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to '/', notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_update\n \t saveupdateProfile = UsersService.updateProfile(user_profile_params)\n \t if saveupdateProfile \n \t \tredirect_to users_path, notice: \"Successfully Updated!!!.\"\n \t else\n flash[:error] = \"Something wrong in User Update Please Check again.\"\n \t \trender :edit_profile\n \t end\n end",
"def update!(**args)\n @profile_name = args[:profile_name] if args.key?(:profile_name)\n @profile_photo_url = args[:profile_photo_url] if args.key?(:profile_photo_url)\n @profile_url = args[:profile_url] if args.key?(:profile_url)\n @takedown_url = args[:takedown_url] if args.key?(:takedown_url)\n end",
"def update \n if params[:profile][:paypal_payment_token].present?\n if @profile.update_with_payment\n redirect_to @profile, notice: 'Payment was successfully updated.'\n else\n joblog params[:profile]\n redirect_to @profile, warning: 'something broke'\n end\n else\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render json: @profile.id, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n# if @profile.update(profile_params)\n# redirect_to @profile, notice: 'Profile was successfully updated.'\n# else\n# render :edit, warning: 'something dun fucked up'\n# end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile\n\t@user_profile_form = UserProfileForm.new(user_profile_params)\n\tif user_profile_params[:edit_profile].present?\n dir = \"#{Rails.root}/app/assets/profiles/\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profilename = user_profile_params[:name]+ \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') + \".\" + ActiveStorage::Filename.new(user_profile_params[:edit_profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f|\n f.write(user_profile_params[:edit_profile].read)\n \tend\n\t \t@user_profile_form.profile = profilename\n\tend\n \tunless @user_profile_form.valid?\n flash[:error] = \"Something wrong in User Update Please Check again.\"\n render :edit_profile\n else\n redirect_to :action => \"update_confirm\", id: @user_profile_form.id, name: @user_profile_form.name, email: @user_profile_form.email, role: @user_profile_form.role, phone: @user_profile_form.phone, dob: @user_profile_form.dob, address: @user_profile_form.address, profile: @user_profile_form.profile\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to (user_profile_path(current_user)), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @profile.update(profile_params)\n redirect_to @profile\n else\n render :edit\n end\n end",
"def update\n unless session[:session_admin].present?\n session[:session_admin] = current_admin.id\n end\n @not_current = 'no'\n @tab = params[:tab]\n respond_to do |format|\n if @admin_profile.update(admin_profile_params)\n Admin.find(current_admin.id).update_attributes(email: params[:admin_profile][:e_mail])\n unless params[:admin_profile][:avatar].blank?\n loaded = Cloudinary::Uploader.destroy(\"company/#{@admin_profile.id}\", :public_id => \"profiles/#{@admin_profile.id}\", :invalidate => true)\n preloaded = Cloudinary::Uploader.upload(params[:admin_profile][:avatar], :use_filename => true, :public_id => \"profiles/#{@admin_profile.id}\")\n rand = RandCloud.generated_rand(\"profile\",@admin_profile.id,\"/v2#{Random.rand(11)}\")\n end\n\n unless params[:admin_profile][:profile_skills_attributes].blank?\n params[:admin_profile][:profile_skills_attributes].each do |skill|\n unless skill[1][:id].present?\n admin_skill = Admin::ProfileSkill.create({profile_id: @admin_profile.id, name: skill[1][:name], skill: skill[1][:skill]})\n admin_skill.save\n else\n unless params[:selected].blank? \n ids_param = params[:selected]\n ids = convert_to_arr_for_query(ids_param)\n Admin::ProfileSkill.delete_all \"id in #{ids}\"\n else\n admin_skill = Admin::ProfileSkill.find(skill[1][:id]).update({name: skill[1][:name], skill: skill[1][:skill]})\n end\n end\n end\n end\n\n unless params[:admin_profile][:profile_hobbies_attributes].blank?\n params[:admin_profile][:profile_hobbies_attributes].each do |hobby|\n unless hobby[1][:id].present?\n admin_hobby = Admin::ProfileHobby.create({profile_id: @admin_profile.id, name: hobby[1][:name]})\n admin_hobby.save\n else\n unless params[:selected].blank? \n ids_param = params[:selected]\n ids = convert_to_arr_for_query(ids_param)\n Admin::ProfileHobby.delete_all \"id in #{ids}\"\n else\n admin_hobby = Admin::ProfileHobby.find(hobby[1][:id]).update({name: hobby[1][:name]})\n end\n end\n end\n end\n format.html { redirect_to admin_root_path, notice: 'Photo Profile was successfully updated.'}\n format.json { head :no_content}\n format.js\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_profile.errors, status: :unprocessable_entity }\n format.js { @admin_profile }\n end\n end\n end",
"def update_user_profile(profile_form)\n isUpdateProfile = UserService.updateProfile(profile_form)\n if isUpdateProfile\n redirect_to users_path\n else\n asdasd\n render :edit_profile\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to [@stakeholder, @profile], notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: [@stakeholder, @profile] }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.723548",
"0.72085047",
"0.70737624",
"0.7049775",
"0.70371795",
"0.7011227",
"0.69912785",
"0.69685876",
"0.6962347",
"0.68755186",
"0.6830007",
"0.68136936",
"0.68051493",
"0.6794946",
"0.6781554",
"0.6780863",
"0.6779092",
"0.67680085",
"0.67679304",
"0.6767008",
"0.6755748",
"0.67517257",
"0.67307675",
"0.6728772",
"0.6707282",
"0.6702544",
"0.66998994",
"0.6699749",
"0.669693",
"0.6692159",
"0.6689957",
"0.6689957",
"0.66813356",
"0.66747814",
"0.6671025",
"0.6664116",
"0.6664116",
"0.6664116",
"0.6664116",
"0.66614264",
"0.6654963",
"0.66546947",
"0.66527796",
"0.6651666",
"0.66505206",
"0.66475755",
"0.66471374",
"0.6642694",
"0.6642336",
"0.66392636",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.6638873",
"0.66380644",
"0.66349876",
"0.6629719",
"0.6628296",
"0.66262156",
"0.6619687",
"0.66159666",
"0.6615419",
"0.66127896",
"0.66127896",
"0.66127896",
"0.66119593",
"0.66099316",
"0.66092944",
"0.66064733",
"0.6605685",
"0.6590632",
"0.65831035",
"0.65773773",
"0.65692776",
"0.6565358",
"0.655068",
"0.6547045",
"0.6543048",
"0.6539671",
"0.6538194",
"0.6533483",
"0.6518999",
"0.651746",
"0.6512299",
"0.6511852",
"0.65087",
"0.65056896",
"0.6498819",
"0.6494343"
] | 0.6672205 | 34 |
Adds a string as an additional private credential to be combined in the collection. | def add_private(private_str='')
additional_privates << private_str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(new_creds)\n @credentials.merge!(new_creds) { |_, old_val, new_val| old_val + new_val }\n end",
"def addCredentials(credential)\n\t\[email protected](credential)\n\tend",
"def add_restricted_string(string)\n @restricted_strings.push(string)\n end",
"def add_credential(db, username, password)\n @credentials ||= {}\n @credentials[db] = [ username, password ]\n apply_credentials\n end",
"def add_credentials!\n @accessor.auth_manager.add_credentials(self)\n end",
"def add_credential(source_id, tenant: user_tenant_account)\n {'id' => source_id.to_s, 'username' => 'admin', 'password' => 'smartvm', 'resource_id' => source_id.to_s, 'resource_type' => 'Endpoint', 'tenant' => tenants[tenant]['external_tenant']}\n end",
"def add_credential(credential_type)\n raise ArgumentError, \"The new credential type cannot be nil\" unless credential_type\n raise ArgumentError, \"The new credential type cannot be empty\" if credential_type.empty?\n\n new_credential = self.service.object_mask(NetworkStorageCredential.default_object_mask).assignNewCredential(credential_type.to_s)\n \n @credentials = nil\n\n NetworkStorageCredential.new(softlayer_client, new_credential) unless new_credential.empty?\n end",
"def add_credential(env, type, credential)\n credentials = env[CREDENTIALS_ENV_KEY] ||= {}\n\n raise ArgumentError, \"credential #{type} already added to request\" if credentials.key?(type)\n credentials[type] = credential\n\n env\n end",
"def add_credential(rack_env, type, credential)\n Env.new(rack_env).tap do |env|\n env.credentials[type] = credential\n end.to_rack\n end",
"def add_string(string)\n @strings << string\n end",
"def add_public(public_str='')\n additional_publics << public_str\n end",
"def add_credentials(post = {})\n post[:ext_person_source_id] = credentials[:ext_person_source_id]\n post[:source_username] = credentials[:username]\n post[:source_password] = credentials[:password]\n post[:ext_policy_id] = credentials[:ext_policy_id]\n post\n end",
"def add(string)\n \tstring + \"only in America!\"\n end",
"def add_secret(secret)\n #@secrets = [] if @secrets == ['If it does not taste well, you did not add enough butter']\n @secrets << secret\n end",
"def append_enhanced(string)\n string.to_s + '_enhanced'\n end",
"def add_password(password)\n @password = password\n end",
"def add(str)\n # If the thing passes for an URI with host and path we use it as url\n # otherwise as fingerprint. file:// uris would not qualify, we do not\n # presently have a use case for them though.\n if url?(str)\n add_url(str)\n else\n fingerprint_added?(str) ? true : add_fingerprint(str)\n end\n end",
"def privatize(txt)\n private_properties unless defined?(@private_props)\n @private_props.each{|v| txt.gsub!(v,\"-private-\") }\n txt.gsub!(decrypt_string_with_prefix(SS_integration_password_enc), \"-private-\") if defined?(SS_integration_password)\n txt\n end",
"def add_licenses=(value)\n @add_licenses = value\n end",
"def add(name, password, email)\n id = Digest::SHA256.hexdigest name + '_' + password + '_' + email\n id = id[0, 8]\n @names[id] = name\n @passwords[id] = password\n @emails[id] = email\n @stats[id] = { swin: 0, slose: 0, gwin: 0, glose: 0, draw: 0 }\n\n id\n end",
"def license name\n self.licenses << name.to_s\n end",
"def add_password(password)\n if password.is_a?(Array)\n password.each do |p|\n self.add_password(p)\n end\n return @passwords\n end\n if password.is_a?(String)\n @passwords.push(password)\n return @passwords\n end\n raise RuntimeError, \"Invalid password: #{password}\"\n end",
"def add_string\n \"will be created.\"\n end",
"def add(mountString)\n @mtab << mountString\n end",
"def add_secure_hash\n # Per MIGS requirements we must stringify, sort fields alphabetically\n # minus the 'vpc_' prefix, add back the 'vpc_' prefix after sorting,\n # then join all fields as a query string separated by '&'.\n sorted_values = @fields.stringify_keys\n .map { |(k, v)| [k.gsub('vpc_', ''), v] }\n .sort\n .map { |i| \"vpc_#{i[0]}=#{i[1]}\" }\n .join('&')\n hash = OpenSSL::HMAC.hexdigest(HASH_ALGORITHM, [@secret].pack('H*'), sorted_values).upcase\n add_field('vpc_SecureHash', hash)\n add_field('vpc_SecureHashType', 'SHA256')\n end",
"def add_string_protected_status(string)\r\n string.concat(@PARAM_HASH['AMOUNT']) if @PARAM_HASH['PROTECT_AMOUNT'] == 'Yes'\r\n string.concat([@PARAM_HASH['REBILLING'], @PARAM_HASH['REB_CYCLES'], @PARAM_HASH['REB_AMOUNT'], @PARAM_HASH['REB_EXPR'], @PARAM_HASH['REB_FIRST_DATE']].join('')) if @PARAM_HASH['REB_PROTECT'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID']) if @PARAM_HASH['PROTECT_CUSTOM_ID'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID2']) if @PARAM_HASH['PROTECT_CUSTOM_ID2'] == 'Yes'\r\n return string \r\n end",
"def add_string_protected_status(string)\r\n string.concat(@PARAM_HASH['AMOUNT']) if @PARAM_HASH['PROTECT_AMOUNT'] == 'Yes'\r\n string.concat([@PARAM_HASH['REBILLING'], @PARAM_HASH['REB_CYCLES'], @PARAM_HASH['REB_AMOUNT'], @PARAM_HASH['REB_EXPR'], @PARAM_HASH['REB_FIRST_DATE']].join('')) if @PARAM_HASH['REB_PROTECT'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID']) if @PARAM_HASH['PROTECT_CUSTOM_ID'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID2']) if @PARAM_HASH['PROTECT_CUSTOM_ID2'] == 'Yes'\r\n return string \r\n end",
"def ldap_mod_add( attribute, *values )\n\t\treturn LDAP::Mod.new( LDAP::LDAP_MOD_ADD, attribute.to_s, values.flatten )\n\tend",
"def ldap_mod_add( attribute, *values )\n\t\treturn LDAP::Mod.new( LDAP::LDAP_MOD_ADD, attribute.to_s, values.flatten )\n\tend",
"def concat(str)\n @string << str\n self\n end",
"def add_server_address(current_string)\n add_if_present(@server_address, current_string, \" #{@server_address} \")\n end",
"def add(*names)\n extract_and_apply_options!(names)\n concat(names)\n clean!\n self\n end",
"def add(*names)\n extract_and_apply_options!(names)\n concat(names)\n clean!\n self\n end",
"def string_append(string)\n \t\tstring + \" appended\"\n \tend",
"def add_ssl_cert(gear, ssl_cert, priv_key, server_alias, passphrase='')\n args = build_base_gear_args(gear)\n args['--with-ssl-cert'] = ssl_cert\n args['--with-priv-key'] = priv_key\n args['--with-alias-name'] = server_alias\n args['--with-passphrase'] = passphrase\n result = execute_direct(@@C_CONTROLLER, 'ssl-cert-add', args)\n parse_result(result)\n end",
"def add(*names)\r\n extract_and_apply_options!(names)\r\n concat(names)\r\n clean!\r\n self\r\n end",
"def add_stuff(a_string_param)\n a_string_param += \"rutabaga\"\nend",
"def add_users(new_users)\n\n return if new_users.nil?\n\n self.users = '|' if self.users.nil? or self.users.empty?\n self.users += new_users.join('|') + '|'\n end",
"def add_digest(item)\n add_lock_prefix(item)\n add_lock_args(item)\n add_lock_digest(item)\n\n item\n end",
"def string_add(string1, string2)\n puts \"#{string1} #{string2}\"\nend",
"def gist_string(string)\n gist(:string=>string, :private=>true)\n end",
"def add_key(key_string, key_type=nil, comment=nil, login=nil )\n #@container.logger.info \"Adding new key #{key_string} #{key_type} #{comment} #{login}\"\n comment = \"\" unless comment\n\n modify do |keys|\n keys[key_id(comment)] = key_entry(key_string, key_type, comment, login)\n end\n\n end",
"def add_password(password)\n\t\tpassword_input.set(password)\n\tend",
"def add_auth_digest auth, url, client_opts\n uri = URI.parse url\n\n abs_domains = if auth.domain.nil? || auth.domain.empty?\n [ /^https?:\\/\\/[^\\/]+\\//.match(url)[0] ]\n else\n auth.domain.map do |d|\n domain_uri = URI.parse d\n d = URI.join(url, d).to_s if domain_uri.relative?\n d\n end\n end\n\n abs_domains.each do |domain|\n l = @spaces.bsearch_lower_boundary { |x| x.prefix <=> domain }\n space = l < @spaces.length ? @spaces[l] : nil\n\n if space.nil? || space.prefix != domain\n space = AuthSpace.new domain\n @spaces.insert l, space\n end\n space.update_auth auth, client_opts\n end\n end",
"def add_user(user)\n user = user.strip.downcase\n key = key_for('autocomplete')\n (1..(user.length)).each{ |l|\n prefix = user[0...l]\n @redis.zadd(key,0,prefix)\n }\n @redis.zadd(key,0,user+'*')\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def privkey(add_compressed_suffix=false)\n compressed_suffix = add_compressed_suffix && compressed ? \"01\" : \"\"\n [key.private_key.to_s(16) + compressed_suffix].pack('H*')\n end",
"def add_service_name(current_string)\n add_if_present(@service_name, current_string, \" #{@service_name}\")\n end",
"def add_auth_basic auth, url, client_opts\n l = @spaces.bsearch_lower_boundary { |x| x.prefix <=> url }\n space = nil\n\n if l < @spaces.length && self.class.prefix?(@spaces[l].prefix, url)\n space = @spaces[l]\n else\n prefix = url.sub /[^\\/]+$/, '' # chop off until last slash\n \n space = AuthSpace.new prefix\n @spaces.insert l, space\n end\n space.update_auth auth, client_opts\n end",
"def add_creditcard(parameters, creditcard)\n parameters[:CardNo] = creditcard.number\n parameters[:Expire] = expdate(creditcard)\n parameters[:SecurityCode] = creditcard.verification_value\n\n # The GMO API doesn't have name fields, so we add them to the client field\n parameters[:ClientField1] = \"#{creditcard.first_name} #{creditcard.last_name} #{parameters[:ClientField1]}\".strip\n end",
"def add username\n @members.add username\n end",
"def add(key, password = nil)\n if @pw_data[key]\n pa %[There is already a password stored for #{key}. You need to remove it before creating a new one!], :red\n return false\n else\n @pw_data[key] = password || ask_for_password(%[please enter a password for #{key}], :yellow)\n if @pw_data[key].empty?\n pa %[Cannot add an empty password!], :red\n return false\n else\n write_safe\n pa %[The password for #{key} has been added], :green\n return true\n end\n end\n end",
"def add\n request('add').auth_required!\n end",
"def add_license_to_gemspec(license)\n gemspec = TTY::Gemspec.new\n gemspec.read(gemspec_path)\n license_regex = /(^\\s*#{gemspec.var_name}\\.license\\s*=\\s*).*/\n\n if gemspec.content =~ license_regex\n gemspec.content.gsub!(liecense_regex,\n \"\\\\1\\\"#{licenses[license][:name]}\\\"\")\n else\n gem_license = ' ' * gemspec.pre_var_indent\n gem_license << \"#{gemspec.var_name}.license\"\n gem_license << ' ' * (gemspec.post_var_indent - '.license'.size)\n gem_license << \"= \\\"#{licenses[license][:name]}\\\"\"\n gemspec.content.gsub!(/(^\\s*#{gemspec.var_name}\\.name\\s*=\\s*.*$)/,\n \"\\\\1\\n#{gem_license}\")\n end\n gemspec.write(gemspec_path)\n end",
"def third_party_credential(url); end",
"def add_account hash, default=false\n ## fill fields in from default account\n unless default\n [:address, :signature, :gpgkey].each { |k| hash[k] ||= @default_account.send(k) }\n end\n hash[:alternates] ||= []\n hash[:regexen] ||= []\n\n a = Account.new hash\n @accounts << a\n if default\n raise ArgumentError, \"multiple default accounts\" if @default_account\n @default_account = a\n end\n\n ([a.email] + hash[:alternates]).each { |email| @by_email[email] ||= a }\n hash[:regexen].each { |re| @by_regex[Regexp.new(re)] = a }\n end",
"def add(username, realm, password)\n raise DigestFileError, \"Unable to add already existing user #{username} in realm #{realm}\" if has_entry?(username, realm)\n\n new_entry = DigestEntry.new(username, realm, password)\n new_index = @lines.size\n @lines << new_entry.to_s\n @entries[new_entry.key] = { 'entry' => new_entry, 'line_index' => new_index }\n dirty!\n return nil\n end",
"def add_rutabaga_to_string(str)\n str << \"rutabaga\"\nend",
"def rsa_encrypt_with_private(plain_string)\n raise \"No private key set\" unless @private_key\n\n @private_key.private_encrypt(plain_string)\n end",
"def rsa_encrypt_with_private(plain_string)\n raise \"No private key set\" unless @private_key\n\n @private_key.private_encrypt(plain_string)\n end",
"def add_key(user_name, key)\n\tabort \"Cannot add key, user not found!\" unless users(:return => :array).include?(user_name)\n\t@ssh_keys << {:user_name => user_name, :key => key}\n end",
"def add(username, password, algorithm = Algorithm::DEFAULT)\n raise PasswdFileError, \"Unable to add already existing user #{username}\" if has_entry?(username)\n new_entry = PasswdEntry.new(username, password, algorithm)\n new_index = @lines.size\n @lines << new_entry.to_s\n @entries[new_entry.key] = { 'entry' => new_entry, 'line_index' => new_index }\n dirty!\n return nil\n end",
"def add_string(string) \n unless @strings.include? string\n @strings[string] = self.strtab.num_bytes\n self.strtab << BinData::Stringz(string)\n end\n @strings[string]\n end",
"def add_player(player, password)\n @storage.save_player(player, password)\n self.add_object(player)\n end",
"def credential_options\n %w[username password].map do |option|\n next if send(option).to_s.empty?\n \"--#{option}='#{send(option)}'\"\n end.compact.join(' ')\n end",
"def add_student_name(name)\n @student_names << name\n end",
"def append(input, string); end",
"def add2(env, id)\n member = ActiveFedora::Base.find(id)\n return unless env.current_ability.can?(:edit, member)\n env.curation_concern.ordered_members << member\n end",
"def secret\n @options[:credential2]\n end",
"def add_password(a_password)\n self.password_hash = Digest::SHA256.hexdigest(a_password + Rails.application.secrets.salt)\n self.save\n end",
"def add_entry( c, dn, attrs ) # :yields: connection_info, distinguished_name, attributes\n \n self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap\n \n # Ensure no duplicates by casting as a case insensitive, case preserving hash\n attrs = CICPHash.new.merge(attrs)\n # Ensure relativedn is included in the attribute list\n relativedn = dn.split(/,(?!([\\w -]+=[\\w -]+,?){1,}\\\")/).first\n attrs.merge!(Hash[*relativedn.split('=', 2).flatten])\n @ldap.add dn: dn, attributes: attrs\n raise \"Unable to add record: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message == 'Success'\n end",
"def add_license(license_id, source, contents_url = nil)\n LicenseScout::Log.debug(\"[#{type}] Adding #{license_id} license for #{name} from #{source}\")\n license.add_license(license_id, source, contents_url, {})\n end",
"def add_member(str, project)\n if (user = find_member(str))\n set_status(project, :member, user, :add)\n @candidate = nil\n else\n flash_error(:add_members_not_found.t(str))\n end\n redirect_to(project_path(project.id, q: get_query_param))\n end",
"def member_add_secondary_email(team_member_id:, secondary_email_addr:, trace: false)\n query_data = \"{\\\"new_secondary_emails\\\": [{\\\"user\\\": {\\\".tag\\\": \\\"team_member_id\\\",\\\"team_member_id\\\": \\\"#{team_member_id}\\\"},\\\"secondary_emails\\\": [\\\"#{secondary_email_addr}\\\"]}]}\"\n dropbox_query(query: '2/team/members/secondary_emails/add', query_data: query_data, trace: trace)\n end",
"def constructAuthorisationString\n \"GoogleLogin auth=#{@authorisationHash}\"\n end",
"def add_extra_data(data)\n=begin\n data[:extra] = {\n password: 'mypass',\n host: 'myhost',\n port: 'myport',\n }\n=end\n return data\n end",
"def add_password(user_password)\n\t\tpassword_field.set(user_password)\n\tend",
"def add_responsible(responsible)\n users << responsible\n end",
"def auth(string)\n @request_id = rand(1000)\n @string1 = string\n @string2 = TRAILER\n @command_type = COMMAND_AUTH\n \n @packet_size = build_packet.length\n \n return self\n end",
"def add_alias( name )\n\t\t\t@aliases << name\n\t\tend",
"def separator(str)\n @registry << str\n end",
"def add_item(grcy_list, string, i=1)\n grcy_list[string] = i\nend",
"def <<(authenticator)\n add authenticator\n end",
"def add_pass pass\n @passes << pass\n end",
"def add(name_, opts_={})\n @group._add(name_, opts_)\n end",
"def add_oauth(req)\n client.sign!(req)\n end",
"def add(chr)\n @str += chr\n end",
"def + other\n self.class.new @dir, @reg, @dss + other.to_s\n end",
"def add_auth(uri, user, password, realm = T.unsafe(nil), domain = T.unsafe(nil)); end",
"def add_auth(uri, user, password, realm = T.unsafe(nil), domain = T.unsafe(nil)); end",
"def add(symbol, comment)\n # initialize variables (if applicable)\n @sets = Hash.new if @sets.nil?\n # check for double creation\n raise ArgumentError, \"CBAC: PrivilegeSet was already defined: #{symbol.to_s}\" if @sets.include?(symbol)\n # Create record if privilege set doesn't exist\n record = Cbac::PrivilegeSetRecord.find_or_create_by(name: symbol.to_s)\n record.set_comment(comment)\n record.save\n\n @sets[symbol] = record\n end",
"def ingredient_add_helper(recipe_id)\n added_ingredient = prompt.ask(\"What ingredient would you like to add\")\n new_recipe_ingredient_arr = user.recipes.where(id: recipe_id)[0].ingredient.split(\", \") << added_ingredient\n ingredient_change_helper(recipe_id, new_recipe_ingredient_arr)\n end",
"def credential=(_arg0); end",
"def credential=(_arg0); end",
"def credential_source\n super\n end",
"def add_extra(key, value)\n @extras[key] = value\n end",
"def add_stored_credentials(post, options = {})\n stored_credential = options[:stored_credential]\n return unless stored_credential && !stored_credential.values.all?(&:nil?)\n\n post[:payment_method_options] ||= {}\n post[:payment_method_options][:card] ||= {}\n\n card_options = post[:payment_method_options][:card]\n card_options[:mit_exemption] = {}\n\n # Stripe PI accepts network_transaction_id and ds_transaction_id via mit field under card.\n # The network_transaction_id can be sent in nested under stored credentials OR as its own field (add_ntid handles when it is sent in on its own)\n # If it is sent is as its own field AND under stored credentials, the value sent under its own field is what will send.\n card_options[:mit_exemption][:ds_transaction_id] = stored_credential[:ds_transaction_id] if stored_credential[:ds_transaction_id]\n unless options[:setup_future_usage] == 'off_session'\n card_options[:mit_exemption][:network_transaction_id] = stored_credential[:network_transaction_id] if stored_credential[:network_transaction_id]\n end\n\n add_stored_credential_transaction_type(post, options)\n end",
"def add_authorized_key(key)\n queries = password_hash\n case key\n when String\n if File.exist?(key)\n key = File.open(key, \"r\")\n content = key.read.strip\n key.close\n else\n content = key\n end\n when File\n content = key.read.strip\n key.close\n end\n\n queries[:query][:authorized_key] = content\n post \"/setup/api/settings/authorized-keys\", queries\n end",
"def child_add_string_encrypted(name, value, key = nil)\n if(not name or not value)\n abort(\"Invalid input specified for name or value\")\n end\n unless(key)\n key = DEFAULT_KEY\n end\n if (key.length != 16)\n abort(\"Invalid key, key length sholud be 16\")\n end\n #encryption of key and others\n encrypted_value = RC4(key, value)\n unpacked_value = encrypted_value.unpack('H*')\n child_add_string(name, unpacked_value[0])\n end"
] | [
"0.65300107",
"0.6401049",
"0.59690285",
"0.5925183",
"0.56813645",
"0.56536406",
"0.5582447",
"0.5550284",
"0.55226195",
"0.5417151",
"0.541112",
"0.540005",
"0.5381424",
"0.52727056",
"0.5145717",
"0.5123634",
"0.5064708",
"0.49927512",
"0.4960606",
"0.49416938",
"0.4937117",
"0.49281532",
"0.4892112",
"0.4874696",
"0.4828146",
"0.4827693",
"0.4827693",
"0.4801365",
"0.4801365",
"0.4795399",
"0.47944945",
"0.47937748",
"0.47937748",
"0.47747892",
"0.47680715",
"0.47660524",
"0.4755348",
"0.47498545",
"0.47469336",
"0.4743163",
"0.47375458",
"0.47244555",
"0.4700468",
"0.46945095",
"0.46853745",
"0.46773532",
"0.46773532",
"0.4672602",
"0.46530262",
"0.4650203",
"0.46494472",
"0.46486992",
"0.4646047",
"0.46390963",
"0.4638615",
"0.4637975",
"0.46378267",
"0.4636037",
"0.46336788",
"0.4621268",
"0.4621268",
"0.46182016",
"0.4615706",
"0.46076295",
"0.46058807",
"0.46054426",
"0.46028444",
"0.45916215",
"0.4591003",
"0.45894292",
"0.45856026",
"0.45797557",
"0.4571307",
"0.45682573",
"0.45660684",
"0.45655096",
"0.45620015",
"0.4560715",
"0.45498538",
"0.4548284",
"0.45423806",
"0.45397478",
"0.453821",
"0.45355275",
"0.4531268",
"0.45292583",
"0.45270807",
"0.4521286",
"0.4521174",
"0.4519965",
"0.4519965",
"0.4515921",
"0.45147914",
"0.4514268",
"0.4514268",
"0.45055705",
"0.4501528",
"0.45002165",
"0.44984806",
"0.44964397"
] | 0.7572148 | 0 |
Returns true when each will have no results to iterate | def empty?
prepended_creds.empty? && !has_privates?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n self.results.empty?\n end",
"def hasResults?\n ! @results.empty?\n end",
"def empty?\n @iterator.nil?\n end",
"def empty?\n iterator.nil?\n end",
"def my_none?\n status = true\n self.my_each do |item|\n if (yield item) == true\n status = false\n end\n end\n status\n end",
"def empty?\n return true unless @all\n @all.empty?\n end",
"def none?(collection)\n collection.each { |element| return false if yield(element) }\n true\nend",
"def my_all?\n my_each do |i|\n if (!yield(i))\n return false\n end\n end\n true\n end",
"def my_all?\n\t\t#if any element is false return false\n\t\tmy_each do | element |\n\t\t\tif yield( element )\n\t\t\t\tnext\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\t# returns true when all iterations pass\n\t\treturn true\n\n\tend",
"def empty?\n find.limit(1).has_next? == false\n end",
"def any?\n !total_pages.zero?\n end",
"def has_results?\n true\n end",
"def nothing_found?\n @matching_documents.nil? or @matching_documents.entries.empty?\n end",
"def my_none?\n if block_given?\n self.my_each {|n| return false if yield(n) == true}\n return true\n else\n return true if self.size == 0\n self.my_each {|n| return false if n == true}\n return true\n end\n end",
"def my_all?\n status = true\n self.my_each do |item|\n if (yield item) != true\n status = false\n end\n end\n status\n end",
"def empty?\n all.empty?\n end",
"def empty?\n peek\n false\n rescue StopIteration\n true\n end",
"def my_none?(&block)\n counter = 0\n my_each do |elem|\n counter += 1 if block.call(elem) == false\n end\n return true if counter == size\n\n false\n end",
"def my_all? \n\ti = true\n\tself.my_each do |a|\n\t\tunless yield (a)\n\t\t\ti = false\n\t\t\tbreak\n\t\tend\n\tend\n\ti\nend",
"def iterator?() end",
"def all?(collection)\r\n collection.each { |item| return false if !yield(item) }\r\n true\r\nend",
"def no_more?\n more_results == :NO_MORE_RESULTS\n end",
"def my_none?\n self.my_each {|x| return false if yield(x) == true}\n true\n end",
"def my_none?\n all = true\n self.my_each do |x|\n if !block_given?\n if x\n all = false\n end\n elsif yield x\n all = false\n end\n break if all == false\n end\n all\n end",
"def empty?\n self.count == 0\n end",
"def empty?\n self.count == 0\n end",
"def my_all?\n return unless block_given?\n self.my_each do |ele|\n if not yield ele then return false\n end\n end\n return true\n end",
"def my_any?\n status = false\n self.my_each do |item|\n if (yield item) == true\n status = true\n end\n end\n status\n end",
"def my_none?\n\t\tvalue = true\n\t\tself.my_each do |element|\n\t\t\tif yield(element) == true\n\t\t\t\tvalue = false\n\t\t\tend\n\t\tend\n\t\treturn value\n\tend",
"def any_results?\n races.any?(&:any_results?)\n end",
"def __empty?\n all?(&:__empty?)\n end",
"def check_for_no_results(hash_of_results)\n if hash_of_results[JSON_NUMBER_OF_RESULTS] == 0\n puts 'No results, try again'\n go\n end\n end",
"def empty?\n count == 0\n end",
"def empty?\n count == 0\n end",
"def has_results?\n !(name == 'aggregate' &&\n pipeline.find {|op| op.keys.include?('$out') })\n end",
"def empty?\n count <= 0\n end",
"def empty?\n total_count == 0\n end",
"def empty?\n total_count == 0\n end",
"def results?() ! find(locator(:no_results_message)) end",
"def my_all?\n self.my_each {|x| return false if yield(x) != true}\n true\n end",
"def more_results?()\n #This is a stub, used for indexing\n end",
"def empty?\n count == 0\n end",
"def my_any?\n if block_given?\n self.my_each {|n| return true if yield(n) == true}\n return false\n else\n return false if self.size == 0\n self.my_each {|n| return true if n == true}\n return false\n end\n end",
"def first?\n\t\treturn @iteration == 0\n\tend",
"def none?(array)\n array.each do |item|\n return false if yield(item)\n end\n true\nend",
"def empty?\n @items.count == 0\n end",
"def my_none?\n return unless block_given?\n self.my_each do |ele|\n if yield ele then return false\n end\n end\n return true\n end",
"def my_none?\n if self.class == Array\n my_each do |value|\n # stop if any item is true\n return false if yield(value)\n end\n elsif self.class == Hash\n my_each do |key, value|\n # stop if any item is true\n return false if yield(key, value)\n end\n end\n\n true\n end",
"def my_none?\n return self unless block_given?\n for n in self\n if yield(n)\n return false\n end\n end\n return true\n end",
"def empty?\n @next.nil?\n end",
"def empty?\n load # make sure we have determined the number of fetched records\n\n @number_of_records.zero?\n end",
"def present?\n results.any?\n end",
"def not_finished?\n more_results == :NOT_FINISHED\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def is_empty()\n return @items.empty?\n end",
"def empty?\n @data.rows_count <= 0\n end",
"def empty?\n RECORDS.each do |name, _|\n return false unless @records[name].empty?\n end\n true\n end",
"def any?\n ! empty?\n end",
"def my_none?\n if block_given?\n self.my_each {|o| return false if yield(o)}\n true\n else\n truths = 0\n self.my_each {|o| truths +=1 if o}\n truths == 0\n end\n end",
"def my_all?\n all = true\n self.my_each do |x|\n if !block_given?\n if !x || x.nil?\n all = false\n end\n elsif !yield x\n all = false\n end\n break if all == false\n end\n all\n end",
"def my_all?\n\t\tvalue = true\n\t\tself.my_each do |element|\n\t\t\tif yield(element) != true\n\t\t\t\tvalue = false\n\t\t\tend\n\t\tend\n\t\treturn value\n\tend",
"def empty?\n return @querys.empty?\n end",
"def empty?\n each_cell do |cell|\n return false if cell\n end\n true\n end",
"def returns_one?\n rule != :each\n end",
"def empty?\n @total == 0\n end",
"def empty?\n @records.empty?\n end",
"def my_all?(collection)\n i = 0\n return_value = []\n while i < collection.length\n return_value << yield(collection[i])\n i += 1\n end\n\n # check to see if the return values from yielding contains a false\n if return_value.include?(false)\n false\n else\n true\n end\n\nend",
"def complete_result?\n @result_count < 1000\n end",
"def empty?\n rows.empty?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n count.zero?\n end",
"def isEmpty?()\r\n return @items == 0\r\n end",
"def my_all?(&prc)\n self.my_each { |el| return false if !prc.call(el) }\n true\n end",
"def empty?\n return @items.nil?\n end",
"def empty?\n @rows.empty? if @rows\n end",
"def my_any?\n all = false\n self.my_each do |x|\n if !block_given?\n if x || !x.nil?\n all = true\n end\n elsif yield x\n all = true\n end\n break if all == true\n end\n all\n end",
"def empty?\n record_count == 0\n end",
"def my_all?(collection)\n #our counter\n i = 0\n block_return_values = [ ]\n while i < collection.length\n block_return_values << yield(collection[i])\n # yield(collection[i]) go throughe each element in the index.\n i = i + 1\n #i += 1 does the same thing. Use this if it's easier for you.\n\n end\n\n if block_return_values.include?(false)\n false\n else\n true\n end\nend",
"def empty?\n items.empty?\n end",
"def empty?\n total_pages.zero?\n end",
"def empty?\n return @tree_iterator.empty?\n end",
"def my_all?(&prc)\n self.my_each do |el|\n return false if !prc.call(el)\n end\n\n true\n end",
"def empty?\n each do |cell|\n return false if cell.value.to_i != 0\n end\n true\n end",
"def empty?\n return @fill_count == 0\n end",
"def has_records? results\n not results.nil? and results.fetch('SearchResult', {}).fetch('Data', {}).fetch('Records', []).count > 0\n end",
"def ok?\n skip? || @result\n end",
"def empty?\n return @records.empty? if loaded?\n\n if limit_value == 0\n true\n else\n # FIXME: This count is not compatible with #select('authors.*') or other select narrows\n c = count\n c.respond_to?(:zero?) ? c.zero? : c.empty?\n end\n end",
"def my_all?(collection)\n i = 0 \n block_return_values = []\n while i < collection.length\n \n # declare our array & yield each element in the collection\n \n block_return_values << yield(collection[i])\n i = i + 1 \n end\n \n # add an ' #include? ' method to determine the return value of the my_all? method.\n \n if block_return_values.include?(false)\n false \n else \n true \n end\nend",
"def none?\n !any?\n end",
"def empty?\n @rows.empty?\n end",
"def empty?\n entries.empty?\n end",
"def empty?\n entries.empty?\n end",
"def all?(collection)\n collection.each_with_object(true) { |el| return false unless yield(el) }\nend",
"def empty?\n self.responses.empty?\n end",
"def any?\n false\n end",
"def empty?\n\t\tself.items\n\tend",
"def test_emptyItem\n f = ItemFilter.new()\n new_list = [].find_all{|x| f.apply(x)}\n return new_list.size == 0\n end"
] | [
"0.7608348",
"0.7486262",
"0.72782457",
"0.72603536",
"0.7162861",
"0.7084586",
"0.7045953",
"0.7011792",
"0.7011498",
"0.69935656",
"0.69506454",
"0.6936981",
"0.692555",
"0.6878075",
"0.6857555",
"0.68537855",
"0.6832348",
"0.68179005",
"0.67823243",
"0.6773387",
"0.6751802",
"0.6749703",
"0.6734551",
"0.6722655",
"0.6710387",
"0.6710387",
"0.6707896",
"0.6684173",
"0.66625744",
"0.6661927",
"0.6651786",
"0.66492355",
"0.664746",
"0.664746",
"0.6640261",
"0.6639972",
"0.66257226",
"0.66257226",
"0.66187704",
"0.6616276",
"0.66125107",
"0.65952593",
"0.6588507",
"0.6587339",
"0.65764296",
"0.65724224",
"0.656495",
"0.65649045",
"0.6556472",
"0.6535875",
"0.6534567",
"0.6527768",
"0.65170074",
"0.6513906",
"0.6513906",
"0.6513906",
"0.6513906",
"0.65106577",
"0.6491994",
"0.64904815",
"0.64879555",
"0.6477632",
"0.6465442",
"0.64628774",
"0.64614934",
"0.6458959",
"0.64570266",
"0.6449526",
"0.6442759",
"0.6433905",
"0.64218056",
"0.6419131",
"0.6396563",
"0.6396563",
"0.6396563",
"0.6394068",
"0.6387567",
"0.6379276",
"0.6377674",
"0.6376263",
"0.63706285",
"0.6369633",
"0.6368923",
"0.63675773",
"0.63616127",
"0.63583744",
"0.63485795",
"0.63442427",
"0.63402826",
"0.6338819",
"0.6332056",
"0.63267714",
"0.6322583",
"0.6322392",
"0.63205713",
"0.63205713",
"0.6313762",
"0.6311423",
"0.6300786",
"0.62995327",
"0.62932605"
] | 0.0 | -1 |
Returns true when there are any private values set | def has_privates?
password.present? || pass_file.present? || !additional_privates.empty? || blank_passwords
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete?\r\n cur_values.all{ |value| value!=nil }\r\n end",
"def has_known_value?\n all?(&:has_known_value?)\n end",
"def all_private\n \treturn is_name_private && is_message_private && is_amount_private\n end",
"def __empty?\n return false unless super\n __empty(__value)\n end",
"def any_key?\n @keys == UndefinedSetting\n end",
"def set?\n\t\t\tbegin\n\n\t\t\t\tvalue = @lookup.inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\t\t# Has to be an object that can have keys\n\t\t\t\t\treturn false unless deep_obj.respond_to?(:[])\n\n\t\t\t\t\tif deep_obj.respond_to?(:fetch)\n\t\t\t\t\t\t# Hash, Array and Struct all respond to fetch\n\t\t\t\t\t\t# We've monkeypatched fetch to Struct\n\t\t\t\t\t\tif deep_obj.is_a?(Array)\n\t\t\t\t\t\t\t# Check array separately as must fetch numeric key\n\t\t\t\t\t\t\treturn false unless Keys.index?(this_key)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tnext_obj = deep_obj.fetch(this_key, Keys::MISSING)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\t# No need to go any further\n\t\t\t\t\treturn false if Keys::MISSING == next_obj\n\n\t\t\t\t\t# Reinject value to next loop\n\t\t\t\t\tnext_obj\n\t\t\t\t}\n\n\t\t\trescue\n\t\t\t\t# If fetch throws a wobbly at any point, fail gracefully\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t# No errors - yield the value if desired\n\t\t\tif block_given?\n\t\t\t\tyield(value)\n\t\t\tend\n\t\t\t# Return true\n\t\t\treturn true\n\t\tend",
"def complete_flag_values?\n @complete_flag_values\n end",
"def private?\n [email protected]?\n end",
"def private?\n self.private\n end",
"def all_instance_variables_set?\n self.class.instance_variables_required.to_a.all? do |instance_variable|\n !instance_variable_get(instance_variable.to_s).nil?\n end\n end",
"def unnamed?\n @keys == nil\n end",
"def ready?\n [email protected]? { |observable, value| value.nil? }\n end",
"def value_set?\n @value_set == true\n end",
"def ready?\n [email protected]? { |observable, value| value.nil? }\n end",
"def value_set?\n @value_set\n end",
"def __empty?\n return false unless super\n __elements.values.all?(&:__empty?)\n end",
"def private?\n self.private\n end",
"def fields_are_private_by_default?\n ensure_setup!\n options[:visibility] == :private\n end",
"def private?\n @private\n end",
"def complete?\n keys.all?(&:complete?)\n end",
"def allows?\n return positive? unless @attributes.empty?\n protected_attributes.nil? || protected_attributes.empty?\n end",
"def private?\n false\n end",
"def valid?(set)\n set.is_a?(Hash) && set[\"values\"].is_a?(Hash)\n end",
"def set?\n return @set == true\n end",
"def isSet?\r\n assert_exists\r\n return @o.checked\r\n end",
"def empty?\n _values.all?(&:empty?)\n end",
"def valid?(set); end",
"def key_set?\n !attributes['key'].nil?\n end",
"def populated?\n !!@populated\n end",
"def valid?\n expected = {}\n\n count = 0\n self.each_unsafe do |k,v|\n return false if @data[k][2] != v\n count += 1\n end\n count == @data.count\n end",
"def has_value?\n false\n end",
"def empty?\n @_values.empty?\n end",
"def value?\n @count > 0\n end",
"def private?\n @attributes[\"access\"] ? @attributes[\"access\"] == \"private\" : false\n end",
"def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end",
"def empty?\n return false if @opts[:values]\n super\n end",
"def empty?\n _values.empty?\n end",
"def variants_have_property_values?\n self.variants.each do |v|\n return true if !v.variant_variant_property_values.empty?\n end\n return false\n end",
"def members?\n !@spec['members'].empty?\n end",
"def is_set?\n @is_set\n end",
"def strict?\n each_pair.all?{|name, value|sufficient? name, value}\n end",
"def any_mines_detonated?\n @value_grid.any?{ |space, properties| properties == { cleared: true, mine: true } }\n end",
"def transitioned_to_private?\n return true if changes['visibility'].present? &&\n (changes['visibility'][0] != JupiterCore::VISIBILITY_PRIVATE) &&\n (changes['visibility'][1] == JupiterCore::VISIBILITY_PRIVATE)\n end",
"def published?\n all_base_attributes_present?\n end",
"def empty?\n prepended_creds.empty? && !has_privates?\n end",
"def valid?\n MANDATORY_ATTRIBUTES.each { |a| return false unless self[a] }\n true\n end",
"def empty?\n DIFF_ATTRIBUTES.all? { |attr|\n self.send(attr).empty?\n } && stacks.values.all? { |stk| stk.empty? }\n end",
"def __empty?\n all?(&:__empty?)\n end",
"def private?\n return (self.owner_id != 0)\n end",
"def has_value?\n true\n end",
"def valid?(*args)\n valid = true\n @transformed_values.each do |sets| \n sets.each do |set| \n valid = false unless set.valid?\n end\n end\n valid\n end",
"def consistent?\n bound? && (store.keys & configs.keys).empty?\n end",
"def empty?\n @values.values.all?(&:nil?)\n end",
"def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end",
"def valid_subset?\n valid = true\n schema.traverse do |key_path, value|\n actual = self.ref(key_path)\n missing = actual.nil?\n valid = valid && !missing\n end\n valid\n end",
"def any_changes?\n @counters.empty? || all_counters.any?(&:value_changed?)\n end",
"def private?\n false\n end",
"def valid?\n self.errors = []\n \n BOOL_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n unless val.nil? == true || val == true || val == false\n self.errors.push field=>ERRORS[:bool]\n end\n end\n \n if self.key_data.nil?\n self.errors.push ERRORS[:data_nil] \n return false\n end\n\n if self.key_type.nil?\n self.errors.push ERRORS[:type_nil] \n return false\n end\n\n if not self.key_data.match \"^#{B64_REGEX}$\"\n self.errors.push ERRORS[:data_char] \n end\n\n if self.key_data.size < 30\n self.errors.push ERRORS[:data_short] \n end\n\n if self.key_data.size > 1000\n self.errors.push ERRORS[:data_long] \n end\n \n if self.key_data.size % 4 != 0\n self.errors.push ERRORS[:data_modulus] \n end\n\n return self.errors.empty?\n end",
"def for_all?\n return (self.owner_id == 0 and self.get_groups_a.empty? and self.get_teams_a.empty?)\n end",
"def can_have_associated_objects?(obj)\n !self[:keys].any?{|k| obj.get_column_value(k).nil?}\n end",
"def all_missing?(values)\n values.all?{|v| is_missing?(v)}\n end",
"def has_value?(p0) end",
"def private?\n private\n end",
"def private?\n private\n end",
"def private?\n return true if @private_key\n \n load_private_key\n !@private_key.nil?\n end",
"def empty?\n @references_to_keys_map.each do |_, ref|\n return false if ref.object\n end\n true\n end",
"def valid?\n return false if @id.nil?\n return false if [email protected]? && @popularity > 5\n return false if [email protected]? && @tags.length > 5\n return false if @type.nil?\n true\n end",
"def valid?\n return false if @key.nil?\n return false if @name.nil?\n return false if @event_code.nil?\n return false if @event_type.nil?\n return false if @start_date.nil?\n return false if @end_date.nil?\n return false if @year.nil?\n return false if @event_type_string.nil?\n true\n end",
"def valid?\n !errors? && entries.values.all?(&:valid?)\n end",
"def valid?\n return false if !key || key_defined? || global_key?\n\n true\n end",
"def hasProperties\n end",
"def valid?\n return false if @property_code.nil?\n return false if @property_name.nil?\n return false if @location.nil?\n return false if @total_price.nil?\n return false if @min_daily_rate.nil?\n return true\n end",
"def has_kerning_data?\n @kern_pairs.any?\n end",
"def valid?(map)\n return true if whitelisted_value?(map)\n\n map.is_a?(Hash) && map.values.all? { |value| subprop.valid?(value) }\n end",
"def profile_complete?\n\t\tparameters_with_values = generate_array_of_param_with_value\n\n\t\tparameters_with_values.each do |p|\n\t\t\treturn false if !p\n\t\tend\n\n\t\treturn true\n\tend",
"def private?\n return true unless @private_key.nil?\n \n load_private_key\n !@private_key.nil?\n end",
"def private?\n private == 'private'\n end",
"def uncertain?\r\n @@maybes\r\n end",
"def private?\n !self.public\n end",
"def empty?\n self.keys.empty?\n end",
"def my_all?\n\t\tvalue = true\n\t\tself.my_each do |element|\n\t\t\tif yield(element) != true\n\t\t\t\tvalue = false\n\t\t\tend\n\t\tend\n\t\treturn value\n\tend",
"def private?\n sensitivity == \"Private\"\n end",
"def populated_hash?(obj)\n obj.is_a?(Hash) && !obj.empty?\n end",
"def priviledged?\n @priviledged\n end",
"def all?(&block)\n if block\n self.each{|*val| return false unless block.call(*val)}\n else\n self.each{|*val| return false unless val.__svalue}\n end\n true\n end",
"def has_attributes?\n [email protected]?\n end",
"def filled?\n !!self[:filled]\n end",
"def published?\n !is_privacy_private? && (!builder? || !derived? || mapcapped?)\n end",
"def has_attributes?\n a = @context.attributes.find{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n a ? true : false\n end",
"def valid?\n return false if @anchor.nil?\n return false if @cv.nil?\n return false if @nullifier.nil?\n return false if @proof.nil?\n return false if @rk.nil?\n return false if @spend_auth_sig.nil?\n true\n end",
"def any?\n REQUIRED_KEYS.any? do |key|\n attributes[key].any?\n end\n end",
"def publicly_accessible?\n @dbi.publicly_accessible\n end",
"def publicly_accessible?\n @dbi.publicly_accessible\n end",
"def has_members?\n self.members.count > 0\n end",
"def valid?(metadata)\n validate.each do |attr|\n return false if metadata[attr.to_sym].nil? || metadata[attr.to_sym].zero?\n end\n end",
"def valid?\n MANDATORY_ATTRIBUTES[type].each{|a| return false unless self[a]}\n true\n end",
"def valid?\n @data_lru.size == @data_ttl.size\n end",
"def defensive\n return (@attributes & 0x10 == 0x10)\n end",
"def valid?\n return false if @audit.nil?\n return false if @comp.nil?\n return false if @subcomp.nil?\n true\n end",
"def valid?(map)\n whitelisted_value?(map) || (map.is_a?(Hash) && map.values.all? { |value| subprop.valid?(value) })\n end"
] | [
"0.687254",
"0.681967",
"0.66989005",
"0.6663614",
"0.6648296",
"0.6613189",
"0.65909714",
"0.6511552",
"0.6488604",
"0.645253",
"0.64206475",
"0.64181036",
"0.64173543",
"0.6408487",
"0.63624",
"0.635655",
"0.6355741",
"0.6338612",
"0.63228446",
"0.6306921",
"0.62918204",
"0.6286491",
"0.6280109",
"0.62763274",
"0.6275547",
"0.6264881",
"0.6256959",
"0.6254667",
"0.6243913",
"0.62426805",
"0.62337756",
"0.62158626",
"0.6197563",
"0.61896294",
"0.61774075",
"0.6174738",
"0.6165978",
"0.616215",
"0.61601126",
"0.6155086",
"0.6145995",
"0.61443305",
"0.61426735",
"0.61202544",
"0.6104178",
"0.6070507",
"0.6067428",
"0.6062482",
"0.60605353",
"0.6057557",
"0.60562587",
"0.60553235",
"0.6054255",
"0.60461617",
"0.60410833",
"0.6037356",
"0.60262686",
"0.60228103",
"0.6020051",
"0.6017337",
"0.6014642",
"0.60090935",
"0.6001925",
"0.6001925",
"0.6001024",
"0.59977627",
"0.5980214",
"0.596923",
"0.5968063",
"0.5965864",
"0.5954323",
"0.595135",
"0.5947109",
"0.59463143",
"0.5934334",
"0.5933834",
"0.5933646",
"0.59321725",
"0.5929061",
"0.59226614",
"0.59165037",
"0.59157157",
"0.589834",
"0.5895637",
"0.5892795",
"0.5884515",
"0.5882688",
"0.58809316",
"0.5875409",
"0.58722395",
"0.58672225",
"0.5865977",
"0.5865977",
"0.58657885",
"0.5861577",
"0.5861418",
"0.58566284",
"0.58537585",
"0.5849002",
"0.58441764"
] | 0.61004925 | 45 |
Analyze a private value to determine its type by checking it against a known list of regular expressions | def private_type(private)
if private =~ /[0-9a-f]{32}:[0-9a-f]{32}/
:ntlm_hash
elsif private =~ /^md5([a-f0-9]{32})$/
:postgres_md5
else
:password
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_value_matcher; end",
"def allow_matcher; end",
"def methods_matching(re); end",
"def private_nets_regex; end",
"def typematch(strict, key, params, _component, value)\n errors = []\n ctx1 = Rsec::ParseContext.new value, \"source\"\n case key\n when :VERSION\n ret = versionvalue._parse ctx1\n when :SOURCE, :PHOTO, :IMPP, :GEO, :LOGO, :MEMBER, :SOUND, :URL, :FBURL,\n :CALADRURI, :CALURI, :ORG_DIRECTORY\n ret = uri._parse ctx1\n when :KIND\n ret = kindvalue._parse ctx1\n when :XML, :FN, :EMAIL, :TITLE, :ROLE, :NOTE, :EXPERTISE, :HOBBY,\n :INTEREST\n ret = text_t._parse ctx1\n when :NICKNAME, :CATEGORIES\n ret = textlist._parse ctx1\n when :ORG\n ret = org._parse ctx1\n when :N\n ret = fivepartname._parse ctx1\n when :ADR\n ret = address._parse ctx1\n when :BDAY, :ANNIVERSARY\n if params && params[:VALUE] == \"text\"\n if params[:CALSCALE]\n parse_err(strict, errors,\n \"Specified CALSCALE within property #{key} as text\", ctx1)\n end\n ret = text_t._parse ctx1\n else\n if params && params[:CALSCALE] && /^T/ =~ value\n parse_err(strict, errors,\n \"Specified CALSCALE within property #{key} as time\", ctx1)\n end\n ret = date_and_or_time._parse ctx1\n end\n when :DEATHDATE\n ret = if params && params[:VALUE] == \"text\"\n text_t._parse ctx1\n else\n date_and_or_time._parse ctx1\n end\n when :TEL\n if params && params[:TYPE]\n typestr = params[:TYPE].is_a?(Array) ? params[:TYPE].join(\",\") : params[:TYPE]\n ret1 = typeparamtel1list.parse typestr\n if !ret1 || Rsec::INVALID[ret1]\n parse_err(strict, errors,\n \"Specified illegal TYPE parameter #{typestr} within property #{key}\", ctx1)\n end\n end\n ret = if params && params[:VALUE] == \"uri\"\n uri._parse ctx1\n else\n text_t._parse ctx1\n end\n when :BIRTHPLACE, :DEATHPLACE\n ret = if params && params[:VALUE] == \"uri\"\n uri._parse ctx1\n else\n text_t._parse ctx1\n end\n when :RELATED\n if params && params[:TYPE]\n typestr = params[:TYPE].is_a?(Array) ? params[:TYPE].join(\";\") : params[:TYPE]\n ret1 = typerelatedlist.parse typestr\n if !ret1 || Rsec::INVALID[ret1]\n parse_err(strict, errors,\n \"Specified illegal TYPE parameter #{typestr} within property #{key}\", ctx1)\n end\n end\n ret = if params && params[:VALUE] == \"uri\"\n uri._parse ctx1\n else\n text_t._parse ctx1\n end\n when :UID, :KEY\n ret = if params && params[:VALUE] == \"text\"\n text_t._parse ctx1\n else\n uri._parse ctx1\n end\n when :GENDER\n ret = gender._parse ctx1\n when :LANG\n ret = lang._parse ctx1\n when :TZ\n ret = if params && params[:VALUE] == \"uri\"\n uri._parse ctx1\n elsif params && params[:VALUE] == \"utc_offset\"\n utc_offset._parse ctx1\n else\n text_t._parse ctx1\n end\n when :REV\n ret = timestamp._parse ctx1\n when :CLIENTPIDMAP\n if params && params[:PID]\n parse_err(strict, errors, \"Specified PID parameter in CLIENTPIDMAP property\", @ctx)\n end\n ret = clientpidmap._parse ctx1\n else\n # left completely open in spec\n ret = Vobject::PropertyValue.new value\n end\n if ret.is_a?(Hash) && ret[:error]\n parse_err(strict, errors, \"#{ret[:error]} for property #{key}, value #{value}\", ctx1)\n end\n if Rsec::INVALID[ret]\n parse_err(strict, errors, \"Type mismatch for property #{key}, value #{value}\", ctx1)\n end\n ret\n end",
"def verify_types(test_data)\n test_types = test_data[Org::ORG_RECORD_TYPES.name]\n errors = []\n test_types = [{ Org::ORG_RECORD_TYPE.name => ''}] unless test_types\n test_types.each_with_index do |test_type, index|\n text_values_match?(test_type[Org::ORG_RECORD_TYPE.name], element_value(org_record_type_input(index)), errors)\n end\n errors\n end",
"def match(pattern); end",
"def roboclassify(desc)\n @pat_matches = []\n Pattern.all.each do |pattern|\n @pat_matches += pattern.codes if regex(pattern).match(desc)\n end\n @pat_matches\n end",
"def match(p0) end",
"def match(p0) end",
"def match(regexp); end",
"def check_regex value, validator\n return unless regexp? value\n\n regex = value.value\n unless secure_regex?(regex)\n warn :model => @current_model,\n :warning_type => \"Format Validation\",\n :warning_code => :validation_regex,\n :message => \"Insufficient validation for '#{get_name validator}' using #{regex.inspect}. Use \\\\A and \\\\z as anchors\",\n :line => value.line,\n :confidence => :high\n end\n end",
"def regexps; end",
"def check_scan(s, pattern); end",
"def check_scan(s, pattern); end",
"def regexp; end",
"def regexp; end",
"def check( value )\n\t\t\tself.log.debug \"Validating %p via regexp %p\" % [ value, self.pattern ]\n\t\t\tmatch = self.pattern.match( value.to_s ) or return nil\n\n\t\t\tif match.captures.empty?\n\t\t\t\tself.log.debug \" no captures, using whole match: %p\" % [match[0]]\n\t\t\t\treturn super( match[0] )\n\n\t\t\telsif match.names.length > 1\n\t\t\t\tself.log.debug \" extracting hash of named captures: %p\" % [ match.names ]\n\t\t\t\trhash = self.matched_hash( match )\n\t\t\t\treturn super( rhash )\n\n\t\t\telsif match.captures.length == 1\n\t\t\t\tself.log.debug \" extracting one capture: %p\" % [match.captures.first]\n\t\t\t\treturn super( match.captures.first )\n\n\t\t\telse\n\t\t\t\tself.log.debug \" extracting multiple captures: %p\" % [match.captures]\n\t\t\t\tvalues = match.captures\n\t\t\t\treturn super( values )\n\t\t\tend\n\t\tend",
"def nonregular_type; end",
"def match(regexp)\n return regexp.match(pickle_format)\n end",
"def match(input); end",
"def type *val\n return @chars_allowed if val.empty?\n\n dtype = val[0]\n #return self if @chars_allowed # disallow changing\n if dtype.is_a? Regexp \n @chars_allowed = dtype\n return self\n end\n dtype = dtype.to_s.downcase.to_sym if dtype.is_a? String\n case dtype # missing to_sym would have always failed due to to_s 2011-09-30 1.3.1\n when :integer, Integer\n @chars_allowed = /\\d/\n when :numeric, :float, Numeric, Float\n @chars_allowed = /[\\d\\.]/ \n when :alpha\n @chars_allowed = /[a-zA-Z]/ \n when :alnum\n @chars_allowed = /[a-zA-Z0-9]/ \n else\n raise ArgumentError, \"Field type: invalid datatype specified. Use :integer, :numeric, :float, :alpha, :alnum \"\n end\n self\n end",
"def allowed?(val)\n case ftype\n when 'string', 'url'\n val.is_a?(String)\n when 'number'\n val.is_a?(Integer) || val.is_a?(Float)\n when 'sample'\n allowable_field_types.collect { |aft| aft.sample_type.id }.member? val.sample_type_id\n when 'item'\n allowable_field_types.collect { |aft| aft.object_type.id }.member? val.object_type_id\n end\n end",
"def regex(_obj)\n raise NotImplementedError\n end",
"def match; end",
"def match; end",
"def check_regex\n return true if resource_type_attribute.nil?\n\n regex = resource_type_attribute.validation_regex\n res = true\n if !regex.blank? and !value.blank?\n res = value.match(regex)\n end\n\n return res\n end",
"def valid_input?(owner, value)\n if value.nil?\n raise StandardError.new(\"Cannot validate null value\")\n end\n \n # Convert to string first\n value = value.to_s\n \n # Match depending on type\n case type\n when 'string' then true\n when 'integer' then !value.match(/^-?\\d+$/).nil?\n when 'decimal' then !value.match(/^-?\\d+(\\.\\d+)?$/).nil?\n when 'length' then !value.match(/^-?\\d+(px)?$/).nil?\n when 'color' then !value.match(/^#[0-9A-F]{6}$/i).nil?\n when 'percent' then !value.match(/^-?\\d+%$/).nil?\n end\n end",
"def match(klass); end",
"def matches(_ext); end",
"def matches(_ext); end",
"def match(tokens, definitions); end",
"def validate(type,input)\n if input.nil? then return false end\n if !(input.is_a? String) then return false end\n case type\n when 'Integer'\n return !(input.match(INTEGER_FORMAT).nil?)\n when 'String'\n return (input.length <= 1024)\n when 'Mail'\n return !(input.match(MAIL_FORMAT).nil?)\n end\nend",
"def matches?(pattern); end",
"def matcher; end",
"def matcher; end",
"def run(value)\n REGEX =~ value\n end",
"def valid?(value, types)\n types.any? do\n case _1\n when :array then true if value.is_a?(Array)\n when :boolean then true # in Ruby everything is a boolean\n when :float then true if value.is_a?(Float) || value.is_a?(Integer)\n when :hash then true if value.is_a?(Hash)\n when :integer then true if value.is_a?(Integer)\n when :string then true if value.is_a?(String)\n when :symbol then true if value.is_a?(Symbol)\n when Class then true if value.is_a?(_1) # for custom checks\n else\n raise \"unknown flag type #{_1.inspect}\"\n end\n end\n end",
"def regex_matcher(string, type)\n return false if string.nil?\n case type\n when \"email\"\n string.match(/^\\w+@\\w+\\.com$/)\n when \"mobile\"\n string.match(/^\\d{10}$/)\n when \"ip\"\n valid_part_count = 0\n ip_array = string.split(\".\")\n ip_array.each do |part|\n if (part.match(/^\\d{1,3}$/) and part.to_i <= 255 and part.to_i >= 0)\n valid_part_count += 1\n end\n end\n if valid_part_count == 4\n return true\n else\n return false\n end\n when \"URL\"\n string.match(/[(http)(https)]:\\/\\/(www.)?\\w+\\.\\w+/)\n end\nend",
"def match(object); end",
"def pre_match() end",
"def re; end",
"def validate_type(type, context:); end",
"def type_7_matches(string)\n TYPE_7_REGEXES.collect {|regex| string.scan(regex)}.flatten.uniq\n end",
"def regex?\n @name.is_a?(Regexp)\n end",
"def match(value)\n return _match(@_compiled_pattern, value)\n end",
"def matches?(value, context); end",
"def each_typed_rule_match(type, rule, subject, match, permissive, &b)\n if rule.atom?\n process_rule_atom(type, rule, subject, match, permissive, &b)\n elsif rule.s_exp?\n process_typed_rule_s_exp(type, rule, subject, match, &b)\n else\n raise RuleException, \"Internal error\"\n end\n end",
"def match_regex\n if !self.value.blank? && self.regex\n errors.add(:value, 'is a invalid value') unless self.value =~ Regexp.new(self.regex)\n end\n end",
"def validated_parser_type(type); end",
"def underlying_matcher; end",
"def underlying_matcher; end",
"def validate!\n investigate_invalid_values!\n\n meaning = \"\"\n halt_loop = false\n match_data = nil\n list = []\n values = @pattern.split(\",\")\n options = {\n unit: self.field_name,\n exclude_preposition: true\n }\n\n # iterate over all comma seperated values for current field\n values.map.with_index do |value, index|\n # look whether the value matches any of regex rule\n self.class.specifications.map do |spec|\n next unless spec[:for_fields].include? self.field_name\n next if (match_data = spec[:rule].match(value)).nil?\n\n # some special kind of values can dominate all other values for\n # current field, e.g. value such as '*'\n if spec[:can_dominate_all]\n meaning = spec[:yields].(*match_data.captures, options)\n halt_loop = true and break\n end\n\n list << spec[:yields].(*match_data.captures, options)\n\n # some values are confusing or ambiguous, e.g. '8/2' -- but crontab\n # allows such values, but they can halt next comma seperated values\n # from being parsed for the current field of cron pattern\n if spec[:can_halt]\n @warning = \"'#{value}' is valid but confusing pattern\"\n halt_loop = true\n break\n end\n # stop looking for other regex rules if values is matched here\n break if match_data\n end\n # stop iterating over comma seperated values if special-purpose flag:\n # `halt_loop` is set to `true` somewhere\n break if halt_loop\n end\n\n list = list.flatten.uniq.map(&:to_s).sort\n list = list.map(&:to_i).sort if !!(/minute|hour|day_of_month/ =~ field_name)\n if meaning.==(\"\") and list.empty?\n raise invalid_field_error_class.new(\"\\\"#{self.field_name}\\\" field's\n pattern is invalid\".squish)\n end\n meaning = self.class.generate_meaning(list, field_name) if meaning.==(\"\")\n meaning\n end",
"def types_match?(api_map, expected, inferred); end",
"def types_match?(api_map, expected, inferred); end",
"def scan_for_t(token); end",
"def investigate_invalid_values!\n invalids = @pattern.split(/,|\\/|\\-/).uniq.collect do |value|\n value unless self.class.allowed_values.to_a.include?(value.upcase)\n end.compact\n invalids.delete(\"*\")\n\n err = nil\n if invalids.include?('') || invalids.include?(' ')\n err = \"#{field_name} field's pattern is invalid, please run:\n '#{self.class}.allowed_values' to know valid values\".squish\n elsif invalids.any?\n err = \"value: '#{invalids.join(', ')}' not allowed for '#{field_name}'\n field, run: '#{self.class}.allowed_values' to know valid values\".squish\n end\n raise self.invalid_field_error_class.new(err) if err\n end",
"def match(regexp)\n self.decoded.match(regexp)\n end",
"def validate(data_value, data_type=nil)\n #TODO: port from python runtime\n end",
"def validate(data_value, data_type=nil)\n #TODO: port from python runtime\n end",
"def matches(ext); end",
"def checkTypo(arg,regex)\r\n return !(arg=~regex)\r\nend",
"def match?(name, literal) true end",
"def match(keyword); end",
"def validate_value(property,value) #:nodoc:\n valid = false\n # Check static strings\n property.values.each do |al_val|\n valid = true if al_val.downcase.eql?(value.downcase)\n end\n # Check regular expressions\n unless valid\n property.expressions.each do |xp_val|\n valid = true if value =~ xp_value\n end\n end\n # check short hand\n unless valid\n property.refs.each do |ref|\n real = @policy.property(ref)\n if real\n valid = validate_value(real,value)\n end\n end\n end\n # We will check media above.\n return valid\n end",
"def datatype\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n return_value = DatatypeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal32 = nil\n string_literal33 = nil\n string_literal34 = nil\n char_literal35 = nil\n __INT36__ = nil\n char_literal37 = nil\n string_literal38 = nil\n char_literal39 = nil\n __INT40__ = nil\n char_literal41 = nil\n string_literal42 = nil\n char_literal43 = nil\n __INT44__ = nil\n char_literal45 = nil\n __INT46__ = nil\n char_literal47 = nil\n\n tree_for_string_literal32 = nil\n tree_for_string_literal33 = nil\n tree_for_string_literal34 = nil\n tree_for_char_literal35 = nil\n tree_for_INT36 = nil\n tree_for_char_literal37 = nil\n tree_for_string_literal38 = nil\n tree_for_char_literal39 = nil\n tree_for_INT40 = nil\n tree_for_char_literal41 = nil\n tree_for_string_literal42 = nil\n tree_for_char_literal43 = nil\n tree_for_INT44 = nil\n tree_for_char_literal45 = nil\n tree_for_INT46 = nil\n tree_for_char_literal47 = nil\n\n begin\n # at line 44:3: ( 'integer' | 'timestamp' | 'char' '(' INT ')' | 'varchar' '(' INT ')' | 'numeric' '(' INT ',' INT ')' )\n alt_8 = 5\n case look_8 = @input.peek( 1 )\n when INTEGER then alt_8 = 1\n when TIMESTAMP then alt_8 = 2\n when CHAR then alt_8 = 3\n when VARCHAR then alt_8 = 4\n when NUMERIC then alt_8 = 5\n else\n raise NoViableAlternative( \"\", 8, 0 )\n end\n case alt_8\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 44:5: 'integer'\n string_literal32 = match( INTEGER, TOKENS_FOLLOWING_INTEGER_IN_datatype_249 )\n\n tree_for_string_literal32 = @adaptor.create_with_payload( string_literal32 )\n @adaptor.add_child( root_0, tree_for_string_literal32 )\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 45:5: 'timestamp'\n string_literal33 = match( TIMESTAMP, TOKENS_FOLLOWING_TIMESTAMP_IN_datatype_255 )\n\n tree_for_string_literal33 = @adaptor.create_with_payload( string_literal33 )\n @adaptor.add_child( root_0, tree_for_string_literal33 )\n\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 46:5: 'char' '(' INT ')'\n string_literal34 = match( CHAR, TOKENS_FOLLOWING_CHAR_IN_datatype_261 )\n\n tree_for_string_literal34 = @adaptor.create_with_payload( string_literal34 )\n root_0 = @adaptor.become_root( tree_for_string_literal34, root_0 )\n\n char_literal35 = match( T__17, TOKENS_FOLLOWING_T__17_IN_datatype_264 )\n __INT36__ = match( INT, TOKENS_FOLLOWING_INT_IN_datatype_267 )\n\n tree_for_INT36 = @adaptor.create_with_payload( __INT36__ )\n @adaptor.add_child( root_0, tree_for_INT36 )\n\n char_literal37 = match( T__20, TOKENS_FOLLOWING_T__20_IN_datatype_269 )\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 47:5: 'varchar' '(' INT ')'\n string_literal38 = match( VARCHAR, TOKENS_FOLLOWING_VARCHAR_IN_datatype_276 )\n\n tree_for_string_literal38 = @adaptor.create_with_payload( string_literal38 )\n root_0 = @adaptor.become_root( tree_for_string_literal38, root_0 )\n\n char_literal39 = match( T__17, TOKENS_FOLLOWING_T__17_IN_datatype_279 )\n __INT40__ = match( INT, TOKENS_FOLLOWING_INT_IN_datatype_282 )\n\n tree_for_INT40 = @adaptor.create_with_payload( __INT40__ )\n @adaptor.add_child( root_0, tree_for_INT40 )\n\n char_literal41 = match( T__20, TOKENS_FOLLOWING_T__20_IN_datatype_284 )\n\n when 5\n root_0 = @adaptor.create_flat_list\n\n\n # at line 48:5: 'numeric' '(' INT ',' INT ')'\n string_literal42 = match( NUMERIC, TOKENS_FOLLOWING_NUMERIC_IN_datatype_291 )\n\n tree_for_string_literal42 = @adaptor.create_with_payload( string_literal42 )\n root_0 = @adaptor.become_root( tree_for_string_literal42, root_0 )\n\n char_literal43 = match( T__17, TOKENS_FOLLOWING_T__17_IN_datatype_294 )\n __INT44__ = match( INT, TOKENS_FOLLOWING_INT_IN_datatype_297 )\n\n tree_for_INT44 = @adaptor.create_with_payload( __INT44__ )\n @adaptor.add_child( root_0, tree_for_INT44 )\n\n char_literal45 = match( T__18, TOKENS_FOLLOWING_T__18_IN_datatype_299 )\n __INT46__ = match( INT, TOKENS_FOLLOWING_INT_IN_datatype_302 )\n\n tree_for_INT46 = @adaptor.create_with_payload( __INT46__ )\n @adaptor.add_child( root_0, tree_for_INT46 )\n\n char_literal47 = match( T__20, TOKENS_FOLLOWING_T__20_IN_datatype_304 )\n\n end# - - - - - - - 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 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__, 9 )\n\n end\n \n return return_value\n end",
"def check(text)\n case @type\n when :prefix\n return text.start_with? @value\n when :suffix\n return text.end_with? @value\n when :dual\n return text.start_with?(@value[0]) && text.end_with?(@value[1])\n when :regex\n return !self.match(text).nil?\n end\n end",
"def determine_type_globally(doc,reference)\n\n return nil if doc.nil?\n\n log_append(\"Looking for '#{reference}'\")\n\n # TODO: Consider the logic of what we are doing here, specifically do we\n # need to introduce a 'public' only match as we are only interested\n # in public variables once @type_depth > 0 IF we are inspecting a\n # a chain of property references. So in: thing.foo.bar thing is\n # local to the class and could be ppp (pp in the supers), but foo\n # can only be a public property.\n\n namespace = \"protected|public\"\n namespace = \"private|protected|public\" if @type_depth == 0\n namespace = \"\" if is_interface(doc)\n\n # Variables and Constants\n var_regexp = /^\\s*(#{namespace})\\s+(var|const)\\s+\\b(#{reference})\\b\\s*:\\s*((\\w+)|\\*)/\n\n doc.scan(var_regexp)\n if $4 != nil\n log_append(\"Type determined as '#{reference}:#{$4}' in global scope.\")\n return [doc,$4]\n end\n\n # Statics.\n var_regexp = /^\\s*(#{namespace}|static)\\s+(#{namespace}|static)\\s+\\b(var|const)\\s+\\b(#{reference})\\b\\s*:\\s*((\\w+)|\\*)/\n\n doc.scan(var_regexp)\n\n if $5 != nil\n log_append(\"Type determined as '#{reference}:#{$5}' in global scope.\")\n return [doc,$5]\n end\n\n # Also picks up single line methods.\n # TODO: public static function getInstance():IFacade {\n if namespace == \"\"\n # Handle interfaces.\n get_regexp = /^\\s*\\bfunction\\s+(get\\s+)?\\b(#{reference})\\b\\s*\\((?m:[^)]*)\\)\\s*:\\s*((\\w+)|\\*)/\n doc.scan(get_regexp)\n found_type = $3\n else\n get_regexp = /^\\s*(#{namespace}|static)\\s+(#{namespace}|static)?\\s*\\bfunction\\s+(get\\s+)?\\b(#{reference})\\b\\s*\\((?m:[^)]*)\\)\\s*:\\s*((\\w+)|\\*)/\n doc.scan(get_regexp)\n found_type = $6\n end\n\n if found_type != nil\n if found_type == \"void\"\n @return_type_void = true\n log_append(\"Return Type determined as '#{reference}:#{found_type}' (void) in global scope.\")\n return nil\n end\n log_append(\"Type determined as '#{reference}:#{found_type}' in global scope.\")\n return [doc,found_type]\n end\n\n @type_depth += 1\n\n # Try the superclass.\n # We check is_interface earlier in the method and set namespace accordingly.\n if namespace == \"\"\n\n # TODO: Check how we track type_depth and it's implications.\n ip = load_interface_parents(doc)\n next_docs = ip[:parents] || nil unless ip.nil?\n\n unless next_docs.nil? or next_docs.empty?\n\n log_append(\"Starting to recurse interface parents #{next_docs.size.to_s}\")\n\n next_docs.each do |d|\n\n found = determine_type_globally(d,reference)\n\n if found.instance_of? Array\n\n if found.size == 2\n log_append(\"found[0] = \\n#{found[0]} \\nfound[1] = \\n#{found[1]}\")\n return found\n else\n log_append(\"Error Expected an Array with 2 elements got #{found.size}\")\n end\n end\n end\n\n else\n nil\n end\n\n else\n next_doc = load_parent(doc);\n found = determine_type_globally(next_doc,reference)\n return found\n end\n\n nil\n end",
"def allowed_pattern(value, pdef)\n if(value.match(/#{pdef['AllowedPattern']}/))\n true\n else\n \"Not a valid pattern. Must match: #{pdef['AllowedPattern']}\"\n end\n end",
"def test_match_tlds\n assert_nothing_raised {\n @decl.pattern = \"*.tld\"\n }\n\n assert_equal(%w{tld}, @decl.pattern, \"Failed to allow custom tld\")\n end",
"def regex?\n @name.is_a?(Regexp)\n end",
"def patterns_for_type(type_)\n @mutex.synchronize do\n typedata_ = @types[type_]\n typedata_ ? typedata_.dup : []\n end\n end",
"def recognized_pattern?(pattern)\n [FalseClass, TrueClass, String, \n Regexp, Waw::Validation::Validator, StaticController::AbstractMatcher].any?{|c| c===pattern}\n end",
"def checkExp(exp, symbs, tmap, c)\n case exp.expr\n when 'identifier'\n #if symbol is not in table the identifier is undeclared\n if not symbs.include?(exp.args.name)\n puts \"ERROR: #{exp.args.line}: Type-Check: Undeclared identifier #{exp.args.name}\"\n exit\n else\n exp.type = symbs[exp.args.name]\n end\n\n when 'assign'\n checkExp(exp.args[1], symbs, tmap, c)\n #cannot assign to self\n if exp.args[0].name == 'self'\n puts \"ERROR: #{exp.line}: Type-Check: Cannot assign to self\"\n exit\n #if assignor not subclass of identifier\n elsif not tmap.isChild(exp.args[1].type, symbs[exp.args[0].name], c)\n puts \"ERROR: #{exp.line}: Type-Check: Bad assignment, #{exp.args[1].type} does not conform to #{symbs[exp.args[0].name]}\"\n exit\n else\n exp.type = exp.args[1].type\n end\n\n when 'true', 'false'\n exp.type = 'Bool'\n\n when 'integer'\n exp.type = 'Int'\n\n when 'string'\n exp.type = 'String'\n\n when 'new'\n #all types, including SELF_TYPE, are allowed here\n exp.type = exp.args.name\n\n when 'self_dispatch'\n checkDispatch(exp, symbs, tmap, c, nil, nil, exp.args[0], exp.args[1])\n\n when 'dynamic_dispatch'\n checkDispatch(exp, symbs, tmap, c, exp.args[0], nil, exp.args[1], exp.args[2])\n\n when 'static_dispatch'\n checkDispatch(exp, symbs, tmap, c, exp.args[0], exp.args[1], exp.args[2], exp.args[3])\n\n when 'if'\n checkExp(exp.args[0], symbs, tmap, c)\n # ERROR on non-Bool condition\n if exp.args[0].type != 'Bool'\n puts \"ERROR: #{exp.line}: Type-Check: Non-boolean condition\"\n exit\n end\n checkExp(exp.args[1], symbs, tmap, c)\n checkExp(exp.args[2], symbs, tmap, c)\n exp.type = tmap.lub(exp.args[1].type, exp.args[2].type, c)\n\n when 'block'\n exp.args.each do |e|\n checkExp(e, symbs, tmap, c)\n end\n exp.type = exp.args[exp.args.size-1].type\n\n when 'let'\n nsymbs = symbs.clone()\n # Bind each let binding\n exp.args[0].each do |bind|\n # can't bind self\n if bind.name.name == 'self'\n puts \"ERROR: #{exp.line}: Type-Check: Can't bind self in a let\"\n exit\n end\n # If there is an initializer, type check it\n if not bind.init.nil?\n checkExp(bind.init, nsymbs, tmap, c)\n if not tmap.isChild(bind.init.type, bind.type.name, c)\n puts \"ERROR: #{exp.line}: Type-Check: Initializer does not conform to declared type\"\n exit\n end\n end\n nsymbs[bind.name.name] = bind.type.name\n end\n checkExp(exp.args[1], nsymbs, tmap, c)\n exp.type = exp.args[1].type\n\n when 'case'\n checkExp(exp.args[0], symbs, tmap, c)\n nsymbs = symbs.clone()\n mtype = nil\n usedTypes = []\n #iterate over all case branches\n exp.args[1].each do |bind|\n #prevent self binding\n if bind.name.name == 'self'\n puts \"ERROR: #{bind.name.line}: Type-Check: Can't bind self in case expression\"\n exit\n end\n #prevent case checking for SELF_TYPE\n if bind.type.name == 'SELF_TYPE'\n puts \"ERROR: #{bind.type.line}: Type-Check: Can't use SELF_TYPE as case branch type\"\n exit\n end\n #prevent multiple branches checking same type\n if usedTypes.include? bind.type.name\n puts \"ERROR: #{bind.type.line}: Type-Check: #{bind.type.name} used twice as case branch type\"\n exit\n end\n usedTypes.push(bind.type.name)\n #bind case var and type check the branch\n nsymbs[bind.name.name] = bind.type.name\n checkExp(bind.body, nsymbs, tmap, c)\n #remove binding so it's not visible to other branches\n nsymbs[bind.name.name] = symbs[bind.name.name]\n #final type of case is least upper bound of all branch expressions\n if mtype.nil?\n mtype = bind.body.type\n else\n mtype = tmap.lub(mtype, bind.body.type, c)\n end\n end\n exp.type = mtype\n\n when 'while'\n checkExp(exp.args[0], symbs, tmap, c)\n #predicate of while must be Bool\n if exp.args[0].type != 'Bool'\n puts \"ERROR: #{exp.line}: Type-Check: Non-boolean loop condition\"\n exit\n end\n checkExp(exp.args[1], symbs, tmap, c)\n exp.type = 'Object'\n\n when 'isvoid'\n checkExp(exp.args, symbs, tmap, c)\n exp.type = 'Bool'\n\n when 'not'\n checkExp(exp.args, symbs, tmap, c)\n #not only operates on Bool\n if exp.args.type != 'Bool'\n puts \"ERROR: #{exp.line}: Type-Check: Can't perform not on #{exp.type}, expected Bool\"\n end\n exp.type = 'Bool'\n\n when 'negate'\n checkExp(exp.args, symbs, tmap, c)\n #negate only operates on Int\n if exp.args.type != 'Int'\n puts \"ERROR: #{exp.line}: Type-Check: Can't negate #{exp.type}, expected Int\"\n end\n exp.type = 'Int'\n\n when 'plus', 'minus', 'times', 'divide'\n checkExp(exp.args[0], symbs, tmap, c)\n checkExp(exp.args[1], symbs, tmap, c)\n #args must be Int for arithmetic\n if not (exp.args[0].type == \"Int\" and exp.args[1].type == \"Int\")\n puts \"ERROR: #{exp.line}: Type-Check: Non-integer arithmetic\"\n exit\n end\n exp.type = \"Int\"\n\n when 'eq', 'lt', 'le'\n checkExp(exp.args[0], symbs, tmap, c)\n checkExp(exp.args[1], symbs, tmap, c)\n #if one arg is Int, String, or Bool, the other must be same type\n #otherwise, the two args can be of any type\n sameComp = ['Int', 'String', 'Bool']\n if not ((sameComp.include?(exp.args[0].type) \\\n and sameComp.include?(exp.args[1].type) \\\n and exp.args[0].type == exp.args[1].type) \\\n or (not sameComp.include?(exp.args[0].type) \\\n and not sameComp.include?(exp.args[1].type)))\n puts \"ERROR: #{exp.line}: Type-Check: Can't compare #{exp.args[0].type} and #{exp.args[1].type}\"\n exit\n end\n exp.type = 'Bool'\n\n when 'internal'\n # do nothing\n\n else\n puts \"Unhandled expression: #{exp.expr}\"\n\n end\nend",
"def scan(pattern); end",
"def run( lines )\r\n # Check if this rule already evaluated to true\r\n return if self.result == true\r\n # Check if input is empty\r\n return if self.pattern == \"\"\r\n\r\n if lines.kind_of?(String)\r\n self.result = check_string( lines )\r\n elsif lines.kind_of?(Array)\r\n self.result = check_array( lines )\r\n else\r\n puts \"#{self.class}:run: Received invalid input of type: #{lines.class}\"\r\n return false\r\n end\r\n\r\n puts \"#{self.result.to_s.upcase}: #{self.class}: #{self.pattern}\" if @@DEBUG == true\r\n end",
"def test(value, attributes)\n value.blank? || value =~ pattern\n end",
"def regexp=(_arg0); end",
"def match?(type, code=nil)\n\t\tif code.nil?\n\t\t\t@type==type\n\t\telsif code.is_a?(Regexp)\n\t\t\t@type==type && @code =~ code\n\t\telse\n\t\t\t@type==type && @code==code\n\t\tend\n\tend",
"def _asset_regexp(type, key, _)\n /#{Regexp.escape(key.sub(/\\A#{type}/, ''))}\\.[0-9a-fA-F]+\\.#{type}/\n end",
"def get_type(value) #method\n if value == 'verdadero'\n true\n elsif value == 'falso'\n false\n elsif value.include? '.'\n value.to_f\n elsif value.scan(/\\D/).empty?\n value.to_i\n else\n value\n end\n end",
"def valid_search_type?(value)\n %w(characters).include? value\n end",
"def datatype_extract(valid_types, value)\n valid_types.find do |type|\n begin\n return type.parse(value) if type.respond_to?(:parse)\n rescue ArgumentError\n end\n end\n nil\n end",
"def submatcher; end",
"def submatcher; end",
"def matching_types(&matcher)\n yield(self) ? [self] : []\n end",
"def check_nominal\n if @type =~ /^\\s*\\{.*(\\,.*)+\\}\\s*$/\n @type_is_nominal = true\n # Example format: \"{nom1,nom2, nom3, nom4,nom5 } \"\n # Split on '{' ',' or '}'\n # @type = @type.gsub(/^\\s*\\{\\s*/, '').gsub(/\\s*\\}\\s*$/, '').split(/\\s*\\,\\s*/)\n @type = @type.split(/\\s*\\,\\s*/)\n end\n end",
"def validate(obj, type); end",
"def type_of_type(value)\n if value.is_a?(Range) || value.is_a?(Array) || value.is_a?(Hash)\n :complex\n else\n :simple\n end\nend",
"def matches\n parse\n end",
"def supports_regexp?\n true\n end",
"def supports_regexp?\n true\n end",
"def validate_line_value(line_value, validators)\n okay = true\n if validators && !validators.empty?\n okay = false\n validators.each do |v|\n okay = true and break if v.class.to_s == 'Regexp' and line_value =~ v\n okay = true and break if v.class.to_s == 'String' and line_value == v\n okay = true and break if v.respond_to?(:call) and v.call(line_value)\n end\n end\n okay\n end",
"def check(input, short_form)\n return false unless input.match short_form\n x = Regexp.last_match\n @match_data = binding\n true\n end",
"def is_valid?(types, item)\n types.each do |type|\n if type == :ipv4\n return true if ipv4?(item)\n elsif type == :domain\n return true if domain?(item)\n elsif type == :hash\n return true if hash?(item)\n elsif type == :classification\n return true if classification?(item)\n elsif type == :tag\n return true if tag?(item)\n elsif type == :bool\n return true if bool?(item)\n elsif type == :ssl_field\n return true if ssl_field?(item)\n elsif type == :whois_field\n return true if whois_field?(item)\n elsif type == :tracker_type\n return true if tracker_type?(item)\n end\n end\n return false\n end",
"def datatype(name, params, block, type_params, &type_block)\n define name, params, block, { :using => DataType }.merge(type_params) do\n #p [:self, __doodle__.__inspect__]\n #p [:checking_values, values, values.class]\n if respond_to?(:values)\n if values.kind_of?(Range)\n must \"be in range #{values}\" do |s|\n values.include?(s)\n end\n # array of values\n elsif values.respond_to?(:size) && values.size > 0\n must \"be one of #{values.join(', ')}\" do |s|\n values.include?(s)\n end\n end\n end\n if respond_to?(:match) && match\n must \"match pattern #{match.inspect}\" do |s|\n #p [:matching, s, da.match.inspect]\n s.to_s =~ match\n end\n end\n instance_eval(&type_block) if type_block\n end\n end",
"def allowed_types\n [SearchString]\nend",
"def match(object)\n @type.match(object)\n end",
"def my_all_handle_func(fun)\n if fun.is_a?(Regexp)\n my_each { |x| return false unless fun.match? x.to_s }\n else\n my_each { |x| return false unless fun === x }\n end\n true\n end",
"def tag_value(type)\n pattern = reserved_patterns[type]\n tag = tags.detect { |t| t.match?(pattern) }\n return unless tag\n\n tag.match(pattern)[type]\n end",
"def test_truth\n assert_kind_of BlacklistPattern, @blacklist_pattern\n end"
] | [
"0.62569076",
"0.60274065",
"0.5947168",
"0.5878101",
"0.5812691",
"0.57527083",
"0.5734143",
"0.5708198",
"0.5636059",
"0.5636059",
"0.5607261",
"0.5586464",
"0.5564149",
"0.55613583",
"0.55613583",
"0.55553705",
"0.55553705",
"0.5552359",
"0.55498874",
"0.55366397",
"0.55260175",
"0.55100167",
"0.55070525",
"0.5484823",
"0.54741186",
"0.54741186",
"0.5473648",
"0.54632205",
"0.54077154",
"0.5356815",
"0.5356815",
"0.5355088",
"0.53370005",
"0.5328518",
"0.5320113",
"0.5320113",
"0.5296862",
"0.5294869",
"0.52839476",
"0.52806485",
"0.5256428",
"0.52512306",
"0.5248478",
"0.52473545",
"0.52353877",
"0.52203214",
"0.5214632",
"0.520622",
"0.5192083",
"0.51917654",
"0.51744944",
"0.51744944",
"0.5173574",
"0.51724124",
"0.51724124",
"0.5164422",
"0.5164228",
"0.5160143",
"0.5153914",
"0.5153914",
"0.5142088",
"0.51349777",
"0.5115776",
"0.51134205",
"0.51102",
"0.5105764",
"0.51055026",
"0.50941736",
"0.50873846",
"0.50847113",
"0.50681126",
"0.50634986",
"0.5060085",
"0.505694",
"0.5049439",
"0.504244",
"0.504092",
"0.5037704",
"0.50304466",
"0.5030398",
"0.50202686",
"0.5009674",
"0.50091314",
"0.5009101",
"0.5009101",
"0.50089794",
"0.5006413",
"0.49959403",
"0.49926373",
"0.49883243",
"0.49805284",
"0.497941",
"0.49793825",
"0.49773556",
"0.49729055",
"0.4972278",
"0.49672464",
"0.49648544",
"0.49603483",
"0.49556273",
"0.4952076"
] | 0.0 | -1 |
Adds a string as an additional public credential to be combined in the collection. | def add_public(public_str='')
additional_publics << public_str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_private(private_str='')\n additional_privates << private_str\n end",
"def addCredentials(credential)\n\t\[email protected](credential)\n\tend",
"def add_restricted_string(string)\n @restricted_strings.push(string)\n end",
"def add(new_creds)\n @credentials.merge!(new_creds) { |_, old_val, new_val| old_val + new_val }\n end",
"def add_credential(source_id, tenant: user_tenant_account)\n {'id' => source_id.to_s, 'username' => 'admin', 'password' => 'smartvm', 'resource_id' => source_id.to_s, 'resource_type' => 'Endpoint', 'tenant' => tenants[tenant]['external_tenant']}\n end",
"def add_credential(db, username, password)\n @credentials ||= {}\n @credentials[db] = [ username, password ]\n apply_credentials\n end",
"def add(string)\n \tstring + \"only in America!\"\n end",
"def add_string(string)\n @strings << string\n end",
"def add(str)\n # If the thing passes for an URI with host and path we use it as url\n # otherwise as fingerprint. file:// uris would not qualify, we do not\n # presently have a use case for them though.\n if url?(str)\n add_url(str)\n else\n fingerprint_added?(str) ? true : add_fingerprint(str)\n end\n end",
"def add_credentials(post = {})\n post[:ext_person_source_id] = credentials[:ext_person_source_id]\n post[:source_username] = credentials[:username]\n post[:source_password] = credentials[:password]\n post[:ext_policy_id] = credentials[:ext_policy_id]\n post\n end",
"def add_credential(credential_type)\n raise ArgumentError, \"The new credential type cannot be nil\" unless credential_type\n raise ArgumentError, \"The new credential type cannot be empty\" if credential_type.empty?\n\n new_credential = self.service.object_mask(NetworkStorageCredential.default_object_mask).assignNewCredential(credential_type.to_s)\n \n @credentials = nil\n\n NetworkStorageCredential.new(softlayer_client, new_credential) unless new_credential.empty?\n end",
"def add_credential(rack_env, type, credential)\n Env.new(rack_env).tap do |env|\n env.credentials[type] = credential\n end.to_rack\n end",
"def gist_string(string)\n gist(:string=>string, :private=>true)\n end",
"def add_string\n \"will be created.\"\n end",
"def add_secret(secret)\n #@secrets = [] if @secrets == ['If it does not taste well, you did not add enough butter']\n @secrets << secret\n end",
"def add_credential(env, type, credential)\n credentials = env[CREDENTIALS_ENV_KEY] ||= {}\n\n raise ArgumentError, \"credential #{type} already added to request\" if credentials.key?(type)\n credentials[type] = credential\n\n env\n end",
"def add_credentials!\n @accessor.auth_manager.add_credentials(self)\n end",
"def add_member(str, project)\n if (user = find_member(str))\n set_status(project, :member, user, :add)\n @candidate = nil\n else\n flash_error(:add_members_not_found.t(str))\n end\n redirect_to(project_path(project.id, q: get_query_param))\n end",
"def license name\n self.licenses << name.to_s\n end",
"def append_enhanced(string)\n string.to_s + '_enhanced'\n end",
"def add_rutabaga_to_string(str)\n str << \"rutabaga\"\nend",
"def add username\n @members.add username\n end",
"def add(name, password, email)\n id = Digest::SHA256.hexdigest name + '_' + password + '_' + email\n id = id[0, 8]\n @names[id] = name\n @passwords[id] = password\n @emails[id] = email\n @stats[id] = { swin: 0, slose: 0, gwin: 0, glose: 0, draw: 0 }\n\n id\n end",
"def alias_add(al,member)\n obj_add(al,Alias,member)\n end",
"def encrypt(string, public_key = nil)\n require_key unless public_key\n\n key = OpenSSL::PKey::RSA.new(public_key || @private_key.public_key.to_pem)\n\n Base64.encode64(key.public_encrypt(string))\n end",
"def add_string_protected_status(string)\r\n string.concat(@PARAM_HASH['AMOUNT']) if @PARAM_HASH['PROTECT_AMOUNT'] == 'Yes'\r\n string.concat([@PARAM_HASH['REBILLING'], @PARAM_HASH['REB_CYCLES'], @PARAM_HASH['REB_AMOUNT'], @PARAM_HASH['REB_EXPR'], @PARAM_HASH['REB_FIRST_DATE']].join('')) if @PARAM_HASH['REB_PROTECT'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID']) if @PARAM_HASH['PROTECT_CUSTOM_ID'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID2']) if @PARAM_HASH['PROTECT_CUSTOM_ID2'] == 'Yes'\r\n return string \r\n end",
"def add_string_protected_status(string)\r\n string.concat(@PARAM_HASH['AMOUNT']) if @PARAM_HASH['PROTECT_AMOUNT'] == 'Yes'\r\n string.concat([@PARAM_HASH['REBILLING'], @PARAM_HASH['REB_CYCLES'], @PARAM_HASH['REB_AMOUNT'], @PARAM_HASH['REB_EXPR'], @PARAM_HASH['REB_FIRST_DATE']].join('')) if @PARAM_HASH['REB_PROTECT'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID']) if @PARAM_HASH['PROTECT_CUSTOM_ID'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID2']) if @PARAM_HASH['PROTECT_CUSTOM_ID2'] == 'Yes'\r\n return string \r\n end",
"def add_stuff(a_string_param)\n a_string_param += \"rutabaga\"\nend",
"def add_to_public_circle\n @circle = Circle.where(name: 'Public').try(:first)\n add_role(:member, @circle) if @circle\n end",
"def sign string\n raise Chimps::AuthenticationError.new(\"No Catalog API secret stored in #{Chimps.config[:config]} or #{Chimps.config[:site_config]}. Set Chimps.config[:catalog][:secret].\") unless (authenticable? || @forgive_authentication_error)\n require 'digest/md5'\n Digest::MD5.hexdigest(string + Chimps.config[:catalog][:secret])\n end",
"def add_account hash, default=false\n ## fill fields in from default account\n unless default\n [:address, :signature, :gpgkey].each { |k| hash[k] ||= @default_account.send(k) }\n end\n hash[:alternates] ||= []\n hash[:regexen] ||= []\n\n a = Account.new hash\n @accounts << a\n if default\n raise ArgumentError, \"multiple default accounts\" if @default_account\n @default_account = a\n end\n\n ([a.email] + hash[:alternates]).each { |email| @by_email[email] ||= a }\n hash[:regexen].each { |re| @by_regex[Regexp.new(re)] = a }\n end",
"def rsa_encrypt_with_public(plain_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_encrypt(plain_string)\n end",
"def rsa_encrypt_with_public(plain_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_encrypt(plain_string)\n end",
"def concat(str)\n @string << str\n self\n end",
"def add_key(user_name, key)\n\tabort \"Cannot add key, user not found!\" unless users(:return => :array).include?(user_name)\n\t@ssh_keys << {:user_name => user_name, :key => key}\n end",
"def add_user(user)\n user = user.strip.downcase\n key = key_for('autocomplete')\n (1..(user.length)).each{ |l|\n prefix = user[0...l]\n @redis.zadd(key,0,prefix)\n }\n @redis.zadd(key,0,user+'*')\n end",
"def third_party_credential(url); end",
"def add_string(string) \n unless @strings.include? string\n @strings[string] = self.strtab.num_bytes\n self.strtab << BinData::Stringz(string)\n end\n @strings[string]\n end",
"def add_player(player, password)\n @storage.save_player(player, password)\n self.add_object(player)\n end",
"def add\n keyfile = args.first || find_key\n key = File.read(keyfile)\n\n display \"Uploading ssh public key #{keyfile}\"\n heroku.add_key(key)\n end",
"def add_secure_hash\n # Per MIGS requirements we must stringify, sort fields alphabetically\n # minus the 'vpc_' prefix, add back the 'vpc_' prefix after sorting,\n # then join all fields as a query string separated by '&'.\n sorted_values = @fields.stringify_keys\n .map { |(k, v)| [k.gsub('vpc_', ''), v] }\n .sort\n .map { |i| \"vpc_#{i[0]}=#{i[1]}\" }\n .join('&')\n hash = OpenSSL::HMAC.hexdigest(HASH_ALGORITHM, [@secret].pack('H*'), sorted_values).upcase\n add_field('vpc_SecureHash', hash)\n add_field('vpc_SecureHashType', 'SHA256')\n end",
"def add_users(new_users)\n\n return if new_users.nil?\n\n self.users = '|' if self.users.nil? or self.users.empty?\n self.users += new_users.join('|') + '|'\n end",
"def add_key(key_string, key_type=nil, comment=nil, login=nil )\n #@container.logger.info \"Adding new key #{key_string} #{key_type} #{comment} #{login}\"\n comment = \"\" unless comment\n\n modify do |keys|\n keys[key_id(comment)] = key_entry(key_string, key_type, comment, login)\n end\n\n end",
"def add\n request('add').auth_required!\n end",
"def add_auth_basic auth, url, client_opts\n l = @spaces.bsearch_lower_boundary { |x| x.prefix <=> url }\n space = nil\n\n if l < @spaces.length && self.class.prefix?(@spaces[l].prefix, url)\n space = @spaces[l]\n else\n prefix = url.sub /[^\\/]+$/, '' # chop off until last slash\n \n space = AuthSpace.new prefix\n @spaces.insert l, space\n end\n space.update_auth auth, client_opts\n end",
"def add_licenses=(value)\n @add_licenses = value\n end",
"def constructAuthorisationString\n \"GoogleLogin auth=#{@authorisationHash}\"\n end",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\") \n\tend",
"def add_key(key)\n deprecate # 07/31/2012\n post(\"/user/keys\", key, { 'Content-Type' => 'text/ssh-authkey' }).to_s\n end",
"def public_key=(_); end",
"def public_key=(_); end",
"def string_add(string1, string2)\n puts \"#{string1} #{string2}\"\nend",
"def add_headers(current_string)\n return current_string if @headers.nil?\n string_headers = @headers.map { |k, v| \" -H '#{k}:#{v}' \" }.join(\"\")\n current_string + string_headers\n end",
"def add_client(new_client)\n output_strings = []\n if @clients[new_client.name.to_sym].nil?\n @clients[new_client.name.to_sym] = new_client\n output_strings << \"New client #{new_client.name} added.\"\n else\n output_strings << \"That client already exists. Not adding again.\"\n end\n end",
"def add_server_address(current_string)\n add_if_present(@server_address, current_string, \" #{@server_address} \")\n end",
"def string_append(string)\n \t\tstring + \" appended\"\n \tend",
"def add_auth_digest auth, url, client_opts\n uri = URI.parse url\n\n abs_domains = if auth.domain.nil? || auth.domain.empty?\n [ /^https?:\\/\\/[^\\/]+\\//.match(url)[0] ]\n else\n auth.domain.map do |d|\n domain_uri = URI.parse d\n d = URI.join(url, d).to_s if domain_uri.relative?\n d\n end\n end\n\n abs_domains.each do |domain|\n l = @spaces.bsearch_lower_boundary { |x| x.prefix <=> domain }\n space = l < @spaces.length ? @spaces[l] : nil\n\n if space.nil? || space.prefix != domain\n space = AuthSpace.new domain\n @spaces.insert l, space\n end\n space.update_auth auth, client_opts\n end\n end",
"def add_password(password)\n @password = password\n end",
"def add\n if keyfile = args.first\n display \"Uploading ssh public key #{keyfile}\"\n heroku.add_key(File.read(keyfile))\n else\n # make sure we have credentials\n Heroku::Auth.get_credentials\n Heroku::Auth.associate_or_generate_ssh_key\n end\n end",
"def auth(string)\n @request_id = rand(1000)\n @string1 = string\n @string2 = TRAILER\n @command_type = COMMAND_AUTH\n \n @packet_size = build_packet.length\n \n return self\n end",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end",
"def add_auth(uri, user, password, realm = T.unsafe(nil), domain = T.unsafe(nil)); end",
"def add_auth(uri, user, password, realm = T.unsafe(nil), domain = T.unsafe(nil)); end",
"def add\n keyfile = shift_argument\n validate_arguments!\n\n if keyfile\n Heroku::Auth.associate_key(keyfile)\n else\n # make sure we have credentials\n Heroku::Auth.get_credentials\n Heroku::Auth.associate_or_generate_ssh_key\n end\n end",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end",
"def add(text)\n @text << text\n end",
"def add_repositories_for_member name\n # For a single repo, we'd call\n # GET /users/:username/repos (see https://developer.github.com/v3/repos/#list-user-repositories)\n GithubApi.get(\"/users/#{name}/repos\").each do |r|\n @repositories << r[\"full_name\"]\n end\n end",
"def add_alias( name )\n\t\t\t@aliases << name\n\t\tend",
"def addSharedWith(demand)\n @sharedWithList.push(demand) ;\n end",
"def add_auth(auth, curl, params)\n if auth == 'basic'\n username, password = params.values_at(:username, :password)\n encoded = Base64.encode64(\"#{username}:#{password}\").strip\n curl.headers['Authorization'] = \"Basic #{encoded}\"\n end\n end",
"def add(host, key); end",
"def add(username, realm, password)\n raise DigestFileError, \"Unable to add already existing user #{username} in realm #{realm}\" if has_entry?(username, realm)\n\n new_entry = DigestEntry.new(username, realm, password)\n new_index = @lines.size\n @lines << new_entry.to_s\n @entries[new_entry.key] = { 'entry' => new_entry, 'line_index' => new_index }\n dirty!\n return nil\n end",
"def << string\n #This is a stub, used for indexing\n end",
"def << string\n #This is a stub, used for indexing\n end",
"def add_license(license_id, source, contents_url = nil)\n LicenseScout::Log.debug(\"[#{type}] Adding #{license_id} license for #{name} from #{source}\")\n license.add_license(license_id, source, contents_url, {})\n end",
"def encrypt(string)\n\t#store passwords with the timestamp first, then password (encrpyted)\n secure_hash(\"#{salt}--#{string}\")\n\t#Since weíre inside the User class, Ruby knows that salt refers to the userís salt attribute.\n end",
"def rsa_encrypt_with_private(plain_string)\n raise \"No private key set\" unless @private_key\n\n @private_key.private_encrypt(plain_string)\n end",
"def rsa_encrypt_with_private(plain_string)\n raise \"No private key set\" unless @private_key\n\n @private_key.private_encrypt(plain_string)\n end",
"def add_strings(strings)\n strings.each { |string| @strings << string }\n self\n end",
"def public_key; end",
"def public_key; end",
"def public_key; end",
"def add_authorized_key(key)\n queries = password_hash\n case key\n when String\n if File.exist?(key)\n key = File.open(key, \"r\")\n content = key.read.strip\n key.close\n else\n content = key\n end\n when File\n content = key.read.strip\n key.close\n end\n\n queries[:query][:authorized_key] = content\n post \"/setup/api/settings/authorized-keys\", queries\n end",
"def append(input, string); end",
"def add2(env, id)\n member = ActiveFedora::Base.find(id)\n return unless env.current_ability.can?(:edit, member)\n env.curation_concern.ordered_members << member\n end",
"def <<(string)\n send(string)\n self\n end",
"def child_add_string_encrypted(name, value, key = nil)\n if(not name or not value)\n abort(\"Invalid input specified for name or value\")\n end\n unless(key)\n key = DEFAULT_KEY\n end\n if (key.length != 16)\n abort(\"Invalid key, key length sholud be 16\")\n end\n #encryption of key and others\n encrypted_value = RC4(key, value)\n unpacked_value = encrypted_value.unpack('H*')\n child_add_string(name, unpacked_value[0])\n end",
"def << other\n @dss << other.to_s\n self\n end",
"def add_creditcard(parameters, creditcard)\n parameters[:CardNo] = creditcard.number\n parameters[:Expire] = expdate(creditcard)\n parameters[:SecurityCode] = creditcard.verification_value\n\n # The GMO API doesn't have name fields, so we add them to the client field\n parameters[:ClientField1] = \"#{creditcard.first_name} #{creditcard.last_name} #{parameters[:ClientField1]}\".strip\n end",
"def add_digest(item)\n add_lock_prefix(item)\n add_lock_args(item)\n add_lock_digest(item)\n\n item\n end",
"def credential_source\n super\n end",
"def add_trusted_key(k)\n @trusted_keys.add(k)\n end",
"def + other\n self.class.new @dir, @reg, @dss + other.to_s\n end",
"def add_service_name(current_string)\n add_if_present(@service_name, current_string, \" #{@service_name}\")\n end",
"def add_item(grcy_list, string, i=1)\n grcy_list[string] = i\nend",
"def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end",
"def public_key(arg = nil)\n set_or_return(\n :public_key,\n arg,\n kind_of: String\n )\n end",
"def add(mountString)\n @mtab << mountString\n end"
] | [
"0.68462294",
"0.62559134",
"0.62259746",
"0.61817056",
"0.59006923",
"0.5748912",
"0.57230186",
"0.5545442",
"0.54890907",
"0.5410406",
"0.5409817",
"0.5360466",
"0.5281468",
"0.52598274",
"0.5255729",
"0.52484703",
"0.52007586",
"0.51919246",
"0.51739335",
"0.5161569",
"0.50369537",
"0.5027012",
"0.5024336",
"0.49870747",
"0.497067",
"0.49663502",
"0.49663502",
"0.4951936",
"0.4941857",
"0.49415556",
"0.49144545",
"0.4898538",
"0.4898538",
"0.4885546",
"0.48795336",
"0.48768872",
"0.48760536",
"0.48730457",
"0.48524308",
"0.48510882",
"0.48503834",
"0.4848212",
"0.48349229",
"0.4832574",
"0.48192853",
"0.48168498",
"0.48094675",
"0.48075148",
"0.4805661",
"0.47814476",
"0.47814476",
"0.47689798",
"0.47688568",
"0.4746888",
"0.474249",
"0.4738947",
"0.47383648",
"0.4734702",
"0.4723787",
"0.47235292",
"0.47156554",
"0.47156554",
"0.47156554",
"0.47147918",
"0.47147918",
"0.47085494",
"0.468791",
"0.46807313",
"0.46791452",
"0.467173",
"0.46589565",
"0.46536255",
"0.46506697",
"0.4646911",
"0.46432504",
"0.46432504",
"0.46402675",
"0.46378043",
"0.46376258",
"0.46376258",
"0.46375567",
"0.4629606",
"0.4629606",
"0.4629606",
"0.46289954",
"0.462873",
"0.4627993",
"0.46261624",
"0.46252802",
"0.462373",
"0.46197698",
"0.4617142",
"0.46162346",
"0.4614842",
"0.46125942",
"0.46105063",
"0.4608025",
"0.46073285",
"0.46058738",
"0.46014923"
] | 0.72316724 | 0 |
Returns true when each will have no results to iterate | def empty?
prepended_creds.empty? && !has_users? || (has_users? && !has_privates?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n self.results.empty?\n end",
"def hasResults?\n ! @results.empty?\n end",
"def empty?\n @iterator.nil?\n end",
"def empty?\n iterator.nil?\n end",
"def my_none?\n status = true\n self.my_each do |item|\n if (yield item) == true\n status = false\n end\n end\n status\n end",
"def empty?\n return true unless @all\n @all.empty?\n end",
"def none?(collection)\n collection.each { |element| return false if yield(element) }\n true\nend",
"def my_all?\n my_each do |i|\n if (!yield(i))\n return false\n end\n end\n true\n end",
"def my_all?\n\t\t#if any element is false return false\n\t\tmy_each do | element |\n\t\t\tif yield( element )\n\t\t\t\tnext\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\t# returns true when all iterations pass\n\t\treturn true\n\n\tend",
"def empty?\n find.limit(1).has_next? == false\n end",
"def any?\n !total_pages.zero?\n end",
"def has_results?\n true\n end",
"def nothing_found?\n @matching_documents.nil? or @matching_documents.entries.empty?\n end",
"def my_none?\n if block_given?\n self.my_each {|n| return false if yield(n) == true}\n return true\n else\n return true if self.size == 0\n self.my_each {|n| return false if n == true}\n return true\n end\n end",
"def my_all?\n status = true\n self.my_each do |item|\n if (yield item) != true\n status = false\n end\n end\n status\n end",
"def empty?\n all.empty?\n end",
"def empty?\n peek\n false\n rescue StopIteration\n true\n end",
"def my_none?(&block)\n counter = 0\n my_each do |elem|\n counter += 1 if block.call(elem) == false\n end\n return true if counter == size\n\n false\n end",
"def my_all? \n\ti = true\n\tself.my_each do |a|\n\t\tunless yield (a)\n\t\t\ti = false\n\t\t\tbreak\n\t\tend\n\tend\n\ti\nend",
"def iterator?() end",
"def all?(collection)\r\n collection.each { |item| return false if !yield(item) }\r\n true\r\nend",
"def no_more?\n more_results == :NO_MORE_RESULTS\n end",
"def my_none?\n self.my_each {|x| return false if yield(x) == true}\n true\n end",
"def my_none?\n all = true\n self.my_each do |x|\n if !block_given?\n if x\n all = false\n end\n elsif yield x\n all = false\n end\n break if all == false\n end\n all\n end",
"def empty?\n self.count == 0\n end",
"def empty?\n self.count == 0\n end",
"def my_all?\n return unless block_given?\n self.my_each do |ele|\n if not yield ele then return false\n end\n end\n return true\n end",
"def my_any?\n status = false\n self.my_each do |item|\n if (yield item) == true\n status = true\n end\n end\n status\n end",
"def my_none?\n\t\tvalue = true\n\t\tself.my_each do |element|\n\t\t\tif yield(element) == true\n\t\t\t\tvalue = false\n\t\t\tend\n\t\tend\n\t\treturn value\n\tend",
"def any_results?\n races.any?(&:any_results?)\n end",
"def __empty?\n all?(&:__empty?)\n end",
"def check_for_no_results(hash_of_results)\n if hash_of_results[JSON_NUMBER_OF_RESULTS] == 0\n puts 'No results, try again'\n go\n end\n end",
"def empty?\n count == 0\n end",
"def empty?\n count == 0\n end",
"def has_results?\n !(name == 'aggregate' &&\n pipeline.find {|op| op.keys.include?('$out') })\n end",
"def empty?\n count <= 0\n end",
"def empty?\n total_count == 0\n end",
"def empty?\n total_count == 0\n end",
"def results?() ! find(locator(:no_results_message)) end",
"def my_all?\n self.my_each {|x| return false if yield(x) != true}\n true\n end",
"def more_results?()\n #This is a stub, used for indexing\n end",
"def empty?\n count == 0\n end",
"def my_any?\n if block_given?\n self.my_each {|n| return true if yield(n) == true}\n return false\n else\n return false if self.size == 0\n self.my_each {|n| return true if n == true}\n return false\n end\n end",
"def first?\n\t\treturn @iteration == 0\n\tend",
"def none?(array)\n array.each do |item|\n return false if yield(item)\n end\n true\nend",
"def empty?\n @items.count == 0\n end",
"def my_none?\n return unless block_given?\n self.my_each do |ele|\n if yield ele then return false\n end\n end\n return true\n end",
"def my_none?\n if self.class == Array\n my_each do |value|\n # stop if any item is true\n return false if yield(value)\n end\n elsif self.class == Hash\n my_each do |key, value|\n # stop if any item is true\n return false if yield(key, value)\n end\n end\n\n true\n end",
"def my_none?\n return self unless block_given?\n for n in self\n if yield(n)\n return false\n end\n end\n return true\n end",
"def empty?\n @next.nil?\n end",
"def empty?\n load # make sure we have determined the number of fetched records\n\n @number_of_records.zero?\n end",
"def present?\n results.any?\n end",
"def not_finished?\n more_results == :NOT_FINISHED\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def is_empty()\n return @items.empty?\n end",
"def empty?\n @data.rows_count <= 0\n end",
"def empty?\n RECORDS.each do |name, _|\n return false unless @records[name].empty?\n end\n true\n end",
"def any?\n ! empty?\n end",
"def my_none?\n if block_given?\n self.my_each {|o| return false if yield(o)}\n true\n else\n truths = 0\n self.my_each {|o| truths +=1 if o}\n truths == 0\n end\n end",
"def my_all?\n all = true\n self.my_each do |x|\n if !block_given?\n if !x || x.nil?\n all = false\n end\n elsif !yield x\n all = false\n end\n break if all == false\n end\n all\n end",
"def my_all?\n\t\tvalue = true\n\t\tself.my_each do |element|\n\t\t\tif yield(element) != true\n\t\t\t\tvalue = false\n\t\t\tend\n\t\tend\n\t\treturn value\n\tend",
"def empty?\n return @querys.empty?\n end",
"def empty?\n each_cell do |cell|\n return false if cell\n end\n true\n end",
"def returns_one?\n rule != :each\n end",
"def empty?\n @total == 0\n end",
"def empty?\n @records.empty?\n end",
"def my_all?(collection)\n i = 0\n return_value = []\n while i < collection.length\n return_value << yield(collection[i])\n i += 1\n end\n\n # check to see if the return values from yielding contains a false\n if return_value.include?(false)\n false\n else\n true\n end\n\nend",
"def complete_result?\n @result_count < 1000\n end",
"def empty?\n rows.empty?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n count.zero?\n end",
"def isEmpty?()\r\n return @items == 0\r\n end",
"def my_all?(&prc)\n self.my_each { |el| return false if !prc.call(el) }\n true\n end",
"def empty?\n return @items.nil?\n end",
"def empty?\n @rows.empty? if @rows\n end",
"def my_any?\n all = false\n self.my_each do |x|\n if !block_given?\n if x || !x.nil?\n all = true\n end\n elsif yield x\n all = true\n end\n break if all == true\n end\n all\n end",
"def empty?\n record_count == 0\n end",
"def my_all?(collection)\n #our counter\n i = 0\n block_return_values = [ ]\n while i < collection.length\n block_return_values << yield(collection[i])\n # yield(collection[i]) go throughe each element in the index.\n i = i + 1\n #i += 1 does the same thing. Use this if it's easier for you.\n\n end\n\n if block_return_values.include?(false)\n false\n else\n true\n end\nend",
"def empty?\n items.empty?\n end",
"def empty?\n total_pages.zero?\n end",
"def empty?\n return @tree_iterator.empty?\n end",
"def my_all?(&prc)\n self.my_each do |el|\n return false if !prc.call(el)\n end\n\n true\n end",
"def empty?\n each do |cell|\n return false if cell.value.to_i != 0\n end\n true\n end",
"def empty?\n return @fill_count == 0\n end",
"def has_records? results\n not results.nil? and results.fetch('SearchResult', {}).fetch('Data', {}).fetch('Records', []).count > 0\n end",
"def ok?\n skip? || @result\n end",
"def empty?\n return @records.empty? if loaded?\n\n if limit_value == 0\n true\n else\n # FIXME: This count is not compatible with #select('authors.*') or other select narrows\n c = count\n c.respond_to?(:zero?) ? c.zero? : c.empty?\n end\n end",
"def my_all?(collection)\n i = 0 \n block_return_values = []\n while i < collection.length\n \n # declare our array & yield each element in the collection\n \n block_return_values << yield(collection[i])\n i = i + 1 \n end\n \n # add an ' #include? ' method to determine the return value of the my_all? method.\n \n if block_return_values.include?(false)\n false \n else \n true \n end\nend",
"def none?\n !any?\n end",
"def empty?\n @rows.empty?\n end",
"def empty?\n entries.empty?\n end",
"def empty?\n entries.empty?\n end",
"def all?(collection)\n collection.each_with_object(true) { |el| return false unless yield(el) }\nend",
"def empty?\n self.responses.empty?\n end",
"def any?\n false\n end",
"def empty?\n\t\tself.items\n\tend",
"def test_emptyItem\n f = ItemFilter.new()\n new_list = [].find_all{|x| f.apply(x)}\n return new_list.size == 0\n end"
] | [
"0.7608348",
"0.7486262",
"0.72782457",
"0.72603536",
"0.7162861",
"0.7084586",
"0.7045953",
"0.7011792",
"0.7011498",
"0.69935656",
"0.69506454",
"0.6936981",
"0.692555",
"0.6878075",
"0.6857555",
"0.68537855",
"0.6832348",
"0.68179005",
"0.67823243",
"0.6773387",
"0.6751802",
"0.6749703",
"0.6734551",
"0.6722655",
"0.6710387",
"0.6710387",
"0.6707896",
"0.6684173",
"0.66625744",
"0.6661927",
"0.6651786",
"0.66492355",
"0.664746",
"0.664746",
"0.6640261",
"0.6639972",
"0.66257226",
"0.66257226",
"0.66187704",
"0.6616276",
"0.66125107",
"0.65952593",
"0.6588507",
"0.6587339",
"0.65764296",
"0.65724224",
"0.656495",
"0.65649045",
"0.6556472",
"0.6535875",
"0.6534567",
"0.6527768",
"0.65170074",
"0.6513906",
"0.6513906",
"0.6513906",
"0.6513906",
"0.65106577",
"0.6491994",
"0.64904815",
"0.64879555",
"0.6477632",
"0.6465442",
"0.64628774",
"0.64614934",
"0.6458959",
"0.64570266",
"0.6449526",
"0.6442759",
"0.6433905",
"0.64218056",
"0.6419131",
"0.6396563",
"0.6396563",
"0.6396563",
"0.6394068",
"0.6387567",
"0.6379276",
"0.6377674",
"0.6376263",
"0.63706285",
"0.6369633",
"0.6368923",
"0.63675773",
"0.63616127",
"0.63583744",
"0.63485795",
"0.63442427",
"0.63402826",
"0.6338819",
"0.6332056",
"0.63267714",
"0.6322583",
"0.6322392",
"0.63205713",
"0.63205713",
"0.6313762",
"0.6311423",
"0.6300786",
"0.62995327",
"0.62932605"
] | 0.0 | -1 |
Returns true when there are any user values set | def has_users?
username.present? || user_file.present? || userpass_file.present? || !additional_publics.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete?\r\n cur_values.all{ |value| value!=nil }\r\n end",
"def value_set?\n @value_set == true\n end",
"def has_known_value?\n all?(&:has_known_value?)\n end",
"def value_set?\n @value_set\n end",
"def complete_flag_values?\n @complete_flag_values\n end",
"def any_key?\n @keys == UndefinedSetting\n end",
"def has_value?\n false\n end",
"def empty?\n return false if @opts[:values]\n super\n end",
"def value?\n @count > 0\n end",
"def has_value?\n true\n end",
"def user_defined?\n [email protected]? || !@user['userId'].nil?\n end",
"def has_users?\n\t\tself.users.size > 0\n\tend",
"def __empty?\n return false unless super\n __empty(__value)\n end",
"def ready?\n [email protected]? { |observable, value| value.nil? }\n end",
"def ready?\n [email protected]? { |observable, value| value.nil? }\n end",
"def just_u_value?()\n @construction.check_keyword?(\"U-VALUE\")\n end",
"def just_u_value?()\n @construction.check_keyword?(\"U-VALUE\")\n end",
"def empty?\n @_values.empty?\n end",
"def empty?\n @values.values.all?(&:nil?)\n end",
"def empty?\n _values.empty?\n end",
"def empty?\n _values.all?(&:empty?)\n end",
"def among_validate_in_values?\n vs = @cfg.valid_values\n !vs || vs.include?(@value)\n end",
"def any_missing?(values)\n values.any?{|v| is_missing?(v)}\n end",
"def profile_complete?\n\t\tparameters_with_values = generate_array_of_param_with_value\n\n\t\tparameters_with_values.each do |p|\n\t\t\treturn false if !p\n\t\tend\n\n\t\treturn true\n\tend",
"def empty?\n find_users.empty?\n end",
"def set?\n @auth.any?\n end",
"def profile_complete?\n\t\t!self.fname.blank? and !self.lname.blank? and !self.email.blank? and !self.company_name.blank? and !self.country.blank? and !self.locale.blank?\n\tend",
"def blank?\n @values.blank?\n end",
"def value_present?\n [email protected]?\n end",
"def all_missing?(values)\n values.all?{|v| is_missing?(v)}\n end",
"def no_missing?(values)\n not(any_missing?(values))\n end",
"def valid?\n [field, value, password].all?(&:present?)\n end",
"def must_have_value?\n return false\n end",
"def empty?\n @json_data['users'].empty?\n end",
"def populated?\n !!@populated\n end",
"def set?\n return @set == true\n end",
"def hasValue\n @valueCreator.hasValue\n end",
"def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end",
"def update_any_data?\n add_name? || add_events? || set_wheel_sizes? || add_volunteers? || add_contact_details? || lodging? || expenses? || set_organization_membership?\n end",
"def exists?\n values.exists?\n end",
"def has_value?(p0) end",
"def update_profile?\r\n REQUIRED_FIELDS.each { |field|\r\n value = self.send field\r\n return true if value.nil? || value.empty?\r\n }\r\n false\r\n end",
"def for_all?\n return (self.owner_id == 0 and self.get_groups_a.empty? and self.get_teams_a.empty?)\n end",
"def all_votes_specified?\n # if at least one value is nil, return false\n return false if (pro.nil? or pro == \"\") or\n (con.nil? or con == \"\") or\n (abs.nil? or abs == \"\")\n # otherwise return true\n return true\n end",
"def all_votes_specified?\n # if at least one value is nil, return false\n return false if (pro.nil? or pro == \"\") or\n (con.nil? or con == \"\") or\n (abs.nil? or abs == \"\")\n # otherwise return true\n return true\n end",
"def any_mines_detonated?\n @value_grid.any?{ |space, properties| properties == { cleared: true, mine: true } }\n end",
"def fetched_value_is_empty?\n Array(@fetched_value).reduce(true) do |all_empty, val|\n all_empty &&= ( val.nil? || ( val.respond_to?(:empty?) && val.empty? ) )\n end\n end",
"def valid?(set)\n set.is_a?(Hash) && set[\"values\"].is_a?(Hash)\n end",
"def can_have_value?\n return false\n end",
"def is_set?\n @is_set\n end",
"def values_stored?\n sheetcells.exists?(status_id: [2, 3, 4])\n end",
"def any?\n REQUIRED_KEYS.any? do |key|\n attributes[key].any?\n end\n end",
"def can_have_value?()\n return true\n end",
"def has_value?(value); end",
"def all?(&block)\n if block\n self.each{|*val| return false unless block.call(*val)}\n else\n self.each{|*val| return false unless val.__svalue}\n end\n true\n end",
"def valid?(val)\n vals.include? val\n end",
"def all_users_have_positions\n users.delete_if { |u| u.student_mode }.each do |u|\n unless u.position\n return false\n end\n end\n true\n end",
"def empty?\n prepended_creds.empty? && !has_users? || (has_users? && !has_privates?)\n end",
"def user_details_complete(user)\n\n user_details_fields_presence = []\n\n user_details_fields_presence.push(user.name.present?)\n user_details_fields_presence.push(user.date_of_birth.present?)\n user_details_fields_presence.push(\n (\n user.line1.present? &&\n user.townCity.present? &&\n user.county.present? &&\n user.postcode.present?\n )\n )\n\n user_details_fields_presence.all?\n\n end",
"def whitelist_users?\n self.whitelist_users.any?\n end",
"def profile_completed?\n !self.name.blank? and !self.country.blank? and !self.contact_number.blank?\n end",
"def empty?\n @fields.values.empty?\n end",
"def authed_user?\n return true unless @data['hasPhone'].nil?\n\n false\n end",
"def acceptable_values?\n options_s_keys = options.keys.map(&:to_s)\n\n if @attributes[:multiple] && resolver.params[name].respond_to?(:map)\n (resolver.params[name].map(&:to_s) - options_s_keys).empty?\n else\n options_s_keys.include?(resolver.params[name].to_s)\n end\n end",
"def strict?\n each_pair.all?{|name, value|sufficient? name, value}\n end",
"def value?(value) true end",
"def set?\n\t\t\tbegin\n\n\t\t\t\tvalue = @lookup.inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\t\t# Has to be an object that can have keys\n\t\t\t\t\treturn false unless deep_obj.respond_to?(:[])\n\n\t\t\t\t\tif deep_obj.respond_to?(:fetch)\n\t\t\t\t\t\t# Hash, Array and Struct all respond to fetch\n\t\t\t\t\t\t# We've monkeypatched fetch to Struct\n\t\t\t\t\t\tif deep_obj.is_a?(Array)\n\t\t\t\t\t\t\t# Check array separately as must fetch numeric key\n\t\t\t\t\t\t\treturn false unless Keys.index?(this_key)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tnext_obj = deep_obj.fetch(this_key, Keys::MISSING)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\t# No need to go any further\n\t\t\t\t\treturn false if Keys::MISSING == next_obj\n\n\t\t\t\t\t# Reinject value to next loop\n\t\t\t\t\tnext_obj\n\t\t\t\t}\n\n\t\t\trescue\n\t\t\t\t# If fetch throws a wobbly at any point, fail gracefully\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t# No errors - yield the value if desired\n\t\t\tif block_given?\n\t\t\t\tyield(value)\n\t\t\tend\n\t\t\t# Return true\n\t\t\treturn true\n\t\tend",
"def filled?\n @value.positive?\n end",
"def valid?\n NON_BLANK_KEYS.all? do |key|\n selected_config.key?(key) && !selected_config[key].to_s.empty?\n end\n end",
"def valid?(set); end",
"def all_instance_variables_set?\n self.class.instance_variables_required.to_a.all? do |instance_variable|\n !instance_variable_get(instance_variable.to_s).nil?\n end\n end",
"def user_set\n return true if no_user_validation\n\n unless user\n errors.add :user, 'must be authenticated and set'\n logger.warn \"User is not set. Failed user_set validation for #{inspect}\"\n end\n user\n end",
"def valid?\n filled?\n end",
"def value_set? key\n @values.key? @schema.resolve_key! key\n end",
"def has_value? value; value? value; end",
"def isSet?\r\n assert_exists\r\n return @o.checked\r\n end",
"def clear_users\n\n if self.users.nil? or self.users.empty?\n return false\n else\n self.users = nil\n return true\n end\n end",
"def value_required?\n if (@data_type == :none) || (@data_type == :global_class)\n return false\n else\n return true\n end\n end",
"def check_local_users_do_exist(users)\n @users_that_should_be_present << {\n nodes_selectors_stack: current_nodes_selectors_stack,\n users: users.is_a?(Array) ? users : [users]\n }\n end",
"def unnamed?\n @keys == nil\n end",
"def set?\n [email protected]?\n end",
"def set?\n [email protected]?\n end",
"def cache_default_values?\n @cache_default_values\n end",
"def variants_have_property_values?\n self.variants.each do |v|\n return true if !v.variant_variant_property_values.empty?\n end\n return false\n end",
"def defined_any?\n cassette_records.size > 0\n end",
"def single_value?\n return false\n end",
"def registered?\n [:first_name, :last_name, :date_of_birth].map do |attribute|\n self.send(attribute).present?\n end.inject(true) { |memo, element| memo && element }\n end",
"def given?\n return true unless @data.nil? || @data.empty?\n\n false\n end",
"def unidentified?\n @unidentified ||= ids.values.all?(&:blank?)\n end",
"def filled?\n @value > 0\n end",
"def explicitly_set_value?\n @explicitly_set_value == true\n end",
"def ensure_not_referenced_by_any_group\n if users.empty?\n return true\n else\n errors.add(:base, 'users present')\n return false\n end\n end",
"def valid_user\n #puts \"VALID USER - USER DEVICE TOKENS #{@device_tokens} #{@first_name} #{@phone_number} #{@last_name} \"\n return (!@phone_number.nil? && !@phone_number.empty? && !@first_name.nil? && !@first_name.empty? && !@last_name.nil? && !@last_name.empty? && !@device_tokens.nil? && !@device_tokens.empty?)\n\n end",
"def can_have_value?\n return true\n end",
"def key_set?\n !attributes['key'].nil?\n end",
"def setting_exists? \n\t\tuser_ids = Setting.pluck :user_id\n\t\terrors.add(:user_id, \"user has a settings file already\") if user_ids.include? self.user_id\n\tend",
"def looks_valid?\n check!(false).empty?\n end",
"def any?\n raw? || stored?\n end",
"def valid?\n if @variable.nil? || @chart_variable.nil? || @values_unique == []\n false\n elsif @variable.type == \"choices\" && @variable.domain.options == []\n false\n elsif @chart_variable.type == \"choices\" && @chart_variable.domain.options == []\n false\n else\n true\n end\n end",
"def emit_value?\n !mlhs? && !no_value_parent?\n end"
] | [
"0.71596587",
"0.70534754",
"0.699063",
"0.6981047",
"0.69351137",
"0.6909376",
"0.68466896",
"0.6749543",
"0.66543704",
"0.6652924",
"0.6652313",
"0.6642557",
"0.6584787",
"0.6556851",
"0.6550875",
"0.65311265",
"0.6495459",
"0.6477065",
"0.6475786",
"0.64717776",
"0.6455629",
"0.64327437",
"0.642503",
"0.6418944",
"0.639651",
"0.6387605",
"0.6362998",
"0.6361239",
"0.63580024",
"0.6344988",
"0.63224924",
"0.63087916",
"0.6301622",
"0.63007855",
"0.6277631",
"0.6276274",
"0.6266363",
"0.626562",
"0.6264989",
"0.6259111",
"0.62586045",
"0.62542427",
"0.621578",
"0.6212349",
"0.6212349",
"0.62116003",
"0.62023735",
"0.6190075",
"0.61657846",
"0.61600196",
"0.61410075",
"0.6135407",
"0.61215913",
"0.61206496",
"0.6104316",
"0.61005884",
"0.61004156",
"0.6099508",
"0.60943025",
"0.60933983",
"0.608633",
"0.60857886",
"0.6082034",
"0.60791457",
"0.6078976",
"0.6076654",
"0.60636514",
"0.60631764",
"0.6062982",
"0.60591906",
"0.6055797",
"0.6050407",
"0.60352385",
"0.6032572",
"0.6031937",
"0.60233176",
"0.6022588",
"0.6021762",
"0.60196936",
"0.6016581",
"0.6016009",
"0.6016009",
"0.6013718",
"0.6012265",
"0.6008965",
"0.6008225",
"0.60038203",
"0.5999061",
"0.5991819",
"0.5983683",
"0.5982692",
"0.5981729",
"0.59804237",
"0.5972623",
"0.5962249",
"0.5961548",
"0.59597504",
"0.5959604",
"0.5957571",
"0.59546214"
] | 0.63699543 | 26 |
Returns true when there are any private values set | def has_privates?
super || userpass_file.present? || user_as_pass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete?\r\n cur_values.all{ |value| value!=nil }\r\n end",
"def has_known_value?\n all?(&:has_known_value?)\n end",
"def all_private\n \treturn is_name_private && is_message_private && is_amount_private\n end",
"def __empty?\n return false unless super\n __empty(__value)\n end",
"def any_key?\n @keys == UndefinedSetting\n end",
"def set?\n\t\t\tbegin\n\n\t\t\t\tvalue = @lookup.inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\t\t# Has to be an object that can have keys\n\t\t\t\t\treturn false unless deep_obj.respond_to?(:[])\n\n\t\t\t\t\tif deep_obj.respond_to?(:fetch)\n\t\t\t\t\t\t# Hash, Array and Struct all respond to fetch\n\t\t\t\t\t\t# We've monkeypatched fetch to Struct\n\t\t\t\t\t\tif deep_obj.is_a?(Array)\n\t\t\t\t\t\t\t# Check array separately as must fetch numeric key\n\t\t\t\t\t\t\treturn false unless Keys.index?(this_key)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tnext_obj = deep_obj.fetch(this_key, Keys::MISSING)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\t# No need to go any further\n\t\t\t\t\treturn false if Keys::MISSING == next_obj\n\n\t\t\t\t\t# Reinject value to next loop\n\t\t\t\t\tnext_obj\n\t\t\t\t}\n\n\t\t\trescue\n\t\t\t\t# If fetch throws a wobbly at any point, fail gracefully\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t# No errors - yield the value if desired\n\t\t\tif block_given?\n\t\t\t\tyield(value)\n\t\t\tend\n\t\t\t# Return true\n\t\t\treturn true\n\t\tend",
"def complete_flag_values?\n @complete_flag_values\n end",
"def private?\n [email protected]?\n end",
"def private?\n self.private\n end",
"def all_instance_variables_set?\n self.class.instance_variables_required.to_a.all? do |instance_variable|\n !instance_variable_get(instance_variable.to_s).nil?\n end\n end",
"def unnamed?\n @keys == nil\n end",
"def ready?\n [email protected]? { |observable, value| value.nil? }\n end",
"def value_set?\n @value_set == true\n end",
"def ready?\n [email protected]? { |observable, value| value.nil? }\n end",
"def value_set?\n @value_set\n end",
"def __empty?\n return false unless super\n __elements.values.all?(&:__empty?)\n end",
"def private?\n self.private\n end",
"def fields_are_private_by_default?\n ensure_setup!\n options[:visibility] == :private\n end",
"def private?\n @private\n end",
"def complete?\n keys.all?(&:complete?)\n end",
"def allows?\n return positive? unless @attributes.empty?\n protected_attributes.nil? || protected_attributes.empty?\n end",
"def private?\n false\n end",
"def valid?(set)\n set.is_a?(Hash) && set[\"values\"].is_a?(Hash)\n end",
"def set?\n return @set == true\n end",
"def isSet?\r\n assert_exists\r\n return @o.checked\r\n end",
"def empty?\n _values.all?(&:empty?)\n end",
"def valid?(set); end",
"def key_set?\n !attributes['key'].nil?\n end",
"def populated?\n !!@populated\n end",
"def valid?\n expected = {}\n\n count = 0\n self.each_unsafe do |k,v|\n return false if @data[k][2] != v\n count += 1\n end\n count == @data.count\n end",
"def has_value?\n false\n end",
"def empty?\n @_values.empty?\n end",
"def value?\n @count > 0\n end",
"def private?\n @attributes[\"access\"] ? @attributes[\"access\"] == \"private\" : false\n end",
"def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end",
"def empty?\n return false if @opts[:values]\n super\n end",
"def empty?\n _values.empty?\n end",
"def variants_have_property_values?\n self.variants.each do |v|\n return true if !v.variant_variant_property_values.empty?\n end\n return false\n end",
"def members?\n !@spec['members'].empty?\n end",
"def is_set?\n @is_set\n end",
"def strict?\n each_pair.all?{|name, value|sufficient? name, value}\n end",
"def any_mines_detonated?\n @value_grid.any?{ |space, properties| properties == { cleared: true, mine: true } }\n end",
"def transitioned_to_private?\n return true if changes['visibility'].present? &&\n (changes['visibility'][0] != JupiterCore::VISIBILITY_PRIVATE) &&\n (changes['visibility'][1] == JupiterCore::VISIBILITY_PRIVATE)\n end",
"def published?\n all_base_attributes_present?\n end",
"def empty?\n prepended_creds.empty? && !has_privates?\n end",
"def has_privates?\n password.present? || pass_file.present? || !additional_privates.empty? || blank_passwords\n end",
"def valid?\n MANDATORY_ATTRIBUTES.each { |a| return false unless self[a] }\n true\n end",
"def empty?\n DIFF_ATTRIBUTES.all? { |attr|\n self.send(attr).empty?\n } && stacks.values.all? { |stk| stk.empty? }\n end",
"def __empty?\n all?(&:__empty?)\n end",
"def private?\n return (self.owner_id != 0)\n end",
"def has_value?\n true\n end",
"def valid?(*args)\n valid = true\n @transformed_values.each do |sets| \n sets.each do |set| \n valid = false unless set.valid?\n end\n end\n valid\n end",
"def consistent?\n bound? && (store.keys & configs.keys).empty?\n end",
"def empty?\n @values.values.all?(&:nil?)\n end",
"def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end",
"def valid_subset?\n valid = true\n schema.traverse do |key_path, value|\n actual = self.ref(key_path)\n missing = actual.nil?\n valid = valid && !missing\n end\n valid\n end",
"def any_changes?\n @counters.empty? || all_counters.any?(&:value_changed?)\n end",
"def private?\n false\n end",
"def valid?\n self.errors = []\n \n BOOL_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n unless val.nil? == true || val == true || val == false\n self.errors.push field=>ERRORS[:bool]\n end\n end\n \n if self.key_data.nil?\n self.errors.push ERRORS[:data_nil] \n return false\n end\n\n if self.key_type.nil?\n self.errors.push ERRORS[:type_nil] \n return false\n end\n\n if not self.key_data.match \"^#{B64_REGEX}$\"\n self.errors.push ERRORS[:data_char] \n end\n\n if self.key_data.size < 30\n self.errors.push ERRORS[:data_short] \n end\n\n if self.key_data.size > 1000\n self.errors.push ERRORS[:data_long] \n end\n \n if self.key_data.size % 4 != 0\n self.errors.push ERRORS[:data_modulus] \n end\n\n return self.errors.empty?\n end",
"def for_all?\n return (self.owner_id == 0 and self.get_groups_a.empty? and self.get_teams_a.empty?)\n end",
"def can_have_associated_objects?(obj)\n !self[:keys].any?{|k| obj.get_column_value(k).nil?}\n end",
"def all_missing?(values)\n values.all?{|v| is_missing?(v)}\n end",
"def has_value?(p0) end",
"def private?\n private\n end",
"def private?\n private\n end",
"def private?\n return true if @private_key\n \n load_private_key\n !@private_key.nil?\n end",
"def empty?\n @references_to_keys_map.each do |_, ref|\n return false if ref.object\n end\n true\n end",
"def valid?\n return false if @id.nil?\n return false if [email protected]? && @popularity > 5\n return false if [email protected]? && @tags.length > 5\n return false if @type.nil?\n true\n end",
"def valid?\n return false if @key.nil?\n return false if @name.nil?\n return false if @event_code.nil?\n return false if @event_type.nil?\n return false if @start_date.nil?\n return false if @end_date.nil?\n return false if @year.nil?\n return false if @event_type_string.nil?\n true\n end",
"def valid?\n !errors? && entries.values.all?(&:valid?)\n end",
"def valid?\n return false if !key || key_defined? || global_key?\n\n true\n end",
"def hasProperties\n end",
"def valid?\n return false if @property_code.nil?\n return false if @property_name.nil?\n return false if @location.nil?\n return false if @total_price.nil?\n return false if @min_daily_rate.nil?\n return true\n end",
"def has_kerning_data?\n @kern_pairs.any?\n end",
"def valid?(map)\n return true if whitelisted_value?(map)\n\n map.is_a?(Hash) && map.values.all? { |value| subprop.valid?(value) }\n end",
"def profile_complete?\n\t\tparameters_with_values = generate_array_of_param_with_value\n\n\t\tparameters_with_values.each do |p|\n\t\t\treturn false if !p\n\t\tend\n\n\t\treturn true\n\tend",
"def private?\n return true unless @private_key.nil?\n \n load_private_key\n !@private_key.nil?\n end",
"def private?\n private == 'private'\n end",
"def uncertain?\r\n @@maybes\r\n end",
"def private?\n !self.public\n end",
"def empty?\n self.keys.empty?\n end",
"def my_all?\n\t\tvalue = true\n\t\tself.my_each do |element|\n\t\t\tif yield(element) != true\n\t\t\t\tvalue = false\n\t\t\tend\n\t\tend\n\t\treturn value\n\tend",
"def private?\n sensitivity == \"Private\"\n end",
"def populated_hash?(obj)\n obj.is_a?(Hash) && !obj.empty?\n end",
"def priviledged?\n @priviledged\n end",
"def all?(&block)\n if block\n self.each{|*val| return false unless block.call(*val)}\n else\n self.each{|*val| return false unless val.__svalue}\n end\n true\n end",
"def has_attributes?\n [email protected]?\n end",
"def filled?\n !!self[:filled]\n end",
"def published?\n !is_privacy_private? && (!builder? || !derived? || mapcapped?)\n end",
"def has_attributes?\n a = @context.attributes.find{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n a ? true : false\n end",
"def valid?\n return false if @anchor.nil?\n return false if @cv.nil?\n return false if @nullifier.nil?\n return false if @proof.nil?\n return false if @rk.nil?\n return false if @spend_auth_sig.nil?\n true\n end",
"def any?\n REQUIRED_KEYS.any? do |key|\n attributes[key].any?\n end\n end",
"def publicly_accessible?\n @dbi.publicly_accessible\n end",
"def publicly_accessible?\n @dbi.publicly_accessible\n end",
"def has_members?\n self.members.count > 0\n end",
"def valid?(metadata)\n validate.each do |attr|\n return false if metadata[attr.to_sym].nil? || metadata[attr.to_sym].zero?\n end\n end",
"def valid?\n MANDATORY_ATTRIBUTES[type].each{|a| return false unless self[a]}\n true\n end",
"def valid?\n @data_lru.size == @data_ttl.size\n end",
"def defensive\n return (@attributes & 0x10 == 0x10)\n end",
"def valid?\n return false if @audit.nil?\n return false if @comp.nil?\n return false if @subcomp.nil?\n true\n end",
"def valid?(map)\n whitelisted_value?(map) || (map.is_a?(Hash) && map.values.all? { |value| subprop.valid?(value) })\n end"
] | [
"0.687254",
"0.681967",
"0.66989005",
"0.6663614",
"0.6648296",
"0.6613189",
"0.65909714",
"0.6511552",
"0.6488604",
"0.645253",
"0.64206475",
"0.64181036",
"0.64173543",
"0.6408487",
"0.63624",
"0.635655",
"0.6355741",
"0.6338612",
"0.63228446",
"0.6306921",
"0.62918204",
"0.6286491",
"0.6280109",
"0.62763274",
"0.6275547",
"0.6264881",
"0.6256959",
"0.6254667",
"0.6243913",
"0.62426805",
"0.62337756",
"0.62158626",
"0.6197563",
"0.61896294",
"0.61774075",
"0.6174738",
"0.6165978",
"0.616215",
"0.61601126",
"0.6155086",
"0.6145995",
"0.61443305",
"0.61426735",
"0.61202544",
"0.6104178",
"0.61004925",
"0.6070507",
"0.6067428",
"0.6062482",
"0.60605353",
"0.6057557",
"0.60562587",
"0.60553235",
"0.6054255",
"0.60461617",
"0.60410833",
"0.6037356",
"0.60262686",
"0.60228103",
"0.6020051",
"0.6017337",
"0.6014642",
"0.60090935",
"0.6001925",
"0.6001925",
"0.6001024",
"0.59977627",
"0.5980214",
"0.596923",
"0.5968063",
"0.5965864",
"0.5954323",
"0.595135",
"0.5947109",
"0.59463143",
"0.5934334",
"0.5933834",
"0.5933646",
"0.59321725",
"0.5929061",
"0.59226614",
"0.59165037",
"0.59157157",
"0.589834",
"0.5895637",
"0.5892795",
"0.5884515",
"0.5882688",
"0.58809316",
"0.5875409",
"0.58722395",
"0.58672225",
"0.5865977",
"0.5865977",
"0.58657885",
"0.5861577",
"0.5861418",
"0.58566284",
"0.58537585",
"0.5849002",
"0.58441764"
] | 0.0 | -1 |
Shows index name in Delayed::Jobname. | def display_name
"#{self.class.name} for #{indices.join(', ')}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_name\n get_key('ALGOLIA_INDEX_NAME', 'index_name')\n end",
"def index_name\n @index_name ||= @options[:index_name] ||\n __get_class_value(:index_name) ||\n DEFAULT_INDEX_NAME\n end",
"def index_name\n models.map { |m| m.index_name }\n end",
"def index_name(event)\n\n index_name, num_docs, write_alias, read_alias = index_status()\n @logger.error(\"status\", :index_name => index_name, :num_docs => num_docs, :write_alias => write_alias, :read_alias => read_alias)\n\n if num_docs == 0\n\n @logger.error(\"index does not exist, create one\", :index_name => index_name)\n\n create_index(index_name)\n\n create_index_aliases(index_name, write_alias, read_alias)\n\n elsif num_docs < @messages_per_slice\n\n @logger.error(\"less than, use the current index\", :index_name => index_name)\n\n else\n\n @logger.error(\"greater than or equal to, create new index and aliases\")\n\n slice = index_name.split('_')[0].to_i\n @logger.error(\"slice\", :slice => slice)\n\n new_index_name = to_index_name(slice += 1, @application, @domain)\n @logger.error(\"index_name\", :new_index_name => new_index_name)\n\n create_index(new_index_name)\n\n update_index_aliases(index_name, new_index_name, write_alias, read_alias)\n end\n\n write_alias\n\n end",
"def display_jobs\n jobs = SearchJobs::Jobs.all\n\n jobs.each.with_index(1) do |job, index|\n puts \"#{index}.\".colorize(:red) + \"==========#{job.company.upcase.strip}=========\".colorize(:yellow)\n puts \"#{job.name.upcase}\".colorize(:blue)\n end\n end",
"def display_name\n job_class\n end",
"def default_index_name\n [ table.name, *columns, :index ].join( '_' ).to_sym\n end",
"def table_name\n \"#{Dynamoid::Config.namespace}_index_#{prefix}_#{name.collect(&:to_s).collect(&:pluralize).join('_and_')}\"\n end",
"def to_s\n \"#{@index}. #{name}\"\n end",
"def index\n\t\t\"#{self}.index\"\n\tend",
"def to_read_index_alias_name()\n sprintf(\"%s_%s\", @application, @domain)\n end",
"def index_name=(name)\n @index_name = name\n end",
"def index_name=(name)\n @index_name = name\n end",
"def index\n jobs_index(Job.all)\n end",
"def to_write_index_alias_name()\n sprintf(\"_w_%s_%s\", @application, @domain)\n end",
"def index_name(table_name, options) #:nodoc:\n super table_name.tr('.', '_'), options\n end",
"def index\n @title=t(\"admin.base.index.title\")\n end",
"def index_name(source=nil)\n (source.nil? ? name : source.to_s).split('::').last.underscore.pluralize\n end",
"def name(index)\n i = get_field_index_by_external_id(index,@fields[:name])\n fields(index, i).to_s unless i.nil?\n end",
"def name(index)\n i = get_field_index_by_external_id(index,@fields[:name])\n fields(index, i).to_s unless i.nil?\n end",
"def index_name\n @element[:name] || @element[:column]\n end",
"def name\n @queue.queue_name\n end",
"def index\n @title = \"Tenjin\"\n @inst_var_one = \"INST_VAR_ONE\"\n @inst_var_two = \"INST_VAR_TWO\"\n return \"#{self.class}: INDEX RETURN STRING\"\n end",
"def table_name\n \"#{Dynamoid::Config.namespace}_index_\" + source.table_name.sub(\"#{Dynamoid::Config.namespace}_\", '').singularize + \"_#{name.collect(&:to_s).collect(&:pluralize).join('_and_')}\"\n end",
"def index_name_by_id(index_id)\n data_dictionary.index_by_id(index_id).fetch(\"NAME\", nil)\n end",
"def name\n @queue.name\n end",
"def to_index_name(slice, application, domain)\n sprintf(\"%d_%s_%s\", slice, application, domain)\n end",
"def indexed_name(name = nil)\n @indexed_name = name.to_sym if name\n @indexed_name\n end",
"def name\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n job_id\n end",
"def set_job_name(*); end",
"def index_name\n raise SearchFlip::MethodNotImplemented, \"You must implement #{name}::index_name\"\n end",
"def show_section_name_idx\n\t\t\t puts \" Section header string table index: #{@elf_section_name_idx}\"\n\t\tend",
"def index_name(version)\n \"#{es_type_name}-v-#{version}\"\n end",
"def name\n id = arguments&.first&.fetch(:id)\n job_id = arguments&.first&.fetch(:job_id)\n \"Analysis for: #{id}, job=#{job_id}\"\n end",
"def index(name)\n query\n @options[:index_name] = name.to_s\n self\n end",
"def job_spec_name\n self.job_spec.name\n end",
"def job_queue_name\n 'email'\n end",
"def job_queue_name\n 'email'\n end",
"def delayed_index(model)\n config = ThinkingSphinx::Configuration.instance\n rotate = ThinkingSphinx.sphinx_running? ? \" --rotate\" : \"\"\n\n output = `#{config.bin_path}#{config.indexer_binary_name} --config #{config.config_file}#{rotate} #{model.delta_index_names.join(' ')}`\n\n\n model.sphinx_indexes.select(&:delta?).each do |index|\n output += `#{config.bin_path}#{config.indexer_binary_name} --config #{config.config_file}#{rotate} --merge #{index.core_name} #{index.delta_name} --merge-dst-range sphinx_deleted 0 0`\n end unless ENV['DISABLE_MERGE'] == 'true'\n\n puts output unless ThinkingSphinx.suppress_delta_output?\n\n true\n end",
"def field_name_for_index(field, args = {})\n solr_name(field, args)\n end",
"def index_prefix\n return \"\" unless Neo4j.running?\n return \"\" unless respond_to?(:ref_node_for_class)\n ref_node = ref_node_for_class.wrapper\n prefix = ref_node.send(:index_prefix) if ref_node.respond_to?(:index_prefix)\n prefix ? prefix + \"_\" : \"\"\n end",
"def command_name(index)\n @list[index]\n end",
"def name\n @queue_string\n end",
"def namespace\n 'delayed_jobs'\n end",
"def set_IndexName(value)\n set_input(\"IndexName\", value)\n end",
"def as_index_string\n case type\n when \"text\" then \"truncate(#{model.name.as_singular}.#{name}, length: 30)\"\n else \"#{model.name.as_singular}.#{name}\"\n end\n end",
"def default_index_name(table_name, columns)\n\t\t schema, table = schema_and_table(table_name)\n\t\t ds = DB[:all_indexes].where(:table_name=>table,:dropped=>'NO')\n\t\t ds = ds.where :owner=>schema unless schema.nil?\n\t\t \"#{table[0,25]}_ix%2.2d\" % [ds.count + 1]\n\t\t end",
"def name(role_name = nil)\n if role_name\n @name = \"#{role_name}.#{index}\"\n end\n @name || \"##{index}\"\n end",
"def full_name\n \"#{@table_alias}#{name}\"\n end",
"def item_name\n \"#{queue_name},#{h_or_s},#{center.center}\"\n end",
"def index_type\n name\n end",
"def log_prefix\n \"Maxretry handler [queue=#{@worker_queue_name}]\"\n end",
"def jobs_performed_key\n \"stats:jobs:#{self.name}:performed\"\n end",
"def index\n @db_jobs = DbJob.all\n end",
"def default_index_name(table_name, columns)\n \"#{table_name}_#{columns.join(UNDERSCORE)}_index\"\n end",
"def check_index_name\n return if index_name\n @logger.display('index_name_missing')\n exit 1\n end",
"def action_name\n name = self.request.route_obj.instance_variable_get('@named').to_s\n name.gsub!(/^#{controller_name}_?/, '')\n name = 'index' if name == ''\n name\n end",
"def name\n\t\t\t@task\n end",
"def index\n @job_progresses = JobProgress.all\n end",
"def batch_name\n [batch.course.course_name, batch.course.section_name, batch.name].join(' ')\n end",
"def temporal_index_name(index_name)\n\t\t\tindex_name.to_s.sub(/^index/, \"ind_h\").sub(/_ix(\\d+)$/, '_hi\\1')\n\t\tend",
"def column_name(index)\n \"Column #{index}\"\n end",
"def index_name(table_name, options) #:nodoc:\n if Hash === options # legacy support\n if options[:column]\n column_names = Array.wrap(options[:column]).map {|c| expression_index_name(c)}\n \"index_#{table_name}_on_#{column_names * '_and_'}\"\n elsif options[:name]\n options[:name]\n else\n raise ArgumentError, \"You must specify the index name\"\n end\n else\n index_name(table_name, column: options)\n end\n end",
"def expression_index_name(name)\n column_name, operator_name = split_column_name(name)\n\n result_name = if column_name =~ FUNCTIONAL_INDEX_REGEXP\n \"#{$1.downcase}_#{$3}\"\n else\n column_name\n end\n\n result_name += \"_\" + operator_name.parameterize.underscore if operator_name\n\n result_name\n end",
"def index\n @nanny_jobs = NannyJob.all\n end",
"def index\n validate_arguments!\n\n options[:limit] ||= '10'\n options[:skip] ||= '0'\n jobs = api.get_jobs(options[:skip], options[:limit]).body['jobs']\n jobs.each do |job|\n if job['start_timestamp']\n job['start_timestamp'] = Time.parse(job['start_timestamp']).strftime('%A, %B %e, %Y, %l:%M %p')\n end\n end\n headers = [ 'job_id', 'script' , 'status' , 'start_date' , 'elapsed_time' , 'cluster_size' , 'cluster_id']\n columns = [ 'job_id', 'display_name', 'status_description', 'start_timestamp', 'duration', 'cluster_size', 'cluster_id']\n display_table(jobs, columns, headers)\n end",
"def index_information\n @db.index_information(@name)\n end",
"def name\n \"#{number}: #{short_name}\"\n end",
"def scheduled\n jobs_index(Job.scheduled)\n end",
"def worker_name\n @client.worker_name\n end",
"def index *args\n # delegate\n self.class.names.index *args\n end",
"def index_name(table_name, options)\n maximum = database_metadata.max_identifier_len || 255\n super(table_name, options)[0...maximum]\n end",
"def index_name(table_name, options)\n maximum = database_metadata.max_identifier_len || 255\n super(table_name, options)[0...maximum]\n end",
"def index_name(table_name, options)\n maximum = database_metadata.max_identifier_len || 255\n super(table_name, options)[0...maximum]\n end",
"def inspect_jobs(index = nil)\n return empty_msg if empty?\n desc = []\n puts \"\\n\"\n @jobs.each_with_index do |j, i|\n unless index.nil?\n next unless i == index\n end\n desc << '| Job: ' + \" #{i + 1} \".rjust(8) + '|' + 'Pattern/AIV:'.rjust(18) + \" #{j.pattern.basename}\".ljust(125) + '|'\n desc << '| |' + 'Compiler ID:'.rjust(18) + \" #{j.id} \".ljust(125) + '|'\n desc << '| |' + 'AVC Files:'.rjust(18) + \" #{j.count} \".ljust(125) + '|'\n desc << '| |' + 'Output Directory:'.rjust(18) + \" #{j.output_directory} \".ljust(125) + '|'\n desc << '| |' + '.avc directory:'.rjust(18) + \" #{j.avc_dir} \".ljust(125) + '|'\n desc << '| |' + '.binl directory:'.rjust(18) + \" #{j.binl_dir} \".ljust(125) + '|'\n desc << '| |' + 'LSF:'.rjust(18) + \" #{j.location == :lsf ? true : false} \".ljust(125) + '|'\n desc << '| |' + 'Delete log files:'.rjust(18) + \" #{j.clean} \".ljust(125) + '|'\n desc << '| |' + 'Verbose:'.rjust(18) + \" #{j.verbose} \".ljust(125) + '|'\n if j.aiv2b_opts && j.aiv2b_opts.is_a?(String)\n aiv2b_opts = j.aiv2b_opts.gsub('AI_V2B_OPTIONS ', '')\n else\n aiv2b_opts = render_aiv2b_options_line.gsub('AI_V2B_OPTIONS', '')\n end\n desc << '| |' + 'AI_V2B Options:'.rjust(18) + \" #{aiv2b_opts} \".ljust(125) + '|'\n desc << '-' * desc.first.size\n end\n puts desc.flatten.join(\"\\n\")\n end",
"def index_field_names\n Blacklight.config[:index_fields][:field_names]\n end",
"def get_job_name(course, assessment, submission)\n \"#{course.name}_#{assessment.name}_#{submission.version}_#{submission.course_user_datum.email}\"\n end",
"def index_url\n connection.index_url(index_name_with_prefix)\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def ar_get_index_label title\n ar_retrieve_field_value title, @resource\n end",
"def default_index_name(table_name, columns)\n schema, table = schema_and_table(table_name)\n \"#{\"#{schema}_\" if schema and schema != default_schema}#{table}_#{columns.join(UNDERSCORE)}_index\"\n end",
"def job_name\n return settings[:job_name] if settings[:job_name]\n relevant_filename = args.compact.uniq.map { |path| File.basename(path, '.rb') }.join('-')\n \"#{relevant_filename}---#{input_paths}---#{output_path}\".gsub(%r{[^\\w/\\.\\-\\+]+}, '')\n end",
"def index_for_id klass\n klass.model_name.plural\n end",
"def index\n @jobs = Job.all\n # @jobs = ScriptedClient::Job.all\n end",
"def success\n jobs_index(Job.success)\n end",
"def exchange_name\n \"#{worker_class_name}_#{job_method}\".downcase\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.with_hires(nil).all\n end",
"def queue_for(num)\n \"#{queue}.#{num}\"\n end",
"def name\n project.name\n end",
"def name\n project.name\n end",
"def index\n if @type == 'queued'\n @delayed_jobs = DelayedJob.where(run_at: nil).order('id DESC').paginate(:page => @page,:per_page => @per_page)\n elsif @type == 'run'\n @delayed_jobs = DelayedJob.where.not(run_at: nil).order('id DESC').paginate(:page => @page,:per_page => @per_page)\n elsif @type == 'failed'\n @delayed_jobs = DelayedJob.where.not(last_error: nil).order('id DESC').paginate(:page => @page,:per_page => @per_page)\n elsif @type == 'success'\n @delayed_jobs = DelayedJob.where(last_error: nil).order('id DESC').paginate(:page => @page,:per_page => @per_page)\n else\n @delayed_jobs = DelayedJob.all.order('id DESC').paginate(:page => @page,:per_page => @per_page)\n end\n end",
"def index_partial_for(o)\n \"#{o.class.name.underscore}s/index\"\n end",
"def waiting_queue_name\n @waiting_queue_name\n end",
"def stream_index\n data_config.index_name\n end"
] | [
"0.66772175",
"0.64888126",
"0.645598",
"0.6331186",
"0.6311525",
"0.624574",
"0.6224369",
"0.62141246",
"0.6211352",
"0.62047786",
"0.6204091",
"0.62003213",
"0.62003213",
"0.6136164",
"0.61107945",
"0.6090453",
"0.6088368",
"0.60810727",
"0.6009568",
"0.6009568",
"0.59747344",
"0.5968083",
"0.59181064",
"0.5899282",
"0.5888875",
"0.58736557",
"0.58511996",
"0.5817926",
"0.58150524",
"0.57302403",
"0.5704551",
"0.569365",
"0.5681268",
"0.56696475",
"0.5668724",
"0.56681156",
"0.5655802",
"0.5655802",
"0.56554",
"0.56477386",
"0.56409645",
"0.56331515",
"0.56268835",
"0.5625479",
"0.5606645",
"0.55681276",
"0.5550999",
"0.5513477",
"0.5513038",
"0.55111784",
"0.54986924",
"0.54960567",
"0.54791194",
"0.54551226",
"0.542631",
"0.54251486",
"0.54132456",
"0.5410057",
"0.53772336",
"0.5370233",
"0.53699064",
"0.53690684",
"0.53673863",
"0.5358928",
"0.53493977",
"0.53469115",
"0.5336467",
"0.5335382",
"0.5334507",
"0.5329663",
"0.5327386",
"0.5319644",
"0.5319644",
"0.5319644",
"0.5319484",
"0.5314776",
"0.52936155",
"0.5293038",
"0.5292885",
"0.5292885",
"0.5292885",
"0.5292885",
"0.5292885",
"0.5292885",
"0.52921027",
"0.5285484",
"0.52803695",
"0.5279557",
"0.52674514",
"0.526299",
"0.52620345",
"0.52568936",
"0.525543",
"0.52540034",
"0.52535266",
"0.52535266",
"0.5252094",
"0.5245171",
"0.52436566",
"0.5239301"
] | 0.64142406 | 3 |
Runs Sphinx's indexer tool to process the index. Currently assumes Sphinx is running. | def perform
index
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform\n config = ThinkingSphinx::Configuration.instance\n \n output = `#{config.bin_path}#{config.indexer_binary_name} --config #{config.config_file} --rotate #{index}`\n puts output unless ThinkingSphinx.suppress_delta_output?\n \n true\n end",
"def index(options = {})\n system(\"gem generate_index -d #{@path} > /dev/null\")\n # options = {:build_legacy => true, :build_modern => true}.merge(options)\n # indexer = indexer(options)\n # options[:update] ? indexer.update_index : indexer.generate_index\n end",
"def exec_index\n begin\n require 'fastri/version'\n fastri = true\n rescue LoadError\n fastri = false\n end\n if fastri\n if no_harm?\n $stderr.puts \"fastri-server -b\"\n else\n system \"fastri-server -b\"\n end\n else\n case config.installdirs\n when 'std'\n output = \"--ri-system\"\n when 'site'\n output = \"--ri-site\"\n when 'home'\n output = \"--ri\"\n else\n abort \"bad config: sould not be possible -- installdirs = #{config.installdirs}\"\n end\n\n if File.exist?('.document')\n files = File.read('.document').split(\"\\n\")\n files.reject!{ |l| l =~ /^\\s*[#]/ || l !~ /\\S/ }\n files.collect!{ |f| f.strip }\n else\n files = [\"lib\", \"ext\"]\n end\n\n opt = []\n opt << \"-U\"\n opt << output\n opt << files\n opt = opt.flatten\n\n if no_harm?\n puts \"rdoc #{opt.join(' ').strip}\"\n else\n #sh \"rdoc #{opt.join(' ').strip}\"\n require 'rdoc/rdoc'\n ::RDoc::RDoc.new.document(opt)\n end\n end\n end",
"def run_sphinx task\n rsudo \"cd #{current_path} && RAILS_ENV=#{Rubber.env} #{fetch(:rake, 'rake')} #{task}\", :as => runner\n end",
"def enqueue_sphinx_index_for_class\n self.class.enqueue_sphinx_index\n end",
"def run_all_indexers\n run_all_indexers_orig\n $pui.run_index_round\n end",
"def build\n @logger.info(\"INDEXING\") { \"Building index of type #{@index_definition.name}\" }\n rdf_types = @index_definition.related_rdf_types\n number_of_documents = count_documents(rdf_types)\n @logger.info(\"INDEXING\") do\n %(Found #{number_of_documents} documents to index\n - matching type(s) #{rdf_types.inspect}\n - using allowed groups #{@search_index.allowed_groups}\"\n )\n end\n batches =\n if @max_batches && (@max_batches != 0)\n [@max_batches, number_of_documents / @batch_size].min\n else\n number_of_documents / @batch_size\n end\n batches = batches + 1\n @logger.info(\"INDEXING\") { \"Number of batches: #{batches}\" }\n\n Parallel.each(1..batches, in_threads: @number_of_threads) do |i|\n batch_start_time = Time.now\n @logger.info(\"INDEXING\") { \"Indexing batch #{i}/#{batches}\" }\n failed_documents = []\n @sparql_connection_pool.with_authorization(@search_index.allowed_groups) do |sparql_client|\n document_builder = MuSearch::DocumentBuilder.new(\n tika: @tika,\n sparql_client: sparql_client,\n attachment_path_base: @attachment_path_base,\n logger: @logger\n )\n document_uris = get_documents_for_batch(rdf_types, i)\n document_uris.each do |document_uri|\n @logger.debug(\"INDEXING\") { \"Indexing document #{document_uri} in batch #{i}\" }\n document = document_builder.build_document_for_index(\n uri: document_uri,\n index_definition: @index_definition\n )\n @elasticsearch.insert_document @search_index.name, document_uri, document\n rescue StandardError => e\n failed_documents << document_uri\n @logger.warn(\"INDEXING\") { \"Failed to index document #{document_uri} in batch #{i}\" }\n @logger.warn { e.full_message }\n end\n end\n @logger.info(\"INDEXING\") { \"Processed batch #{i}/#{batches} in #{(Time.now - batch_start_time).round} seconds.\" }\n if failed_documents.length > 0\n @logger.warn(\"INDEXING\") { \"#{failed_documents.length} documents failed to index in batch #{i}.\" }\n @logger.debug(\"INDEXING\") { \"Failed documents: #{failed_documents}\" }\n end\n end\n end",
"def do_local_indexing(solr_doc); end",
"def build_xapian_index()\n models = [Request, Response]\n if ! $existing_db\n ActsAsXapian::WriteableIndex.rebuild_index(models, verbose=false)\n $existing_db = true\n end\n end",
"def build_index\n @search = RSemantic::Search.new(@documents.map(&:text), @options)\n end",
"def build\n # Note: @index_definitions will only contain multiple elements in case of a composite type.\n @index_definitions.each do |type_def|\n @logger.info(\"INDEXING\") { \"Building index of type #{type_def[\"type\"]}\" }\n rdf_type = type_def[\"rdf_type\"]\n number_of_documents = count_documents(rdf_type)\n @logger.info(\"INDEXING\") { \"Found #{number_of_documents} documents to index of type #{rdf_type} with allowed groups #{@search_index.allowed_groups}\" }\n batches =\n if @max_batches && (@max_batches != 0)\n [@max_batches, number_of_documents / @batch_size].min\n else\n number_of_documents / @batch_size\n end\n batches = batches + 1\n @logger.info(\"INDEXING\") { \"Number of batches: #{batches}\" }\n\n Parallel.each(1..batches, in_threads: @number_of_threads) do |i|\n batch_start_time = Time.now\n @logger.info(\"INDEXING\") { \"Indexing batch #{i}/#{batches}\" }\n failed_documents = []\n\n @sparql_connection_pool.with_authorization(@search_index.allowed_groups) do |sparql_client|\n document_builder = MuSearch::DocumentBuilder.new(\n tika: @tika,\n sparql_client: sparql_client,\n attachment_path_base: @attachment_path_base,\n logger: @logger\n )\n document_uris = get_documents_for_batch rdf_type, i\n document_uris.each do |document_uri|\n @logger.debug(\"INDEXING\") { \"Indexing document #{document_uri} in batch #{i}\" }\n document = document_builder.fetch_document_to_index(\n uri: document_uri,\n properties: type_def[\"properties\"])\n @elasticsearch.insert_document @search_index.name, document_uri, document\n rescue StandardError => e\n failed_documents << document_uri\n @logger.warn(\"INDEXING\") { \"Failed to index document #{document_uri} in batch #{i}\" }\n @logger.warn { e.full_message }\n end\n end\n @logger.info(\"INDEXING\") { \"Processed batch #{i}/#{batches} in #{(Time.now - batch_start_time).round} seconds.\" }\n if failed_documents.length > 0\n @logger.warn(\"INDEXING\") { \"#{failed_documents.length} documents failed to index in batch #{i}.\" }\n @logger.debug(\"INDEXING\") { \"Failed documents: #{failed_documents}\" }\n end\n end\n end\n end",
"def perform\n PgSearch::Multisearch.rebuild(Doc)\n end",
"def reindex!\n indexed if generate_solr_index\n end",
"def run\n parse_options\n Calamum::Config.apply(config)\n @definition = Calamum::DocParser.new(load_source)\n @definition.load_resources\n Calamum::DocGenerator.init_base_dir\n process_index\n\n if config[:template] == 'twitter'\n process_pages\n process_section(\"overview\", @definition.get_description)\n process_section(\"authentication\", @definition.get_authentication)\n process_errors\n end\n rescue => ex\n puts_error ex.message\n end",
"def index\n @config_vars = ENVIRONMENT_VARIABLES_TO_PRINT\n @corpus_size = RLetters::Solr::CorpusStats.new.size\n @ping = RLetters::Solr::Connection.ping\n @solr_info = RLetters::Solr::Connection.info\n end",
"def _index_document(opts = {})\n index_document(opts)\n end",
"def setup_index\n @index_driver.setup_index\n end",
"def run\n\t\tbegin\n\t\t\t# get update from from git remote (pull)\n\t\t\tupdate_repo(COURSE_DIR)\n\n\t\t\t# add course info pages\n\t\t\tload_course_info(COURSE_DIR)\n\t\t\tprocess_info(COURSE_DIR)\n\t\t\tload_schedules(COURSE_DIR)\n\t\t\n\t\t\t# and all sections, recursively\n\t\t\tif Settings.submodule\n\t\t\t\tprocess_sections(\"#{COURSE_DIR}/#{Settings.submodule}\")\n\t\t\telse\n\t\t\t\tprocess_sections(COURSE_DIR)\n\t\t\tend\n\t\t\t\t\n\t\t\t# remove old stuff\n\t\t\tprune_untouched\n\t\t\tprune_empty\n\t\t\trecreate_all_slugs\n\t\t\n\t\t\t# put psets in order\n\t\t\tCourseTools.clean_psets\n\t\trescue SQLite3::BusyException\n\t\t\t@errors << \"A timeout occurred while loading the new course content. Just try again!\"\n\t\tend\n\t\t\n\t\tSettings['keyword_index'] = @index\n\t\t\n\t\treturn @errors\n\tend",
"def process_index\n bindings = {\n :url => @definition.get_url,\n :name => @definition.get_name,\n :resources => @definition.resources,\n :description => @definition.get_description,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:index)\n page.save_template('index.html', bindings)\n end",
"def run(abort_on_exc: true)\n TreeConverter.register_adoc_extensions(@adoc_ext)\n pre_build(abort_on_exc: abort_on_exc)\n build(abort_on_exc: abort_on_exc)\n post_build(abort_on_exc: abort_on_exc)\n ensure\n TreeConverter.unregister_adoc_extenstions\n end",
"def reindex!\n logger.debug \"Updating #{self.name} (#{self.id}) to Solr directly...\"\n indexed if generate_solr_index\n end",
"def run(content, params={})\n # only process item that are changed since last regeneration\n if (!@last_indexed.nil? && @last_indexed > item.mtime)\n return content\n end\n\n puts \"Indexing page #{@item.identifier}\"\n\n while not @index.running?\n # wait for the indextank index to get ready\n sleep 0.5\n end\n\n page_text = extract_text(content)\n\n @index.document(@item.identifier).add({\n :text => page_text,\n :title => @item[:title] || item.identifier\n })\n puts 'Indexed ' << item.identifier\n\n @last_indexed = Time.now\n write_last_indexed\n\n content\n end",
"def run\n setup_options\n\n if parse_options?\n\n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n\n show_effective_options if @options.verbose\n\n # do_work(WordAnalyzer)\n\n # example alternate analyzer implementation\n do_work(AdaptiveWordAnalyzer)\n\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n\n 0 # happy shell exit code\n else\n show_help\n end\n end",
"def index(data_path, db_path)\n db = Xapian::WritableDatabase.new(db_path, Xapian::DB_CREATE_OR_OPEN)\n term_generator = Xapian::TermGenerator.new\n term_generator.stemmer = Xapian::Stem.new('en')\n parse_csv_file(data_path).each do |row|\n doc = Xapian::Document.new\n term_generator.document = doc\n term_generator.index_text(row['TITLE'].to_s, 1, 'S')\n term_generator.index_text(row['DESCRIPTION'].to_s, 1, 'XD')\n term_generator.index_text(row['TITLE'].to_s)\n term_generator.increase_termpos\n term_generator.index_text(row['DESCRIPTION'].to_s)\n\n ### Start of new indexing code.\n # Index the MATERIALS field, splitting on semicolons.\n row['MATERIALS'].to_s.split(';').each do |material|\n material.strip!\n material.downcase!\n doc.add_boolean_term(\"XM#{material}\") if material.length.positive?\n end\n ### End of new indexing code.\n\n doc.data = row.to_h.to_json\n idterm = \"Q#{row['id_NUMBER']}\"\n doc.add_boolean_term(idterm)\n db.replace_document(idterm, doc)\n end\nend",
"def indexAllItems\n begin\n Thread.current[:name] = \"index thread\" # label all stdout from this thread\n batch = emptyBatch({})\n\n # The resolver and catalog stuff below is to prevent BioMed files from loading external DTDs\n # (which is not only slow but also unreliable)\n classPath = \"/apps/eschol/erep/xtf/WEB-INF/lib/saxonb-8.9.jar:\" +\n \"/apps/eschol/erep/xtf/control/xsl/jing.jar:\" +\n \"/apps/eschol/erep/xtf/normalization/resolver.jar\"\n Nailgun.run(classPath, 0, \"-Dxml.catalog.files=/apps/eschol/erep/xtf/normalization/catalog.xml\") { |nailgun|\n loop do\n # Grab an item from the input queue\n Thread.current[:name] = \"index thread\" # label all stdout from this thread\n itemID = $indexQueue.pop\n itemID or break\n\n # Extract data and index it (in batches)\n begin\n Thread.current[:name] = \"index thread: #{itemID}\" # label all stdout from this thread\n indexItem(itemID, batch, nailgun)\n rescue Exception => e\n puts \"Error indexing item #{itemID}\"\n raise\n end\n\n # To avoid Saxon's Java process from growing gigantic, restart it once in a while.\n nailgun.callCount == 1000 and nailgun.restart\n end\n }\n\n # Finish off the last batch.\n batch[:items].empty? or $batchQueue << batch\n rescue Exception => e\n if $preindexMode\n raise e\n else\n puts \"Exception in indexAllItems: #{e} #{e.backtrace}\"\n end\n ensure\n $batchQueue << nil # marker for end-of-queue\n end\nend",
"def makeIndex()\n\t\tputs \"Indexing TlpDB...\" unless @options[:quiet]\n\n\t\tlineno = 1\n\t\tfor line in @dbFile do\n\t\t\tif line =~ /^name (.*)/ then\n\t\t\t\t@index[$1] = lineno\n\t\t\tend\n\t\t\tlineno = lineno.next\n\t\tend\n\n\t\tputs \"Done. #{@index.size} packages\" unless @options[:quiet]\n\tend",
"def after_update\n super\n self.class.call_es { _index_document }\n end",
"def after_build\n cleanup_nontarget_files\n run_help_indexer\nend",
"def index_all\n puts \"Indexing everything\"\n MojoDNA::Searchable::RemoteSearchable::searcher.push( [:index_all, self.inspect.to_s, nil] )\n end",
"def delayed_index(model)\n config = ThinkingSphinx::Configuration.instance\n rotate = ThinkingSphinx.sphinx_running? ? \" --rotate\" : \"\"\n\n output = `#{config.bin_path}#{config.indexer_binary_name} --config #{config.config_file}#{rotate} #{model.delta_index_names.join(' ')}`\n\n\n model.sphinx_indexes.select(&:delta?).each do |index|\n output += `#{config.bin_path}#{config.indexer_binary_name} --config #{config.config_file}#{rotate} --merge #{index.core_name} #{index.delta_name} --merge-dst-range sphinx_deleted 0 0`\n end unless ENV['DISABLE_MERGE'] == 'true'\n\n puts output unless ThinkingSphinx.suppress_delta_output?\n\n true\n end",
"def perform\n @propagate_exceptions = false # propagation off by default\n\n return perform_top_level if not self.nested\n\n instance_eval(&self.block)\n index.build \n\n true\n end",
"def open_index_file\n end",
"def reindex!\n doc = {:id => neo_node_id }\n self.class.index_updaters.each_value do |updater|\n updater.call(self, doc)\n end\n lucene_index << doc\n end",
"def update_index # :nodoc:\n self.class.indexer.index(self)\n end",
"def index\n Index.new(root, paths, extensions, aliases)\n end",
"def build_gems(rebuild = false)\n require 'rubygems'\n Gem.source_index.find_name('').each do |spec|\n reload = true\n dir = Registry.yardoc_file_for_gem(spec.name)\n if dir && File.directory?(dir) && !rebuild\n log.debug \"#{spec.name} index already exists at '#{dir}'\"\n else\n yfile = Registry.yardoc_file_for_gem(spec.name, \">= 0\", true)\n next unless yfile\n Registry.clear\n Dir.chdir(spec.full_gem_path)\n log.info \"Building yardoc index for gem: #{spec.full_name}\"\n Yardoc.run('-n', '-b', yfile)\n reload = false\n end\n end\n exit(0)\n end",
"def generate_index!(output_doc_path)\n result = ''\n\n ATTACK_API.techniques_by_tactic.each do |tactic, techniques|\n result += \"# #{tactic}\\n\"\n techniques.each do |technique|\n result += \"- #{ATOMIC_RED_TEAM.github_link_to_technique(technique, true)}\\n\"\n ATOMIC_RED_TEAM.atomic_tests_for_technique(technique).each_with_index do |atomic_test, i|\n result += \" - Atomic Test ##{i+1}: #{atomic_test['name']}\\n\"\n end\n end\n result += \"\\n\"\n end\n\n File.write output_doc_path, result\n\n puts \"Generated Atomic Red Team index at #{output_doc_path}\"\n end",
"def generate_text_sql\n ThinkingSphinx.context.indexed_models.each do |model|\n model = model.constantize\n model.define_indexes\n model.sphinx_indexes.each do |idx|\n idx.sources.each do |src|\n puts \"#{model.to_s} SQL => \"\n puts src.to_sql\n end\n end\n end\nend",
"def run(*args)\n args += support_rdoc_document_file!\n optparse(*yardopts)\n optparse(*args)\n \n if use_cache\n Registry.load\n checksums = Registry.checksums.dup\n end\n YARD.parse(files, excluded)\n Registry.save(use_cache)\n \n if generate\n if incremental\n generate_with_cache(checksums)\n else\n Registry.load_all if use_cache\n Templates::Engine.generate(all_objects, options)\n end\n end\n \n true\n end",
"def load_index\n construct_index unless index_valid?\n open_index_file\n end",
"def update_index\n SolrService.add(to_solr, softCommit: true)\n end",
"def refresh\n super do |modified|\n return unless modified\n @indexer.generate_index #TODO: update_index?\n end\n end",
"def perform(druid)\n druid_obj = Dor.find(druid)\n collection_id = Dor::WASCrawl::Dissemination::Utilities.get_collection_id(druid_obj)\n collection_path = Dor::Config.was_crawl_dissemination.stacks_collections_path + collection_id\n contentMetadata = druid_obj.datastreams['contentMetadata']\n path_working_directory = Dor::Config.was_crawl_dissemination.path_working_directory\n\n path_indexer_service = Dor::WASCrawl::PathIndexerService.new(druid, collection_path, path_working_directory, contentMetadata.content)\n path_indexer_service.merge\n path_indexer_service.sort\n path_indexer_service.publish\n path_indexer_service.clean\n end",
"def build_indices\n @files, @classes = RDoc::Generator::Context.build_indices(@toplevels,\n @options)\n end",
"def build_indices\n @files, @classes = RDoc::Generator::Context.build_indices(@toplevels,\n @options)\n end",
"def index\r\n build_index unless @index\r\n @index\r\n end",
"def index!\n set_search_text!\n set_query_attributes!\n update_columns text: self.text, query: self.query\n end",
"def perform\n ThinkingSphinx::Connection.take do |client|\n indices.each do |index|\n client.update index, ['sphinx_deleted'], {@document_id => [1]}\n end\n end\n rescue Riddle::ConnectionError\n # If it fails here, so be it.\n ensure\n true\n end",
"def index\n @index ||= Crawler::Index.new(base_uri)\n end",
"def index ; @index ; end",
"def indexItem(itemID, batch, nailgun)\n\n # Grab the main metadata file\n metaPath = arkToFile(itemID, \"meta/base.meta.xml\")\n if !File.exist?(metaPath) || File.size(metaPath) < 50\n puts \"Warning: skipping #{itemID} due to missing or truncated meta.xml\"\n $nSkipped += 1\n return\n end\n rawMeta = fileToXML(metaPath)\n rawMetaXML = rawMeta.to_xml(indent: 3)\n rawMeta.remove_namespaces!\n rawMeta = rawMeta.root\n\n isPending = metaPath.include?(\"/next/\")\n\n existingItem = Item[itemID]\n\n normalize = nil\n if rawMeta.name =~ /^DISS_submission/ ||\n (rawMeta.name == \"mets\" && rawMeta.attr(\"PROFILE\") == \"http://www.loc.gov/mets/profiles/00000026.html\")\n normalize = \"ETD\"\n elsif rawMeta.name == \"mets\"\n normalize = \"BioMed\"\n elsif rawMeta.name == \"Publisher\"\n normalize = \"Springer\"\n end\n\n Thread.current[:name] = \"index thread: #{itemID} #{sprintf(\"%-8s\", normalize ? normalize : \"UCIngest\")}\"\n\n if normalize\n dbItem, attrs, authors, contribs, units, issue, section, suppSummaryTypes =\n processWithNormalizer(normalize, itemID, metaPath, nailgun, isPending)\n else\n dbItem, attrs, authors, contribs, units, issue, section, suppSummaryTypes =\n parseUCIngest(itemID, rawMeta, \"UCIngest\", isPending)\n end\n\n text = $noCloudSearchMode ? \"\" : grabText(itemID, dbItem.content_type)\n \n # Create JSON for the full text index\n authsAndContribs = authors.map { |auth| auth[:name][0,1024] } + contribs.map { |c| c[:name][0,1024] }\n idxItem = {\n type: \"add\", # in CloudSearch land this means \"add or update\"\n id: itemID,\n fields: {\n title: dbItem[:title] ? cleanTitle(dbItem[:title]) : \"\",\n authors: authsAndContribs.length > 1000 ? authsAndContribs[0,1000] : authsAndContribs,\n abstract: attrs[:abstract] || \"\",\n type_of_work: dbItem[:genre],\n disciplines: attrs[:disciplines] ? attrs[:disciplines] : [\"\"], # only the numeric parts\n peer_reviewed: attrs[:is_peer_reviewed] ? 1 : 0,\n pub_date: dbItem[:published].to_date.iso8601 + \"T00:00:00Z\",\n pub_year: dbItem[:published].year,\n rights: rightsURLToCode(dbItem[:rights]),\n sort_author: (authors[0] || {name:\"\"})[:name].gsub(/[^\\w ]/, '')[0,1024].downcase,\n keywords: attrs[:keywords] ? attrs[:keywords] : [\"\"],\n is_info: 0\n }\n }\n\n # Determine campus(es), department(s), and journal(s) by tracing the unit connnections.\n firstCampus = addIdxUnits(idxItem, units)\n\n # Use the first campus and various other attributes to make an OA policy association\n dbItem[:oa_policy] = oaPolicyAssoc(firstCampus, units, dbItem, attrs[:pub_status])\n\n # Summary of supplemental file types\n suppSummaryTypes.empty? or idxItem[:fields][:supp_file_types] = suppSummaryTypes.to_a\n\n # Limit text based on size of other fields (so, 1000 authors will mean less text).\n # We have to stay under the overall limit for a CloudSearch record. This problem is\n # a little tricky, since conversion to JSON introduces additional characters, and\n # it's hard to predict how many. So we just use a binary search.\n idxItem[:fields][:text] = text\n if JSON.generate(idxItem).bytesize > MAX_TEXT_SIZE\n idxItem[:fields][:text] = nil\n baseSize = JSON.generate(idxItem).bytesize\n toCut = (0..text.size).bsearch { |cut|\n JSON.generate({text: text[0, text.size - cut]}).bytesize + baseSize < MAX_TEXT_SIZE\n }\n (toCut==0 || toCut.nil?) and raise(\"Internal error: have to cut something, but toCut=#{toCut.inspect}\")\n #puts \"Note: Keeping only #{text.size - toCut} of #{text.size} text chars.\"\n idxItem[:fields][:text] = text[0, text.size - toCut]\n end\n\n # Make sure withdrawn items get deleted from the index. Also make sure pending items\n # aren't in the index.\n if attrs[:suppress_content] || dbItem[:status] == \"pending\"\n idxItem = {\n type: \"delete\",\n id: itemID\n }\n end\n\n dbAuthors = authors.each_with_index.map { |data, idx|\n ItemAuthor.new { |auth|\n auth[:item_id] = itemID\n auth[:attrs] = JSON.generate(data)\n auth[:ordering] = idx\n }\n }\n\n roleCounts = Hash.new { |h,k| h[k] = 0 }\n dbContribs = contribs.each_with_index.map { |data, _idx|\n ItemContrib.new { |contrib|\n contrib[:item_id] = itemID\n contrib[:role] = data[:role]\n data.delete(:role)\n contrib[:attrs] = JSON.generate(data)\n contrib[:ordering] = (roleCounts[contrib[:role]] += 1)\n }\n }\n\n # For convenient spelunking, record the archival metadata in the db\n dbArchiveMeta = collectArchiveMeta(itemID, rawMetaXML)\n\n # Calculate digests of the index data and database records\n idxData = JSON.generate(idxItem)\n idxDigest = Digest::MD5.base64digest(idxData)\n dbCombined = {\n dbItem: dbItem.to_hash,\n dbAuthors: dbAuthors.map { |authRecord| authRecord.to_hash },\n dbIssue: issue ? issue.to_hash : nil,\n dbSection: section ? section.to_hash : nil,\n units: units,\n archiveMeta: dbArchiveMeta.to_hash\n }\n dbContribs.empty? or dbCombined[:dbContribs] = dbContribs.map { |record| record.to_hash }\n dataDigest = Digest::MD5.base64digest(JSON.generate(dbCombined))\n\n # Add time-varying things into the database item now that we've generated a stable digest.\n timestamp = $preindexMode ? nil : DateTime.now\n dbItem[:last_indexed] = timestamp\n dbItem[:index_digest] = $noCloudSearchMode ? (existingItem && existingItem[:index_digest]) : idxDigest\n dbItem[:data_digest] = dataDigest\n\n dbDataBlock = { dbItem: dbItem, dbAuthors: dbAuthors, dbContribs: dbContribs,\n dbIssue: issue, dbSection: section, units: units,\n dbArchiveMeta: dbArchiveMeta }\n\n # Single-item debug\n if $testMode\n fooData = dbCombined.clone\n fooData.delete(:archiveMeta)\n pp fooData\n fooData = idxItem.clone\n fooData[:fields] and fooData[:fields][:text] and fooData[:fields].delete(:text)\n pp fooData\n exit 1\n end\n\n # If nothing has changed, skip the work of updating this record.\n if existingItem && !$forceMode && ($preindexMode || existingItem[:index_digest] == idxDigest)\n\n # If only the database portion changed, we can safely skip the CloudSearch re-indxing\n if existingItem[:data_digest] != dataDigest\n puts \"#{$forceMode ? \"Forced\" : \"Changed\"} item. (database change only, search data unchanged)\"\n $dbMutex.synchronize {\n DB.transaction { updateDbItem(dbDataBlock) }\n }\n $nProcessed += 1\n return\n end\n\n # Nothing changed; just update the timestamp.\n puts \"Unchanged item.\"\n existingItem.last_indexed = timestamp\n existingItem.save\n $nUnchanged += 1\n return\n end\n\n puts \"#{existingItem ? ($forceMode ? 'Forced' : 'Changed') : 'New'} item.#{attrs[:suppress_content] ? \" (suppressed content)\" : \"\"}\"\n\n if $noCloudSearchMode\n $dbMutex.synchronize {\n DB.transaction { updateDbItem(dbDataBlock) }\n }\n $nProcessed += 1\n return\n end\n\n # Make doubly sure the logic above didn't generate a record that's too big.\n if idxData.bytesize >= 1024*1024\n puts \"idxData=\\n#{idxData}\\n\\nInternal error: generated record that's too big.\"\n exit 1\n end\n\n # If this item won't fit in the current batch, send the current batch off and clear it.\n if batch[:idxDataSize] + idxData.bytesize > MAX_BATCH_SIZE || batch[:items].length > MAX_BATCH_ITEMS\n #puts \"Prepared batch: nItems=#{batch[:items].length} size=#{batch[:idxDataSize]} \"\n batch[:items].empty? or $batchQueue << batch.clone\n emptyBatch(batch)\n end\n\n # Now add this item to the batch\n batch[:items].empty? or batch[:idxData] << \",\\n\" # Separator between records\n batch[:idxData] << idxData\n batch[:idxDataSize] += idxData.bytesize\n batch[:items] << dbDataBlock\n #puts \"current batch size: #{batch[:idxDataSize]}\"\nend",
"def index(model, instance = nil)\n return true if skip? instance\n\n self.class.enqueue(\n FlyingSphinx::IndexRequest.new(model.delta_index_names, true),\n delayed_job_priority\n )\n\n self.class.enqueue_without_duplicates_check(\n FlyingSphinx::FlagAsDeletedJob.new(\n model.core_index_names, instance.sphinx_document_id\n ),\n delayed_job_priority\n ) if instance\n\n true\n end",
"def reindex\n # We would need to set this explicitly to re-index\n if BoolENV[\"REINDEX_SOLR\"]\n Sunspot.session = Sunspot::SessionProxy::Retry5xxSessionProxy.new(Sunspot.session)\n reindex_options = { :batch_commit => false }\n Dir.glob(Rails.root.join('app/models/**/*.rb')).each { |path| require path }\n sunspot_models = Sunspot.searchable\n sunspot_models.each do |model|\n model.solr_reindex(reindex_options)\n end\n end\n end",
"def run(content, params={})\n puts \"Indexing page #{@item.identifier}\"\n\n page_text = extract_text(content)\n\n @index.save_object(\n {\n text: page_text,\n title: @item[:title] || item.identifier\n }, item.identifier)\n puts 'Indexed ' << item.identifier\n\n content\n end",
"def index(model)\n model.index\n ElasticMapper.index.refresh\nend",
"def index\n @@semaphore.synchronize {\n inner_index()\n }\n end",
"def reindex\n custom_breadcrumbs_for(admin: true,\n leaf: 'Start search index refresh')\n\n render :reindex, layout: 'admin/application', locals: { success: nil, errors: [] }\n end",
"def run\n # Like RuboCop itself, we'll lazy load so the task\n # doesn't substantially impact Rakefile load time.\n require 'ruumba'\n\n analyzer = Ruumba::Analyzer.new\n puts 'Running Ruumba...'\n\n analyzer.run @dir\n end",
"def after_create\n super\n self.class.call_es { _index_document }\n end",
"def index(ref, ref_base, software, annotation = '')\n index_suffix = {\n bowtie1: '4.ebwt',\n bowtie2: '4.bt2',\n bwa: '.sa',\n star: '.star'\n }\n index_cmd = {\n bowtie1: \"bowtie-build -p #{ref} #{ref_base}\",\n bowtie2: \"bowtie2-build -p #{ref} #{ref_base}\",\n bwa: \"bwa index #{ref}\",\n star: \"mkdir #{ref_base} && \"\\\n 'STAR --runMode genomeGenerate' \\\n ' --runThreadN $(nproc)' \\\n \" --genomeDir #{ref_base}\"\\\n \" --genomeFastaFiles #{ref}\"\\\n ' --sjdbOverhang 49' \\\n \" --sjdbGTFfile #{annotation} \"\n }\n\n time = 5\n while File.exist?(\"#{ref_base}.lock\")\n print_e \"#{ref_base}.lock exists. Wait for #{time} seconds.\"\n sleep(time)\n time *= 5\n end\n\n return if software == :tophat ||\n skip_step?(\"#{ref_base}.#{index_suffix[software]}\", 'indexing')\n\n begin\n run_cmd(\"touch #{ref_base}.lock\")\n run_cmd(index_cmd[software])\n ensure\n run_cmd(\"rm -f #{ref_base}.lock\")\n end\n end",
"def assure_existing_couch_index\n if (doc = database.get(\"_design/CouchSphinxIndex\") rescue nil)\n return if (ver = doc['version']) and ver == CouchSphinx::VERSION\n\n database.delete_doc(doc)\n end\n\n all_couchrests = {\n :map => 'function(doc) {\n if(doc[\"couchrest-type\"] && (doc[\"created_at\"] || doc[\"updated_at\"])) {\n var date = doc[\"updated_at\"];\n \n if(date == null)\n date = doc[\"created_at\"];\n\n emit(doc._id, doc);\n }\n }'\n }\n\n couchrests_by_timestamp = {\n :map => 'function(doc) {\n if(doc[\"couchrest-type\"] && (doc[\"created_at\"] || doc[\"updated_at\"])) {\n var date = doc[\"updated_at\"];\n \n if(date == null)\n date = doc[\"created_at\"];\n\n emit(Date.parse(date), doc);\n }\n }'\n }\n\n database.save_doc({\n \"_id\" => \"_design/CouchSphinxIndex\",\n :lib_version => CouchSphinx::VERSION,\n :views => {\n :all_couchrests => all_couchrests,\n :couchrests_by_timestamp => couchrests_by_timestamp\n }\n })\n end",
"def enable_lucene\n set_lucene_enabled true\n end",
"def generate_index\n setup\n\n template_file = @template_dir + 'index.rhtml'\n return unless template_file.exist?\n\n debug_msg \"Rendering the index page...\"\n\n out_file = @base_dir + @options.op_dir + 'index.html'\n rel_prefix = @outputdir.relative_path_from out_file.dirname\n search_index_rel_prefix = rel_prefix\n search_index_rel_prefix += @asset_rel_path if @file_output\n\n asset_rel_prefix = rel_prefix + @asset_rel_path\n\n @title = @options.title\n\n render_template template_file, out_file do |io|\n here = binding\n # suppress 1.9.3 warning\n here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)\n here\n end\n rescue => e\n error = RDoc::Error.new \\\n \"error generating index.html: #{e.message} (#{e.class})\"\n error.set_backtrace e.backtrace\n\n raise error\n end",
"def index\n set_index_options\n load_index if params[:reload].to_s.to_boolean(true)\n end",
"def index\n set_index_options\n load_index if params[:reload].to_s.to_boolean(true)\n end",
"def route_index\n if adapter.options[:single_library]\n route_docs(adapter.libraries.values.first.first, [])\n else\n LibraryIndexCommand.new(adapter.options.merge(:path => '')).call(request)\n end\n end",
"def rebuild_index\n aaf_index.rebuild_index\n end",
"def search(*args)\n options = args.extract_options!\n options[:class] = self\n args << options\n ThinkingSphinx::Search.search(*args)\n end",
"def index(*args)\n\t\t\treturn find_index(*args,&block)\n\t\tend",
"def perform(args)\n Elasticsearch::Persistence.client.indices.refresh index: \"frontend*\"\n ## here you are saying Indicator.find\n ## and it is not being able to find the job.\n ## because it is using that document type.\n obj = args[1].constantize.find(args[0])\n obj.run_callbacks(:find)\n obj.do_background_job(args[2]) if obj.respond_to? \"do_background_job\"\n end",
"def index(*args)\n @config.index(args)\n end",
"def index_write\n rugged_repository.index.reload\n yield(rugged_repository.index)\n rugged_repository.index.write\n end",
"def index\n @@index ||= Ferret::Index::Index.new(default_index_params)\n end",
"def index\n @@index ||= Ferret::Index::Index.new(default_index_params)\n end",
"def generate_index!(title_prefix, output_doc_path, only_platform: /.*/)\n result = ''\n result += \"# #{title_prefix} Atomic Tests by ATT&CK Tactic & Technique\\n\"\n\n ATTACK_API.techniques_by_tactic(only_platform: only_platform).each do |tactic, techniques|\n result += \"# #{tactic}\\n\"\n techniques.each do |technique|\n result += \"- #{ATOMIC_RED_TEAM.github_link_to_technique(technique, include_identifier: true, link_new_to_contrib: true)}\\n\"\n ATOMIC_RED_TEAM.atomic_tests_for_technique(technique).each_with_index do |atomic_test, i|\n next unless atomic_test['supported_platforms'].any? {|platform| platform.downcase =~ only_platform}\n\n result += \" - Atomic Test ##{i+1}: #{atomic_test['name']} [#{atomic_test['supported_platforms'].join(', ')}]\\n\"\n end\n end\n result += \"\\n\"\n end\n\n File.write output_doc_path, result\n\n puts \"Generated Atomic Red Team index at #{output_doc_path}\"\n end",
"def index_delta\n if ThinkingSphinx::Configuration.environment == \"test\" ||\n !ThinkingSphinx.deltas_enabled?\n return true\n end\n \n configuration = ThinkingSphinx::Configuration.new\n system \"indexer --config #{configuration.config_file} --rotate #{self.class.name.downcase}_delta\"\n \n true\n end",
"def elastic_index(options = {})\n \n options.symbolize_keys!\n Escargot.register_model(self)\n \n if respond_to?('single_collection_inherited?') and single_collection_inherited?\n ivars = %w[@index_name @update_index_policy @index_options @indexing_options @mapping @current_schema_version @previous_schema_version]\n ivars.each do |ivar|\n if passed_option = options[ivar[1..-1].to_sym]\n instance_variable_set ivar, passed_option\n else\n instance_variable_set ivar, superclass.instance_variable_get(ivar)\n end\n end\n else\n @index_name = options[:index_name] || self.name.underscore.gsub(/\\//,'-')\n @update_index_policy = options.include?(:updates) ? options[:updates] : :immediate\n \n if @update_index_policy\n after_save :update_index\n after_destroy :delete_from_index\n end\n \n @index_options = options[:index_options] || {}\n @indexing_options = options[:indexing_options] || {}\n @mapping = options[:mapping] || false\n @current_schema_version = options[:current_schema_version] || \"0\"\n @previous_schema_version = options[:previous_schema_version] || \"0\"\n end\n \n end",
"def reindex(autocommit = true)\n message = {:id => self.id, :document => self.search_document, :boost => self.boost}.to_json\n if defined?(RABBIT_MQ) && defined?(Bunny)\n Bunny.run RABBIT_MQ do |rabbit|\n queue = rabbit.queue \"sisyphus__reindex_place_document\"\n queue.publish(message)\n end\n else\n Sisyphus.async_reindex_place_document(message)\n end\n end",
"def generate(site)\n puts 'Running the search indexer...'\n\n # gather pages and posts\n items = pages_to_index(site)\n content_renderer = PageRenderer.new(site)\n index = []\n\n items.each do |item|\n entry = SearchEntry.create(item, content_renderer)\n\n entry.strip_index_suffix_from_url! if @strip_index_html\n entry.strip_stopwords!(stopwords, @min_length) if File.exists?(@stopwords_file) \n \n index << {\n :title => entry.title, \n :url => entry.url,\n :date => entry.date,\n :categories => entry.categories,\n :body => entry.body\n }\n \n puts 'Indexed ' << \"#{entry.title} (#{entry.url})\"\n end\n \n json = JSON.generate({:entries => index})\n \n # Create destination directory if it doesn't exist yet. Otherwise, we cannot write our file there.\n Dir::mkdir(site.dest) unless File.directory?(site.dest)\n \n # File I/O: create search.json file and write out pretty-printed JSON\n filename = 'search.json'\n \n File.open(File.join(site.dest, filename), \"w\") do |file|\n file.write(json)\n end\n\n File.open(File.join('.', filename), \"w\") do |file|\n file.write(json)\n end\n\n # Keep the search.json file from being cleaned by Jekyll\n site.static_files << Jekyll::SearchIndexFile.new(site, site.dest, \"/\", filename)\n end",
"def index_documents\n @params = {}\n @action = 'index_documents'\n \n send_auth_request\n end",
"def update_index\n self.reload\n SearchIndex.update_record(self)\n end",
"def update_index\n self.reload\n SearchIndex.update_record(self)\n end",
"def title\n \"Thinking Sphinx\"\n end",
"def initialize\n super\n @source = Riddle::Configuration::XMLSource.new(:source, :xmlpipe2)\n @index = Riddle::Configuration::Index.new(:index, @source)\n @file = OpenStruct.new(output_path: \"./sphinx.conf\")\n @static_indexes = {}\n @generated_indexes = {}\n end",
"def update_index\n index_files = []\n index_files << upload(\"specs.4.8.gz\", specs_index)\n log \"Uploaded all specs index\"\n index_files << upload(\"latest_specs.4.8.gz\", latest_index)\n log \"Uploaded latest specs index\"\n index_files << upload(\"prerelease_specs.4.8.gz\", prerelease_index)\n log \"Uploaded prerelease specs index\"\n\n index_files.each do |file|\n tuf_repo.replace_file(file, 'targets/unclaimed', 'targets')\n end\n\n # For now assume all files are unclaimed\n pending_files = tuf_pending_store.pending\n pending_files.each do |file|\n puts \"Adding file: #{file.path}\"\n tuf_repo.add_file(file, 'targets/unclaimed', 'targets')\n end\n tuf_repo.publish!\n tuf_pending_store.clear(pending_files)\n end",
"def build_index\n reset @store.all_files.sort, @store.all_classes_and_modules.sort\n\n index_classes\n index_methods\n index_pages\n\n { :index => @index }\n end",
"def generate(site)\n puts 'Indexing pages...'\n \n # gather pages and posts\n items = site.pages.dup.concat(site.posts)\n\n # only process files that will be converted to .html and only non excluded files \n items = items.find_all {|i| i.output_ext == '.html' && ! @excludes.any? {|s| (i.absolute_url =~ Regexp.new(s)) != nil } } \n items.reject! {|i| i.data['exclude_from_search'] } \n \n # only process items that are changed since last regeneration\n items = items.find_all {|i| @last_indexed.nil? || File.mtime(i.full_path_to_source) > @last_indexed }\n\n # dont process index pages\n items.reject! {|i| i.is_a?(Jekyll::Page) && i.index? }\n\t\t\t \n while not @index.running?\n # wait for the indextank index to get ready\n sleep 0.5\n end\n \n items.each do |item| \n page_text = extract_text(site,item)\n\n @index.document(item.absolute_url).add({ \n :text => page_text,\n :title => item.data['title'] || item.name \n })\n puts 'Indexed ' << item.absolute_url\n end\n \n @last_indexed = Time.now\n write_last_indexed()\n \n puts 'Indexing done'\n end",
"def update_index\n all.each do |n|\n n.update_index\n end\n end",
"def run\n # Get YARD ready\n YARD::Registry.load!\n\n # Populate the type information file\n populate\n\n if object_count.zero?\n Logging.warn(\"No objects processed.\")\n Logging.warn(\"Have you definitely generated the YARD documentation for this project?\")\n Logging.warn(\"Run `yard` to generate docs.\")\n end\n\n Logging.done(\"Processed #{object_count} objects (#{@namespace_count} namespaces and #{@method_count} methods)\")\n\n Logging.hooks.clear\n\n unless warnings.empty?\n Logging.warn(\"There were #{warnings.length} important warnings in the output file, listed below.\")\n if @replace_errors_with_untyped\n Logging.warn(\"The types which caused them have been replaced with untyped.\")\n else\n Logging.warn(\"The types which caused them have been replaced with SORD_ERROR_ constants.\")\n end\n Logging.warn(\"Please edit the file to fix these errors.\")\n Logging.warn(\"Alternatively, edit your YARD documentation so that your types are valid and re-run Sord.\")\n warnings.each do |(msg, item, _)|\n puts \" (#{Rainbow(item&.path).bold}) #{msg}\"\n end\n end\n rescue\n Logging.error($!)\n [email protected] do |line|\n puts \" #{line}\"\n end\n end",
"def run\n super\n\n # get options\n opt_elastic = _get_option(\"elastic\")\n opt_mongodb = _get_option(\"mongodb\")\n opt_couchdb = _get_option(\"couchdb\")\n opt_rsync = _get_option(\"rsync\")\n opt_sonarqube = _get_option(\"sonarqube\")\n opt_jenkins = _get_option(\"jenkins\")\n opt_gitlab = _get_option(\"gitlab\")\n opt_kibana = _get_option(\"kibana\")\n #opt_listing = _get_option(\"listing\")\n opt_cassandra = _get_option(\"cassandra\")\n opt_rethink = _get_option(\"rethink\")\n\n # Set the range of research\n first_page = _get_option(\"first_page\") || 1\n last_page = _get_option(\"last_page\") || 20\n\n range = first_page..last_page\n\n elastic_query = \"type:%22elasticsearch%22\"\n mongodb_query = \"type:%22mongodb%22\"\n couchdb_query = \"product:%22couchdb%22\"\n rsync_query = \"rsync port:%22873%22\"\n sonarqube_query = \"%22Title: SonarQube%22\"\n jenkins_query = \"%22Dashboard [Jenkins]%22\"\n gitlab_query = \"%22Sign in GitLab%22\"\n kibana_query = \"product:%22kibana%22\"\n listing_query = '%22Index of /%22'\n cassandra_query = \"type:%22cassandra%22\"\n rethink_query = \"type:%22rethinkdb%22\"\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n db_source = nil\n\n # Make sure the key is set\n api_key = _get_task_config(\"binary_edge_api_key\")\n \n # Set the headers\n headers = { \"X-Key\" => \"#{api_key}\" }\n\n if opt_elastic == true\n query = elastic_query\n\t range.each do |page_num|\n \t result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_elastic_results(result)\n end\n end\n\n if opt_kibana == true\n query = kibana_query\n\t range.each do |page_num|\n \t result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_kibana_results(result)\n end\n end\n\n if opt_rsync == true\n query = rsync_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_rsync_results(result)\n end\n end\n\n if opt_jenkins == true\n query = jenkins_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_jenkins_results(result)\n end\n end\n\n if opt_gitlab == true\n query = gitlab_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_gitlab_results(result)\n end\n end\n\n if opt_sonarqube == true\n query = sonarqube_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_sonarqube_results(result)\n end\n end\n\n if opt_mongodb == true\n query = mongodb_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_mongodb(result)\n end\n end\n\n if opt_cassandra == true\n query = cassandra_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_cassandra_results(result)\n end\n end\n\n if opt_couchdb == true\n query = couchdb_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_couchdb_results(result)\n end\n end\n\n if opt_rethink == true\n query = rethink_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_rethinkdb_results(result)\n end\n end\n\n end",
"def index_csv(data_path, db_path)\n db = Xapian::WritableDatabase.new(db_path, Xapian::DB_CREATE_OR_OPEN)\n term_generator = Xapian::TermGenerator.new\n term_generator.stemmer = Xapian::Stem.new('en')\n parse_csv_file(data_path).each do |row|\n doc = Xapian::Document.new\n term_generator.document = doc\n term_generator.index_text(row['TITLE'].to_s, 1, 'S')\n term_generator.index_text(row['DESCRIPTION'].to_s, 1, 'XD')\n term_generator.index_text(row['TITLE'].to_s)\n term_generator.increase_termpos\n term_generator.index_text(row['DESCRIPTION'].to_s)\n doc.data = row.to_h.to_json\n idterm = \"Q#{row['id_NUMBER']}\"\n doc.add_boolean_term(idterm)\n db.replace_document(idterm, doc)\n end\nend",
"def index_one_document hsh\n response = client.prepare_index(@index, @type).set_source(hsh.to_indexable_json).execute.action_get\n end",
"def construct_index\n end",
"def indexes\n raise 'not implemented'\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n index_suppressed(solr_doc)\n index_workflow_fields(solr_doc)\n end\n end",
"def test_keyword_index_builder\n CEdictImporter.create_headword_index\n end",
"def start # :nodoc:\n run_corpus\n run_matchers\n save_unmatched_words\n find_event if @matches[:event].empty?\n @matches\n end",
"def exec_doc\n output = File.join('doc', 'rdoc')\n title = (PACKAGE.capitalize + \" API\").strip\n main = Dir.glob(\"README{,.txt}\", File::FNM_CASEFOLD).first\n template = config.doctemplate || 'html'\n\n opt = []\n opt << \"-U\"\n opt << \"-S\"\n opt << \"--op=#{output}\"\n opt << \"--template=#{template}\"\n opt << \"--title=#{title}\"\n opt << \"--main=#{main}\" if main\n\n if File.exist?('.document')\n files = File.read('.document').split(\"\\n\")\n files.reject!{ |l| l =~ /^\\s*[#]/ || l !~ /\\S/ }\n files.collect!{ |f| f.strip }\n opt << files\n else\n opt << main if main\n opt << [\"lib\", \"ext\"]\n end\n\n opt = opt.flatten\n\n if no_harm?\n puts \"rdoc \" + opt.join(' ').strip\n else\n #sh \"rdoc {opt.join(' ').strip}\"\n require 'rdoc/rdoc'\n ::RDoc::RDoc.new.document(opt)\n end\n end",
"def index(file_rec)\n @index_driver.index(file_rec)\n end",
"def index(docs, commit_within: ENV.fetch('SOLR_COMMIT_WITHIN', 5000).to_i)\n indexed_count = 0\n\n docs.each do |record, path|\n # log the unique identifier for the record for debugging\n id = record['id'] || record['dc_identifier_s']\n puts \"Indexing #{id}: #{path}\" if $DEBUG\n\n # index the record into solr\n @solr.update params: { commitWithin: commit_within, overwrite: true },\n data: [record].to_json,\n headers: { 'Content-Type' => 'application/json' }\n\n # count the number of records successfully indexed\n indexed_count += 1\n rescue RSolr::Error::Http => e\n puts e\n end\n\n @solr.commit\n indexed_count\n end"
] | [
"0.69802433",
"0.6724148",
"0.6644357",
"0.6502688",
"0.6477452",
"0.6365644",
"0.6262395",
"0.6260822",
"0.6159486",
"0.6153946",
"0.61057174",
"0.60655636",
"0.6059642",
"0.6022898",
"0.60181665",
"0.6005722",
"0.59887016",
"0.59227896",
"0.59220713",
"0.5909556",
"0.5898908",
"0.5867991",
"0.5860189",
"0.5851347",
"0.5845927",
"0.5823498",
"0.5821507",
"0.58175385",
"0.57902974",
"0.57874763",
"0.57075155",
"0.56934667",
"0.56842935",
"0.56602496",
"0.56592876",
"0.56471646",
"0.56293005",
"0.5608802",
"0.55991554",
"0.5585993",
"0.5582011",
"0.5568716",
"0.55679166",
"0.55280787",
"0.55280787",
"0.5523155",
"0.54934424",
"0.5486075",
"0.5478981",
"0.5470579",
"0.5466998",
"0.54628736",
"0.5447235",
"0.5423365",
"0.5423364",
"0.5416913",
"0.5410297",
"0.5405094",
"0.53896254",
"0.537066",
"0.53579617",
"0.5351572",
"0.53504705",
"0.53504425",
"0.53504425",
"0.53427416",
"0.53425485",
"0.53399384",
"0.5331491",
"0.53265476",
"0.53196913",
"0.53195846",
"0.5318463",
"0.5318463",
"0.53159565",
"0.530862",
"0.53058463",
"0.53017193",
"0.52853715",
"0.5278001",
"0.5274774",
"0.5274774",
"0.526064",
"0.5252507",
"0.52483827",
"0.52337396",
"0.52311707",
"0.52296746",
"0.52292335",
"0.5227012",
"0.5222878",
"0.52193624",
"0.5199472",
"0.5196014",
"0.51927406",
"0.5192328",
"0.5183719",
"0.51807463",
"0.51784885",
"0.5178051"
] | 0.5341289 | 67 |
GET /docderivaciones GET /docderivaciones.json | def index
@docderivaciones = Docderivacione.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_docderivacione\n @docderivacione = Docderivacione.find(params[:id])\n end",
"def docderivacione_params\n params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado)\n end",
"def getDoc(doc)\n uri = URI.parse(\"https://api.figma.com/v1/files/#{doc[\"document\"]}\")\n request = Net::HTTP::Get.new(uri)\n request[\"X-Figma-Token\"] = @figmatoken\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n \n response.body\n end",
"def create\n @docderivacione = Docderivacione.new(docderivacione_params)\n\n respond_to do |format|\n if @docderivacione.save\n format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully created.' }\n format.json { render :show, status: :created, location: @docderivacione }\n else\n format.html { render :new }\n format.json { render json: @docderivacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @docderivacione.update(docderivacione_params)\n format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully updated.' }\n format.json { render :show, status: :ok, location: @docderivacione }\n else\n format.html { render :edit }\n format.json { render json: @docderivacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @docderivacione.destroy\n respond_to do |format|\n format.html { redirect_to docderivaciones_url, notice: 'Docderivacione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def service_document\n response = get(@url.to_s)\n response.body\n end",
"def get(*path)\n return super if path.empty?\n\n get_derivatives(*path)\n end",
"def get_derivatives(*path)\n return derivatives if path.empty?\n\n path = derivative_path(path)\n\n derivatives.dig(*path)\n end",
"def request_doc\n \n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def retrieve \n if !check_auth()\n render text: { \"message\" => \"401 Unauthorized\" }.to_json(), status: :unauthorized\n else\n uri = params[:uri]\n type = params[:type]\n doc = Document.find_by_uri(uri)\n if doc.present?\n case type\n when 'gale'\n render :text => doc.get_corrected_gale_xml()\n when 'text'\n render :text => doc.get_corrected_text()\n when 'tei-a'\n render :text => doc.get_corrected_tei_a(false)\n when 'tei-a-words'\n render :text => doc.get_corrected_tei_a(true)\n when 'original-gale'\n render :text => doc.get_original_gale_xml()\n when 'original-text'\n render :text => doc.get_original_gale_text()\n end\n else\n render text: { \"message\" => \"Document #{uri} not found\" }.to_json(), status: :not_found\n end\n end\n end",
"def documents(params={})\n server.get(\"#{name}/_all_docs\", params)\n end",
"def get_doc \n @doc\n end",
"def get_document_info( doc_id: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :get, url_for_base(doc_id), params, :json\n end",
"def documents\n return bad_request unless params[:id] and request.format.json? || request.format.js? || request.format.text?\n return not_found unless current_document\n opts = {:access => true, :sections => true, :annotations => true, :data => true}\n if current_account\n opts[:account] = current_account\n opts[:allowed_to_edit] = current_account.allowed_to_edit?(current_document)\n opts[:allowed_to_review] = current_account.reviews?(current_document)\n end\n @response = {'document' => current_document.canonical(opts)}\n respond_to do |format|\n format.text do\n direct = [PRIVATE, ORGANIZATION, EXCLUSIVE].include? current_document.access\n redirect_to(current_document.full_text_url(direct: direct))\n end\n format.json { render_cross_origin_json }\n format.js { render_cross_origin_json }\n end\n end",
"def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end",
"def docentes\n\t\t@seccion = \"Docentes\"\n @titulo = \"Docentes\"\n\n if Docente.all().size > 0\n \t\tif params[:orden]\n \t\t\t@orden = params[:orden]\n \t\telse\n \t\t\t@orden = \"Cédula\"\n \t\tend\n\n \t\t#Guardo todos los docentes\n \t\tcase @orden\n \t\twhen \"Cédula\"\n \t\t\t@usuarios = Usuario.order('cedula').where(:id => Docente.all)\n \t\twhen \"Nombre\"\n \t\t\t@usuarios = Usuario.order('nombre').where(:id => Docente.all)\n \t\twhen \"Apellido\"\n \t\t\t@usuarios = Usuario.order('apellido').where(:id => Docente.all)\n \t\twhen \"Correo\"\n \t\t\t@usuarios = Usuario.order('correo').where(:id => Docente.all)\n \t\tend\n\n end\n\t\t\n\t\t @categorias = ['Cédula', 'Nombre', 'Apellido', 'Correo'] #Este es el orden que se mostrará en el select de la vista\n\n \t\t@docente_datos = [] #En este arreglo se guardan los pares \"Cedula - Nombre Apellido\" de cada usuario para mostrar en el campo de busqueda\n \t\tUsuario.order('nombre').where(:id => Docente.all).each do |usuario|\n \t\t\t#En este foro se agregan uno a uno los valores de cada docente al arreglo de la manera indicada arriba\n \t\t\t@docente_datos << usuario.cedula.to_s + \" - \" + usuario.nombre_y_apellido.to_s\n \t\tend\n\tend",
"def list\n @documentations = Documentation.not_article.order('created_at DESC')\n end",
"def eds_documents(data)\n docs = data&.dig('response', 'docs')\n docs = Array.wrap(docs).compact\n factory = blacklight_config.document_factory\n model_opt = { lens: blacklight_config.lens_key }\n docs.map { |doc| factory.build(doc, data, model_opt) }\n end",
"def docs api\n\t\tget_html \"#{@options[:docs]}/#{@apis[api][:url]}.htm\"\n\tend",
"def index\n @degres = Degre.all\n end",
"def index\n # @documentos = Documento.all\n @documentos = Documento.order(\"fecha_publicacion DESC\").paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documentos }\n end\n end",
"def index\n # @results = []\n # @document.bioc_doc.all_relations.each do |a|\n # e = EntityUtil.get_relation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager\n @relations = @document.relations.where('`version`=?', @version)\n else\n @relations = @assign.relations\n end\n @relations = @relations.order(\"offset\")\n end",
"def getToolsDocs( object, format)\n params = Hash.new\n params['object'] = object\n params['format'] = format\n return doCurl(\"get\",\"/tools/docs\",params)\n end",
"def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end",
"def show\n @response = search_service.fetch(params[:id]).first\n @document = @response.documents.first\n if @document.generic_file?\n @document = nil\n raise DRI::Exceptions::BadRequest, \"Invalid object type DRI::GenericFile\"\n end\n\n @children = @document.children(limit: 100).select { |child| child.published? }\n\n # assets ordered by label, excludes preservation only files\n @assets = @document.assets(ordered: true)\n @file_display_type_count = @document.file_display_type_count(published_only: true)\n @presenter = DRI::ObjectInCatalogPresenter.new(@document, view_context)\n supported_licences\n @reader_group = governing_reader_group(@document.collection_id) unless @document.collection?\n\n if @document.doi\n doi = DataciteDoi.where(object_id: @document.id).current\n @doi = doi.doi if doi.present? && doi.minted?\n end\n\n if @document.published?\n dimensions = { collection: @document.root_collection_id, object: @document.id }\n dimensions[:organisation] = @document.depositing_institute.name if @document.depositing_institute.present?\n @dimensions = dimensions\n @track_download = true\n end\n\n respond_to do |format|\n format.html { @search_context = setup_next_and_previous_documents }\n format.json do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n options[:with_metadata] = true\n formatter = DRI::Formatters::Json.new(self, @document, options)\n render json: formatter.format(func: :as_json)\n end\n format.ttl do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n options[:with_metadata] = true\n formatter = DRI::Formatters::Rdf.new(self, @document, options)\n render plain: formatter.format({format: :ttl})\n end\n format.rdf do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n options[:with_metadata] = true\n formatter = DRI::Formatters::Rdf.new(self, @document, options)\n render plain: formatter.format({format: :xml})\n end\n format.js { render layout: false }\n\n additional_export_formats(@document, format)\n end\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def deprecate_search\n @results = @cookbook.deprecate_search(params.fetch(:q, nil))\n\n respond_to do |format|\n format.json\n end\n end",
"def index\n @doc_artefacts = DocArtefact.all\n end",
"def derivatives_for_reference\n Hyrax::DerivativePath.derivatives_for_reference(@file_set)\n end",
"def index\n @direccions = Direccion.recientes.all\n end",
"def index\n \n @docfiles = Docfile.all\n end",
"def get_document( doc_id:, version:CURRENT, filename: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :get, path_for(doc_id, filename, version), {}, :binary\n end",
"def get_document_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocumentApi.get_document_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/document'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageDocument')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocumentApi#get_document_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def api_docs(method)\n @doc_urls ||= {}\n @doc_urls[method]\n end",
"def show\n @response, @document = fetch params[:id]\n\n @children = @document.children(limit: 100).select { |child| child.published? }\n\n # assets ordered by label, excludes preservation only files\n @assets = @document.assets(ordered: true)\n\n @presenter = DRI::ObjectInCatalogPresenter.new(@document, view_context)\n\n supported_licences\n\n @reader_group = governing_reader_group(@document.collection_id) unless @document.collection?\n\n if @document.published?\n Gabba::Gabba.new(GA.tracker, request.host).event(@document.root_collection_id, \"View\", @document.id, 1, true)\n end\n\n respond_to do |format|\n format.html { setup_next_and_previous_documents }\n format.json do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Json.new(@document, options)\n render json: formatter.format(func: :as_json)\n end\n format.ttl do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Rdf.new(@document, options)\n render text: formatter.format({format: :ttl})\n end\n format.rdf do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Rdf.new(@document, options)\n render text: formatter.format({format: :xml})\n end\n format.js { render layout: false }\n\n additional_export_formats(@document, format)\n end\n end",
"def show\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doc }\n end\n end",
"def index\n # @documents = Document.all.with_attached_images\n respond_to do |format|\n format.html\n format.json { render json: DocumentDatatable.new(params, view_context: view_context) }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def index\n @ficha_docs = FichaDoc.all\n end",
"def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"def index\n @depts = Dept.roots.includes(:children)\n render json: @depts, each_serializer: V1::DeptSerializer, root: false\n end",
"def get_document_schema\n filePath = Rails.root.join(\"lib\", \"base_truevault_doc.json\")\n file = File.read(filePath)\n schema = JSON.parse(file).with_indifferent_access\n end",
"def documents; end",
"def documents; end",
"def json_ld; end",
"def designations\n self.dig_for_string(\"designations\")\n end",
"def index\n @documentos = @externo.documentos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"def index\n @documentacions = Documentacion.all\n end",
"def doc2dct_references(fgdc_url, doc)\n dct_references = {}\n\n ### 12 possible keys. \n ### Which ones are we able to provide?\n\n # Only Public content has been loaded into GeoServer.\n # Restricted content is only available via Direct Download.\n if @dc_rights == 'Public'\n # For Columbia, Raster data is NEVER loaded into GeoServer.\n layer_geom_type = doc2layer_geom_type(doc)\n if @provenance != 'Columbia' || layer_geom_type != 'Raster'\n # Web Mapping Service (WMS) \n dct_references['http://www.opengis.net/def/serviceType/ogc/wms'] =\n @geoserver_wms_url\n # Web Feature Service (WFS)\n dct_references['http://www.opengis.net/def/serviceType/ogc/wfs'] =\n @geoserver_wfs_url\n end\n end\n\n # International Image Interoperability Framework (IIIF) Image API\n # Direct download file\n if onlink = doc.at_xpath(\"//idinfo/citation/citeinfo/onlink\")\n if onlink.text.match /.columbia.edu/\n dct_references['http://schema.org/downloadUrl'] = onlink.text\n end\n end\n\n # This is unnecessary. GeoBlacklight will already display FGDC XML\n # in a prettily formatted HTML panel. And the HTML metadata isn't\n # downloadable - or anything else - in stock GeoBlacklight.\n # None of the OpenGeoBlacklight institutions bother with this.\n # # Full layer description\n # # Metadata in HTML\n # die \"No APP_CONFIG['display_urls']['html']\" unless APP_CONFIG['display_urls']['html']\n # dct_references['http://www.w3.org/1999/xhtml'] =\n # APP_CONFIG['display_urls']['html'] + \"/#{@key}.html\"\n\n # # Metadata in ISO 19139\n # dct_references['http://www.isotc211.org/schemas/2005/gmd/'] =\n # APP_CONFIG['display_urls']['iso19139'] + \"/#{@key}.xml\"\n # Metadata in FGDC\n dct_references['http://www.opengis.net/cat/csw/csdgm'] = fgdc_url\n # Metadata in MODS\n # ArcGIS FeatureLayer\n # ArcGIS TiledMapLayer\n # ArcGIS DynamicMapLayer\n # ArcGIS ImageMapLayer\n\n return dct_references.compact.to_json.to_s\n end",
"def d(doc)\n doc.keys.inject(0.0) do |d, term|\n d + doc[term]**2.0\n end\n end",
"def design_doc\n database.get(\"_design/#{design_doc_slug}\")\n end",
"def index\n @direcciones = Direccion.all\n end",
"def get_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Get.new(uri)\n run(uri, req)\n end",
"def get_pdf_de_etiquetas_por_orden_or_numero_envio(opts = {})\n method = :get_pdf_de_etiquetas_por_orden_or_numero_envio\n opts = {\n \"idOrdenRetiro\" => opts[:id_orden_retiro],\n \"nroEnvio\" => opts[:nro_envio],\n \"logisticaInversa\" => opts.fetch(:logistica_inversa, FALSE_STRING).to_s\n }\n response = client.call(method, message: opts)\n parse_result(response, method)\n rescue Savon::SOAPFault => error\n msg = \"Oca WS responded with:\\n#{error.http.code}\\n#{error}\"\n raise Oca::Errors::BadRequest.new(msg)\n end",
"def index\n @deces = Dece.all\n end",
"def get_json\n html = Nokogiri::HTML(@page)\n text = open(\"https://theintercept.com/api/requestSIDDocuments/?orderBy=publishedTime&orderDirection=desc&perPage=2000\").read\n documents = JSON.parse(text)[\"documents\"][\"edges\"].map{|d| d[\"node\"]}\n \n documents.each do |doc|\n @output.push(parse_json(doc))\n end\n\n return JSON.pretty_generate(@output)\n end",
"def de\n file = File.read(Rails.root.join('client', 'languages', 'deDe.json'))\n data_hash = JSON.parse(file)\n render :json => data_hash\n end",
"def design_docs\n req = make_http_request(\"/pools/default/buckets/#{bucket}/ddocs\",\n :type => :management, :extended => true)\n docmap = {}\n req.on_body do |body|\n res = MultiJson.load(body.value)\n res[\"rows\"].each do |obj|\n if obj['doc']\n obj['doc']['value'] = obj['doc'].delete('json')\n end\n doc = DesignDoc.wrap(self, obj)\n key = doc.id.sub(/^_design\\//, '')\n next if self.environment == :production && key =~ /dev_/\n docmap[key] = doc\n end\n yield(docmap) if block_given?\n end\n req.continue\n async? ? nil : docmap\n end",
"def retrieve_docs_from_host1\n apis = {}\n host = @doc_urls[:doc_base1][%r{^https?:\\/\\/[^\\/]+}]\n apis_received = open(@doc_urls[:doc_base1], @api_docs, &:read).scan(/<a class=\"swagger-list--item-link\" href=\"\\/(.+?)\".*?>\\s*(.+?)\\s*<\\/a>/i)\n \n apis_received.each do |path, title|\n begin\n api = { path: \"#{@doc_urls[:doc_base1]}#{path}\",\n title: title.sub(/\\s*\\(.+?\\)$/, ''),\n deprecated: title.include?('(Deprecated)') }\n\n fetched_path = open(api['path'], Options, &:read).scan(%r{url:\\s*'(.+?)'})\n api[:path] = \"#{host}#{fetched_path}\"\n apis[api[:title]] = api\n rescue OpenURI::HTTPError\n # Some log here\n end\n end\n\n apis\n end",
"def show\n @derivative = Derivative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @derivative }\n end\n end",
"def get_doc(id,*opts)\n q = \"#{database}/#{id}\"\n q << build_query_string(opts.first,\"doc\") if opts && opts.any? && opts.first.is_a?(Hash)\n\n @conn.query({url_path: q, method: :get})\n end",
"def get_definitions(word, *args)\n http_method = :get\n path = '/word/{word}/definitions'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def get_order_edi_documents_with_http_info(order_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_order_edi_documents ...'\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling OrderApi.get_order_edi_documents\"\n end\n # resource path\n local_var_path = '/order/orders/{order_id}/edi'.sub('{' + 'order_id' + '}', order_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OrderEdiDocumentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_order_edi_documents\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @documento = Documento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @documento }\n end\n end",
"def index\n authorize Document\n\n @documents = apply_scopes(Document).valid.all\n\n if current_user.client?\n @documents = @documents.by_belongings([current_user.id])\n end\n\n respond_with do |format|\n format.html\n format.json { render json: DocumentsDatatable.new(view_context, @documents) }\n format.js\n end\n\n end",
"def document\n json = Net::HTTP.get_response URI.parse(query_string(@query))\n json.body\n end",
"def get_document(depth: nil, pierce: nil)\n {\n method: \"DOM.getDocument\",\n params: { depth: depth, pierce: pierce }.compact\n }\n end",
"def index\n @notadedebito = Notadedebito.find(params[:notadedebito_id])\n @renglon_nddndcs = @notadedebito.renglon_nddndcs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_nddndcs }\n end\n end",
"def repo_docs_for(uuid)\n string_response = make_request_for('repo_solr_docs', uuid)\n convert_to_json_docs(string_response) if string_response\n end",
"def get_design_doc(id)\n @conn.query({url_path: \"#{database}/_design/#{id}\", method: :get})\n end",
"def derivatives_options\n opts[:derivatives]\n end",
"def new\n @documento = Documento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documento }\n end\n end",
"def list_doc\r\n @query = params[:query]\r\n @pages = []\r\n @docs = []\r\n if request.post? || @query\r\n case @query\r\n when /type:(\\w+)/\r\n case $1\r\n when /^unknown/i\r\n @docs = Document.find_unknown\r\n @pages = Paginator.new(self, @docs.length, PER_PAGE, params[:page])\r\n \r\n page = (params[:page] ||= 1).to_i\r\n offset = (page - 1) * PER_PAGE\r\n @docs = @docs[offset..(offset + PER_PAGE - 1)]\r\n end\r\n else\r\n @pages, @docs = paginate(\r\n :documents,\r\n :conditions => \"path LIKE '%#{@query}%'\",\r\n :per_page => PER_PAGE)\r\n end\r\n end\r\n end",
"def all opts = {}\n self.generated_design_doc ||= default_design_doc\n unless design_doc_fresh\n refresh_design_doc\n end\n view_name = \"#{design_doc_slug}/all\"\n raw = opts.delete(:raw)\n fetch_view_with_docs(view_name, opts, raw)\n end",
"def test_get_document_drawing_objects\n remote_file_name = 'TestGetDocumentDrawingObjects.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = GetDocumentDrawingObjectsRequest.new(name: remote_file_name, node_path: 'sections/0', folder: remote_data_folder)\n\n result = @words_api.get_document_drawing_objects(request)\n assert_equal false, result.nil?\n end",
"def get_pdf_in_storage_to_doc(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_pdf_in_storage_to_doc_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_pdf_in_storage_to_doc_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def getToolsIodocs( mode, path, endpoint, doctype)\n params = Hash.new\n params['mode'] = mode\n params['path'] = path\n params['endpoint'] = endpoint\n params['doctype'] = doctype\n return doCurl(\"get\",\"/tools/iodocs\",params)\n end",
"def bra_per_day(date)\n date = date.to_i\n p url = \"https://donneespubliques.meteofrance.fr/donnees_libres/Pdf/BRA/bra.#{date}.json\"\n JSON.parse(open(url).read)\nend",
"def index\n @documentations = Documentation.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentations }\n end\n end",
"def create_derivatives\n GeoMetadataExtractor.new(change_set: parent_change_set, file_node: resource, persister: change_set_persister).extract\n end",
"def doc()\n buffer = ''\n descr_mapping = {}\n\n buffer += '## Available Methods :\\n\\n'\n buffer += 'This GEM wraps the following SOLIDserver API calls, allowing you to interract with SOLIDserver DDI solution.\\n'\n\n begin\n @servicemapper.each do |service_name, service_mapped|\n buffer += '\\n### Method - #{service_name}\\n'\n rest_answer = RestClient::Request.execute(\n url: sprintf('%s/%s', @resturl, service_mapped[0]),\n accept: 'application/json',\n method: 'options',\n timeout: @timeout,\n verify_ssl: @sslcheck,\n headers: {\n 'X-IPM-Username' => @username,\n 'X-IPM-Password' => @password\n }\n )\n\n first_input = true\n first_output = true\n\n JSON.parse(rest_answer.body).each do |item|\n if (item.has_key?('description'))\n buffer += 'Description\\n\\n'\n buffer += '\\t#{@servicemapper[service_name.to_s][1]}\\n'\n end\n\n if (item.has_key?('mandatory_addition_params') && service_name.match(/_add$/))\n buffer += '\\nMandatory Parameters\\n\\n'\n buffer += '\\t' + item['mandatory_addition_params'].gsub('&&', '+').gsub('||','|') + '\\n'\n end\n\n if (item.has_key?('mandatory_edition_params') && service_name.match(/_update$/))\n buffer += '\\nMandatory Parameters\\n\\n'\n buffer += '\\t' + item['mandatory_edition_params'].gsub('&&', '+').gsub('||','|') + '\\n'\n end\n\n if (item.has_key?('mandatory_params'))\n buffer += '\\nMandatory Parameters\\n\\n'\n buffer += '\\t' + item['mandatory_params'].gsub('&&', '+').gsub('||','|') + '\\n'\n end\n\n if (item.has_key?('param_type'))\n if (item['param_type'] == 'in')\n if (first_input == true)\n buffer += '\\nAvailable Input Parameters :\\n\\n'\n first_input = false\n end\n\n if (item['name'] == 'WHERE')\n buffer += '\\t* where - Can be used to filter the result using any output field in an SQL fashion.\\n'\n elsif (item['name'] == 'ORDERBY')\n buffer += '\\t* orderby - Can be used to order the result using any output field in an SQL fashion.\\n'\n else\n descr_key = service_name[/^(ip|vlm|dns)/]\n if (item.has_key?('descr'))\n descr_mapping[descr_key.to_s + '_' + item['name']] = item['descr']\n end\n if !(item.has_key?('descr') && item['name'].match(/^no_usertracking/))\n buffer += '\\t* ' + item['name'] + (item.has_key?('descr') ? ' - ' + item['descr'] : '') + '\\n'\n end\n end\n else\n if (first_output == true)\n buffer += '\\nAvailable Output Fields :\\n\\n'\n first_output = false\n end\n\n descr_key = service_name[/^(ip|vlm|dns)/]\n\n if (item.has_key?('descr'))\n descr_mapping[descr_key.to_s + '_' + item['name']] = item['descr']\n else\n if (descr_mapping.has_key?(descr_key.to_s + '_' + item['name']))\n item['descr'] = descr_mapping[descr_key + '_' + item['name']]\n end\n end\n buffer += '\\t* ' + item['name'] + (item.has_key?('descr') ? ' - ' + item['descr'] : '') + '\\n'\n end\n end\n end\n end\n\n return(buffer)\n rescue RestClient::ExceptionWithResponse => rest_error\n raise SOLIDserverError.new('SOLIDserver REST call error : - TEST')\n end\n end",
"def docs_to_pay\n @docs=DocHead.approved.payable.page(params[:page]).per(20)\n respond_to do |format|\n format.js { render 'show_docs'}\n format.html\n end\n end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def index\n @fontes_de_recurso = FonteDeRecurso.all\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def index\n #Todos los documentos ordenados por producto, tipo y fecha de vencimiento\n @documentos = Documento.order(\"producto_id\").order(\"TipoDocumento_id\").order(\"fecha_vencimiento DESC\").all\n flash[:title] = \"Documentos\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documentos }\n end\n end",
"def index\n @functional_design_documents = FunctionalDesignDocument.all\n end",
"def extract_department(dept_uri, vivo_loc, username, password)\n client = VivoWebApi::Client.new(vivo_loc)\n client.authenticate(username, password)\n\n person_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX core: <http://vivoweb.org/ontology/core#>\n\nconstruct { \n ?person core:personInPosition ?pos .\n ?person foaf:firstName ?firstName .\n ?person foaf:lastName ?lastName .\n ?person core:authorInAuthorship ?authorship .\n ?person rdf:type ?type .\n ?person rdfs:label ?label \n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n\n ?person foaf:firstName ?firstName .\n ?person foaf:lastName ?lastName .\n ?person rdf:type ?type .\n ?person rdfs:label ?label .\n\n optional { ?person core:authorInAuthorship ?authorship }\n}\n EOH\n\n authorship_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX core: <http://vivoweb.org/ontology/core#>\n\nconstruct { \n ?authorship core:linkedAuthor ?person .\n ?authorship core:authorRank ?authorRank .\n ?authorship core:linkedInformationResource ?publication .\n\n ?authorship rdf:type ?type .\n ?authorship rdfs:label ?label \n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n\n ?authorship core:linkedAuthor ?person .\n ?authorship core:linkedInformationResource ?publication .\n\n ?authorship rdf:type ?type .\n optional { ?authorship rdfs:label ?label }\n optional { ?authorship core:authorRank ?authorRank }\n}\n EOH\n\n publication_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX core: <http://vivoweb.org/ontology/core#>\nPREFIX bibo: <http://purl.org/ontology/bibo/>\n\nconstruct {\n ?publication rdf:type ?type .\n ?publication rdfs:label ?label . \n\n ?authorship core:linkedInformationResource ?publication .\n ?publication core:informationResourceInAuthorship ?authorship .\n ?publication bibo:pageStart ?pageStart .\n ?publication bibo:pageEnd ?pageEnd .\n ?publication bibo:volume ?volume .\n ?publication bibo:issue ?issue .\n ?publication core:yearMonth ?yearMonth .\n ?publication core:doi ?doi\n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n ?person core:authorInAuthorship ?authorship .\n ?authorship core:linkedInformationResource ?publication .\n\n ?publication rdf:type ?type .\n ?publication rdfs:label ?label . \n\n ?authorship core:linkedInformationResource ?publication .\n ?publication core:informationResourceInAuthorship ?authorship .\n optional { ?publication bibo:pageStart ?pageStart }\n optional { ?publication bibo:pageEnd ?pageEnd }\n optional { ?publication bibo:volume ?volume }\n optional { ?publication bibo:issue ?issue }\n optional { ?publication core:yearMonth ?yearMonth }\n optional { ?publication core:doi ?doi }\n}\n EOH\n\n person_results = client.execute_sparql_construct(username, password, \n person_construct)\n authorship_results = client.execute_sparql_construct(username, password, \n authorship_construct)\n publication_results = client.execute_sparql_construct(username, password, \n publication_construct)\n\n results = []\n person_results.each do |statement| \n results << statement\n end\n\n authorship_results.each do |statement| \n results << statement\n end\n\n publication_results.each do |statement| \n results << statement\n end\n\n return results\nend",
"def index\n @desginations = Desgination.all\n end",
"def repo_doc_for(uuid)\n string_response = make_request_for('repo_solr_doc', uuid)\n string_response = \"[\" + string_response + \"]\"\n doc_array = convert_to_json_docs(string_response) if string_response\n doc_array.first\n end",
"def docs\n @docs ||= raw_response['response']['docs']\n end",
"def get_document_data(doc)\n d = []\n begin\n d = doc.stuffing_data\n rescue\n log_and_print \"WARN: get_document_data threw an unknown exception\"\n d = []\n end\n \n return d\n end",
"def index\n @daw_representantes = DawRepresentante.all\n end",
"def all_design_doc_versions(db = database)\n db.documents :startkey => \"_design/#{self.to_s}\", \n :endkey => \"_design/#{self.to_s}-\\u9999\"\n end",
"def index\n @direccionts = Direcciont.all\n end",
"def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end",
"def show\n @documentation = Documentation.find(params[:id])\n @documentations = Documentation.find(:all)\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documentation }\n end\n end",
"def new\n@documento = Documento.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documento }\n end\n end"
] | [
"0.6441894",
"0.63214195",
"0.60927546",
"0.6063289",
"0.5955682",
"0.5637765",
"0.55295205",
"0.5497133",
"0.54547197",
"0.54527336",
"0.5411118",
"0.5392355",
"0.5382574",
"0.53776795",
"0.537531",
"0.5343551",
"0.5338128",
"0.5320747",
"0.53071207",
"0.53033966",
"0.52902925",
"0.529025",
"0.5288604",
"0.5275316",
"0.5273228",
"0.5271347",
"0.5271204",
"0.52280253",
"0.5208778",
"0.52051705",
"0.5192689",
"0.5187927",
"0.51876473",
"0.5183814",
"0.51832074",
"0.5180218",
"0.51543",
"0.515282",
"0.51453334",
"0.5141421",
"0.51409787",
"0.51390743",
"0.5138282",
"0.5136941",
"0.513467",
"0.513467",
"0.51290923",
"0.51248586",
"0.5124329",
"0.51208717",
"0.51202315",
"0.5119314",
"0.5112153",
"0.50980145",
"0.5091084",
"0.508568",
"0.5083888",
"0.5069796",
"0.5067514",
"0.50665116",
"0.50656873",
"0.50571644",
"0.5048772",
"0.5045832",
"0.5045267",
"0.5041413",
"0.5040894",
"0.5038065",
"0.5031194",
"0.50276893",
"0.5025368",
"0.5024393",
"0.50189894",
"0.50160223",
"0.50124794",
"0.5009636",
"0.50049746",
"0.5002295",
"0.4987051",
"0.4982308",
"0.49822843",
"0.49815738",
"0.49804848",
"0.49802533",
"0.49788836",
"0.49777052",
"0.49767846",
"0.49721855",
"0.49644095",
"0.49641714",
"0.4963225",
"0.4961315",
"0.49574104",
"0.49556798",
"0.49476168",
"0.4943563",
"0.49402666",
"0.49330074",
"0.49315783",
"0.49281165"
] | 0.76148593 | 0 |
GET /docderivaciones/1 GET /docderivaciones/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @docderivaciones = Docderivacione.all\n end",
"def set_docderivacione\n @docderivacione = Docderivacione.find(params[:id])\n end",
"def docderivacione_params\n params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado)\n end",
"def create\n @docderivacione = Docderivacione.new(docderivacione_params)\n\n respond_to do |format|\n if @docderivacione.save\n format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully created.' }\n format.json { render :show, status: :created, location: @docderivacione }\n else\n format.html { render :new }\n format.json { render json: @docderivacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getDoc(doc)\n uri = URI.parse(\"https://api.figma.com/v1/files/#{doc[\"document\"]}\")\n request = Net::HTTP::Get.new(uri)\n request[\"X-Figma-Token\"] = @figmatoken\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n \n response.body\n end",
"def update\n respond_to do |format|\n if @docderivacione.update(docderivacione_params)\n format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully updated.' }\n format.json { render :show, status: :ok, location: @docderivacione }\n else\n format.html { render :edit }\n format.json { render json: @docderivacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @docderivacione.destroy\n respond_to do |format|\n format.html { redirect_to docderivaciones_url, notice: 'Docderivacione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def request_doc\n \n end",
"def service_document\n response = get(@url.to_s)\n response.body\n end",
"def get_doc \n @doc\n end",
"def get_document( doc_id:, version:CURRENT, filename: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :get, path_for(doc_id, filename, version), {}, :binary\n end",
"def get_document_info( doc_id: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :get, url_for_base(doc_id), params, :json\n end",
"def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end",
"def index\n # @results = []\n # @document.bioc_doc.all_relations.each do |a|\n # e = EntityUtil.get_relation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager\n @relations = @document.relations.where('`version`=?', @version)\n else\n @relations = @assign.relations\n end\n @relations = @relations.order(\"offset\")\n end",
"def get_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Get.new(uri)\n run(uri, req)\n end",
"def show\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doc }\n end\n end",
"def show\n @response = search_service.fetch(params[:id]).first\n @document = @response.documents.first\n if @document.generic_file?\n @document = nil\n raise DRI::Exceptions::BadRequest, \"Invalid object type DRI::GenericFile\"\n end\n\n @children = @document.children(limit: 100).select { |child| child.published? }\n\n # assets ordered by label, excludes preservation only files\n @assets = @document.assets(ordered: true)\n @file_display_type_count = @document.file_display_type_count(published_only: true)\n @presenter = DRI::ObjectInCatalogPresenter.new(@document, view_context)\n supported_licences\n @reader_group = governing_reader_group(@document.collection_id) unless @document.collection?\n\n if @document.doi\n doi = DataciteDoi.where(object_id: @document.id).current\n @doi = doi.doi if doi.present? && doi.minted?\n end\n\n if @document.published?\n dimensions = { collection: @document.root_collection_id, object: @document.id }\n dimensions[:organisation] = @document.depositing_institute.name if @document.depositing_institute.present?\n @dimensions = dimensions\n @track_download = true\n end\n\n respond_to do |format|\n format.html { @search_context = setup_next_and_previous_documents }\n format.json do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n options[:with_metadata] = true\n formatter = DRI::Formatters::Json.new(self, @document, options)\n render json: formatter.format(func: :as_json)\n end\n format.ttl do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n options[:with_metadata] = true\n formatter = DRI::Formatters::Rdf.new(self, @document, options)\n render plain: formatter.format({format: :ttl})\n end\n format.rdf do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n options[:with_metadata] = true\n formatter = DRI::Formatters::Rdf.new(self, @document, options)\n render plain: formatter.format({format: :xml})\n end\n format.js { render layout: false }\n\n additional_export_formats(@document, format)\n end\n end",
"def retrieve \n if !check_auth()\n render text: { \"message\" => \"401 Unauthorized\" }.to_json(), status: :unauthorized\n else\n uri = params[:uri]\n type = params[:type]\n doc = Document.find_by_uri(uri)\n if doc.present?\n case type\n when 'gale'\n render :text => doc.get_corrected_gale_xml()\n when 'text'\n render :text => doc.get_corrected_text()\n when 'tei-a'\n render :text => doc.get_corrected_tei_a(false)\n when 'tei-a-words'\n render :text => doc.get_corrected_tei_a(true)\n when 'original-gale'\n render :text => doc.get_original_gale_xml()\n when 'original-text'\n render :text => doc.get_original_gale_text()\n end\n else\n render text: { \"message\" => \"Document #{uri} not found\" }.to_json(), status: :not_found\n end\n end\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def index\n # @documentos = Documento.all\n @documentos = Documento.order(\"fecha_publicacion DESC\").paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documentos }\n end\n end",
"def get_doc(id,*opts)\n q = \"#{database}/#{id}\"\n q << build_query_string(opts.first,\"doc\") if opts && opts.any? && opts.first.is_a?(Hash)\n\n @conn.query({url_path: q, method: :get})\n end",
"def show\n @documento = Documento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @documento }\n end\n end",
"def documents\n return bad_request unless params[:id] and request.format.json? || request.format.js? || request.format.text?\n return not_found unless current_document\n opts = {:access => true, :sections => true, :annotations => true, :data => true}\n if current_account\n opts[:account] = current_account\n opts[:allowed_to_edit] = current_account.allowed_to_edit?(current_document)\n opts[:allowed_to_review] = current_account.reviews?(current_document)\n end\n @response = {'document' => current_document.canonical(opts)}\n respond_to do |format|\n format.text do\n direct = [PRIVATE, ORGANIZATION, EXCLUSIVE].include? current_document.access\n redirect_to(current_document.full_text_url(direct: direct))\n end\n format.json { render_cross_origin_json }\n format.js { render_cross_origin_json }\n end\n end",
"def getToolsDocs( object, format)\n params = Hash.new\n params['object'] = object\n params['format'] = format\n return doCurl(\"get\",\"/tools/docs\",params)\n end",
"def get_design_doc(id)\n @conn.query({url_path: \"#{database}/_design/#{id}\", method: :get})\n end",
"def new\n @documento = Documento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documento }\n end\n end",
"def show\n @response, @document = fetch params[:id]\n\n @children = @document.children(limit: 100).select { |child| child.published? }\n\n # assets ordered by label, excludes preservation only files\n @assets = @document.assets(ordered: true)\n\n @presenter = DRI::ObjectInCatalogPresenter.new(@document, view_context)\n\n supported_licences\n\n @reader_group = governing_reader_group(@document.collection_id) unless @document.collection?\n\n if @document.published?\n Gabba::Gabba.new(GA.tracker, request.host).event(@document.root_collection_id, \"View\", @document.id, 1, true)\n end\n\n respond_to do |format|\n format.html { setup_next_and_previous_documents }\n format.json do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Json.new(@document, options)\n render json: formatter.format(func: :as_json)\n end\n format.ttl do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Rdf.new(@document, options)\n render text: formatter.format({format: :ttl})\n end\n format.rdf do\n options = {}\n options[:with_assets] = true if can?(:read, @document)\n formatter = DRI::Formatters::Rdf.new(@document, options)\n render text: formatter.format({format: :xml})\n end\n format.js { render layout: false }\n\n additional_export_formats(@document, format)\n end\n end",
"def repo_doc_for(uuid)\n string_response = make_request_for('repo_solr_doc', uuid)\n string_response = \"[\" + string_response + \"]\"\n doc_array = convert_to_json_docs(string_response) if string_response\n doc_array.first\n end",
"def get(*path)\n return super if path.empty?\n\n get_derivatives(*path)\n end",
"def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"def docentes\n\t\t@seccion = \"Docentes\"\n @titulo = \"Docentes\"\n\n if Docente.all().size > 0\n \t\tif params[:orden]\n \t\t\t@orden = params[:orden]\n \t\telse\n \t\t\t@orden = \"Cédula\"\n \t\tend\n\n \t\t#Guardo todos los docentes\n \t\tcase @orden\n \t\twhen \"Cédula\"\n \t\t\t@usuarios = Usuario.order('cedula').where(:id => Docente.all)\n \t\twhen \"Nombre\"\n \t\t\t@usuarios = Usuario.order('nombre').where(:id => Docente.all)\n \t\twhen \"Apellido\"\n \t\t\t@usuarios = Usuario.order('apellido').where(:id => Docente.all)\n \t\twhen \"Correo\"\n \t\t\t@usuarios = Usuario.order('correo').where(:id => Docente.all)\n \t\tend\n\n end\n\t\t\n\t\t @categorias = ['Cédula', 'Nombre', 'Apellido', 'Correo'] #Este es el orden que se mostrará en el select de la vista\n\n \t\t@docente_datos = [] #En este arreglo se guardan los pares \"Cedula - Nombre Apellido\" de cada usuario para mostrar en el campo de busqueda\n \t\tUsuario.order('nombre').where(:id => Docente.all).each do |usuario|\n \t\t\t#En este foro se agregan uno a uno los valores de cada docente al arreglo de la manera indicada arriba\n \t\t\t@docente_datos << usuario.cedula.to_s + \" - \" + usuario.nombre_y_apellido.to_s\n \t\tend\n\tend",
"def index\n @ficha_docs = FichaDoc.all\n end",
"def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end",
"def index\n @documentos = @externo.documentos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"def index\n @documentacions = Documentacion.all\n end",
"def documents(params={})\n server.get(\"#{name}/_all_docs\", params)\n end",
"def index\n @doc_artefacts = DocArtefact.all\n end",
"def show\n @tdoc = Tdoc.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tdoc }\n end\n end",
"def new\n@documento = Documento.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documento }\n end\n end",
"def index\n # @documents = Document.all.with_attached_images\n respond_to do |format|\n format.html\n format.json { render json: DocumentDatatable.new(params, view_context: view_context) }\n end\n end",
"def index\n \n @docfiles = Docfile.all\n end",
"def document\n json = Net::HTTP.get_response URI.parse(query_string(@query))\n json.body\n end",
"def get_document_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocumentApi.get_document_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/document'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageDocument')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocumentApi#get_document_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def design_doc\n database.get(\"_design/#{design_doc_slug}\")\n end",
"def show\n @derivative = Derivative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @derivative }\n end\n end",
"def show\n @document = Document.where(:id => params[:id])\n render :json => @document, :include => [:versions]\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def list\n @documentations = Documentation.not_article.order('created_at DESC')\n end",
"def show\n @doucment = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def get_document_schema\n filePath = Rails.root.join(\"lib\", \"base_truevault_doc.json\")\n file = File.read(filePath)\n schema = JSON.parse(file).with_indifferent_access\n end",
"def index\n @degres = Degre.all\n end",
"def retrieve_docs_from_host1\n apis = {}\n host = @doc_urls[:doc_base1][%r{^https?:\\/\\/[^\\/]+}]\n apis_received = open(@doc_urls[:doc_base1], @api_docs, &:read).scan(/<a class=\"swagger-list--item-link\" href=\"\\/(.+?)\".*?>\\s*(.+?)\\s*<\\/a>/i)\n \n apis_received.each do |path, title|\n begin\n api = { path: \"#{@doc_urls[:doc_base1]}#{path}\",\n title: title.sub(/\\s*\\(.+?\\)$/, ''),\n deprecated: title.include?('(Deprecated)') }\n\n fetched_path = open(api['path'], Options, &:read).scan(%r{url:\\s*'(.+?)'})\n api[:path] = \"#{host}#{fetched_path}\"\n apis[api[:title]] = api\n rescue OpenURI::HTTPError\n # Some log here\n end\n end\n\n apis\n end",
"def show\n @documentation = Documentation.find(params[:id])\n @documentations = Documentation.find(:all)\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documentation }\n end\n end",
"def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def index\n #Todos los documentos ordenados por producto, tipo y fecha de vencimiento\n @documentos = Documento.order(\"producto_id\").order(\"TipoDocumento_id\").order(\"fecha_vencimiento DESC\").all\n flash[:title] = \"Documentos\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documentos }\n end\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def docs api\n\t\tget_html \"#{@options[:docs]}/#{@apis[api][:url]}.htm\"\n\tend",
"def documents; end",
"def documents; end",
"def getDoc(key); @docs[key] end",
"def show\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_documento }\n end\n end",
"def eds_documents(data)\n docs = data&.dig('response', 'docs')\n docs = Array.wrap(docs).compact\n factory = blacklight_config.document_factory\n model_opt = { lens: blacklight_config.lens_key }\n docs.map { |doc| factory.build(doc, data, model_opt) }\n end",
"def show\n @knowledge = Knowledge.find(params[:id])\n @documents = @knowledge.documents\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def bra_per_day(date)\n date = date.to_i\n p url = \"https://donneespubliques.meteofrance.fr/donnees_libres/Pdf/BRA/bra.#{date}.json\"\n JSON.parse(open(url).read)\nend",
"def index\n authorize Document\n\n @documents = apply_scopes(Document).valid.all\n\n if current_user.client?\n @documents = @documents.by_belongings([current_user.id])\n end\n\n respond_with do |format|\n format.html\n format.json { render json: DocumentsDatatable.new(view_context, @documents) }\n format.js\n end\n\n end",
"def get_derivatives(*path)\n return derivatives if path.empty?\n\n path = derivative_path(path)\n\n derivatives.dig(*path)\n end",
"def info\n @document = Document.find(params[:id])\n respond_to do |format|\n format.json { render :json => @document, serializer: Api::Mobile::V2::DynamicDocumentSerializer, root: 'document' }\n end\n end",
"def new\n \tif params[:id]\n \t\t@old_doc = Doc.find(params[:id])\n \t\t@doc = Doc.new({:component => @old_doc.component, :maj_version => (params[:version] == \"major\" ? @old_doc.maj_version + 1 : @old_doc.maj_version ), :min_version => (params[:version] == \"minor\" ? @old_doc.min_version + 1 : @old_doc.min_version), :dev_stage => @old_doc.dev_stage, :url => @old_doc.new_version_url(params[:version]), :contents => @old_doc.contents})\n \telse\n\t @doc = Doc.new\n\t\tend\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doc }\n end\n end",
"def docs_to_pay\n @docs=DocHead.approved.payable.page(params[:page]).per(20)\n respond_to do |format|\n format.js { render 'show_docs'}\n format.html\n end\n end",
"def new\n @paper = Paper.new\n @document = @paper.documents.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper }\n end\n end",
"def get_json\n html = Nokogiri::HTML(@page)\n text = open(\"https://theintercept.com/api/requestSIDDocuments/?orderBy=publishedTime&orderDirection=desc&perPage=2000\").read\n documents = JSON.parse(text)[\"documents\"][\"edges\"].map{|d| d[\"node\"]}\n \n documents.each do |doc|\n @output.push(parse_json(doc))\n end\n\n return JSON.pretty_generate(@output)\n end",
"def getorden\n @id = params['id']\n @orden = Orden.find(@id)\n @factura = Factura.where(:ordens_id => @id).first\n @monto= @factura.iva + @factura.costoTotal\n\n @historico = Orden.rutas(@id)\n\n respond_to do |format|\n # format.html # show.html.erb\n format.xml\n end\n end",
"def get_doc(did)\n DB.get(did)\nend",
"def doc()\n buffer = ''\n descr_mapping = {}\n\n buffer += '## Available Methods :\\n\\n'\n buffer += 'This GEM wraps the following SOLIDserver API calls, allowing you to interract with SOLIDserver DDI solution.\\n'\n\n begin\n @servicemapper.each do |service_name, service_mapped|\n buffer += '\\n### Method - #{service_name}\\n'\n rest_answer = RestClient::Request.execute(\n url: sprintf('%s/%s', @resturl, service_mapped[0]),\n accept: 'application/json',\n method: 'options',\n timeout: @timeout,\n verify_ssl: @sslcheck,\n headers: {\n 'X-IPM-Username' => @username,\n 'X-IPM-Password' => @password\n }\n )\n\n first_input = true\n first_output = true\n\n JSON.parse(rest_answer.body).each do |item|\n if (item.has_key?('description'))\n buffer += 'Description\\n\\n'\n buffer += '\\t#{@servicemapper[service_name.to_s][1]}\\n'\n end\n\n if (item.has_key?('mandatory_addition_params') && service_name.match(/_add$/))\n buffer += '\\nMandatory Parameters\\n\\n'\n buffer += '\\t' + item['mandatory_addition_params'].gsub('&&', '+').gsub('||','|') + '\\n'\n end\n\n if (item.has_key?('mandatory_edition_params') && service_name.match(/_update$/))\n buffer += '\\nMandatory Parameters\\n\\n'\n buffer += '\\t' + item['mandatory_edition_params'].gsub('&&', '+').gsub('||','|') + '\\n'\n end\n\n if (item.has_key?('mandatory_params'))\n buffer += '\\nMandatory Parameters\\n\\n'\n buffer += '\\t' + item['mandatory_params'].gsub('&&', '+').gsub('||','|') + '\\n'\n end\n\n if (item.has_key?('param_type'))\n if (item['param_type'] == 'in')\n if (first_input == true)\n buffer += '\\nAvailable Input Parameters :\\n\\n'\n first_input = false\n end\n\n if (item['name'] == 'WHERE')\n buffer += '\\t* where - Can be used to filter the result using any output field in an SQL fashion.\\n'\n elsif (item['name'] == 'ORDERBY')\n buffer += '\\t* orderby - Can be used to order the result using any output field in an SQL fashion.\\n'\n else\n descr_key = service_name[/^(ip|vlm|dns)/]\n if (item.has_key?('descr'))\n descr_mapping[descr_key.to_s + '_' + item['name']] = item['descr']\n end\n if !(item.has_key?('descr') && item['name'].match(/^no_usertracking/))\n buffer += '\\t* ' + item['name'] + (item.has_key?('descr') ? ' - ' + item['descr'] : '') + '\\n'\n end\n end\n else\n if (first_output == true)\n buffer += '\\nAvailable Output Fields :\\n\\n'\n first_output = false\n end\n\n descr_key = service_name[/^(ip|vlm|dns)/]\n\n if (item.has_key?('descr'))\n descr_mapping[descr_key.to_s + '_' + item['name']] = item['descr']\n else\n if (descr_mapping.has_key?(descr_key.to_s + '_' + item['name']))\n item['descr'] = descr_mapping[descr_key + '_' + item['name']]\n end\n end\n buffer += '\\t* ' + item['name'] + (item.has_key?('descr') ? ' - ' + item['descr'] : '') + '\\n'\n end\n end\n end\n end\n\n return(buffer)\n rescue RestClient::ExceptionWithResponse => rest_error\n raise SOLIDserverError.new('SOLIDserver REST call error : - TEST')\n end\n end",
"def show\n \n # @response, @document = get_solr_response_for_doc_id(params[:id], )\n @response, @document = get_solr_doc_with_gated_discovery(params[:id])\n folder_siblings(@document)\n\n \n respond_to do |format|\n format.html {setup_next_and_previous_documents}\n\n # Add all dynamically added (such as by document extensions)\n # export formats.\n @document.export_formats.each_key do | format_name |\n # It's important that the argument to send be a symbol;\n # if it's a string, it makes Rails unhappy for unclear reasons. \n format.send(format_name.to_sym) { render :text => @document.export_as(format_name), :layout => false }\n end\n \n end\n rescue Blacklight::Exceptions::InvalidSolrID\n flash[:notice]= \"You do not have sufficient access privileges to read this document, which has been marked private.\"\n redirect_to(\"/\") and return false\n end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def get_pdf_in_storage_to_doc(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_pdf_in_storage_to_doc_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_pdf_in_storage_to_doc_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"def get_pdf_de_etiquetas_por_orden_or_numero_envio(opts = {})\n method = :get_pdf_de_etiquetas_por_orden_or_numero_envio\n opts = {\n \"idOrdenRetiro\" => opts[:id_orden_retiro],\n \"nroEnvio\" => opts[:nro_envio],\n \"logisticaInversa\" => opts.fetch(:logistica_inversa, FALSE_STRING).to_s\n }\n response = client.call(method, message: opts)\n parse_result(response, method)\n rescue Savon::SOAPFault => error\n msg = \"Oca WS responded with:\\n#{error.http.code}\\n#{error}\"\n raise Oca::Errors::BadRequest.new(msg)\n end",
"def get_doc(did)\n DB.get(did)\nend",
"def get_document_info\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return stream_hash[\"Document\"]\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"def index\n @direccions = Direccion.recientes.all\n end",
"def deprecate_search\n @results = @cookbook.deprecate_search(params.fetch(:q, nil))\n\n respond_to do |format|\n format.json\n end\n end",
"def show\n @apprenticeship_type = ApprenticeshipType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprenticeship_type }\n format.xml { render xml: @apprenticeship_type }\n # format.docx { render word: @apprenticeship_type }\n # file = Rails.root.join(\"public\",\"resources\", \"test.docx\");\n format.docx { send_file @apprenticeship_type.render_to_word, :disposition => 'attachment' }\n # format.docx { send_data @apprenticeship_type.render_to_word(), :disposition => 'attachment' }\n\n # \"#{RAILS_ROOT}/public/resources/newdoc.docx\",\n # :filename=> \"newdoc.docx\",\n # :type=>mime_type)\n\n end\n end",
"def index\n @documentations = Documentation.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentations }\n end\n end",
"def index\n @notadedebito = Notadedebito.find(params[:notadedebito_id])\n @renglon_nddndcs = @notadedebito.renglon_nddndcs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_nddndcs }\n end\n end",
"def index\n @functional_design_documents = FunctionalDesignDocument.all\n end",
"def index\n @client_docs = ClientDoc.all\n end",
"def show\n @documento = @externo.documentos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documento }\n end\n end",
"def get_document_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_document ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_document\"\n end\n # resource path\n local_var_path = \"/pdf/{name}\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DocumentResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_document\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def json_ld; end",
"def show\n transform_id if /^nyu_\\d{4}_\\d{5}$/.match(params[:id])\n @response, @document = fetch_document(params[:id])\n\n respond_to do |format|\n format.html { setup_next_and_previous_documents }\n format.json { render json: { response: { document: @document } } }\n additional_export_formats(@document, format)\n end\n end",
"def print_doc(data)\n print \"Documento #{data['id']} Status: #{data['status']} Nível do Sentimento: #{data['sentiment_score']} \\r\\n\"\n print 'Temas encontrados:', \"\\r\\n\"\n data['themes'].nil? or data['themes'].each do |theme|\n print ' ', theme['title'], ' (sentimento: ', theme['sentiment_score'], ')', \"\\r\\n\"\n end\n print 'Entidades encontradas:', \"\\r\\n\"\n data['entities'].nil? or data['entities'].each do |entity|\n print ' ', entity['title'], ' : ', entity['entity_type'], ' (sentimento: ', entity['sentiment_score'], ')', \"\\r\\n\"\n end\n\n print 'Categorias:', \"\\r\\n\"\n data['auto_categories'].nil? or data['auto_categories'].each do |entity|\n print ' ', entity['title'], ' : ', entity['type'], ' (Força: ', entity['strength_score'], ')', \"\\r\\n\"\n\n print 'Subcategorias:', \"\\r\\n\"\n data['categories'].nil? or data['categories'].each do |c|\n print ' ', c['title'], ' : ', entity['type'], ' (Força: ', entity['strength_score'], ')', \"\\r\\n\"\n end\n end\n\n print \"\\r\\n\"\n end",
"def index\n @docs = Doc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @docs }\n end\n end",
"def get_order_edi_documents_with_http_info(order_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_order_edi_documents ...'\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling OrderApi.get_order_edi_documents\"\n end\n # resource path\n local_var_path = '/order/orders/{order_id}/edi'.sub('{' + 'order_id' + '}', order_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OrderEdiDocumentsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_order_edi_documents\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def discovery_document(api, version=nil)\n api = api.to_s\n version = version || 'v1'\n return @discovery_documents[\"#{api}:#{version}\"] ||= (begin\n request = self.generate_request(\n :http_method => 'GET',\n :uri => self.discovery_uri(api, version),\n :authenticated => false\n )\n response = self.transmit(request)\n status, headers, body = response\n if status >= 200 && status < 300\n # TODO(bobaman) Better status code handling?\n merged_body = body.inject(StringIO.new) do |accu, chunk|\n accu.write(chunk)\n accu\n end\n ::JSON.parse(merged_body.string)\n elsif status >= 400 && status < 500\n _, request_uri, _, _ = request\n raise ClientError,\n \"Could not retrieve discovery document at: #{request_uri}\"\n elsif status >= 500 && status < 600\n _, request_uri, _, _ = request\n raise ServerError,\n \"Could not retrieve discovery document at: #{request_uri}\"\n elsif status > 600\n _, request_uri, _, _ = request\n raise TransmissionError,\n \"Could not retrieve discovery document at: #{request_uri}\"\n end\n end)\n end",
"def get_document(depth: nil, pierce: nil)\n {\n method: \"DOM.getDocument\",\n params: { depth: depth, pierce: pierce }.compact\n }\n end",
"def index\n @documentos = Documento.all\n end",
"def index\n @admin_documentos = Admin::Documento.all\n end",
"def index\n @documents = Document.all\n @document = Document.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def index\n @deces = Dece.all\n end"
] | [
"0.76613003",
"0.68103784",
"0.63388824",
"0.6336488",
"0.6323652",
"0.61583567",
"0.58821476",
"0.575896",
"0.57555586",
"0.57349676",
"0.5717576",
"0.5708986",
"0.56768644",
"0.56713486",
"0.5644072",
"0.5637579",
"0.5635437",
"0.5608392",
"0.55983305",
"0.5589454",
"0.55874234",
"0.5536919",
"0.5502141",
"0.5495641",
"0.54817814",
"0.54544395",
"0.54505044",
"0.5448651",
"0.5447053",
"0.5434323",
"0.54312027",
"0.54279375",
"0.5421758",
"0.54115546",
"0.54087114",
"0.5406858",
"0.538525",
"0.5376806",
"0.5368019",
"0.53652656",
"0.536026",
"0.5345072",
"0.5343479",
"0.534225",
"0.5328997",
"0.5325352",
"0.5322216",
"0.5313216",
"0.53119904",
"0.53052014",
"0.53030586",
"0.5301915",
"0.529881",
"0.5298377",
"0.5297109",
"0.5296272",
"0.5287782",
"0.52831227",
"0.52751905",
"0.52751905",
"0.5266005",
"0.5262147",
"0.5259337",
"0.5257913",
"0.52527785",
"0.525016",
"0.52421767",
"0.5241634",
"0.52370334",
"0.52222186",
"0.5213675",
"0.52110183",
"0.5210601",
"0.5209289",
"0.52062607",
"0.5199469",
"0.51981926",
"0.5197944",
"0.51940423",
"0.51936895",
"0.51913196",
"0.51858",
"0.51850486",
"0.51822186",
"0.51747316",
"0.51729566",
"0.5171988",
"0.5160458",
"0.51599103",
"0.51581216",
"0.5152369",
"0.5146343",
"0.5144339",
"0.513208",
"0.5131407",
"0.51270956",
"0.5124171",
"0.51190627",
"0.51186097",
"0.51176363",
"0.5117623"
] | 0.0 | -1 |
POST /docderivaciones POST /docderivaciones.json | def create
@docderivacione = Docderivacione.new(docderivacione_params)
respond_to do |format|
if @docderivacione.save
format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully created.' }
format.json { render :show, status: :created, location: @docderivacione }
else
format.html { render :new }
format.json { render json: @docderivacione.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def docderivacione_params\n params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado)\n end",
"def index\n @docderivaciones = Docderivacione.all\n end",
"def set_docderivacione\n @docderivacione = Docderivacione.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @docderivacione.update(docderivacione_params)\n format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully updated.' }\n format.json { render :show, status: :ok, location: @docderivacione }\n else\n format.html { render :edit }\n format.json { render json: @docderivacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @docderivacione.destroy\n respond_to do |format|\n format.html { redirect_to docderivaciones_url, notice: 'Docderivacione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create_doc(doc)\n @conn.query({url_path: \"#{database}\", opts: doc, method: :post})\n end",
"def create\n \n @ficha_doc = FichaDoc.new(ficha_doc_params)\n\n respond_to do |format|\n if @ficha_doc.save\n format.html { redirect_to @ficha_doc, notice: 'Creado ' }\n format.json { render :show, status: :created, location: @ficha_dos }\n else\n format.html { render :show }\n format.json { render json: @ficha_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def doc_params\n params.require(:doc).permit(:title, :draft_title, :body, :body_sml, :draft_body, :draft_body_sml, :slug, :format)\n end",
"def create\n @doc_artefact = DocArtefact.new(doc_artefact_params)\n\n respond_to do |format|\n if @doc_artefact.save\n format.html { redirect_to @doc_artefact, notice: 'Doc artefact was successfully created.' }\n format.json { render :show, status: :created, location: @doc_artefact }\n else\n format.html { render :new }\n format.json { render json: @doc_artefact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def doc_artefact_params\n params.fetch(:doc_artefact).permit(:answer, :document_id, :params_config_type_doc_id)\n end",
"def document_params\n params.require(:document).permit(:d_title, :d_content, :d_type, :d_tags, :annex)\n end",
"def post(path, doc = nil, options = {}, &block)\n execute('POST', path, options, doc, &block)\n end",
"def post #:doc:\n end",
"def post( doc, opts = {} )\n response = http_action :post, nil, opts.merge( :doc => doc )\n doc['_id'], doc['_rev'] = response['id'], response['rev'] if doc.kind_of? Hash\n response\n end",
"def doc_params\n params.require(:doc).permit(:title, :text, :number, :logs, :signed, :agreed, :resolution, :done, :signer_id, :destination_id, :executor_id, :image, :matcher_ids => [])\n end",
"def post(uri, doc = nil, options = {})\n execute(uri, :post, options, doc)\n end",
"def doc_params\n params.require(:doc).permit(:group_id, \n :user_id,\n :description,\n :uploaded_doc)\n end",
"def create\n @admin_documento = Admin::Documento.new(admin_documento_params)\n\n respond_to do |format|\n if @admin_documento.save\n format.html { redirect_to admin_documentos_url }\n format.json { render :show, status: :created, location: @admin_documento }\n else\n format.html { render :new }\n format.json { render json: @admin_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @doc = Doc.new(doc_params)\n @doc.initiator = User.find(session[:user_id])\n @doc.destination = User.first\n @doc.executor = User.first\n @doc.logs = \"<br>Документ создан #{DateTime.now} <br> Инициатор документа: #{current_user.name_with_initial} <br> \"\n respond_to do |format|\n if @doc.save\n if @doc.matchers.any?\n format.html { redirect_to @doc, notice: 'Документ успешно создан и отправлен на согласование, вы можете отслеживать его состояние во вкладке \"Мои документы\".' }\n else\n format.html { redirect_to @doc, notice: 'Документ успешно создан и отправлен на подпись, вы можете отслеживать его состояние во вкладке \"Мои документы\".' }\n end\n format.json { render :show, status: :created, location: @doc }\n else\n format.html { render :new }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @edu_doc = current_user.edu_docs.new(edu_doc_params)\n\n respond_to do |format|\n if @edu_doc.save\n format.html { redirect_to edu_docs_path, notice: \"Edu doc was successfully created.\" }\n format.json { render :index, status: :created, location: @edu_docs }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @edu_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ficha_doc_params\n params.require(:ficha_doc).permit(:diagnostico_id,:motivoConsul, :examenFisico, :otroDiagnos, :tratamiento)\n end",
"def post(url_variables:, body:)\n ensure_service_document\n\n end",
"def detalle_documento_de_compra_params\n params.require(:detalle_documento_de_compra).permit(:doc_com_cod, :det_doc_com_linea, :ins_cod, :ins_cod_prov, :det_doc_com_cant, :det_doc_com_precio, :det_doc_com_precio_uni)\n end",
"def post_process(doc)\n doc\n end",
"def create_doc_with_http_info(doc, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocApi.create_doc ...'\n end\n # verify the required parameter 'doc' is set\n if @api_client.config.client_side_validation && doc.nil?\n fail ArgumentError, \"Missing the required parameter 'doc' when calling DocApi.create_doc\"\n end\n # resource path\n local_var_path = '/docs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(doc)\n\n # return_type\n return_type = opts[:debug_return_type] || 'String'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"DocApi.create_doc\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocApi#create_doc\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @gdoc = Gdoc.new(gdoc_params)\n\n respond_to do |format|\n if @gdoc.save\n format.html { redirect_to @gdoc, notice: 'Gdoc was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gdoc }\n else\n format.html { render action: 'new' }\n format.json { render json: @gdoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @detalle_documento_de_compra = DetalleDocumentoDeCompra.new(detalle_documento_de_compra_params)\n\n respond_to do |format|\n if @detalle_documento_de_compra.save\n format.html { redirect_to @detalle_documento_de_compra, notice: 'Detalle documento de compra was successfully created.' }\n format.json { render :show, status: :created, location: @detalle_documento_de_compra }\n else\n format.html { render :new }\n format.json { render json: @detalle_documento_de_compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n save_object_relationship\n format.html { redirect_to(@doc, :notice => 'Doc was successfully created.') }\n format.xml { render :xml => @doc, :status => :created, :location => @doc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def request_doc\n \n end",
"def doc_params\n params.require(:doc).permit(:name, :content, :folder_id, :owner_id)\n end",
"def document_params\n params.require(:pdf_document).permit(:name, :data, dataFields: [])\n end",
"def create\n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n format.html { redirect_to @doc, notice: \"\\\"#{@doc.component}\\\" was successfully created.\" }\n format.json { render json: @doc, status: :created, location: @doc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @documento = Documento.new(params[:documento])\n doc = TipoDocumento.where(:descripcion => params[:documento][:TipoDocumento_attributes][:descripcion])\n #Si ya existe un tipo de documento, se usa esa instancia\n if doc.any?\n @documento.TipoDocumento_id = doc[0].id\n end\n\n @producto = Producto.find(@documento.producto_id)\n respond_to do |format|\n if @documento.save\n format.html { redirect_to @producto, notice: 'Documento creado exitosamente.', :format => :pdf }\n format.json { render json: @producto, status: :created, location: @documento }\n else\n @tipos = get_tipoDoc\n @documento.TipoDocumento = TipoDocumento.new\n @producto_id = @producto.id\n flash.keep\n format.html { render action: \"new\", alert: 'Documento no pudo ser creado.' }\n format.json { render json: @documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n @donation = Donation.new(donation_params)\n\n if params[:donation][:document] != nil\n archivo = params[:donation][:document]; \n #Nombre original del archivo.\n nombre = archivo.original_filename;\n #Directorio donde se va a guardar.\n directorio = \"public/archivos/\";\n #Extensión del archivo.\n extension = nombre.slice(nombre.rindex(\".\"), nombre.length).downcase;\n #Ruta del archivo.\n path = File.join(directorio, nombre);\n #Crear en el archivo en el directorio. Guardamos el resultado en una variable, será true si el archivo se ha guardado correctamente.\n resultado = File.open(path, \"wb\") { |f| f.write(archivo.read) };\n #Verifica si el archivo se subió correctamente.\n if resultado\n subir_archivo = \"ok\";\n else\n subir_archivo = \"error\";\n end\n end\n\n respond_to do |format|\n if @donation.save\n format.html { redirect_to @donation }\n format.json { render :show, status: :created, location: @donation }\n else\n format.html { render :new }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @laboratorio = Laboratorio.new(laboratorio_params)\n get_responsavel\n puts \"O responsavel é: #{@laboratorio.responsavel_id}\"\n if (@responsavel != \"sem_responsavel\")\n @laboratorio.docentes << Docente.find(@laboratorio.responsavel_id)\n puts \"Add relação entre #{@laboratorio.nome} e #{Docente.find(@laboratorio.responsavel_id).user.nome}\"\n end\n respond_to do |format|\n if @laboratorio.save\n format.html { redirect_to @laboratorio, notice: 'Laboratorio was successfully created.' }\n format.json { render :show, status: :created, location: @laboratorio }\n else\n format.html { render :new }\n format.json { render json: @laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paper = Paper.new(paper_params)\n\t respond_to do |format|\n if @paper.save\n filename = @paper.userdoc.path \n puts filename \n response = RestClient.post('http://maui-indexer.appspot.com/mauiapp',\n :document => File.new(filename,\"rb\"),\n :domain => \"keywords\")\n doc = Nokogiri::HTML(response)\n keywords = \"\"\n doc.css(\"#keywords a\").each do |k|\n keywords << k << ' '\n end\n puts keywords \n textfile = `pdftotext #{filename} -`\n ref =[]\n #textfile.reverse_each do|s|\n #if s.upcase == \"REFERENCES\\n\"\n #break\n #end\n #ref << s\n #end\n #ref.reverse_each do |s|\n # puts s\n #end\n url = \"http://wikipedia-miner.cms.waikato.ac.nz/services/wikify?source=\" + URI::encode(keywords.force_encoding('ASCII-8BIT')) + \"&minProbability=0.1\"\n doc = Nokogiri::XML(open(url))\n topics = []\n doc.css(\"detectedTopic\").each do |t|\n puts t\n topics << t[:title]<<t[:weight] \n end\n puts topics\n @paper.keywords = keywords\n @paper.topics = topics\n\nkeywords.gsub!(\" \",\"%20\")\nkeywords = keywords.chomp('+')\nurl = \"https://api.mendeley.com:443/search/catalog?query=\"+keywords+\"&view=all&limit=100\"\nhtml = open(url, \"Authorization\" => \"Bearer #{session[:mendeley_token]}\").read\ndocs = JSON.parse(html)\nsession = Neo4j::Session.open(:server_db, 'http://localhost:7474')\n\ndocs.each do |d|\n puts \"ID: \" + d[\"id\"]\n authors = [] \n begin\n d[\"authors\"].each do |a|\n authors << a[\"first_name\"] + \" \" + a[\"last_name\"]\n end\n rescue \n authors = []\n end\n docnode = Neo4j::Node.create({id: d[\"id\"], title: d[\"title\"], type: d[\"type\"], authors: authors, year: d[\"year\"], month: d[\"month\"], day: d[\"day\"], source: d[\"source\"], keywords: d[\"keywords\"], accessed: d[\"accessed\"], reader_count: d[\"reader_count\"], abstract: d[\"abstract\"]}, :PAPER)\n begin\n reader_count_by_academic_status = []\n d[\"reader_count_by_academic_status\"].each do |key, value|\n docnode[key.to_sym] = value\n reader_count_by_academic_status << key\n end\n docnode[:reader_count_by_academic_status] = reader_count_by_academic_status\n rescue\n #academic status details not found\n end\n\n begin \n reader_count_by_country =[]\n d[\"reader_count_by_country\"].each do |key, value|\n docnode[key.to_sym] = value\n reader_count_by_country << key\n end\n docnode[:reader_count_by_country] = reader_count_by_country\n rescue\n #country details not found \n end\n begin\n reader_count_by_subdiscipline = []\n d[\"reader_count_by_subdiscipline\"].each do |key,value|\n docnode[key.to_sym] = value.values.inject(:+)\n reader_count_by_subdiscipline << key\n end\n docnode[:reader_count_by_subdiscipline] = reader_count_by_subdiscipline\n rescue\n #subdiscipline details not found \n end\nend\n\n\n # puts `ruby ~/rails_project/maui_rest.rb \"#{@paper.userdoc.path}\"`\n @paper.save \n format.html { redirect_to @paper, notice: 'Paper was successfully created.' }\n format.json { render :show, status: :created, location: @paper }\n else\n format.html { render :new }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_design_doc(data)\n attrs = case data\n when String\n MultiJson.load(data)\n when IO\n MultiJson.load(data.read)\n when Hash\n data\n else\n raise ArgumentError, \"Document should be Hash, String or IO instance\"\n end\n rv = nil\n id = attrs.delete('_id').to_s\n attrs['language'] ||= 'javascript'\n if id !~ /\\A_design\\//\n rv = Result.new(:operation => :http_request,\n :key => id,\n :error => ArgumentError.new(\"'_id' key must be set and start with '_design/'.\"))\n yield rv if block_given?\n raise rv.error unless async?\n end\n req = make_http_request(id, :body => MultiJson.dump(attrs),\n :method => :put, :extended => true)\n req.on_body do |res|\n rv = res\n val = MultiJson.load(res.value)\n if block_given?\n if res.success? && val['error']\n res.error = Error::View.new(\"save_design_doc\", val['error'])\n end\n yield(res)\n end\n end\n req.continue\n unless async?\n rv.success? or raise res.error\n end\n end",
"def create\n\n#@parametro = params[:image_file].original_filename\n\n @documento = Documento.new(params[:documento])\n @documento.estado = 'INCOMPLETO'\n\n # Si el documento no es evaluado, eliminar la nota\n unless params[:documento][:tipo_documento_id].to_i.between?(1,2)\n @documento.calificacion = 0 \n end\n\n # Crear autores, tutores y jurados\n crear_autores(@documento,params)\n crear_tutores(@documento,params)\n crear_jurados(@documento,params)\n\n # Inicializar el estado del documento a NUEVO\n @documento.estado_documento_id = NUEVO\n\n # Almacenar titulo_texto_plano\n @documento.titulo_texto_plano = ActionController::Base.helpers.strip_tags(params[:documento][:titulo])\n\n # Almacenar resumen_texto_plano\n @documento.resumen_texto_plano = ActionController::Base.helpers.strip_tags(params[:documento][:resumen])\n\n # Variables para preservar los valores de los text-field autocompletados\n @autor1 = @documento.personas_autor.first\n @autor2 = @documento.personas_autor.second\n @tutor1 = @documento.personas_tutor.first\n @tutor2 = @documento.personas_tutor.second\n @jurado1 = @documento.personas_jurado.first\n @jurado2 = @documento.personas_jurado.second\n\n @documento.descargas = 0\n\n respond_to do |format|\n if @documento.save\n #@documento.update_attributes( :paginas => Utilidades::contar_paginas(@documento.publicacion.path))\n #format.html { redirect_to @documento, notice: 'Documento creado' }\n format.html { redirect_to \"/subir_archivo/#{@documento.id}\" }\n format.json { render json: @documento, status: :created, location: @documento }\n else\n format.html { render :action => \"new\", :layout => !request.xhr? }\n #render action: \"new\", notice: \"prueba_notice\", }\n format.json { render json: @documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_document\n config = Spree::BilletConfig\n doc_user = user.attributes[config.doc_customer_attr] rescue ''\n due_date = Date.today + config.due_date.days\n\n params = {cedente: config.corporate_name,\n documento_cedente: config.document,\n cedente_endereco: config.address,\n sacado: self.customer_name,\n sacado_documento: doc_user,\n sacado_endereco: order.bill_address.full_address,\n numero_documento: document_number,\n data_vencimento: due_date,\n data_documento: Date.parse(created_at.to_s),\n valor: amount,\n aceite: config.acceptance,\n agencia: config.agency,\n conta_corrente: config.account,\n convenio: config.agreement,\n carteira: config.wallet,\n variacao: config.variation_wallet\n }\n (1..6).each { |cont| params[\"instrucao#{cont}\".to_sym] = config[\"instruction_#{cont}\"] }\n if config.bank == 'sicredi' then\n params.merge!({posto: config.office_code,\n byte_idt: config.byte_idt})\n end\n\n document = case config.bank\n when 'banco_brasil' then Brcobranca::Boleto::BancoBrasil.new params\n when 'bradesco' then Brcobranca::Boleto::Bradesco.new params\n when 'caixa' then Brcobranca::Boleto::Caixa.new params\n when 'santander' then Brcobranca::Boleto::Santander.new params\n when 'itau' then Brcobranca::Boleto::Itau.new params\n when 'sicredi' then Brcobranca::Boleto::Sicredi.new params\n else\n raise 'It is necessary set the billet config'\n end\n document\n end",
"def save_design_doc(data)\n attrs = case data\n when String\n MultiJson.load(data)\n when IO\n MultiJson.load(data.read)\n when Hash\n data\n else\n raise ArgumentError, \"Document should be Hash, String or IO instance\"\n end\n\n id = attrs.delete('_id').to_s.split('/')[1]\n\n design_doc = DesignDocument.new(id)\n\n attrs['views'].each_pair do |view, functions|\n view_design = if functions['reduce']\n ViewDesign.new(view.to_s.to_java_string, functions['map'].to_java_string, functions['reduce'].to_java_string)\n else\n ViewDesign.new(view.to_s.to_java_string, functions['map'].to_java_string)\n end\n design_doc.getViews.add(view_design)\n end\n\n client.createDesignDoc(design_doc)\n end",
"def socioeduk_tipo_documento_params\n params.require(:socioeduk_tipo_documento).permit(:descricao)\n end",
"def create\n @derivative = Derivative.new(params[:derivative])\n\n respond_to do |format|\n if @derivative.save\n flash[:notice] = 'Derivative was successfully created.'\n format.html { redirect_to(@derivative) }\n format.xml { render :xml => @derivative, :status => :created, :location => @derivative }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @derivative.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_post_save_document_as_from_pdf_to_doc\n filename = '45.pdf'\n remote_name = 'TestPostDocumentSaveAsFromPdfToDoc.docx'\n dest_name = remote_test_out + 'TestPostDocumentSaveAs.docx'\n save_options = SaveOptionsData.new({:SaveFormat => 'docx', :FileName => dest_name})\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read\n @storage_api.put_create st_request\n\n request = PostDocumentSaveAsRequest.new remote_name, save_options, remote_test_folder + test_folder, :dest_file_name => dest_name\n result = @words_api.post_document_save_as request\n assert_equal 200, result.code\n end",
"def create_document_using_post_with_http_info(document_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocumentApi.create_document_using_post ...'\n end\n # verify the required parameter 'document_request' is set\n if @api_client.config.client_side_validation && document_request.nil?\n fail ArgumentError, \"Missing the required parameter 'document_request' when calling DocumentApi.create_document_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/document'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(document_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Document')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocumentApi#create_document_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def signalement_params\n params.require(:signalement).permit(:urgence, :reference_administration, :commentaire, :lieux_faits, :date_faits, documents: [])\n end",
"def create\n @docfile = Docfile.new(docfile_params)\n\n respond_to do |format|\n if @docfile.save\n format.html { redirect_to @docfile, notice: \"Docfile was successfully created.\" }\n format.json { render :show, status: :created, location: @docfile }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @docfile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Document.new, @project\n main = @project.document_mains.create\n rev = main.revisions.create\n document = rev.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n rev.destroy\n main.destroy\n render json: document.errors, status: :unprocessable_entity\n end\n end",
"def perdida_params\n params.require(:perdida).permit(:fecha, :num_doc, :cliente, :fecha_entrega, :empleado, :cant, :prenda, :pieza, :talla, :val_uni, :total, :subtotal, :iva, :total)\n end",
"def create\n @doc_ponto_comer = DocPontoComer.new(doc_ponto_comer_params)\n\n respond_to do |format|\n if @doc_ponto_comer.save\n format.html { redirect_to @doc_ponto_comer, notice: 'Doc ponto comer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @doc_ponto_comer }\n else\n format.html { render action: 'new' }\n format.json { render json: @doc_ponto_comer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @docs_ponto = DocsPonto.new(docs_ponto_params)\n\n respond_to do |format|\n if @docs_ponto.save\n format.html { redirect_to @docs_ponto, notice: 'Docs ponto was successfully created.' }\n format.json { render action: 'show', status: :created, location: @docs_ponto }\n else\n format.html { render action: 'new' }\n format.json { render json: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n #lessons semester prof doc_type\n i = Document.where(\"lesson_id = ? AND semester_id = ? AND prof_id = ? AND doc_type_id = ?\", @document.lesson.id, @document.semester.id, @document.prof.id, @document.doc_type.id).size\n \n #name = docType_prof_fach_sem_zahl\n\[email protected] = (@document.doc_type.name+'_'[email protected]+'_'[email protected]+'_'[email protected]+'_'+i.to_s).parameterize\n\t$upName = @document.name\n\t\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_thesis_with_whodunnit(user)\n sign_in user\n title = 'Spacecraft avoidance: a short'\n post '/thesis',\n params: {\n thesis: {\n title: title,\n abstract: 'Frook.',\n department_ids: departments(:one).id.to_s,\n degree_ids: degrees(:one).id.to_s,\n graduation_year: (Time.current.year + 1).to_s,\n graduation_month: 'September',\n files: fixture_file_upload('a_pdf.pdf', 'application/pdf')\n }\n }\n sign_out user\n end",
"def doc_params\n params.require(:condo_document).permit(:document, :name, hoa_id: Hoa.find(params[:hoa_id]))\n end",
"def add_relation\n #add relation\n @word.word_roots.create(@word_root)\n respond_to do |format|\n format.js\n end\n end",
"def create\n @document = Document.new(document_params)\n @document.document_type_id = get_document_type(params[\"document\"][\"auto_process_type\"])\n respond_to do |format|\n if @document.save\n # download file\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n if params[\"document\"][\"auto_process_type\"] == \"slice\"\n get_gazette_document_type_id #this is maybe a misplaced and useless call to this method, delete later?\n file.download \"tmp/gazette.pdf\"\n slice_gazette @document, Rails.root.join(\"tmp\") + \"gazette.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nueva gaceta seccionada en Valid! \" + @document.publication_number + \" :scroll:\")\n end\n format.html { redirect_to gazette_path(@document.publication_number), notice: 'La gaceta se ha partido exitósamente.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"process\"\n file.download \"tmp/gazette.pdf\"\n process_gazette @document, Rails.root.join(\"tmp\") + \"gazette.pdf\"\n if $discord_bot\n publication_number = \"\"\n publication_number = @document.publication_number if @document.publication_number\n $discord_bot.send_message($discord_bot_document_upload, \"Nueva gaceta en Valid! \" + publication_number + \" :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido una gaceta.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"judgement\"\n JudgementAuxiliary.create(document_id: @document.id, applicable_laws: \"\")\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido una sentencia.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"seccion\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/seccion_de_gaceta.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"seccion_de_gaceta.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nueva Sección de Gaceta subida en Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se han subido Avisos Legales.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"avisos\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/avisos_legales.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"avisos_legales.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevos avisos legales subidos en Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se han subido Avisos Legales.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"marcas\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/marcas.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"marcas.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevas Marcas de Fábrica subidas en Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se han subido Marcas de Fábrica.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"autos\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/auto_acordado.pdf\"\n slice_autos_acordados @document, Rails.root.join(\"tmp\") + \"auto_acordado.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevos autos acordados seccionados en Valid! :scroll:\")\n end\n format.html { redirect_to documents_path+\"?autos=true\", notice: 'Autos acordados se han partido exitosamente.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"formats\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/formato.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"formato.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevo formato subido a Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido un nuevo formato.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"comunicados\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/comunicado.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"comunicado.pdf\"\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevo comunicado subido a Valid! :scroll:\")\n end\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido un nuevo comunicado.' }\n elsif params[\"document\"][\"auto_process_type\"] == \"others\"\n bucket = get_bucket\n file = bucket.file @document.original_file.key\n file.download \"tmp/documento.pdf\"\n add_stamp_to_unprocessed_document @document, Rails.root.join(\"tmp\") + \"documento.pdf\"\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido un documento.' }\n if $discord_bot\n $discord_bot.send_message($discord_bot_document_upload, \"Nuevo documento subido a Valid! :scroll:\")\n end\n else\n format.html { redirect_to edit_document_path(@document), notice: 'Se ha subido un documento.' }\n end\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @docent = Docent.new(params[:docent])\n\n respond_to do |format|\n if @docent.save\n format.html { redirect_to(@docent, :notice => 'Docent was successfully created.') }\n format.xml { render :xml => @docent, :status => :created, :location => @docent }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @docent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n format.html { redirect_to(@doc, :notice => 'Doc was successfully created.') }\n format.xml { render :xml => @doc, :status => :created, :location => @doc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def document_params\n params.require(:document).permit(:language, :doc_type, :image)\n end",
"def freelance_doc_params\n params.require(:freelance_doc).permit(:title, :description, :file_url, :image_url)\n end",
"def detalle_params\n params.require(:detalle).permit(:nofra, :codigoprd, :cantidad, :impuesto, :precio)\n end",
"def create_design_doc(id,doc)\n @conn.query({url_path: \"#{database}/_design/#{id}\", opts: doc, method: :put})\n end",
"def create\n @tipos_documento = TiposDocumento.new(tipos_documento_params)\n\n respond_to do |format|\n if @tipos_documento.save\n format.html { redirect_to @tipos_documento, notice: 'El Tipo de Documento se ha creado correctamente.' }\n format.json { render :show, status: :created, location: @tipos_documento }\n else\n format.html { render :new }\n format.json { render json: @tipos_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document_params\n params.require(:document).permit(:description, :currency, :amount, :documents_date, :shipment_date, :shipment_from, :port_of_loading, :port_of_discharge, :final_destination, :incoterm, :goods, :remarks, :tenor, :consignee_name, :consignee_address1, :consignee_address2, :consignee_address3, :shipper_name, :shipper_address1, :shipper_address2, :shipper_address3, :documentary_credit_id)\n end",
"def create\n @tipo_documento = TipoDocumento.new(params[:tipo_documento])\n\n respond_to do |format|\n if @tipo_documento.save\n format.html { redirect_to @tipo_documento, notice: 'Tipo documento was successfully created.' }\n format.json { render json: @tipo_documento, status: :created, location: @tipo_documento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dejeuner_params\n params.require(:dejeuner).permit(:libelle, :description, :prix, :image)\n end",
"def edu_doc_params\n params.require(:edu_doc).permit(:documentname, :documentid,:documents,:user_id)\n end",
"def document_params\n\n params.require(:document).permit(:id, :title, :removed_edges, :removed_nodes,\n :graphs => [:id],\n :nodes => [:id, :graph_id, :label, :shape, :tags, :group, :cluster, :icon, :x, :y],\n :edges => [:id, :graph_id, :label, :from, :to],\n :tags => [:id, :name, :graph_id, :color, :shape, :icon],\n :clusters => [:id, :title, :label, :graph_id, :color, :shape, :icon])\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create_hosted_doc_with_http_info(doc, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocApi.create_hosted_doc ...'\n end\n # verify the required parameter 'doc' is set\n if @api_client.config.client_side_validation && doc.nil?\n fail ArgumentError, \"Missing the required parameter 'doc' when calling DocApi.create_hosted_doc\"\n end\n # resource path\n local_var_path = '/hosted_docs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(doc)\n\n # return_type\n return_type = opts[:debug_return_type] || 'DocStatus'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"DocApi.create_hosted_doc\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocApi#create_hosted_doc\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_examples_post(word, body, *args)\n http_method = :post\n path = '/word/{word}/examples'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def create\n @tipo_documento = TipoDocumento.new(tipo_documento_params)\n\n respond_to do |format|\n if @tipo_documento.save\n format.html { redirect_to @tipo_documento, notice: 'Se ha creado un nuevo Tipo de documento.' }\n format.json { render :show, status: :created, location: @tipo_documento }\n else\n format.html { render :new }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_derivatives(*args, storage: nil, **options)\n files = process_derivatives(*args, **options)\n add_derivatives(files, storage: storage)\n end",
"def ddc_params\n params.require(:ddc).permit(:name, :description, :reference_url, :json, :examples)\n end",
"def document_params\n params.require(:doc_file).permit(:data)\n end",
"def docs_ponto_params\n params.require(:docs_ponto).permit(:interessado_id, :arquivo, :nome)\n end",
"def add_doc(doc_id, fields, opts = {})\n call(ft_add(doc_id, fields, opts))\n end",
"def create_docx\n params[:event][:event_curator_users_attributes].values.each do |curator|\n @usernameid = curator[:user_id]\n end\n @user = User.find(@usernameid)\n\n @infoarray = params[:info]\n\n respond_to do |format|\n format.docx { headers[\"Content-Disposition\"] = \"attachment; filename=\\\"КП \" + params[:event][:name] + \".docx\\\"\" }\n end\n end",
"def document_params\n params.require(:document).permit(:name, :data, :lab_id)\n end",
"def create_doc(doc_records)\n puts \"create_doc Not implemented\"\n end",
"def socioeduk_atendimento_inicial_documento_params\n params.require(:socioeduk_atendimento_inicial_documento).permit(:descricao, :atendimento_inicial_id, :documento_forma_entrada_id, :documento)\n end",
"def update\n @doc.refused = false\n @doc.logs += \"Документ отредактирован #{DateTime.now}. <br> Документ повторно отправлен на подпись #{@doc.signer.name_with_initial}<br>\"\n respond_to do |format|\n if @doc.update(doc_params)\n format.html { redirect_to @doc, notice: 'Doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc }\n else\n format.html { render :edit }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def desafio_params\n params.require(:desafio).permit(:tipo, :titulo, :descripcion, :puntos)\n end",
"def agregar_docente\n\t\t@seccion = \"Docentes\"\n @titulo = \"Agregar docente\"\n\tend",
"def create\n @documentation = current_user.documentations.build(documentation_params)\n\n respond_to do |format|\n if @documentation.save\n format.html { redirect_to @documentation, notice: 'Documentation was successfully created.' }\n format.json { render :show, status: :created, location: @documentation }\n else\n format.html { render :new }\n format.json { render json: @documentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getDoc(doc)\n uri = URI.parse(\"https://api.figma.com/v1/files/#{doc[\"document\"]}\")\n request = Net::HTTP::Get.new(uri)\n request[\"X-Figma-Token\"] = @figmatoken\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n \n response.body\n end",
"def docfile_params\n params.require(:docfile).permit(:aadhar, :pan)\n end",
"def despesa_params\n params.require(:despesa).permit(:descricao, :data, :valor, :observacao, :anexo, :tenant_id, :user_id, :fornecedor_id, :tipo_despesa_id, :condominio_id, :forma_pagamento_id)\n end",
"def descuento_adicional_params\n params.require(:descuento_adicional).permit(:descuento_adicional, :detalle)\n end",
"def detalle_params\n params.permit(:nofra, :codigoprd, :cantidad, :impuesto, :precio)\n end",
"def new\n@documento = Documento.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documento }\n end\n end",
"def tipo_documento_params\n params.require(:tipo_documento).permit(:descripcion)\n end",
"def tipos_documento_params\n params.require(:tipos_documento).permit(:nombre)\n end",
"def payment_params\n params.require(:payment).permit(:doc_number, :description, :due_date, :payment_date, :installments, :value_doc, :supplier_id, :type_doc, :status, :form_payment, :categ_payment_id)\n end",
"def documentacion_params\n params.require(:documentacion).permit(:nombre, :validez_documentacion, :mem_id, :cover)\n end",
"def create\n @documentoclasificacion = Documentoclasificacion.new(params[:documentoclasificacion])\n\n respond_to do |format|\n if @documentoclasificacion.save\n format.html { redirect_to(@documentoclasificacion, :notice => 'Documentoclasificacion was successfully created.') }\n format.xml { render :xml => @documentoclasificacion, :status => :created, :location => @documentoclasificacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @documentoclasificacion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def postEntityDocument( entity_id, name, filedata)\n params = Hash.new\n params['entity_id'] = entity_id\n params['name'] = name\n params['filedata'] = filedata\n return doCurl(\"post\",\"/entity/document\",params)\n end",
"def create\n @department_document = DepartmentDocument.new(department_document_params)\n\n respond_to do |format|\n if @department_document.save\n format.html { redirect_to @department_document, notice: 'Department document was successfully created.' }\n format.json { render :show, status: :created, location: @department_document }\n else\n format.html { render :new }\n format.json { render json: @department_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def denuncium_params\n params.permit(:fecha, :descripcion_asalto, :descripcion_asaltante, :zona_id, :usuario_id, :tipo_denuncia_id)\n end",
"def document_params\n params.require(:document)\n .permit(:doc_type, :doc_number, :doc_expire, :upload)\n end"
] | [
"0.7072325",
"0.6475485",
"0.63414633",
"0.61643094",
"0.58071005",
"0.5706033",
"0.5676506",
"0.56693447",
"0.56190854",
"0.5597035",
"0.5562291",
"0.5488476",
"0.54817027",
"0.5479422",
"0.5451929",
"0.54373866",
"0.5420097",
"0.5409644",
"0.54018664",
"0.5400603",
"0.53773034",
"0.5377282",
"0.5377077",
"0.5371202",
"0.53381765",
"0.53251845",
"0.5324296",
"0.53242797",
"0.53234154",
"0.531643",
"0.5313011",
"0.5307253",
"0.52936906",
"0.52904284",
"0.5290384",
"0.5286938",
"0.5285141",
"0.52700764",
"0.52683747",
"0.52661",
"0.52540994",
"0.52509224",
"0.5239145",
"0.5217575",
"0.5201575",
"0.5200266",
"0.51668316",
"0.5152899",
"0.5150013",
"0.5149011",
"0.5147268",
"0.51468444",
"0.51437044",
"0.51411563",
"0.51334447",
"0.5128708",
"0.51287055",
"0.51250255",
"0.5124219",
"0.5116781",
"0.5108739",
"0.5104228",
"0.5103844",
"0.510315",
"0.509022",
"0.50827944",
"0.50806093",
"0.5073295",
"0.5072356",
"0.50713253",
"0.50704217",
"0.5063295",
"0.5059438",
"0.50591296",
"0.5057705",
"0.50536966",
"0.50502855",
"0.5037504",
"0.5034962",
"0.50317484",
"0.50283545",
"0.5022853",
"0.5021983",
"0.501491",
"0.5012207",
"0.5001125",
"0.49953994",
"0.49872643",
"0.49849793",
"0.4980752",
"0.4979128",
"0.4977348",
"0.49736762",
"0.49678776",
"0.4965616",
"0.49551457",
"0.49549186",
"0.49539727",
"0.49454993",
"0.4940685"
] | 0.7329176 | 0 |
PATCH/PUT /docderivaciones/1 PATCH/PUT /docderivaciones/1.json | def update
respond_to do |format|
if @docderivacione.update(docderivacione_params)
format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully updated.' }
format.json { render :show, status: :ok, location: @docderivacione }
else
format.html { render :edit }
format.json { render json: @docderivacione.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @doc.refused = false\n @doc.logs += \"Документ отредактирован #{DateTime.now}. <br> Документ повторно отправлен на подпись #{@doc.signer.name_with_initial}<br>\"\n respond_to do |format|\n if @doc.update(doc_params)\n format.html { redirect_to @doc, notice: 'Doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc }\n else\n format.html { render :edit }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\traise RuntimeError, \"Not authorized\" unless current_user && current_user.root? == true\n\n\t\tparams = doc_params\n\t\tparams[:body].gsub!(/\\r\\n/, \"\\n\")\n\t\t@doc = Doc.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @doc.update(params)\n\t\t\t\tformat.html { redirect_to @doc, notice: t('controllers.shared.successfully_updated', :model => t('activerecord.models.doc')) }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @doc.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n \n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to edit_document_path(@document), notice: 'Documento gardado correctamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def patch!\n request! :patch\n end",
"def update\n @documento = Documento.find(params[:id])\n\n respond_to do |format|\n if @documento.update_attributes(params[:documento])\n format.html { redirect_to @documento, notice: 'Documento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_documento.update_attributes(params[:tipo_documento])\n format.html { redirect_to @tipo_documento, notice: 'Tipo documento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @doc_file.update(doc_file_params)\n format.html { redirect_to @doc_file, notice: 'Doc file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @doc_file.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 respond_to do |format|\n if @doc_artefact.update(doc_artefact_params)\n format.html { redirect_to @doc_artefact, notice: 'Doc artefact was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc_artefact }\n else\n format.html { render :edit }\n format.json { render json: @doc_artefact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @doc = Doc.find(params[:id])\n \n respond_to do |format|\n if @doc.update_attributes(params[:doc])\n save_object_relationship\n format.html { redirect_to(@doc, :notice => 'Doc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @documento = Documento.find(params[:id])\n respond_to do |format|\n if @documento.update_attributes(params[:documento])\n format.html { redirect_to @documento, notice: 'Documento actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", alert: 'Documento no pudo ser actualizado.' }\n format.json { render json: @documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @documento.update(documento_params)\n format.html { redirect_to @documento, notice: 'Documento was successfully updated.' }\n format.json { render :show, status: :ok, location: @documento }\n else\n format.html { render :edit }\n format.json { render json: @documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n #if params[:original_file]\n # run_gazette_script @document\n #end\n if !params[:document][\"applicable_laws\"].blank?\n judgement_auxiliary = JudgementAuxiliary.find_by_document_id(@document.id)\n if judgement_auxiliary\n judgement_auxiliary.applicable_laws = params[:document][\"applicable_laws\"]\n judgement_auxiliary.save\n end\n end\n if params[:commit] == 'Guardar cambios'\n format.html { redirect_to edit_document_path(@document), notice: 'Document was successfully updated.' }\n elsif params[:commit] == 'Guardar y siguiente'\n format.html { redirect_to edit_document_path(get_next_document @document), notice: 'Document was successfully updated.' }\n elsif params[:commit] == 'Subir nueva sentencia'\n format.html { redirect_to new_document_path + \"?selected_document_type=judgement\" }\n end\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_docderivacione\n @docderivacione = Docderivacione.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @doc_ponto_comer.update(doc_ponto_comer_params)\n format.html { redirect_to @doc_ponto_comer, notice: 'Doc ponto comer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @doc_ponto_comer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gdoc.update(gdoc_params)\n format.html { redirect_to @gdoc, notice: 'Gdoc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gdoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @documentotipo = Documentotipo.find(params[:id])\n\n respond_to do |format|\n if @documentotipo.update_attributes(params[:documentotipo])\n format.html { redirect_to @documentotipo, notice: 'Documentotipo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @documentotipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_documento.update(admin_documento_params)\n format.html { redirect_to admin_documentos_url }\n format.json { render :show, status: :ok, location: @admin_documento }\n else\n format.html { render :edit }\n format.json { render json: @admin_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @doc = Doc.find(params[:id])\n # do a check to make sure the editor hasn't incremented the version without making a new doc first - if true then create new doc instead\n @version = params[:doc][:dev_stage] + \" \" + params[:doc][:maj_version] + \".\" + params[:doc][:min_version]\n\t\tunless @doc.get_version == @version\n\t\t\t@new_doc = Doc.new(params[:doc])\n\t\t\t# increment the url as necessary\n\t\t\tif @new_doc.maj_version > @doc.maj_version\n\t\t\t\turl_parts = @new_doc.url.split(\"-\")\n\t\t\t\turl_parts[url_parts.size - 2] = @new_doc.maj_version\n\t\t\t\turl_parts[url_parts.size - 1] = @new_doc.min_version\n\t\t\t\t@new_doc.url = url_parts.join(\"-\")\n\t\t\telsif @new_doc.maj_version == @doc.maj_version && @new_doc.min_version > @doc.min_version\n\t\t\t\turl_parts = @new_doc.url.split(\"-\")\n\t\t\t\turl_parts[url_parts.size - 1] = @new_doc.min_version\n\t\t\t\t@new_doc.url = url_parts.join(\"-\")\n\t\t\telse\n\t\t\t\t# default case where possibly the editor has graduated the dev stage to something different, will completely rebuild url using create_url at save\n\t\t\t\t@new_doc.url = \"\"\n\t\t\tend\n\t\t\t@new_doc.save\n\t\t\tredirect_to @new_doc, alert: \"You have incremented the version for this doc, so a new doc was created with the version \\\"#{@version}\\\" instead.\" and return\n\t\tend\n\t\t\n respond_to do |format|\n if @doc.update_attributes(params[:doc])\n format.html { redirect_to @doc, notice: \"\\\"#{@doc.component}\\\" was successfully updated.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_doc.update(client_doc_params)\n format.html { redirect_to @client_doc, notice: 'Client doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_doc }\n else\n format.html { render :edit }\n format.json { render json: @client_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n document = @document.revision.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n render json: document.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @docfile.update(docfile_params)\n format.html { redirect_to @docfile, notice: \"Docfile was successfully updated.\" }\n format.json { render :show, status: :ok, location: @docfile }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @docfile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipos_documento.update(tipos_documento_params)\n format.html { redirect_to @tipos_documento, notice: 'El Tipo de Documento se ha actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @tipos_documento }\n else\n format.html { render :edit }\n format.json { render json: @tipos_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n if @doc.update_attributes(params[:doc])\n format.html { redirect_to(@doc, :notice => 'Doc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cliente_documento.update(cliente_documento_params)\n format.html { redirect_to @cliente_documento, notice: 'Cliente documento was successfully updated.' }\n format.json { render :show, status: :ok, location: @cliente_documento }\n else\n format.html { render :edit }\n format.json { render json: @cliente_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detalle_documento_de_compra.update(detalle_documento_de_compra_params)\n format.html { redirect_to @detalle_documento_de_compra, notice: 'Detalle documento de compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @detalle_documento_de_compra }\n else\n format.html { render :edit }\n format.json { render json: @detalle_documento_de_compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\tdata = unpack_document(params[:document][:datafile]) \n\tdoc_params = {:title => document_params[\"title\"], :date => get_date(document_params,\"date\")}\n\tif !data.nil? then\n\t\tdoc_params[:content] = data[:content]\n\t\tdoc_params[:styles] = data[:styles]\n\tend\n respond_to do |format|\n if @document.update(doc_params)\n format.html { redirect_to @document, notice: \"Document updated successfully\"}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @modified_document = ModifiedDocument.find(params[:id])\n \n if @modified_document.update(modified_document_params)\n render json: @modified_document, status: :ok \n else\n render json: @modified_document.errors, status: :unprocessable_entity\n end\n end",
"def update\n document = Document.find(params[:id])\n document.update!(update_params)\n render json: {}\n end",
"def update\n respond_to do |format|\n if @tipo_documento.update(tipo_documento_params)\n format.html { redirect_to @tipo_documento, notice: 'Se ha actualizado el Tipo de documento.' }\n format.json { render :show, status: :ok, location: @tipo_documento }\n else\n format.html { render :edit }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @documentation.update(documentation_params)\n format.html { redirect_to @documentation, notice: 'Documentation was successfully updated.' }\n format.json { render :show, status: :ok, location: @documentation }\n else\n format.html { render :edit }\n format.json { render json: @documentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\")\n req = Net::HTTP::Post.new(uri)\n req.body = { \"doc\": document }.to_json\n run(uri, req)\n end",
"def update\n respond_to do |format|\n if @document.update_attributes(name: document_params[:name], lab_id: document_params[:lab_id])\n format.html { redirect_to documents_url, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: documents_url }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @docu_template.update(docu_template_params)\n format.html { redirect_to @docu_template, notice: 'Docu sign was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docu_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tdoc = Tdoc.find(params[:id])\n \n respond_to do |format|\n if @tdoc.update_attributes(params[:tdoc])\n format.html { redirect_to @tdoc, notice: 'Tdoc was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tdoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n save_doc\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to root_url , notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_de_documento.update_attributes(params[:tipo_de_documento])\n format.html { redirect_to(@tipo_de_documento, :notice => 'Tipo de documento atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_de_documento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n # format.json { head :no_content }\n format.json { render jbuilder: @document }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @docent = Docent.find(params[:id])\n\n respond_to do |format|\n if @docent.update_attributes(params[:docent])\n format.html { redirect_to(@docent, :notice => 'Docent was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @docent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tucdoc.update(tucdoc_params)\n format.html { redirect_to @tucdoc, notice: 'Tucdoc was successfully updated.' }\n format.json { render :show, status: :ok, location: @tucdoc }\n else\n format.html { render :edit }\n format.json { render json: @tucdoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def docderivacione_params\n params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado)\n end",
"def update\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n\n respond_to do |format|\n if @calidadtiposdocumento.update_attributes(params[:calidadtiposdocumento])\n format.html { redirect_to(@calidadtiposdocumento, :notice => 'Calidadtiposdocumento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calidadtiposdocumento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @doc.update_from_params(params[:course_document])\n render json: @doc, status: :ok\n else\n render json: doc.errors, status: :unprocessable_entity\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, success: 'Documento actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n document = Document.find(params[:id])\n if document.update(params_document)\n render json: document, status: 200\n else\n render json: document.errors, status: 422\n end\n\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to documents_path, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @documentoclasificacion = Documentoclasificacion.find(params[:id])\n\n respond_to do |format|\n if @documentoclasificacion.update_attributes(params[:documentoclasificacion])\n format.html { redirect_to(@documentoclasificacion, :notice => 'Documentoclasificacion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @documentoclasificacion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @documentable = @document.documentable\n\n respond_to do |format|\n if @document.update(document_params)\n notify_user(:notice, 'Document was successfully updated.')\n format.html { redirect_to get_resource_url(@documentable) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @documento = @externo.documentos.find(params[:id])\n\n respond_to do |format|\n if @documento.update_attributes(params[:documento])\n flash[:notice] = 'ATUALIZADO COM SUCESSO.'\n format.html { redirect_to[@externo,@documento] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @documento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, :notice => 'Document was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\t\n\t@tmp = Document.new(params[:document])\n\t\n\ttmp2 = @document.name\n\ttempPath = \"public/dokumente/\"\n\textName = File.extname(@document.file_url)\n\t\n\ti = Document.where(\"lesson_id = ? AND semester_id = ? AND prof_id = ? AND doc_type_id = ?\", @tmp.lesson.id, @tmp.semester.id, @tmp.prof.id, @tmp.doc_type.id).size\n \n #name = docType_prof_fach_sem_zahl\n\[email protected] = (@tmp.doc_type.name+'_'[email protected]+'_'[email protected]+'_'[email protected]+'_'+i.to_s).parameterize\n\t\n\t$newPath = tempPath\n\t$newFile = @document.name+extName\n\t\n\tFile.rename(tempPath+tmp2+extName, [email protected]+extName)\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n @tmp.destroy\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n @special_document = ModifiedDocument.find(params[:id])\n\n respond_to do |format|\n if @special_document.update_attributes(params[:special_document])\n format.html { redirect_to @special_document, notice: 'Special document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @special_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to edit_admin_document_path(@document), notice: 'Document was successfully updated.' }\n format.js { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @doc_data = args[:doc_data] if args.key?(:doc_data)\n @salient_term = args[:salient_term] if args.key?(:salient_term)\n @version = args[:version] if args.key?(:version)\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Rails.logger.info \"Before update\"\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n Rails.logger.info \"After update\"\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to :action => \"index\", notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, :flash => { :success => 'Document was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fonte_de_recurso.update(fonte_de_recurso_params)\n addlog(\"Fonte de recurso atualizada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @fonte_de_recurso }\n else\n format.html { render :edit }\n format.json { render json: @fonte_de_recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(referencia_base_params)\n format.html { redirect_to @objeto, notice: \"Referencia base was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tdoc = Tdoc.find(params[:id])\n\n respond_to do |format|\n if @tdoc.update_attributes(params[:tdoc])\n format.html { redirect_to(@tdoc, :notice => 'Tdoc was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tdoc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n add_breadcrumb @document.name, library_category_library_document_path(@category, @document)\n add_breadcrumb \"Modify\"\n\n respond_to do |format|\n if @document.update(document_params)\n notify_user(:notice, 'Document was successfully updated.')\n format.html { redirect_to library_category_library_document_path(@category, @document) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update\n @document = Document.find(params[:id])\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.json { render :json => nil, :status => :ok }\n format.html { redirect_to(@document, :notice => 'Document was successfully updated.') }\n else\n format.json { render :json => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group_doc.update(group_doc_params)\n format.html { redirect_to @group_doc, notice: 'Group doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @group_doc }\n else\n format.html { render :edit }\n format.json { render json: @group_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @document\n disable_primary if document_params[:primary]\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document.instruction, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dependencia = Dependencia.find(params[:id])\n\n respond_to do |format|\n if @dependencia.update_attributes(dependencia_params)\n format.html { redirect_to @dependencia, notice: 'Dependencia se actualizo correctamente.' }\n format.json { head :no_content }\n format.js{}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dependencia.errors, status: :unprocessable_entity }\n format.js{}\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(tipo_referencia_base_params)\n format.html { redirect_to @objeto, notice: \"Tipo referencia base was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n params[:document][:version] = ENV[\"VERSION\"]\r\n params[:document][:username] = current_user.username\r\n @document = Document.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @document.update_attributes(document_params)\r\n format.html { redirect_to @document, notice: 'Document 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: @document.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n \t@document = Document.find(params[:id])\n if @document.update_attributes(document_params)\n render json: {status: 'SUCCESS', message:'Document updated', data:@document}, status: :ok\n else\n\t\trender json: {status: 'ERROR', message:'Document not updated', data:@document.errors}, status: :unprocessable_entity\n end\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update\n if @doc.update(doc_params)\n redirect_to @doc\n else\n render \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @documentos_simposio.update(documentos_simposio_params)\n format.html { redirect_to @documentos_simposio, notice: 'Documentos simposio was successfully updated.' }\n format.json { render :show, status: :ok, location: @documentos_simposio }\n else\n format.html { render :edit }\n format.json { render json: @documentos_simposio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @documentacion.update(documentacion_params)\n format.html { redirect_to @documentacion.mem, notice: 'Documentación actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @documentacion }\n else\n format.html { render :edit }\n format.json { render json: @documentacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n if @doc.update(doc_params)\n flash[:notice] = '更新资料成功'\n redirect_to journal_doc_path(@journal, @doc)\n else\n flash[:alert] = '更新资料未成功'\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(detalle_pedido_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Detalle pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def on_agree\n @doc.update(agreed: false)\n respond_to do |format|\n if @doc.update(doc_params)\n format.html { redirect_to @doc, notice: 'Doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc }\n else\n format.html { render :edit }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end",
"def update\n respond_to do |format|\n if @gov_doc.update(gov_doc_params)\n format.html { redirect_to @gov_doc, notice: \"Gov doc was successfully updated.\" }\n format.json { render :show, status: :ok, location: @gov_doc }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @gov_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compras_documento = ComprasDocumento.find(params[:id])\n @compras_documento.usuario_updated = current_user.id\n @compras_documento.unidade_updated = current_unidade.id\n\n respond_to do |format|\n if @compras_documento.update_attributes(params[:compras_documento])\n if @compras_documento.compra_id != nil\n format.html { redirect_to \"/compras/#{@compras_documento.compra_id}/compras_documento\" }\n else\n format.html { redirect_to compras_documentos_path }\n end\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @doc_template.update(doc_template_params)\n format.html { redirect_to @doc_template, notice: 'Doc template was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc_template }\n else\n format.html { render :edit }\n format.json { render json: @doc_template.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6633506",
"0.64857626",
"0.6472843",
"0.6454058",
"0.6446523",
"0.642279",
"0.6361423",
"0.6348208",
"0.62918496",
"0.6282565",
"0.62794197",
"0.62763816",
"0.6246639",
"0.62454915",
"0.6241526",
"0.6237541",
"0.62311083",
"0.62249064",
"0.6208386",
"0.6154303",
"0.61498946",
"0.61477035",
"0.61326694",
"0.6130837",
"0.6124333",
"0.6111789",
"0.6079891",
"0.6074831",
"0.6069763",
"0.6066834",
"0.6054053",
"0.60366666",
"0.60354173",
"0.6034514",
"0.6027372",
"0.6018934",
"0.6013297",
"0.60064703",
"0.6006211",
"0.60031366",
"0.60009867",
"0.59889054",
"0.5982965",
"0.5979491",
"0.5955652",
"0.59501994",
"0.59485155",
"0.59458566",
"0.59358746",
"0.59358746",
"0.59358746",
"0.59294444",
"0.59284914",
"0.5922467",
"0.591843",
"0.59001017",
"0.5894588",
"0.5892671",
"0.58895725",
"0.58864224",
"0.58864224",
"0.5880739",
"0.58771706",
"0.58762664",
"0.58732414",
"0.5867638",
"0.58601224",
"0.58571243",
"0.58564776",
"0.5855456",
"0.5852997",
"0.5851186",
"0.5851186",
"0.5851186",
"0.58451223",
"0.5844499",
"0.58397",
"0.58338493",
"0.5828035",
"0.58207554",
"0.581068",
"0.5807153",
"0.5805827",
"0.5801001",
"0.57830024",
"0.5779096",
"0.57779807",
"0.5776746",
"0.57747376",
"0.57727677",
"0.5768948",
"0.5768948",
"0.57667315",
"0.5762686",
"0.57621956",
"0.57580763",
"0.5751241",
"0.5750469",
"0.57401097",
"0.5733192"
] | 0.707577 | 0 |
DELETE /docderivaciones/1 DELETE /docderivaciones/1.json | def destroy
@docderivacione.destroy
respond_to do |format|
format.html { redirect_to docderivaciones_url, notice: 'Docderivacione was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @doc.destroy\n respond_to do |format|\n format.html { redirect_to docs_url, notice: 'Документ был удалён' }\n format.json { head :no_content }\n end\n end",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @ficha_doc.destroy\n respond_to do |format|\n format.html { redirect_to ficha_docs_url, notice: 'Ficha doc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docs_ponto.destroy\n respond_to do |format|\n format.html { redirect_to docs_pontos_url }\n format.json { head :no_content }\n end\n end",
"def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
"def delete_document( doc_id: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :delete, url_for_base(doc_id), params, :json\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to docs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @constancia_documento.destroy\n respond_to do |format|\n format.html { redirect_to constancia_documentos_url, notice: 'La constancia fue eliminada correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to documentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url }\n format.json { head :no_content }\n end\n end",
"def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end",
"def destroy\n @admin_documento.destroy\n respond_to do |format|\n format.html { redirect_to admin_documentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documentacion.destroy\n respond_to do |format|\n format.html { redirect_to @mem, notice: 'Documentación eliminada correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documento = Documento.find(params[:id])\n # Eliminar los registros asociativos de las tablas JOIN \n # para las asociaciones HBTM (has_and_belongs_to_many)\n #\n @documento.reconocimientos.destroy_all\n @documento.areas.destroy_all\n\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to documentos_url, :notice => \"#{@documento.titulo} eliminado\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_doc.destroy\n respond_to do |format|\n format.html { redirect_to client_docs_url, notice: 'Client doc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gdoc.destroy\n respond_to do |format|\n format.html { redirect_to gdocs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n \n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Documento eliminado correctamente' }\n format.json { head :no_content }\n end\n end",
"def delete_version( doc_id:, version: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :delete, \"#{url_for_base doc_id}/#{version}\", params, :json\n end",
"def destroy\n \t@doc = Doc.find params[:id]\n @doc.destroy\nend",
"def delete!\n request! :delete\n end",
"def destroy\n @documentoclasificacion = Documentoclasificacion.find(params[:id])\n @documentoclasificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentoclasificaciones_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @docfile.destroy\n respond_to do |format|\n format.html { redirect_to docfiles_url, notice: \"Docfile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc_artefact.destroy\n respond_to do |format|\n format.html { redirect_to doc_artefacts_url, notice: 'Doc artefact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento.destroy\n respond_to do |format|\n format.html { redirect_to documentos_url, notice: 'Documento was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @doc_ponto_comer.destroy\n respond_to do |format|\n format.html { redirect_to doc_ponto_comers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_documento_de_compra.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Linea eliminada' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_documento.destroy\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url, notice: 'Se ha eliminado el Tipo de documento.' }\n format.json { head :no_content }\n end\n end",
"def delete( doc, opts = {} )\n rev = opts.delete(:rev)\n response = http_action :delete, doc, { :query => {:rev => rev || doc['_rev'] } }.merge( opts )\n doc.delete '_rev' if doc.kind_of? Hash\n response\n end",
"def destroy\n @tipos_documento.destroy\n respond_to do |format|\n format.html { redirect_to tipos_documentos_url, notice: 'El Tipo de Documento se ha eliminado correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def delete_doc(id)\n doc = get_doc(id)\n rev = doc[\"_rev\"] if doc[\"_rev\"]\n\n @conn.query({url_path: \"#{database}/#{id}?rev=#{rev}\", method: :delete})\n end",
"def destroy\n @tdoc = Tdoc.find(params[:id])\n @tdoc.destroy\n \n respond_to do |format|\n format.html { redirect_to tdocs_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @documentotipo = Documentotipo.find(params[:id])\n @documentotipo.destroy\n\n respond_to do |format|\n format.html { redirect_to documentotipos_url }\n format.json { head :ok }\n end\n end",
"def delete(*rest) end",
"def destroy\n @tucdoc.destroy\n respond_to do |format|\n format.html { redirect_to tucdocs_url, notice: 'Tucdoc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente_documento.destroy\n respond_to do |format|\n format.html { redirect_to cliente_documentos_url, notice: 'Cliente documento was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(opts = {})\n response = Crocodoc.connection.post 'document/delete', :uuid => @uuid\n response.body.chomp.downcase == 'true'\n end",
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @edu_doc.destroy\n respond_to do |format|\n format.html { redirect_to edu_docs_url, notice: \"Edu doc was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n File.delete( @doc_file.docOwner)\n rescue\n end\n @doc_file.destroy\n \n respond_to do |format|\n format.html { redirect_to doc_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n @person_identification_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => 'Documentação excluída.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @documentation.destroy\n respond_to do |format|\n format.html { redirect_to documentations_url, notice: 'Documentation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tdoc = Tdoc.find(params[:id])\n @tdoc.destroy\n\n respond_to do |format|\n format.html { redirect_to(tdocs_url) }\n format.xml { head :ok }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n authorize @document\n instruction = @document.instruction\n @document.destroy\n respond_to do |format|\n format.html { redirect_to instruction, notice: t('documents.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @doc.destroy\n redirect_to docs_path\n end",
"def destroy\n @gov_doc.destroy\n respond_to do |format|\n format.html { redirect_to gov_docs_url, notice: \"Gov doc was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url(document_filter: {kind: @document.kind}), success: 'Documento eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documentos_simposio.destroy\n #respond_to do |format|\n # format.html { redirect_to documentos_simposios_url, notice: 'Documentos simposio was successfully destroyed.' }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n @tipo_de_documento = TipoDeDocumento.find(params[:id])\n @tipo_de_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_de_documento_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n \n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @docu_template.destroy\n respond_to do |format|\n format.html { redirect_to docu_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = @maintenance.documents.find(params[:id])\n @document.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_maintenance_path(@vehicle, @maintenance), notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"def destroy\n puts \"------------------------\"\n document_item = ActiveStorage::Attachment.find(@document.doc.id)\n p document_item.purge\n puts \"------------------------\"\n\n @document.destroy\n respond_to do |format|\n\n\n\n\n format.html { redirect_to property_property_unit_documents_path(@property, @property_unit), notice: 'Dokumentet ble slettet.' }\n format.json { head :no_content }\n end\n end",
"def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end",
"def delete\n \n end",
"def destroy\n @documento = Documento.find(params[:id])\n producto = Producto.find(@documento.producto_id)\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to producto, notice: 'Documento eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_documents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @oa_sent_document = Oa::SentDocument.find(params[:id])\n @oa_sent_document.destroy\n\n respond_to do |format|\n format.html { redirect_to oa_sent_documents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @identity_document_type.destroy\n respond_to do |format|\n format.html { redirect_to identity_document_types_url, notice: 'Tipo Documento excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estadocivil.destroy\n respond_to do |format|\n format.html { redirect_to estadocivils_url, notice: 'Estadocivil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def destroy\n @documentation = Documentation.find(params[:id])\n @documentation.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentations_url) }\n format.xml { head :ok }\n end\n end",
"def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \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 @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def delete(document)\n delete_path(document.path)\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end"
] | [
"0.7239966",
"0.71952367",
"0.70715845",
"0.7060022",
"0.7048746",
"0.7036805",
"0.7006747",
"0.7006268",
"0.6970322",
"0.69347113",
"0.69215626",
"0.6897966",
"0.6861335",
"0.6811945",
"0.6811423",
"0.67984647",
"0.67976826",
"0.67974615",
"0.67974615",
"0.67974615",
"0.67974615",
"0.67895246",
"0.6788785",
"0.67861634",
"0.6781516",
"0.67764056",
"0.67634153",
"0.6760147",
"0.675757",
"0.67557955",
"0.67557955",
"0.67523664",
"0.6748068",
"0.6740325",
"0.67352515",
"0.67205495",
"0.6707547",
"0.67066544",
"0.6700029",
"0.6697182",
"0.66949636",
"0.66832733",
"0.6680397",
"0.6677573",
"0.6672828",
"0.6668091",
"0.6666454",
"0.6665763",
"0.66447645",
"0.66327024",
"0.66302043",
"0.66287565",
"0.66254497",
"0.6606688",
"0.6598489",
"0.6588732",
"0.65878016",
"0.6586983",
"0.6580409",
"0.65788245",
"0.65656906",
"0.65645164",
"0.6561468",
"0.6558479",
"0.6558479",
"0.65492344",
"0.6549219",
"0.6541148",
"0.6537534",
"0.653499",
"0.65320706",
"0.65266323",
"0.6524449",
"0.65242857",
"0.6520416",
"0.6519965",
"0.6512048",
"0.6510657",
"0.65021",
"0.64966583",
"0.64955944",
"0.6484067",
"0.6477811",
"0.6474162",
"0.6468879",
"0.6467508",
"0.6449641",
"0.64487106",
"0.64487106",
"0.64487106",
"0.64487106",
"0.64487106",
"0.6446634",
"0.64441806",
"0.64441067",
"0.64387465",
"0.6437665",
"0.6434998",
"0.6434998",
"0.6434998"
] | 0.770392 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_docderivacione
@docderivacione = Docderivacione.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def docderivacione_params
params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end"
] | [
"0.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915146",
"0.6290595",
"0.62824667",
"0.62420255",
"0.62403506",
"0.6217174",
"0.6213706",
"0.62112075",
"0.6194868",
"0.6178784",
"0.6174678",
"0.6172499",
"0.61630744",
"0.61544263",
"0.615248",
"0.6147727",
"0.61221075",
"0.6119646",
"0.61076134",
"0.6106584",
"0.6094013",
"0.6081423",
"0.6071337",
"0.6063637",
"0.6021453",
"0.6018253",
"0.60161054",
"0.60112554",
"0.60071784",
"0.60071784",
"0.60004836",
"0.6000254",
"0.5999255",
"0.59930664",
"0.59919107",
"0.5991741",
"0.5980763",
"0.59663844",
"0.59605104",
"0.5960486",
"0.5959414",
"0.5957901",
"0.59538954",
"0.5953327",
"0.59450173",
"0.59391475",
"0.59391475",
"0.59386194",
"0.59351885",
"0.593139",
"0.5926316",
"0.5925927",
"0.59176016",
"0.59119296",
"0.5909275",
"0.5908221",
"0.59053046",
"0.58983994",
"0.58980995",
"0.58964473",
"0.5895902",
"0.5893993",
"0.58927304",
"0.5887752",
"0.58841616",
"0.5880381",
"0.58752084",
"0.586956",
"0.5868584",
"0.58679324",
"0.5867004",
"0.58667004",
"0.58642864",
"0.5863347",
"0.58626384",
"0.58615845",
"0.58594906",
"0.5854959",
"0.5854423",
"0.58506453",
"0.5850135"
] | 0.0 | -1 |
before_save :ensure_authentication_token validates_format_of :email, :with => Configuration::EMAIL_CHECK Include default devise modules. Others available are: :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable Setup accessible (or protected) attributes for your model | def user_kind
UserKind.find(user_kind_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_save_user\n self.encrypted_password.encode! 'utf-8'\n\n # If demo is enabled, demo user cannot change email or password nor be locked\n if Feedbunch::Application.config.demo_enabled\n demo_email = Feedbunch::Application.config.demo_email\n if email_changed? && self.email_was == demo_email\n Rails.logger.info 'Somebody attempted to change the demo user email. Blocking the attempt.'\n self.errors.add :email, 'Cannot change demo user email'\n self.email = demo_email\n end\n\n demo_password = Feedbunch::Application.config.demo_password\n if encrypted_password_changed? && self.email == demo_email\n Rails.logger.info 'Somebody attempted to change the demo user password. Blocking the attempt.'\n self.errors.add :password, 'Cannot change demo user password'\n self.password = demo_password\n end\n\n if locked_at_changed? && self.email == demo_email\n Rails.logger.info 'Keeping demo user from being locked because of too many authentication failures'\n self.locked_at = nil\n end\n\n if unlock_token_changed? && self.email == demo_email\n Rails.logger.info 'Removing unlock token for demo user, demo user cannot be locked out'\n self.unlock_token = nil\n end\n end\n end",
"def ldap_before_save\n self.email = Devise::LDAP::Adapter.get_ldap_param(username, 'mail').first\n end",
"def authenticate_user_from_token!\n user_email = params[:user_email].presence\n user = user_email && User.find_by_email(user_email)\n\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n if user && Devise.secure_compare(user.auth_token, params[:auth_token])\n sign_in user, store: false\n end\n\n end",
"def authenticate_user_from_token!\n user_email = params[:user_email].presence\n user = user_email && User.find_by_email(user_email)\n\n # Notice how we use Devise.secure_compare to compare the token\n # in the database with the token given in the params, mitigating\n # timing attacks.\n\n if user && Devise.secure_compare(user.authentication_token, params[:user_token])\n sign_in user, store: false\n end\n end",
"def authenticate_user_from_token\n email = request.headers['X-User-Email']\n\n if email && (user = User.find_by(email: email))\n token = request.headers['X-User-Authentication-Token']\n\n if Devise.secure_compare(user.authentication_token, token)\n sign_in user, store: false\n end\n end\n end",
"def authenticate_user_from_token!\n user_email = params[:user_email]\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.auth_token, params[:user_token])\n old_password = user.encrypted_password\n new_password = SecureRandom.hex\n\n user.update_attribute :password, new_password\n\n begin\n sign_in_with_casino user.email, new_password, params[:service]\n rescue Exception => e\n Appsignal.add_exception e\n Rails.logger e\n end\n\n user.update_column :encrypted_password, old_password\n end\n end",
"def make_email_verification_code\n self.email_verification_code = self.class.make_token\n end",
"def apply_omniauth(auth)\n # In previous omniauth, 'user_info' was used in place of 'raw_info'\n self.email = auth['extra']['raw_info']['email']\n # Again, saving token is optional. If you haven't created the column in authentications table, this will fail\n authentications.build(:provider => auth['provider'], :uid => auth['uid'], :token => auth['credentials']['token'])\n end",
"def ensure_authentication_token\n\t\tself.authentication_token = generate_authentication_token\n\t\tself.save!\n\t\tself.authentication_token\n\tend",
"def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!\n # save!(:validate => false)\n # validate for password validation, done on front end\n end",
"def available_email_login?\n true\nend",
"def primary_email_verified?(auth_token)\n true\n end",
"def email_login\n end",
"def token_params\n params.permit(:email, :password)\n end",
"def ensure_authentication_token\n authorization = Authorization.where(:provider => 'devise', :customer_id => id.to_s).first_or_initialize\n\n if authorization.token.blank?\n #generate new token\n authorization.token = Devise.friendly_token\n end\n\n authorization.save\n end",
"def azure_auth\n if (email = authenticated?)\n email_pat = /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i\n unless email =~ email_pat\n flash[:alert] = \"Unknown email: #{email}\"\n redirect_to root_path\n return\n end\n user = User.where(:email => email).first\n unless user\n password = Devise.friendly_token[0,8]\n user = User.create(\n email:email,\n password:password,\n password_confirmation:password\n )\n end\n \n if user.email_confirmed?\n sign_in_and_redirect user, :event => :authentication\n else\n redirect_to root_path, :notice => I18n.t(:conf_msg, :scope => [:messages, :controllers, :invitations])\n end\n else\n flash[:alert] = \"No email found.\"\n redirect_to root_path\n end\n end",
"def authenticate_user_from_token!\n authenticate_with_http_token do |token, options|\n user_email = options[:email].presence\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.authentication_token, token)\n sign_in user, store: false\n end\n end\n end",
"def reset_password_token!\n raw, enc = Devise.token_generator.generate(self.class, :reset_password_token)\n self.reset_password_token = enc\n self.reset_password_sent_at = Time.now.utc\n save(validate: false)\n raw\n end",
"def reset_token!\n token = Devise.friendly_token[0,20]\n self.password = self.password_confirmation = token\n self.email = \"#{name}@scribe\"\n save! validate: false\n token\n end",
"def update_devise_user\n inject_into_file 'app/models/user.rb', after: \":validatable\" do <<-'RUBY'\n, :omniauthable\n validates_presence_of :email\n has_many :authorizations\n\n def self.new_with_session(params,session)\n if session[\"devise.user_attributes\"]\n new(session[\"devise.user_attributes\"],without_protection: true) do |user|\n user.attributes = params\n user.valid?\n end\n else\n super\n end\n end\n\n def self.from_omniauth(auth, current_user)\n authorization = Authorization.where(:provider => auth.provider, :uid => auth.uid.to_s, :token => auth.credentials.token, :secret => auth.credentials.secret).first_or_initialize\n if authorization.user.blank?\n user = current_user.nil? ? User.where('email = ?', auth[\"info\"][\"email\"]).first : current_user\n if user.blank?\n user = User.new\n user.password = Devise.friendly_token[0,10]\n user.name = auth.info.name\n user.email = auth.info.email\n auth.provider == \"twitter\" ? user.save(:validate => false) : user.save\n end\n authorization.username = auth.info.nickname\n authorization.user_id = user.id\n authorization.save\n end\n authorization.user\n end\n RUBY\n end\n end",
"def ensure_user_has_authentication_token\n return unless User.current.authentication_token.nil?\n\n User.current.ensure_authentication_token\n User.current.save\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:confirm_token,:email, :password, :password_confirmation])\n end",
"def verify_email!\n self.email_verified_at = Time.now.utc\n self.email_verification_code = nil\n reconcile_privileges! :email_verified\n success = save(false)\n success\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :soft_token\n end",
"def activate_email\n self.email_confirmed = true\n self.confirm_token = nil\n save!(:validate => false)\n end",
"def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n # Redundant, but makes sure we don't run into password validation issues\n save!(validate: false)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password) }\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:email, :password, :password_confirmation, :current_password) }\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[email])\n end",
"def apply_omniauth(auth)\n self.email = auth['extra']['raw_info']['email'] if auth['extra']['raw_info']['email']\n self.password = Devise.friendly_token[0,20]\n authentications.build(:provider=>auth['provider'], :uid=>auth['uid'], :token=>auth['credentials']['token'], :secret=>auth['credentials']['secret'])\n end",
"def ensure_password\n self.password ||= Devise.friendly_token[0,20]\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:email, :password, :remember_me)\n end\n\n devise_parameter_sanitizer.permit(:sign_up) do |user_params|\n user_params.permit(:email, :password, :password_confirmation)\n end\n end",
"def save_authentication_token(token)\n carrier_setting.settings['token'] = token\n carrier_setting.settings['token_expire_date'] = DateTime.now + 7.hours\n carrier_setting.save\n end",
"def before_save_password\n if @password_updated and valid?\n self.crypted_password = ::Challah::Encrypter.encrypt(@password)\n\n @password_updated = false\n @password = nil\n end\n\n self.persistence_token = ::Challah::Random.token(125) if self.persistence_token.to_s.blank?\n self.api_key = ::Challah::Random.token(50) if self.api_key.to_s.blank?\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password) }\n end",
"def validate_email?\n MinimalistAuthentication.configuration.validate_email && active?\n end",
"def login_token\n user ? email : seed\n end",
"def before_import_save(record)\n self.allow_blank_password = true\n self.allow_blank_email = true\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :fname, :lname, :username, :birthday, :image, :newsletter, :language) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:email, :password, :fname, :lname, :username, :birthday, :image, :description, :phoneNumber, :facebook, :twitter, :googlePlus, :newsletter, :language) }\n end",
"def before_rodauth\n rails_verify_authenticity_token\n super\n end",
"def set_attributes(email,password,first_name,last_name)#called by sign_in api in apis controller\n self.email = email\n self.password = password\n self.first_name = first_name\n self.last_name = last_name\n self.save\n end",
"def initialize email,token\n super(email, token)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:nhs_number, :email, :password, :password_confirmation, :remember_me)\n end\n\n devise_parameter_sanitizer.for(:sign_in) do |u|\n u.permit(:login, :nhs_number, :email, :password, :remember_me)\n end\n\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:login, :nhs_number, :email, :password, :password_confirmation, :current_password)\n end\n end",
"def validation_login\n validate_token User, params[:token]\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :username, :first_name, :last_name, :birthday, :password, :password_confirmation, :remember_me) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :first_name, :last_name, :age, :country_code, :language_first, :language_second, :sex, :address, :birthday, :password, :password_confirmation, :current_password) }\n end",
"def authenticate_user_from_token!\n authenticate_with_http_token do |token, options|\n user_email = options[:email].presence\n user = user_email && User.find_by_email(user_email)\n\n if user && Devise.secure_compare(user.api_token, token)\n sign_in user, store: false\n end\n end\n end",
"def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!(:validate => false)\nend",
"def set_initial_password_reset!\n raw, enc = Devise.token_generator.generate(self.class, :reset_password_token)\n\n self.reset_password_token = enc\n self.reset_password_sent_at = Time.now.utc\n save(validate: false)\n raw\n end",
"def ensure_authentication_token\n if authentication_token.blank?\n self.authentication_token = generate_authentication_token\n end\n end",
"def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end",
"def apply_omniauth(omniauth, confirmation)\n self.email = omniauth['info']['email'] if email.blank?\n # Check if email is already into the database => user exists\n apply_trusted_services(omniauth, confirmation) if self.new_record?\n end",
"def devise_parameter_sanitizer; end",
"def check_auth_token\n generate_authentication_token! if new_record? || user_status_id_changed?\n end",
"def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!(:validate => false)\n end",
"def email_activate\n self.email_confirmed = true\n self.confirm_token = nil\n save!(:validate => false)\n end",
"def set_email_field(email)\n end",
"def before_save\n self.hashed_password = User.encrypt(password) if !self.password.blank?\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:registration) do |u|\n u.permit(:first_name, :last_name, :email, :password, :phone, :photo, :bio)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:password, :password_confirmation, :current_password, :global_email_notifications)\n end\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: [:email, :password])\n end",
"def generate_verification_token!\n self.verification_token = generate_token\n self.verification_sent_at = Time.now.utc\n self.save(validate: false)\n end",
"def validates_email\n self.type == 'email'\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:first_name, :surname, :email, :role_id, :job_grade, :line_manager, :admin, :password, :password_confirmation) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:first_name, :surname, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:first_name, :surname, :email, :role_id, :line_manager, :admin, :password, :password_confirmation, :current_password) }\n\tend",
"def ensure_authentication_token\n if authentication_token.blank?\n self.authentication_token = generate_authentication_token\n end\n end",
"def make_facebook_model_valid!\n # These database fields are required if authenticable is used\n write_attribute(:password_salt, '') if self.respond_to?(:password_salt)\n write_attribute(:encrypted_password, '') if self.respond_to?(:encrypted_password)\n \n skip_confirmation! if self.class.skip_confimation_for_facebook_users && respond_to?(:skip_confirmation!)\n end",
"def generate_token\n self.token = Digest::MD5.hexdigest(\"PersonRecordToken#{email}#{Rails.application.config.try(:hash_salt)}\")[0..254]\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:first_name, :middle_initial, :last_name, :username, :type, :email, :password, :password_confirmation) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:logon, :username, :email, :password, :remember_me) }\n end",
"def create\n @user = User.find_by_email(params[:email])\n \n if @user and not @user.valid_password?(params[:password])\n @user.failed_attempts += 1\n if @user.failed_attempts >= Devise.maximum_attempts\n @user.lock_access!\n end\n @user.save\n @user = nil\n end\n \n if @user and @user.access_locked?\n @user = nil\n end\n \n if @user\n sign_in(:user, @user)\n current_user.reset_authentication_token!\n current_user.save!\n respond_to do |format|\n format.html {\n redirect_to show_token_authentications_path\n }\n format.json { \n redirect_to show_token_authentications_path({:format => :json})\n }\n end\n else\n respond_to do |format|\n format.html {\n redirect_to new_token_authentication_path, :alert => \"incorrect email or password\"\n }\n format.json { \n render :json => {:error => \"incorrect email or password\"}, :callback => params[:callback] \n }\n end\n end\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation) }\n end",
"def ensure_auth_token\n unless self.auth_token\n self.auth_token = User.generate_token\n end\n end",
"def email_required?\n true\n end",
"def email_required?\n user_tokens.empty?\n end",
"def valid_for_autosignin_token_authentication?(attributes)\n if (result = valid_autosignin_token?(attributes[:autosignin_token])) && self.class.devise_modules.include?(:lockable)\n self.failed_attempts = 0 if self.class.devise_modules.include?(:lockable)\n else\n if self.class.devise_modules.include?(:lockable)\n self.failed_attempts += 1\n lock_access! if failed_attempts > self.class.maximum_attempts\n end\n end\n reset_autosignin_token! if self.class.autosignin_expire\n save(:validate => false) if changed?\n result\n end",
"def ensure_authentication_token (remember)\n token = AuthToken.create!(token: generate_authentication_token,\n remember: remember,\n user_id: self.id)\n end",
"def model_class\n AuthenticationToken\n end",
"def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :profile_photo, :job_type, :username, :email])\n devise_parameter_sanitizer.permit(:sign_in, keys: [:login, :password,:password_confirmation])\n # devise_parameter_sanitizer.permit(:account_update, keys: [:username, :email, :profile_photo, :password, :password_confirmation, :current_password, :mobile_number])\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: [:email,:password,:remember_me])\n end",
"def remember_me\n self.remember_token_expires_at = 10.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate => false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate=> false)\n end",
"def after_create(user)\n #user.reset_perishable_token! # set the perishable token to some value\n #UserNotifier.deliver_signup_notification(user.email, user)\n end",
"def ensure_authentication_token! \n reset_authentication_token! if authentication_token.blank? \n end",
"def email_required?\n false\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:username, :email)\n end\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u|\n u.permit(:uid, :email, :password, :password_confirmation, :remember_me)\n }\n devise_parameter_sanitizer.for(:sign_in) { |u|\n u.permit(:login, :uid, :email, :password, :remember_me)\n }\n devise_parameter_sanitizer.for(:account_update) { |u|\n u.permit(:uid, :email, :password, :password_confirmation, :current_password)\n }\n end",
"def authenticate_user_from_token\n authenticate_with_http_token do |token, options|\n user_email = options[:email]\n user_email && User.where(email: user_email, authentication_token: token).first\n end\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit( :usuario , :nombre , :apellido , :email , :facebook , :twitter , :tipo_usuario_id , :password , :password_confirmation )\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit( :usuario , :nombre , :apellido , :email, :facebook , :twitter , :tipo_usuario_id , :password , :password_confirmation , :current_password )\n end\n end",
"def configure_permitted_parameters\n\t devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :first_name, :last_name, :about, :occupation, :field, :orientation, :interest, :physical, :free_time, :image, :gender, :birthday)}\n\tend",
"def user_params\n params.permit(:email)\n end",
"def configure_permitted_parameters\n\t devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:name, :email, :password, :password_confirmartion) }\n\tend",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate => false)\n end",
"def validate_email_presence?\n MinimalistAuthentication.configuration.validate_email_presence && validate_email?\n end",
"def email_required?\n (authentications.empty?) && super\n end",
"def setup_email_account\n email_accounts.create!(email: email, primary: true, confirmed: !confirmed_at.blank?)\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in) { |u| u.permit(:email, :password)}\n #devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:first_name, :last_name, :email, :password, :password_confirmation)}\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :password, :remember_me) }\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:realname, :username, :email, :phone, :password, :password_confirmation, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:realname, :email, :phone, :password, :password_confirmation, :current_password) }\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << [:name, :terms_and_conditions]\n devise_parameter_sanitizer.for(:account_update) << :name\n\n return unless user_signed_in?\n\n # Confirmed users cannot update their email address\n devise_parameter_sanitizer.for(:account_update).delete(:email) if current_user.confirmed_at?\n end",
"def email_required?\n super && twitter_uid.blank? || (!twitter_uid.blank? && persisted?)\n end",
"def after_token_authentication\n end",
"def after_token_authentication\n end",
"def enable_email_verification?\n false\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :password, :password_confirmation]) \n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :is_female, :date_of_birth, :email, :password, :password_confirmation, :current_password]) \n end",
"def ldap_before_save\n self.email = Devise::LDAP::Adapter.get_ldap_param(self.username, \"mail\").first\n self.encrypted_password = Devise::LDAP::Adapter.get_ldap_param(self.username, \"userPassword\").first\n display_name = Devise::LDAP::Adapter.get_ldap_param(self.username, \"displayName\" )\n if display_name.present?\n display_name = display_name.first.split(' ')\n self.firstname = display_name[1]\n self.lastname = display_name.shift\n end\n end"
] | [
"0.6453975",
"0.6439959",
"0.6416453",
"0.6392954",
"0.63522303",
"0.6340321",
"0.62730765",
"0.6260867",
"0.6226619",
"0.621187",
"0.61856496",
"0.61786246",
"0.6165335",
"0.61544305",
"0.6131984",
"0.6122918",
"0.611076",
"0.6102844",
"0.6083457",
"0.6057489",
"0.6046848",
"0.6034526",
"0.6021904",
"0.6021771",
"0.60190576",
"0.60006493",
"0.5968282",
"0.5952116",
"0.594871",
"0.5938175",
"0.5938117",
"0.5908063",
"0.5895495",
"0.58865577",
"0.5877999",
"0.58630127",
"0.58600825",
"0.58581215",
"0.5857586",
"0.58527195",
"0.58520573",
"0.5849278",
"0.5848788",
"0.5845662",
"0.58425426",
"0.58334905",
"0.581577",
"0.5809883",
"0.5791913",
"0.57918847",
"0.5790639",
"0.5788463",
"0.57825243",
"0.57825243",
"0.57819515",
"0.57731456",
"0.57699615",
"0.57651025",
"0.5759559",
"0.5751534",
"0.57451534",
"0.57440346",
"0.573985",
"0.5738369",
"0.5738245",
"0.5733888",
"0.5731868",
"0.57306737",
"0.57256705",
"0.5720077",
"0.5717489",
"0.5716799",
"0.57137716",
"0.5712013",
"0.57110107",
"0.5704829",
"0.5702373",
"0.56992626",
"0.5692005",
"0.56858766",
"0.56834024",
"0.56802845",
"0.5678253",
"0.56745964",
"0.5674173",
"0.56669223",
"0.5666445",
"0.5661146",
"0.5658252",
"0.5657114",
"0.56561834",
"0.5653392",
"0.5652189",
"0.5651016",
"0.56501615",
"0.56433743",
"0.56373113",
"0.56373113",
"0.56369287",
"0.5636853",
"0.5636415"
] | 0.0 | -1 |
method to get the number of data values specified by the values of the domain object | def number_of_values
Integer((@upper - @lower) / @step) + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count; @value.size; end",
"def value_count\n values.count\n end",
"def count\n @data.size\n end",
"def count\n @valueset.length\n end",
"def count(data)\n return data.length\n end",
"def length\n @values.length\n end",
"def count\n values.inject(0){|m, v| m + v.length}\n end",
"def length\n values.length\n end",
"def count\n dataset.count\n end",
"def Count()\n _getproperty(1, [], [])\n end",
"def size\n data.values.inject(0){|m,v| m+=v.size}\n end",
"def rows_count\n @values.count\n end",
"def count\n @data['count']\n end",
"def count\n @obj['count'].to_i\n end",
"def value_count\n $capitals.values.length\nend",
"def count\n filtered = apply_criteria(@data)\n filtered.count\n end",
"def domain_count\n @attributes[:domain_count]\n end",
"def getCount\n return @nodeValues.size\n end",
"def length\n\t\[email protected]\n\tend",
"def size\n values.flatten.size\n end",
"def size\n values.flatten.size\n end",
"def size\n values.flatten.size\n end",
"def size\n\n DataMapper.repository(@dm_repository) { DmExpression.count }\n end",
"def size\n values.flatten.size\n end",
"def size\n count = 0\n @properties.each do |gid, values|\n if ! values.empty?\n count += 1\n end\n end\n return count\n end",
"def length\n @data.length\n end",
"def length\n\n count_objects()\n end",
"def length\n case @type\n when :data\n return 0 if self.empty?\n 1\n when :list\n @data[:list].length\n end\n end",
"def length\n return @args[:data].length\n end",
"def ndata; end",
"def size\n @count\n end",
"def size\n @count\n end",
"def length\n @driver_instance.count_list_value(@key)\n end",
"def length\n @count\n end",
"def total_count()\n @raw_data.size\n end",
"def count\n to_a.size\n end",
"def count\n to_a.size\n end",
"def collect_values_with_count\n\t\tvalues = Hash.new {|h,k| h[k]=0}\n\t\tself.class.ecore.eAllAttributes.each do |a|\n\t\t\tv = self.send(:\"#{a.name}\")\n\t\t\tif v!=nil\n\t\t\t\tif a.many\n\t\t\t\t\tv.each {|el| values[el]+=1}\n\t\t\t\telse\n\t\t\t\t\tvalues[v]+=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tvalues\t\t\t\n\tend",
"def deep_length data\n case data\n when Hash then data.length + data.inject(0) {|sum,v| sum + deep_length(v[1])}\n when Array then data.length + data.inject(0) {|sum,v| sum + deep_length(v)}\n else 0\n end\n end",
"def length\n return @args[\"data\"].length\n end",
"def data_count\n @episodes.sum { |_, v| v.length }\n end",
"def size\n @data['results'].length\n end",
"def size\n @value.inject(0) {|acc, it| acc + it.size}\n end",
"def counts\r\n @counts\r\n end",
"def count\n self[:count].to_i\n end",
"def count\n folder.data_objects.all(parameters).count\n end",
"def count\n to_a.size\n end",
"def size\n return @args[:data].length\n end",
"def size\n @data.size\n end",
"def size\n @data.size\n end",
"def value_counts\n values = @data.each_with_object(Hash.new(0)) do |d, memo|\n memo[d] += 1\n end\n\n Daru::Vector.new(values)\n end",
"def n\n @clensing_data.size\n end",
"def total\n dataset.unlimited.count\n end",
"def get_field_count\n\t\tend",
"def length; count end",
"def length\r\n\t\[email protected]\r\n\tend",
"def field_count\n @fields.size\n end",
"def size\n value.size\n end",
"def dataset_length\n return 0 if self.length == 0\n return 1 unless @data[0].respond_to? \"length\"\n\n @data[0].length\n end",
"def size ; data['size'] ; end",
"def size\n val.size\n end",
"def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end",
"def length\n value.length\n end",
"def count\n @attributes['count']\n end",
"def records\n @process.instance_variable_get(:@values).count\n end",
"def get_label_value_length(label_values)\n lengths = []\n label_values.each do |lv|\n lengths << lv.size\n end\n lengths\nend",
"def size\n return @args[\"data\"].length\n end",
"def size\n @data_items.size\n end",
"def length\r\n self.count\r\n end",
"def size\n return @data.size\n end",
"def n\n x.size\n end",
"def count value=false, &block\n if block_given?\n @data.select(&block).count\n elsif value\n count { |val| val == value }\n else\n size - indexes(*Daru::MISSING_VALUES).size\n end\n end",
"def trait\n @raw_data.size\n end",
"def quantityFields\n return @elements.length\n end",
"def count\n underlying_array.length\n end",
"def size\n @data.size\n end",
"def size\n @data.size\n end",
"def size\n @data.size\n end",
"def size\n @obj['results'].length\n end",
"def row_count\n result = get_filtered_dataset true\n\n result['data'].first.values.first\n end",
"def count\n all.size\n end",
"def length\n @val.length\n end",
"def number_of_sales\n sales.length\n end",
"def number_of_sales\n sales.length\n end",
"def item_count\n item_values.values.compact.sum { |v| v.is_a?(Array) ? v.size : 1 }\n end",
"def length\n data_sets.length\n end",
"def length(include_deleted = false)\n values(include_deleted).length\n end",
"def length; @records.length; end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count; end",
"def count; end",
"def count; end",
"def number_of_sales\n product_sales = self.sales\n num_of_sales = product_sales.length\n return num_of_sales\n end",
"def variable_count\n variables.size\n end",
"def count\n elements.count\n end",
"def length\n count\n end",
"def count_objects\n count = 0\n @objects.keys.each do |key|\n count += @objects[key].length\n end\n\n return count\n end",
"def size\n return @data.size\n end",
"def size\n \[email protected]\n end"
] | [
"0.77504927",
"0.75499654",
"0.739095",
"0.72951",
"0.709219",
"0.70900136",
"0.70258766",
"0.6947495",
"0.693233",
"0.6901595",
"0.6877374",
"0.6866073",
"0.6854823",
"0.68457043",
"0.68240345",
"0.68150157",
"0.67930543",
"0.67907363",
"0.6783369",
"0.67362374",
"0.67362374",
"0.67362374",
"0.6705592",
"0.6689063",
"0.66799104",
"0.66529286",
"0.665263",
"0.66197467",
"0.661267",
"0.6602918",
"0.65810186",
"0.65810186",
"0.6563193",
"0.6544395",
"0.65381634",
"0.6531332",
"0.6531332",
"0.6495629",
"0.6491228",
"0.6480204",
"0.64791584",
"0.6477583",
"0.6472278",
"0.6444482",
"0.64417315",
"0.6434769",
"0.6433956",
"0.6432624",
"0.6431143",
"0.6431143",
"0.6430658",
"0.6424472",
"0.64138484",
"0.64096385",
"0.64012635",
"0.6364246",
"0.636371",
"0.6348991",
"0.6336125",
"0.63358265",
"0.63339216",
"0.6330225",
"0.6329299",
"0.63273305",
"0.6321996",
"0.63206017",
"0.63187987",
"0.63143235",
"0.6313271",
"0.6312216",
"0.630921",
"0.6307668",
"0.62961495",
"0.62763125",
"0.6269681",
"0.6266027",
"0.6266027",
"0.6266027",
"0.6261167",
"0.62573165",
"0.62564355",
"0.62519485",
"0.6250525",
"0.6250525",
"0.624341",
"0.62427825",
"0.6228269",
"0.62243664",
"0.62225467",
"0.62225467",
"0.62225467",
"0.6221424",
"0.6221424",
"0.6221424",
"0.62199855",
"0.6215575",
"0.6211124",
"0.6206255",
"0.61968607",
"0.61750144",
"0.6155976"
] | 0.0 | -1 |
Exercise Example input_prices = [19,19,19,17,17,17] Set of prices where there is no apporiate time to buy. input_prices = [66,65,64,63,55,17,3,6,9,15,21,3,8,2,6,21,3,1,10] crazy array | def stock_picker (array)
b = [] # Contains index of all valid max numbers
palce_holder = []
valid_max = nil
max_finder = 0
min = nil
max = nil
if array.length == 0
puts "No Data Available."
return nil
end
if array.max == array[0]
while array[max_finder] == (array[max_finder..array.length-1]).max
if (array[max_finder..array.length-1]).max == array.min
puts "An investment strategy could not be formulated based on the information supplied."
return nil
end
max_finder += 1
end
valid_max = array[max_finder..array.length-1].max
else
valid_max = array.max
end
#unless valid_max == array.min
0.upto(array.length-1) do |x|
if array[x] == valid_max
b << x
end
end
max = b.last
min = array.index(array[0..max].min)
puts "#{[min,max]} for a profit of $#{array[max] - array[min]}"
[min,max]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock_picker(prices)\n combinations = prices.combination(2).to_a\n profits = combinations.map { |days| days[1] - days[0] }\n (0...prices.size).to_a.combination(2).to_a[profits.index(profits.max)]\nend",
"def stock_picker(array)\n\n#store 2 numbered arrays that consist of every combination of numbers in the passed array\n manipulate_array = array.combination(2).to_a\n\n# change each array's 2 index to contain the difference of the two numbers\n manipulate_array.each do |i|\n i.push(i.max - i.min) \n end\n \n# sort the array by thier difference from largest to smalles \n sorted_array = manipulate_array.sort {|a,b| b[2] <=> a[2]}\n \n sorted_array.each do |i|\n# delete the sum from each combonation \n i.delete_at(2)\n# return the position of the smallest price that comes before the postion of the highest price (returning day to buy low then return the day to buy high)\n if array.index(i.min) < array.index(i.max)\n return [array.index(i.min),array.index(i.max)]\n break\n elsif i == sorted_array.last\n return \"There are no buy opportunities in this set of stock prices\"\n end\n end\nend",
"def stock_picker(prices_arr)\n buy_price = prices_arr[0]\n buy_index = 0\n profit = 0\n range = [0, 0]\n\n prices_arr.each_with_index do |price, index|\n if price < buy_price\n buy_price = price\n buy_index = index\n next\n end\n\n if price - buy_price > profit\n profit = price - buy_price\n range = [buy_index, index]\n end\n end\n return range\nend",
"def stock(prices)\n\n all_choices = []\n\n prices.each_with_index do |buy, i1|\n prices.each_with_index do |sell, i2|\n next if i1 >= i2 \n all_choices << [buy, sell]\n end\n end\n\n best_choice = 0 # []\n\n all_choices.each do |combination| # [ [] ] \n buy_price, sell_price = combination\n profit = sell_price - buy_price\n if profit > best_choice[1] - best_choice[0]\n best_choice = [buy_price, sell_price]\n end\n end\n best_choice\nend",
"def stock_picker(prices) \n min_price = Float::INFINITY\n day_min_cost = 0\n max_price = -Float::INFINITY\n profit = -Float::INFINITY\n best_days = []\n\n prices.each_with_index do |price, day|\n if price < min_price \n min_price = price\n day_min_cost = day\n end\n \n if price - min_price > profit && day > day_min_cost\n max_price = price\n profit = price - min_price\n best_days = [day_min_cost, day]\n end\n end\n\n if best_days.empty?\n # In the case that the prices are decreasing order and there are no duplicates, the best days \n # to buy is the second to last day and the best day to sell is the last day\n best_days = [prices.length - 2, prices.length - 1]\n else\n best_days\n end\nend",
"def stock_picker(price_arr)\n\n profit = 0\n \n # Handles edge case of first price being a low point\n if price_arr[0] < price_arr[1]\n if price_arr.max - price_arr[0] > profit\n profit = price_arr.max - price_arr[0]\n best_range = [0, price_arr.index(price_arr.max)]\n end\n end\n \n #finds low points and their max earning potential updating the best range as it goes\n index = 1 # index is stepped up each loop to keep up with the index of the price\n price_arr[1..-2].each do |price|\n remaining_prices = price_arr[index..-1]\n if price_arr[index - 1] > price && price_arr[index + 1] > price\n if remaining_prices.max - price > profit\n profit = remaining_prices.max - price\n best_range = [price_arr.index(price), remaining_prices.index(remaining_prices.max) + index]\n end\n end\n index +=1 # index stepper\n end\n \n puts \"profit = #{profit}$\"\n best_range\n end",
"def stock_prices(array)\n\tlargest_difference = 0\n\tarray.each_with_index {| value, index| \n\t\tarray.each { |i|\n\t\t\tdifference = value - i\n\t\t\tif (difference <= largest_difference) && (index < array.rindex(i))\n\t\t\t\tnegative_array = [] << difference\n\t\t\t\tnegatives = [index, array.rindex(i)]\n\t\t\t\tlargest_difference = difference\n\t\t\tend\n\t\t\t}\n\t\t}\n\t\tif negative_array.nil?\n\t\t\tputs \"Buy/sell [0,1]\"\n\t\telse\n\t\t\tputs \"Buy/sell #{negatives}\"\n\t\tend\n\tend",
"def stock_picker(prices)\n buy_date = 0\n sell_date = 0\n max_profit = 0\n \n (0...prices.size).each do |buy|\n ((buy + 1)...prices.size).each do |sell|\n \n profit = prices[sell] - prices[buy] \n if max_profit < profit\n max_profit = profit\n buy_date = buy\n sell_date = sell\n end\n end\n end\n [buy_date, sell_date]\nend",
"def stock_picker prices\n\tbest_days = []\n\tbest_profit = 0\n\n\tprices.length.times do |i|\n\t\tj = i\n\t\tfor j in i...prices.length\n\t\t\tif prices[j] - prices[i] > best_profit\n\t\t\t\tbest_profit = prices[j] - prices[i]\n\t\t\t\tbest_days[0] = i\n\t\t\t\tbest_days[1] = j\n\t\t\tend\n\t\tend\n\tend\n\tbest_days\nend",
"def stock_picker(prices)\r\n\tprice_to_buy = 0\r\n\tprice_to_sell = 0\r\n\tprofit = 0\r\n\r\n\tprices[0..-2].each_with_index do |buy, index_buy|\r\n\t\tprices[(index_buy + 1)..-1].each_with_index do |sell, index_sell|\r\n\t\t\tif profit < sell - buy\r\n\t\t\t\tprofit = sell - buy\r\n\t\t\t\tprice_to_buy = index_buy\r\n\t\t\t\tprice_to_sell = index_sell + (index_buy + 1)\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\t[price_to_buy, price_to_sell]\r\nend",
"def stock_picker(array)\n best_buy = 0\n best_sell = 0\n max_profit = 0\n\n #first iterate through the array to find a buy day\n (0..(array.length-2)).each do |buy_date|\n\n #for each possible buy day, iterate through each sell day\n ((buy_date + 1)..array.length - 1).each do |sell_date|\n\n #check the price difference for those two days\n price_difference = array[sell_date] - array[buy_date]\n\n #if price diff is larger than the current max profit, store those days and max profit\n if price_difference > max_profit\n best_buy = buy_date\n best_sell = sell_date\n max_profit = price_difference\n end\n end\n end\n puts \"day #{best_buy}: buy at #{array[best_buy]}\"\n puts \"day #{best_sell}: sell at #{array[best_sell]}\"\n puts \"profit of #{max_profit}\"\n\n return [best_buy, best_sell]\nend",
"def your_price(array_homes)\n\tprice = gets.chomp.to_i\n\tarray_budget = array_homes.select do |hm|\n\t\tprice >= hm.price\n\tend\n\tlist(array_budget)\nend",
"def stock_picker(prices)\n\n profit = 0\n\n (prices.length - 1).times do |i|\n\n curr_buy_price = prices[0]\n prices.delete_at(0)\n\n if prices.max - curr_buy_price > profit\n profit = prices.max - curr_buy_price\n buy_index = i\n sell_index = i + prices.index(prices.max) + 1\n @best_days = [buy_index, sell_index]\n end\n\n end\n\n p @best_days\n \nend",
"def stock_prices(array)\n i = 0\n \n max_profit = -1\n buy_day = nil\n sell_day = nil\n \n length = array.length\n \n while i < length - 1\n j = i + 1\n \n while j < length\n profit = array[j] - array[i]\n \n if profit > max_profit\n max_profit = profit\n buy_day = i\n sell_day = j\n end\n \n j += 1\n end\n \n i += 1\n end\n \n return \"Buy day: #{buy_day}. Sell day: #{sell_day}.\"\nend",
"def stock_picker daily_prices_array\n best_buy_day = 0\n best_sell_day = 0\n best_profit = 0\n for buy_day in 0...daily_prices_array.length\n for sell_day in buy_day...daily_prices_array.length\n if daily_prices_array[sell_day] - daily_prices_array[buy_day] > best_profit\n best_profit = daily_prices_array[sell_day] - daily_prices_array[buy_day]\n best_sell_day = sell_day\n best_buy_day = buy_day\n end\n end\n end\n [best_buy_day, best_sell_day]\nend",
"def single_profit(prices)\n profit = 0\n i = 0\n while i < prices.length do\n remainder = prices.slice(i+1, prices.length-1)\n if remainder.length > 0\n value = remainder.max - prices[i]\n if value > profit\n profit = value\n end\n end\n i+=1\n end\n profit\n \nend",
"def buy_and_sell_price(prices)\n return if prices.length < 2\n\n buy_price = prices[0]\n current_buy_price = buy_price\n max_profit = (prices[1] - buy_price)\n\n for i in 2..prices.length - 1\n profit = prices[i] - current_buy_price\n\n if profit > max_profit\n buy_price = current_buy_price\n max_profit = profit\n else\n current_buy_price = [current_buy_price, prices[i]].min\n end\n end\n\n [buy_price, max_profit + buy_price]\nend",
"def stock_picker prices\n max_profit = 0-Float::INFINITY\n buy_day = 0\n sell_day = 0\n\n prices.each.with_index do |first_price,first_index|\n profits_for_day = prices.map.with_index do |second_price,second_index|\n if first_index < second_index\n second_price - first_price\n else\n 0-Float::INFINITY\n end\n end\n max_profit_for_day = profits_for_day.max\n if max_profit_for_day > max_profit\n max_profit = max_profit_for_day\n buy_day = first_index\n sell_day = profits_for_day.index(max_profit_for_day)\n end\n end\n\n return [buy_day,sell_day]\nend",
"def solution(unsorted_prices, max_price)\n prices_to_counts = Array.new(max_price + 1, 0)\n\n unsorted_prices.each do |price|\n prices_to_counts[price] += 1\n end\n\n sorted_prices = []\n\n prices_to_counts.each_with_index do |price, count|\n (0...count).each do |time|\n sorted_prices << price\n end\n end\n\n sorted_prices\nend",
"def stock_picker(array)\n sorted_stocks = array.sort.reverse\n profit = 0\n days_buy_sell = []\n sorted_stocks.each do |price_sell|\n array.each do |price_buy|\n if price_buy < price_sell && array.index(price_sell) > array.index(price_buy) && price_sell - price_buy > profit\n days_buy_sell = [array.index(price_buy), array.index(price_sell)]\n profit = price_sell - price_buy\n end\n end\n end\n days_buy_sell\nend",
"def pick_stocks(prices)\n profits = []\n pairs = []\n prices.each_with_index do |price_b, buy_date|\n prices.each_with_index do |price_s, sell_date|\n if sell_date > buy_date\n profits << price_s - price_b\n pairs << [buy_date, sell_date]\n end\n end\n end\n pairs[profits.index(profits.max)]\nend",
"def stock_picker(prices)\n\t# Initialize everything to 0\n\tmin = 0\t\t\t# Day with lowest price so far\t\t\t\t\t\n\tbuy = 0\t\t\t# Buy day with best max_diff so far\n\tsell = 0\t\t# Sell day with best max_diff so far\n\tmax_diff = 0\t# Best value of prices[sell]-prices[buy]\n\t(1...prices.length).each do |i|\n\t\t# Go through each day - not necessary to do the first\n\t\tif prices[i] < prices[min]\n\t\t\t# If current price is less than current min:\n\t\t\tmin = i\t\t\t\t\t\t# Set as current min\n\t\tend\n\t\tdiff = prices[i] - prices[min]\t# Compare difference to current min\n\t\tif diff > max_diff\n\t\t\t# If it's better:\n\t\t\tbuy = min\t\t\t\t\t# Record min as day to buy\n\t\t\tsell = i\t\t\t\t\t# Record current day as day to sell\n\t\t\tmax_diff = diff\t\t\t\t# Record new max difference\n\t\tend\n\tend\n\t[buy, sell]\nend",
"def stock_picker(array)\n profit = -999999\n counter = 0\n result = []\n while counter < array.length - 1\n array.each_with_index do |el, index|\n if counter < index && profit < (el - array[counter])\n profit = el - array[counter]\n result[0] = counter\n result[1] = index\n end\n end\n counter += 1\n end\n result\nend",
"def stock_picker(prices)\n i = 0\n diff = 0\n best_days = []\n (i...prices.length).each do |index_one|\n (i + 1...prices.length).each do |index_two|\n if prices[index_two] - prices[index_one] > diff\n diff = prices[index_two] - prices[index_one]\n best_days = [index_one, index_two]\n end\n end\n end\n best_days\n end",
"def stock_picker(prices)\n acc_profit = 0\n acc_buy_date = 0\n acc_sell_date = 0\n \n profits = prices.map.with_index do |price, index|\n remaining_days = prices[index..-1] # to create an array that becomes smaller each iteration from index 0\n maximum = remaining_days.max # to identify the maximum number in that iteration's array\n highest_value = maximum - price # price is at index 0, so maximum minus minimum for each one will help identify the best buy/sell dates\n \n # create accumilator for index and value of highest profit\n if highest_value > acc_profit\n acc_profit = highest_value\n acc_buy_date = prices.index(price)\n acc_sell_date = prices.index(maximum)\n end\n\n end\n \n p \"Buy on day #{acc_buy_date} and sell on day #{acc_sell_date} for a profit of $#{acc_profit}.\"\n end",
"def stock_picker(price_arr)\n profit = 0\n trade_days = [0,0]\n price_arr.each_with_index do |buy_value, buy_day|\n price_arr.each_with_index do |sell_value, sell_day|\n if (sell_value - buy_value) > profit\n profit = (sell_value - buy_value)\n trade_days[0] = buy_day\n trade_days[1] = sell_day\n end\n end\n end\n \"buy on #{trade_days[0]} and sell on #{trade_days[1]} for a profit of #{profit}\"\nend",
"def stock_picker(arr)\n profit = 0\n bestdays = []\n\n arr.each_with_index do |buyp, buyi|\n arr.each_with_index do |sellp, selli|\n next unless buyi < selli && (sellp - buyp) > profit\n\n profit = sellp - buyp\n bestdays[0] = buyi\n bestdays[1] = selli\n end\n end\n puts \"#{bestdays[0]} and #{bestdays[1]}\"\nend",
"def exit_price_array(n = 100)\n min = liq_pref\n max = equilibrium_price\n range = max - min\n dx = range/n\n (1..n).to_a.map{|i| min + i*dx}\n end",
"def stock_picker(arr)\n days = Array.new(2,0)\n profit = 0\n min_index = 0\n cost = arr.first\n\n arr.each_with_index do |price, index|\n if price < cost\n cost = price\n min_index = index\n next\n end\n if (price - cost) > profit\n days = [min_index, index] \n profit = price - cost\n end\n end\n days\nend",
"def stock_picker(prices)\n\tgreatest_profit = 0\n\tbuy_day, sell_day = nil, nil\n\n\t(prices.length - 1).times do |day|\n\t\t((day+1)..(prices.length - 1)).each do |day2|\n\t\t\tcurrent_profit = prices[day2] - prices[day]\n\n\t\t\tif current_profit > greatest_profit\n\t\t\t\tbuy_sell = [day,day2] \n\t\t\t\tgreatest_profit = profit\n\t\t\tend\n\t\tend\n\tend\n\n\treturn [buy_day, sell_day]\nend",
"def stock_picker(prices)\n\n\t# Best available [buy, sell] days for each buy day\n\tbest_days = []\n\tprices.each_index do |i|\n\t\tavailable_days = prices[i...prices.size] # only same day or after are valid sell days\n\t\tbest_days << [i, prices.index(available_days.max)]\n\tend\n\n\t# Calculates profit of each best day, same size and index as best_days\n\tprofits = []\n\tbest_days.each {|i| profits << prices[i[1]] - prices[i[0]] }\n\n\t# Returns [buy, sell] day pair matching index of highest profit\n\tbest_days[profits.index(profits.max)]\nend",
"def stock_picker(prices)\n price_diff = 0\n count = 0\n best_days_array = []\n\n prices.each do |price1|\n count += 1\n prices.each do |price2|\n if count > prices.index(price2)\n next\n else\n if (price2 - price1) > price_diff\n price_diff = (price2 - price1)\n best_days_array = [prices.index(price1), prices.index(price2)]\n end\n end\n end\n end\n puts best_days_array\nend",
"def stock_picker(array)\n\n\n\ti = 0 \n\tj = 1\n\n\tprofit_list = Array.new\n\n\twhile i < array.length do\n\t\twhile (j <= array.length && j > i) do\n\t\t\tprofit = array[j].to_i - array[i].to_i\n\t\t\tprofit_list << profit\n\t\t\tif profit_list.max == profit\n\t\t\t\tbuy = i\n\t\t\t\tsell = j\n\t\t\tend\n\t\t\t\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\t\tj = i + 1\n\tend\n\tputs [buy,sell]\nend",
"def stock_picker(arr)\n final_profit = 0\n current_profit = 0\n final_dates = []\n\n arr.each do |buy_price|\n buy_date = arr.index(buy_price)\n \n arr.each do |sell_price| \n sell_date = arr.index(sell_price)\n \n if (sell_date > buy_date && sell_price > buy_price) \n current_profit = sell_price - buy_price\n if current_profit > final_profit\n final_profit = current_profit\n final_dates = [buy_date, sell_date]\n end\n end \n end\n end\n puts final_dates\nend",
"def stock_picker(array)\n max_profit = 0\n buy_sell_days = [0,0]\n array.each_with_index do |buy_price, buy_day|\n array.each_with_index do |sell_price, sell_day|\n if buy_day > sell_day\n next\n end\n if sell_price - buy_price > max_profit\n max_profit = sell_price - buy_price\n buy_sell_days = [buy_day, sell_day]\n end\n end \n end \n p buy_sell_days\nend",
"def stock_picker(prices)\n days = [0,0]\n profit = 0\n i = 0\n\n while i < prices.size\n n = i + 1\n while n < prices.size\n dividend = (prices[n].to_i - prices[i].to_i)\n if dividend > profit\n profit = dividend\n days[0] = prices.index(prices[i])\n days[1] = prices.index(prices[n])\n end\n n += 1\n end\n i += 1\n end\n print \"Buy at $#{prices[days[0]]} and sell at $#{prices[days[1]]}\"\n puts \" on days #{days} for a profit of $#{prices[days[1]] - prices[days[0]]}!\"\nend",
"def stock_picker(prices)\n\t# Storing variables what I use later\n\t$d = 0\n\t$small = 0\n\t$big = 0\n\tprices.each do |x|\t\t\t# iterating through all prices elements\n\t\ty = prices.index(x)+1 \t# y is the next element in prices array\n\t\twhile y < (prices.length)\t# it runs till we have something in the array\n\t\t\tif (x-prices[y]) < $d \t# only runs when the difference of x element and the next one is lower than the previous pair's (which is stored in $d)\n\t\t\t\t$d = x-prices[y] \t# so we store the lowest difference in $d\n\t\t\t\t$small = prices.index(x) \t# we store in $small the index number of x in the array, that is the day when we need to buy, the lowest price\n\t\t\t\t$big = y \t\t\t\t\t# y is the index number in the array of the number, which is the highest, and have the biggest difference with x\n\t\t\t\ty += 1 \t\t\t\t\t\t# add +1 to y so we can loop through the array\n\t\t\telse\n\t\t\t\ty += 1 \t\t\t\t\t\t# if the difference of the following pair is not smaller than the previous ones then we just move on and don't change $small and $big and $d\n\t\t\tend\n\t\tend\n\tend\n\tresult = []\n\tresult.push($small, $big) \t\t\t# pushing the results into result array\n\tputs result\nend",
"def stock_picker(prices)\n profits_per_day = {}\n prices.each_with_index do |value, index|\n break if index == prices.length - 1\n profit = prices[index + 1] - value\n if (index + 1 == prices.length - 1)\n profits_per_day[profit] = [index, index + 1]\n break\n end\n for i in (index + 2..prices.length - 1)\n profit = prices[i] - value > profit ? prices[i] - value : profit\n end\n profits_per_day[value] = profit\n end\n return profits_per_day.max_by{|k,v| v}\nend",
"def stock_picker(number_array)\n #Stores current profit to be gained\n profit = 0\n #Stores the maximum profit from the combination of previous days\n max_profit = 0\n #Stores the days in which max profit can be had. stored_days[0] is buy day. stored_days[1] is sell day\n stored_days = [0, 0]\n\n #Loops through all numbers in array. Compares each iteration against all numbers from the iteration to the end of the array for max profit\n for i in 0..number_array.length-1\n # p \"Day #{i}: \"\n for j in i..number_array.length-1\n if number_array[j] < number_array[i]\n break\n else\n profit = number_array[j] - number_array[i]\n # p \"buy: \" + number_array[i].to_s + \" sell: \" + number_array[j].to_s + \" profit: \" + profit.to_s\n if profit > max_profit\n max_profit = profit\n stored_days[0] = i\n stored_days[1] = j\n end\n end\n end\n end\n return stored_days\nend",
"def stock_picker(array)\n # loop through array twice. Once to take value, 2nd to compare, store index into result\n result = []\n profit, buy_day, sell_day = 0, 0, 0\n\n array.size.times do |n|\n (n + 1).upto (array.size - 1) do |i|\n if (array[n] - array[i]) > profit\n profit = array[n] - array[i]\n buy_day = n\n sell_day = i\n end\n end\n end\n [buy_day, sell_day]\nend",
"def stock_picker(prices)\n index = 0\n lowest = 0\n best_value = []\n for i in prices\n for j in prices[index..prices.length-1]\n if i - j < lowest\n lowest = i - j # lowest will be equal to the greatest price difference (greatest negative number)\n min = prices.index(i) # index of buy date\n max = prices.index(j) # index of sell date\n end\n end\n index += 1 # increments each iteration to ensure sell dates cannot be past dates\n end \n best_value << min\n best_value << max\n puts \"#{best_value} If you buy on day #{min} and sell on day #{max},\n you will make $#{lowest.abs} profit.\"\nend",
"def solution(a)\n return 0 if a.count <= 1\n \n max_profit = 0\n min_price = a.first\n a[1..-1].each { |price|\n max_profit = [max_profit, price - min_price].max\n min_price = [min_price, price].min\n }\n max_profit\nend",
"def stock_picker(prices)\n\tmax_diffs_for_each_day = []\n\tsecond_days_for_each_max_diff = []\n\t# the - 1 ignores buys on the last day, which can't be sold\n\t# also keeps the remaining_prices range beginning from overshooting its end\n\tfor day in (0...(prices.length - 1)) \n\t\tremaining_prices = prices[(day + 1)...prices.length]\n\t\tmax_remaining_price = remaining_prices.max\n\t\tmax_diffs_for_each_day << (max_remaining_price - prices[day])\n\t\t# for tied maxes, index will return the earliest day, which we want\n\t\t# the + 1 accounts for zero-indexing of remaining_prices\n\t\tsecond_days_for_each_max_diff << (remaining_prices.index(max_remaining_price) + day + 1)\n\tend\n\tmaxest_diff = max_diffs_for_each_day.max\n\t# for tied maxes, index will return the earliest day, which we want\n\tfirst_day = max_diffs_for_each_day.index(maxest_diff)\n\tsecond_day = second_days_for_each_max_diff[first_day]\n\t[first_day, second_day]\nend",
"def stock_picker(ary)\n trade = ary.combination(2).to_a.reject {|x, y| x >= y}.max_by {|x, y| y-x}\n trade.nil? ? \"no trade\" : trade.map {|p| ary.index(p)}\nend",
"def stock_picker(arr)\n profits = []\n arr.each_with_index do |price, day|\n arr[day + 1..-1].each do |price2, day2|\n profit = price - price2\n profits << profit.abs if profit.negative?\n end\n end\n profits.empty? ? -1 : profits.max\nend",
"def stock_picker prices\n\tbest_buy_date = nil\n\tbest_sell_date = nil\n\tbest_profit = 0\n\tprices.each_index do |buy_date|\n\t\t(buy_date+1...prices.length).each do |sell_date|\n\t\t\tprofit = prices[sell_date] - prices[buy_date]\n\t\t\tif profit > best_profit\n\t\t\t\tbest_profit = profit\n\t\t\t\tbest_buy_date = buy_date\n\t\t\t\tbest_sell_date = sell_date\n\t\t\tend\n\t\tend\n\tend\n\t[best_buy_date,best_sell_date]\nend",
"def highest_possible_profit(prices)\n best_profit = 0\n # iterate over the dataset\n prices.each_with_index do |price, index|\n # in each hour compare with the future hours to find difference\n\n # check if difference is positive\n # check if difference is greater than current best\n # keep best difference\n # check next hour\n\n end\n # end return the best difference\n\nend",
"def max_profit_cooldown(prices)\n return 0 if prices.length < 2\n\n p \"has1_doNothing\", has1_doNothing = -prices[0]\n\tp \"has0_Buy\", has0_Buy = -prices[0]\n\tp \"has0_doNothing\", has0_doNothing = 0\n p \"has1_Sell\", has1_Sell = 0\n i = 1\n while i < prices.length\n\t\tp \"has1_doNothing\", has1_doNothing = has1_doNothing > has0_Buy ? has1_doNothing : has0_Buy\n\t\tp \"has0_Buy\", has0_Buy = -prices[i] + has0_doNothing\n\t\tp \"has0_doNothing\", has0_doNothing = has0_doNothing > has1_Sell ? has0_doNothing : has1_Sell\n\t\tp \"has1_Sell\", has1_Sell = prices[i] + has1_doNothing\n i += 1\n\tend\n has1_Sell > has0_doNothing ? has1_Sell : has0_doNothing\nend",
"def stock_picker(stock_array)\n\n day_hash = Hash.new(0)\n day_index = 0\n stock_array.each { |day_number|\n day_hash[day_index] = day_number\n day_index += 1\n }\n\n day_hash_sell = day_hash.clone\n profit_best = Hash.new(0)\n profit_best_counter = nil\n day_hash.each do |key, value|\n\n buy = -value \n day_hash_sell.each do |key_sell, value_sell|\n\n #ensure day is only in futue\n if key_sell <= key then \n next\n end\n\n profit = buy + value_sell \n if profit_best_counter == nil || profit > profit_best_counter then \n #reset hash to ensure only 1 answer given\n profit_best = Hash.new(0)\n\n #track best days to buy/sell in array\n profit_best[key] = key_sell\n\n #keep track of best profit so far\n profit_best_counter = profit\n end \n end \n end\n puts profit_best\nend",
"def stockPicker(prices)\n pair = [0,0]\n profit = 0\n prices.each_with_index do |buy, i|\n # Find highest sell day\n sell = prices[i..-1].max\n if profit < (sell-buy)\n pair[0] = i\n pair[1] = prices[i..-1].index(sell)+i # Find index of that sell day\n profit = sell-buy\n end\n end\n pair\nend",
"def maximum_profit(prices)\n max_profit = 0\n (2..prices.length - 2).to_a.each do |idx|\n first_transaction = max_difference(prices.slice(0, idx))\n second_transaction = max_difference(prices.slice(idx, prices.length))\n profit = first_transaction + second_transaction\n max_profit = profit if profit > max_profit\n end\n max_profit\nend",
"def stock_picker(arr)\n\tbuy_day = 0\n\tsell_day = 0\n\told_profit = -999\n\n\tarr.each_with_index do |buy_price, buy_index|\n\t\tarr.each_with_index do |sell_price, sell_index|\n\t\t\tif sell_index <= buy_index\n\t\t\t\tnext\n\t\t\tend\n\t\t\tnew_profit = sell_price - buy_price\n\t\t\tif new_profit > old_profit\n\t\t\t\told_profit = new_profit\n\t\t\t\tbuy_day = buy_index\n\t\t\t\tsell_day = sell_index\n\t\t\tend\n\t\tend\n\tend\n\treturn [buy_day,sell_day]\nend",
"def stock_picker(arr)\n lowest = [arr[0],0]\n highest = [arr[0],0]\n lowest_i = highest_i = nil\n max_gain = 0\n \n for i in 1...arr.count\n # Every time see a price drop compare to previous price\n # 1. calculate the max gain from all previous time span\n # 2. if this current max gain is greater than all time max gain, it becomes the new all time max gain\n # 3. record lowest and highest price index\n if arr[i] < arr[i-1]\n if max_gain < highest[0] - lowest[0]\n max_gain = highest[0] - lowest[0]\n lowest_i, highest_i = lowest[1], highest[1]\n end\n end\n # This is the tricky part. Whenever found a new lowest price:\n # Reset highest price, because previous highest price don't matter no more\n highest = lowest = [arr[i], i] if arr[i] < lowest[0]\n # This is just every time it found a higher highest price, will use the higher price\n highest = [arr[i], i] if arr[i] > highest[0]\n end\n [lowest_i, highest_i]\nend",
"def stock_picker(array)\n best_days = Hash.new(0)\n\n array.each_with_index do |buy_price, idx1|\n buy_day = idx1\n (idx1 + 1...array.length).each do |idx2|\n sell_day = idx2\n sell_price = array[idx2]\n if buy_price <= sell_price\n best_days[[buy_day, sell_day]] = sell_price - buy_price\n end\n end\n end\n result = greatest_value_in_hash(best_days)\n\n # Days start at 0, wchich is the very first day of the prices\n return \"Best day to buy: #{result[0]}\\nBest day to sell: #{result[1]}\\nProfit: $#{result[2]}\"\nend",
"def stock_picker(stock_prices)\n buying_price = 0\n buying_index = 0\n selling_price = 0\n max_profit = -1\n max_buy_index = 0\n max_sell_index = 0\n\n change_buy = true\n\n stock_prices.each_with_index do |price, day|\n selling_price = stock_prices[day + 1].to_i\n\n if change_buy\n buying_price = price.to_i\n buying_index = day\n end\n\n if buying_price > selling_price\n change_buy = true;\n else\n profit = selling_price - buying_price\n if profit > max_profit\n max_profit = profit\n max_sell_index = day + 1\n max_buy_index = buying_index\n end\n change_buy = false;\n end\n\n end\n\n [max_buy_index, max_sell_index]\n\nend",
"def stock_picker(arr)\n \n max = 0\n day1 = 0\n day2 = 0\n\n arr.length.times do |buy|\n arr.length.times do |sell|\n if buy < sell && (arr[sell] - arr[buy] > max)\n day1 = buy\n day2 = sell\n max = arr[day2] - arr[day1]\n end\n end\n end\n\n return [day1, day2]\nend",
"def on_2(prices)\n max_profit = 0\n min_valley = prices.max\n\n prices.each do |number|\n if number < min_valley\n min_valley = number\n elsif number - min_valley > max_profit\n max_profit = number - min_valley\n end\n end\n\n max_profit\n end",
"def stock_picker(arr)\n buy = \"\"\n sell = \"\"\n biggest_difference = 0\n profit = 0\n arr.each_with_index do |day, index|\n #no days after last day so last day can't be the buy day\n if (day != arr[-1])\n #sell date must be after purchase date, therefore only want indicies after current\n future_date = (index +1)\n while future_date < arr.length\n profit = arr[future_date] - arr[index]\n if profit > biggest_difference\n buy = index\n sell = future_date\n biggest_difference = profit\n end\n future_date += 1\n end\n end\n end\n [buy,sell]\nend",
"def stock_picker(input)\n \n best_profit = 0\n buy_sell_days = [0,0]\n \n# Since we need to buy before we can sell, we should only consider\n# buying up until the second-to-last day:\n \n for x in 0..input.length-2\n \n# We'll always sell after we buy, so we use nested 'for' loops to\n# check our sell value against our buy value and store our max profit:\n \n for y in 1+x..input.length-1\n \n profit = (input[y] - input[x])\n \n if profit > best_profit\n best_profit = profit\n buy_sell_days = [x,y]\n end\n \n end\n \n end\n \n return buy_sell_days\n \nend",
"def get_max_profit_2(array)\n\n max_profit = 0\n\n # go through every price (with it's index as the time)\n array.each_with_index do |number, index|\n\n # and go through all the LATER prices\n for later_price in array[index+1..-1]\n\n # see what our profit would be if we bought at the\n # earlier price and sold at the later price\n potential_profit = later_price - number\n\n # update max_profit if we can do better\n max_profit = [max_profit, potential_profit].max\n end\n end\n\n return max_profit\nend",
"def spicy_food(spice_arr, price_arr)\n \n i=0\n new_arr = []\n spice = 0\n no_spice = 0\n\n while i<spice_arr.count # Use while loop to calculate the total amount spent each on spicy and non-spicy food\n\n if spice_arr[i] == \"S\"\n spice += price_arr[i] # To add price of spicy food\n else\n no_spice += price_arr[i] # To add price of non-spicy food\n end\n i+=1\n\n end\n\n spice= spice + (no_spice/2.0) # Money owed by person who eats spicy food\n no_spice = no_spice/2.0 # Money owed by person who does not eat spicy food\n new_arr.push(spice)\n new_arr.push(no_spice)\n return new_arr #returns array with money owed by each party\n\nend",
"def stock_picker(stock_prices)\n\n max_profit = 0\n best_days = []\n\n stock_prices.each_with_index do |buying_price, index|\n (index+1).upto(stock_prices.length - 1) do |selling_index|\n selling_price = stock_prices[selling_index]\n profit = selling_price - buying_price\n if profit > max_profit\n max_profit = profit\n best_days = [index, selling_index]\n end\n\n end\n end\n best_days\nend",
"def stock_picker(stock_prices)\n\n\tstock_prices.map!{|price| price.to_i}\t#Convert array values to integers\n\n#Empty array for buy-low and sell-high differences\n\tdifference = []\n\n#Each day is considered a (low_price) and respective (high_price) is determined\n\tstock_prices.map.with_index do |price, i|\n\t\tlow_price = price\n\t\thigh_price = stock_prices[i+1..-1].max\n#The differnces array collects all high-low differences\t\t\n\t\tdifference.push(high_price.to_i - low_price.to_i)\n\tend\n\n\tday_1 = difference.index(difference.max)\t#Get day of highest difference possible\n\tday_2 = stock_prices.index(stock_prices[day_1+1..-1].max)\t#Calculate correspoinding high value\n\n\ta = [day_1]\n\tb = [day_2]\n\n\tprint a + b\nend",
"def stock_picker(stock_prices)\n best_pick = 0\n first_index = 0\n second_index = 0\n\n stock_prices.each_with_index do |val, idx|\n current_pick = stock_prices.slice((idx + 1)..(stock_prices.length - 1))\n current_pick.each_with_index do |num, i|\n new_pick = num - val\n if new_pick > best_pick\n best_pick = new_pick\n first_index = idx\n second_index = idx + i + 1\n end\n end\n end\n p \"Best day to buy: #{first_index}. Best day to sell: #{second_index}\"\n p \"Profit: #{best_pick}\"\nend",
"def stock_picker(stock_arr)\n\tdiff=0\n\tbuy_date=0\n\tsell_date=0\n\tcombo=(0...30).to_a.combination(2).to_a\n\tprint combo\n\tputs \"\"\n\tcombo.each do |x,y|\n\t\tif (stock_arr[y] - stock_arr[x]) > diff\n\t\t\tdiff = (stock_arr[y] - stock_arr[x])\n\t\t\tsell_date=y\n\t\t\tbuy_date=x\n\t\tend\n\tend\n\n\tputs \"Buy date: #{buy_date}, Sell date: #{sell_date}, Profit: #{diff}\"\nend",
"def stock_picker(prices)\n max_diff = 0\n result_prices = []\n result_indices = []\n \n prices.each_with_index do |x,i|\n \tcurrent_max = prices[i..-1].max\n \tunless x == current_max\n \t current_max_diff = current_max - x\n \t if current_max_diff > max_diff\n \t max_diff = current_max_diff\n \t result_prices << x\n \t result_prices << current_max\n \t result_indices << i\n \t result_indices << prices.find_index(current_max)\n \t end\n \tend\n end\n\n [] << result_indices << result_prices\nend",
"def stock_picker(prices)\n\t# Empty hash for saving the buy & sell days (key) and the proffit (value)\n\tbuy_sell = Hash.new\n\n\tprices.each do |buy|\n\t\t# loop inside the loop that caluclates proffit ONLY IF the sell date has higher index than the buy date in the array.\n\t\tprices.each do |sell|\n\t\t\tif prices.index(sell) > prices.index(buy)\n\t\t\t\tproffit = sell - buy\n\t\t\t\t# Saves the buy index, sell index and proffit into our hash\n\t\t\t\tbuy_sell[\"#{prices.index(buy)}, #{prices.index(sell)}\"] = proffit\n\t\t\tend\n\t\tend\n\tend\n\t# lists the hash key (buy & sell day) that had the highest proffit value.\n\tputs buy_sell.key(buy_sell.values.max)\nend",
"def stock_prices(arr)\n min = arr[0]\n max = arr[0]\n big_gain = 0\n\n arr.each do |n|\n if n < min\n min = n\n max = n\n elsif n > max\n max = n\n end\n big_gain = max - min if max - min > big_gain\n end\n\n big_gain\nend",
"def stock_picker(prices, best_profit = -(2**(0.size * 8 -2)) )\t\n\tabs_max_sell = prices[1..-1].max\n\n\tmin_buy = prices[0..-2].min\n\tmin_buy_index = prices.index(min_buy)\n\n\tmax_sell = prices[(min_buy_index+1)..-1].max\n\tmax_sell_index = (min_buy_index + 1) + prices[(min_buy_index+1)..-1].index(max_sell)\n\n\tprofit = max_sell - min_buy\n\t\n\tif (profit > best_profit)\n\t\tbest_profit = profit\n\tend\n\tif (max_sell == abs_max_sell || prices[0..(min_buy_index-1)].length == 1)\n\t\tputs \"Best profit is #{best_profit}, buying on day #{min_buy_index} and selling on day #{max_sell_index}\"\n\telse\n\t\tprices = prices[0..(min_buy_index-1)]\n\t\tstock_picker(prices, best_profit)\n\tend\nend",
"def max_profit(prices)\n profit = 0\n 0.upto(prices.size - 2) do |current_pointer|\n next_pointer = current_pointer + 1\n diff = prices[next_pointer] - prices[current_pointer]\n profit += diff > 0 ? diff : 0\n end\n profit\nend",
"def max_profit(prices)\n max_profit = 0\n min_price = 1_000_000\n\n 0.upto(prices.length - 1) do |i|\n if prices[i] < min_price\n min_price = prices[i]\n elsif prices[i] - min_price > max_profit\n max_profit = prices[i] - min_price\n end\n end\n\n max_profit\nend",
"def generate_low_price_buy_signal(low_price_array,price_array,bpc)\n\tbuy_signal=true\n\tif bpc.respond_to?(\"low_price\")\n\t buy_signal &&=bpc.low_price.lowest_5_day == (low_price_array[4].to_f < price_array[3].to_f) if bpc.low_price.respond_to?(\"lowest_5_day\")\n buy_signal &&=bpc.low_price.lowest_10_day == (low_price_array[5].to_f < price_array[3].to_f) if bpc.low_price.respond_to?(\"lowest_10_day\")\n buy_signal &&=bpc.low_price.lowest_20_day == (low_price_array[6].to_f < price_array[3].to_f) if bpc.low_price.respond_to?(\"lowest_20_day\")\n buy_signal &&=bpc.low_price.lowest_30_day == (low_price_array[7].to_f < price_array[3].to_f) if bpc.low_price.respond_to?(\"lowest_30_day\")\n buy_signal &&=bpc.low_price.lowest_60_day == (low_price_array[8].to_f < price_array[3].to_f) if bpc.low_price.respond_to?(\"lowest_60_day\")\n buy_signal &&=bpc.low_price.lowest_100_day == (low_price_array[9].to_f < price_array[3].to_f) if bpc.low_price.respond_to?(\"lowest_100_day\")\n buy_signal &&=bpc.low_price.lowest_120__day == (low_price_array[10].to_f < price_array[3].to_f) if bpc.low_price.respond_to?(\"lowest_120_day\")\n end\n buy_signal\nend",
"def stock_picker(stock_arr)\n highest_profit = 0 \n best_day_to_buy = 0 \n best_day_to_sell = 0 \n\n # Return 0- 9 but due to \"...\" it means it will exclude running the last number \n for i in 0...stock_arr.length \n #I am using a nested array so I can keep track of one number and use the other to iterate \n # Ex. [0, 1-8],[1, 2-8], [2, 3-8], .. [8, 8-8] and so on \n #I am doing this so I can use the i index postion to keep track of each day \n # Then I will use the second for loop to iterate through the stock_arr again and compare and calculate\n # those value to what I have in i(the tracked day) \n # I keep the calculation in profit_calculating until I find the profit_calculating becomes a number with the highest_profit \n for j in i+1...stock_arr.length do \n profit_calculating = stock_arr[j] - stock_arr[i]\n if highest_profit < profit_calculating\n highest_profit = profit_calculating\n best_day_to_buy = i \n best_day_to_sell = j \n end\n end \n end\n return \"[#{best_day_to_buy}, #{best_day_to_sell}] with a profit of #{highest_profit}\"\n\nend",
"def stock_picker(prices)\n\n buy = 0\n sell = 0\n max = 0\n \n prices.each_index do |x|\n prices.each_index do |y|\n if prices[y] - prices[x] > 0 and prices[y] - prices[x] > max and y > x\n buy = x\n sell = y\n max = prices[y] - prices[x]\n end\n end\n end\n \n [buy, sell]\nend",
"def stock_picker(arr)\n best_days = []\n arr.each do |i|\n arr.each do |x|\n if arr.index(x) > arr.index(i)\n if x - i > 0\n best_days.insert(x - i, \"Buying day #{arr.index(i)} and selling day #{arr.index(x)} gives the highest possible profit of #{x - i}\")\n end\n end\n end\n end\n best_days.last\nend",
"def best_profit_from_yesterday_greedy(prices_array)\n\n lowest_thus_far = prices_array[0]\n max_profit = 0\n\n prices_array.each do |price|\n if price < lowest_thus_far\n lowest_thus_far = price\n end\n\n potential_profit = price - lowest_thus_far\n if(potential_profit > max_profit)\n max_profit = potential_profit\n end\n end\n max_profit\nend",
"def max_profit(prices)\n buy = nil\n profit = 0\n \n prices.each do |p|\n if buy.nil?\n buy = p\n elsif p < buy\n buy = p\n else\n profit = p - buy if p - buy > profit\n end\n end\n profit\nend",
"def stock_picker(stocks)\n biggest_price = 0\n profitable_days = []\n (0...stocks.length).each do |i|\n (i + 1...stocks.length).each do |j|\n day = stocks[i][0]\n price = stocks[i][1]\n other_day = stocks[j][0]\n other_price = stocks[j][1]\n stock_price = price - other_price\n if stock_price.abs > biggest_price\n biggest_price = stock_price\n profitable_days = [day, other_day]\n end\n end\n end\n\n profitable_days\nend",
"def generate_high_price_buy_signal(high_price_array,price_array,bpc)\n buy_signal=true\n\tif bpc.respond_to?(\"high_price\")\n\t buy_signal &&=bpc.high_price.highest_5_day == (high_price_array[4].to_f < price_array[3].to_f) if bpc.high_price.respond_to?(\"highest_5_day\")\n buy_signal &&=bpc.high_price.highest_10_day == (high_price_array[5].to_f < price_array[3].to_f) if bpc.high_price.respond_to?(\"highest_10_day\")\n buy_signal &&=bpc.high_price.highest_20_day == (high_price_array[6].to_f < price_array[3].to_f) if bpc.high_price.respond_to?(\"highest_20_day\")\n buy_signal &&=bpc.high_price.highest_30_day == (high_price_array[7].to_f < price_array[3].to_f) if bpc.high_price.respond_to?(\"highest_30_day\")\n buy_signal &&=bpc.high_price.highest_60_day == (high_price_array[8].to_f < price_array[3].to_f) if bpc.high_price.respond_to?(\"highest_60_day\")\n buy_signal &&=bpc.high_price.highest_100_day == (high_price_array[9].to_f < price_array[3].to_f) if bpc.high_price.respond_to?(\"highest_100_day\")\n buy_signal &&=bpc.high_price.highest_120__day == (high_price_array[10].to_f < price_array[3].to_f) if bpc.high_price.respond_to?(\"highest_120_day\")\n end\n buy_signal\nend",
"def on2(prices)\n max_profit = 0\n\n prices.each_with_index do |number, index|\n prices.each_with_index do |another_number, another_index|\n next if index >= another_index\n\n max_profit = [another_number - number, max_profit].max\n end\n end\n\n max_profit\n end",
"def price_excl_options\n duration_price = 0\n (1..duration).each do |day|\n if day == 1\n duration_price += @selected_car.price_per_day\n # price per day decreases by 10% after 1 day\n elsif day.between?(2,4)\n duration_price += @selected_car.price_per_day * 0.9\n # price per day decreases by 30% after 4 days\n elsif day.between?(5,10)\n duration_price += @selected_car.price_per_day * 0.7\n # price per day decreases by 50% after 10 days\n else\n duration_price += @selected_car.price_per_day * 0.5\n end\n end\n\n price_excl_options = duration_price + @distance * @selected_car.price_per_km\n price_excl_options.to_i\n end",
"def stock_picker(prices)\n #results array indicates the best time to buy and then sell the stock\n results = [0, 0]\n #this variable keeps tabs of the best positive price difference\n greatest_price_difference = 0\n prices.each_with_index do |price, current_index|\n #index_counter keeps track of the index in the array as it's being\n #looped in the while loop\n \n index_counter = current_index + 1\n #the while loop loops through the array starting with the first \n #potential day to buy and compares the potential difference\n #each day going forward to determine which day would be best to sell on\n #should they buy the stock today\n while index_counter < prices.length\n \n price_difference = prices[index_counter] - prices[current_index]\n if price_difference > greatest_price_difference\n #price difference is updated if a greater difference is found\n greatest_price_difference = price_difference\n results[0] = current_index \n results[1] = index_counter \n end\n index_counter += 1\n end\n end\n\n\n\n puts results\nend",
"def stock_picker stock_prices\n coll = Hash.new \n stock_prices.each_index do |i|\n stock_prices.map.with_index(i) do |e, j|\n if stock_prices[j] && stock_prices[j] > stock_prices[i]\n coll[[i, j]] = stock_prices[j] - stock_prices[i]\n end\n end\n end\n\n coll = coll.key(coll.values.max)\n puts \"Buy on day:\\t#{coll[0]} \\nSell on day:\\t#{coll[1]}\"\n puts \"Profit ($):\\t#{stock_prices[coll[1]] - stock_prices[coll[0]]}\"\nend",
"def stock(arr)\n if arr.length >= 2\n hash = {}\n count = 1\n until arr.length == 1\n current = arr[0]\n arr.delete_at(0)\n arr.each do |price|\n hash[count] = price - current\n count += 1\n end\n end\n else\n puts \"Not enough stocks to trade.\"\n end\n p hash.values.max\nend",
"def generate_stock_prices\n\topen_close_time = ['9:30', '16:00']\n\n\topen_close_time.map! do |t|\n\t\tt = t.split(':')\n\t\tt = t[0].to_i * 60 + t[1].to_i\n\tend\n\n\ttrade_mins = open_close_time[1] - open_close_time[0]\n\n\tprices = [124.41]\n\tfor i in 1..trade_mins\n\t\tplus_or_minus = rand(0..1)\n\t\tif plus_or_minus == 0\n\t\t\tprices[i] = (prices[i-1] + rand(0.02..0.95))\n\t\telse\n\t\t\tprices[i] = (prices[i-1] - rand(0.02..0.95))\n\t\tend\n\t\tprices[i] = prices[i].round(2)\n\tend\n\treturn prices\nend",
"def stock_picker(prices)\n current_max = 0\n buy_index = 0\n sell_index = 1\n (0...prices.length - 1).each do |buy|\n (buy + 1...prices.length).each do |sell|\n if prices[sell] - prices[buy] > current_max\n current_max = prices[sell] - prices[buy]\n buy_index = buy\n sell_index = sell\n end\n end\n end\n [buy_index, sell_index]\nend",
"def max_profit(prices)\n current_profit = 0\n buy = 0\n sell = 0\n in_trade = false\n arr_idx_length = prices.length - 1\n\n prices.each_with_index do |value,index|\n if index == arr_idx_length && in_trade == true\n sell = value\n puts \"last day must sell. at #{value}\"\n current_profit += (sell-buy)\n puts \"current_profit: #{current_profit}\"\n break\n elsif index == arr_idx_length && in_trade == false\n break\n else\n end\n\n if in_trade == false\n if value < prices[index+1]\n buy = value\n in_trade = true\n puts \"buy at #{value}\"\n end\n else\n if value > prices[index+1]\n sell = value\n in_trade = false\n puts \"sell at #{value}\"\n current_profit += (sell-buy)\n puts \"current_profit: #{current_profit}\"\n end\n end\n end\n\n puts \"total profit: #{current_profit}\"\n\nend",
"def eshop_games \n arr = [] \n listings.each do |g| \n if g&.sale_price\n arr << g \n end \n end \n arr \n end",
"def stock_picker(stocks)\n buy_day, sell_day, max_profit = 0, 0, 0\n for i in (0...stocks.length - 1)\n buy, possible_sales = stocks[i], stocks[i+1..-1]\n best_sale = possible_sales.max # Find the best price we can still sell for\n current_profit = best_sale - buy\n if current_profit > max_profit\n max_profit = current_profit # New standard we'll have to beat\n buy_day = i + 1 # If i is 0, we should buy on day 1\n sell_day = sales.index(best_sale) + buy_day + 1 # Add 1 in both cases to correct for indexing\n end\n end\n print [buy_day,sell_day]\nend",
"def trade_cleared(event)\n trade = event.cleared_trade\n @all_prices[trade.commodity] << trade.price\n @max_prices[trade.commodity] = trade.price if trade.price > @max_prices[trade.commodity]\n @min_prices[trade.commodity] = trade.price if trade.price < @min_prices[trade.commodity]\n end",
"def max_profit(prices)\n total = 0\n (0...prices.size - 1).each do |i|\n total += prices[i + 1] - prices[i] if prices[i + 1] > prices[i]\n end\n total\nend",
"def make_prices_negative\n tickets.each{|ticket| ticket.price = -1}\n end",
"def greedy_make_change(cents,coins = [25,10,5,1])\n return [cents] if coins.include?(cents)\n arr = Array.new\n coins.each do |coin|\n if coin < cents\n arr << coin\n break\n end\n end\n greedy_make_change(cents-arr.first,coins).each {|coin| arr << coin}\n return arr\nend",
"def max_profit(prices)\n max = 0\n min = (2**(0.size * 8 -2) -1)\n\n prices.each do |price|\n if price < min\n min = price\n else\n max = [max, price - min].max\n end\n end\n\n max\nend",
"def stock_picker(array)\n\ndiff = array[0] - array[1]\nlowest, highest = array[0], array[1]\n\n\tarray.each do |first_price|\n\t\tindex_num = array.index(first_price)\n\t\tarray.each_with_index do |next_price, second_index|\n\t\t\tif second_index > index_num\n\t\t\t\tif (first_price - next_price) < diff\n\t\t\t\t\tdiff = first_price - next_price\n\t\t\t\t\tlowest, highest = first_price, next_price\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\t\n\tputs \"Buy on \" + array.index(lowest).to_s + \", sell on \" + array.index(highest).to_s\n\tputs \"You'll buy at the price of #{lowest} and sell at #{highest}.\"\nend",
"def on2_2(prices)\n max_profit = 0\n\n return max_profit if prices.empty?\n\n prices.each_with_index do |number, index|\n max_price_after_date = prices[index..-1].max\n\n next if max_price_after_date <= number\n\n max_profit = [max_price_after_date - number, max_profit].max\n end\n\n max_profit\n end",
"def prices\n Array(tariff_data&.fetch('results', nil)).map do |t|\n # skip periods before the current time\n next unless Time.parse(t['valid_to']) >= Time.now\n\n [Time.parse(t['valid_from']).localtime, t['value_inc_vat']]\n end.compact.sort.to_h\n end",
"def stock_picker(arr)\n\thighestGain = 0\n\tbuyDay = 0\n\tsellDay = 0\n\n\tarr.each_index do |i|\n\t\tbiggestGainDayFrom = findDayWithHighestGainFrom(i, arr)\n\t\tif arr[biggestGainDayFrom] - arr[i] > highestGain\n\t\t\thighestGain = arr[biggestGainDayFrom] - arr[i]\n\t\t\tbuyDay = i\n\t\t\tsellDay = biggestGainDayFrom\n\t\tend\n\tend\n\treturn [buyDay,sellDay]\nend",
"def stock_picker(arr)\n\n max_profit = 0 \n\n days = []\n\n arr.each.with_index do |num1, idx1|\n arr.each.with_index do |num2, idx2|\n if idx1 < idx2 && (num2 - num1) > max_profit\n max_profit = num2 - num1\n days = [idx1, idx2]\n end\n end\n end\n\n # return most profitable days \n days \n \n end",
"def best_profit (stock_prices_yesterday)\n possible_sale_combinations = stock_prices_yesterday.combination(2).to_a\n profits = []\n possible_sale_combinations.each do |pair|\n buy_price = pair[0]\n sell_price = pair[1]\n profit = sell_price - buy_price\n profits << profit\n end\n profits.sort!\n profits.count\n max_profit = profits[-1]\n if max_profit < 0\n return 0\n else\n return max_profit\n end\nend"
] | [
"0.6788952",
"0.65283084",
"0.650083",
"0.64897037",
"0.64808506",
"0.64540464",
"0.641136",
"0.63882864",
"0.6378258",
"0.63720065",
"0.63666344",
"0.63421804",
"0.6329192",
"0.632665",
"0.6311838",
"0.6305009",
"0.6283879",
"0.6270574",
"0.6264901",
"0.62637025",
"0.6260511",
"0.62495655",
"0.62462986",
"0.6244883",
"0.62421983",
"0.6236625",
"0.6223828",
"0.62059855",
"0.6168937",
"0.6168041",
"0.6157743",
"0.61513686",
"0.61497265",
"0.61471033",
"0.6138724",
"0.6132158",
"0.6131489",
"0.6104533",
"0.6085235",
"0.60665476",
"0.6065402",
"0.60516423",
"0.6045312",
"0.60289156",
"0.60107183",
"0.60035586",
"0.5994495",
"0.599012",
"0.5989643",
"0.5988153",
"0.59804827",
"0.5979139",
"0.5970681",
"0.59540653",
"0.5939435",
"0.5929644",
"0.5920594",
"0.5915083",
"0.59008193",
"0.5895721",
"0.5892536",
"0.5892283",
"0.5877903",
"0.5869371",
"0.58493966",
"0.5847816",
"0.58460355",
"0.5845201",
"0.58073205",
"0.58063054",
"0.58036804",
"0.58028436",
"0.580107",
"0.57922107",
"0.5774639",
"0.5763711",
"0.57474095",
"0.574215",
"0.5740792",
"0.57279485",
"0.572146",
"0.5719662",
"0.57177556",
"0.568944",
"0.568787",
"0.5682295",
"0.567747",
"0.5671934",
"0.5669711",
"0.56688607",
"0.5667462",
"0.5665627",
"0.5656961",
"0.565223",
"0.5644253",
"0.56404716",
"0.56378",
"0.56351364",
"0.5621017",
"0.56019723"
] | 0.5692081 | 83 |
Takes the urls from the enhancement, gets labels and types for them, and generates some html and RDF | def make_html_and_rdf(valscount)
puts "Making RDF and html"
types = {}
labels = {}
types_urls = {}
puts "\nFound #{valscount.length} URLs"
if (use_store())
require 'lib/four_store/store'
store = FourStore::Store.new 'http://dbtune.org/bbc/programmes/sparql/'
valscount.each_key do |url|
q = "SELECT distinct ?label ?type WHERE { <#{url}> <http://www.w3.org/2000/01/rdf-schema#label> ?label .}"
q2 = "SELECT distinct ?label ?type WHERE {<#{url}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .}"
puts "Enhancing #{url}\n\n#{q}\n#{q2}\n"
response = store.select(q)
sleep 2
response2 = store.select(q2)
sleep 2
# Get types
response2.each do |r|
ty = r["type"]
types[url] = ty
if(types_urls[ty]==nil)
arr = Array.new
arr.push(url)
types_urls[ty]=arr
else
arr = types_urls[ty]
arr.push(url)
end
end
# Get labels
response.each do |r|
label = r["label"]
labels[url] = label
end
end
else
valscount.each_key do |url|
puts "valscount url is #{url}"
#serivces are problematic in the url retrival case so we bypass them
#genres can also be problematic
# http://www.bbc.co.uk/programmes/genres/comedy/
if url.match("service")
label = url.gsub(/\#.*/,"")
label = label.gsub(/http:\/\/www\.bbc\.co\.uk\//,"")
ty = "http://purl.org/ontology/po/Service"
types[url]=ty
labels[url]=label
if(types_urls[ty]==nil)
arr = Array.new
arr.push(url)
types_urls[ty]=arr
else
arr = types_urls[ty]
arr.push(url)
end
elsif url.match("genres")
label = url.gsub(/\#.*/,"")
label = label.gsub(/http:\/\/www\.bbc\.co\.uk\/programmes\/genres\//,"")
ty = "http://purl.org/ontology/po/Genre"
types[url]=ty
labels[url]=label
if(types_urls[ty]==nil)
arr = Array.new
arr.push(url)
types_urls[ty]=arr
else
arr = types_urls[ty]
arr.push(url)
end
else
uu = url.gsub(/\#.*$/,".rdf")
m = ModelFactory.createDefaultModel()
m.read(uu)
q = "SELECT distinct ?label WHERE { <#{url}> <http://purl.org/dc/elements/1.1/title> ?label .}"
q2 = "SELECT distinct ?type WHERE {<#{url}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .}"
qexec = QueryExecutionFactory.create(q, m) ;
qexec2 = QueryExecutionFactory.create(q2, m) ;
response = qexec.execSelect()
response2 = qexec2.execSelect()
# ResultSetFormatter.out(java.lang.System.out, response)
# ResultSetFormatter.out(java.lang.System.out, response2)
# Get types
response2.each do |r|
ty = r.get("type").to_s
types[url] = ty
if(types_urls[ty]==nil)
arr = Array.new
arr.push(url)
types_urls[ty]=arr
else
arr = types_urls[ty]
arr.push(url)
end
end
# Get labels
response.each do |r|
label = r.get("label").to_s
labels[url] = label
end
end
end
end
# pp valscount
# Make the html
cc = 0
str = "<html><body>"
types_urls.each_key do |t|
str = str + "<h3>" + t + "</h3>\n<p>"
u = types_urls[t]
u.each do |uu|
label = labels[uu]
c = valscount[uu]
cc = cc + c
str = "#{str} <a href='#{uu}'>#{label}</a>: #{c} <br />\n"
end
str = str + "</p>\n"
end
str = str + "</body></html>"
# Now the rdf
topstr = "<rdf:RDF
xmlns:owl=\"http://www.w3.org/2002/07/owl#\"
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"
xmlns:wi=\"http://xmlns.notu.be/wi#\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"
xmlns:tl=\"http://perl.org/NET/c4dm/timeline.owl#\"
xmlns:days=\"http://ontologi.es/days#\"
xmlns:po=\"http://purl.org/ontology/po/\"
xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"
>
<foaf:Person>
"
endstr = "
</foaf:Person>
<wi:Context rdf:about=\"#default\">
<wi:timePeriod>
<days:DayInterval> <!-- i.e. every day, all day -->
<tl:at rdf:datatype=\"http://www.w3.org/2001/XMLSchema#time\">00:00:00</tl:at>
<tl:end rdf:datatype=\"http://www.w3.org/2001/XMLSchema#time\">23:59:59</tl:end>
</days:DayInterval>
</wi:timePeriod>
</wi:Context>
</rdf:RDF>
"
totalnums = cc.to_f
str2 = topstr
valscount.each_key do |u|
t = types[u]
label = labels[u]
label.gsub!("&","and")
c = valscount[u].to_f
weight = c
puts "weight is #{c} #{totalnums}"
tmpl =
"
<wi:preference>
<wi:WeightedInterest>
<wi:topic rdf:resource=\"#{u}\" />
<rdf:type rdf:resource=\"#{t}\"/>
<rdfs:label>#{label}</rdfs:label>
<wi:weight>#{weight}</wi:weight>
<wi:scale>0..#{cc}</wi:scale>
<wi:reason>You watched #{weight} of a total of #{cc} items in topic #{label}</wi:reason>
<wi:context rdf:resource=\"#default\" />
</wi:WeightedInterest>
</wi:preference>
"
str2 = str2 + tmpl
end
str2 = str2 + endstr
return str,str2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_url url, text\n if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then\n type = \"link\"\n elsif url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n else\n type = \"http\"\n end\n\n if (type == \"http\" or type == \"https\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n ''\n else\n text.sub(%r%^#{type}:/*%, '')\n end\n end",
"def go(uri)\n\n foaf='http://xmlns.com/foaf/0.1/' \n contact=\"http://www.w3.org/2000/10/swap/pim/contact#\" \n air= 'http://www.megginson.com/exp/ns/airports#'\n\n ayf = SimpleScutter.new uri\n\n pagecount=0\n # a code block to output basic info about each RDF page encountered\n # \n page_summary = Proc.new do |crawler,page| \n puts \"RDFDOC: count='#{pagecount}': uri:#{crawler.uri} gave RDF graph #{page} \\\n\twith #{page.size} triples\\n\" \n pagecount=pagecount+1\n end\n\n # a code block to see if some page provides nearestAirport information: \n #\n # <contact:nearestAirport><wn:Airport air:icao=\"EGGD\" air:iata=\"BRS\"/>...\n #\n airports = Proc.new do |crawler,page| \n\n #page.reg_xmlns 'http://www.megginson.com/exp/ns/airports#', 'air'\n \n rs = page.ask Statement.new(nil, air+\"iata\", nil)\n rs.objects.each do |a|\n a.graph=page\n puts \"AIRPORT: #{a} got airport code in #{crawler.uri})\" if (a.to_s =~ /\\S/) \n end\t\t\t\t\t# the 'if' is fix for parser bug\n end\n\n\n # the mugshots and htmler blocks are related, and share some state:\n report=\"\"\n seenpic=Hash.new(0) \t# counter\n\n # basic image metadata harvesting\n #\n mugshots = Proc.new do |crawler,page|\n images=[]\n img = page.ask Statement.new(nil, foaf+'img', nil)\n img.objects.each {|a| images.push a.to_s }\n img = page.ask Statement.new(nil, foaf+'depiction',nil)\n img.objects.each {|a| images.push a.to_s }\n\t\t # todo: store this state locally instead of inside crawler\n images.each do |pic|\n next if (!pic =~ /\\S/) #bug in Liber RDF parser.\n if seenpic[pic]==0 ### how to do this as a Proc? fixme\n report += \"<img src='#{pic}' width='128' height='128' />\" \n report += \"<!-- linked at: #{crawler.uri} -->\\n\\n\"\n end\n seenpic[pic]=seenpic[pic]+1\n end\n end\n\n # a code block that writes an html page based on the crawler's .out property \n #\n htmler = Proc.new do |crawler,page|\n html = \"<html><head><title>all your foaf depictions...</title></head>\\n<body>\\n\"\n html += \"<h1>AllYourFoaf Image Index</h1>\\n\" \n html += \"<p><strong>stats:</strong>: left.size=#{crawler.left.size} \\\n\tseen.size=#{crawler.seen.size} seenpic.size=#{seenpic.size} current:#{crawler.uri} </p> \"\n html += \"<hr />\\n\\n\" + report\n html += \"</body></html>\\n\\n\"\n SimpleScutter.writefile(crawler.outfile,html)\n end\n\n # stats to be output at start of each loop \n #\n loopstats = Proc.new do |s|\n puts \"INIT: s.left.size=#{s.left.size} s.seen.size=#{s.seen.size} current: #{s.uri}\"\n end\n\n error_logger = Proc.new {|e| puts \"ERROR: #{e}\" }\n\n # register some handlers:\n ayf.pagehandlers.push page_summary, airports, mugshots, htmler\n ayf.inithandlers.push loopstats\n ayf.errorhandlers.push error_logger \n ayf.run # set crawler running!\nend",
"def enhance_referent(body, request) \n doc = Nokogiri::XML(body)\n return unless cite = doc.at(\"PubmedArticleSet/PubmedArticle/MedlineCitation\") # Nothing of interest here\n \n return unless article = cite.at(\"Article\") # No more useful metadata \n if abstract = article.at(\"Abstract/AbstractText\")\n request.add_service_response( \n :service=>self,\n :display_text => \"Abstract from #{@display_name}\",\n :content => abstract.inner_text,\n :service_type_value => 'abstract') unless abstract.inner_text.blank? \n end\n \n if journal = article.at(\"Journal\")\n if issn = journal.at('ISSN')\n if issn.attributes['issntype']==\"Print\" \n request.referent.enhance_referent('issn', issn.inner_html)\n else \n request.referent.enhance_referent('eissn', issn.inner_html) \n end\n end\n if jrnlissue = journal.at('JournalIssue')\n if volume = jrnlissue.at('Volume')\n request.referent.enhance_referent('volume', volume.inner_text)\n end\n if issue = jrnlissue.at('Issue')\n request.referent.enhance_referent('issue', issue.inner_text)\n end \n if date = jrnlissue.at('PubDate') \n \n request.referent.enhance_referent('date', openurl_date(date))\n \n end \n end\n \n if jtitle = journal.at('Title')\n request.referent.enhance_referent('jtitle', jtitle.inner_text) \n end\n if stitle = journal.at('ISOAbbreviation')\n request.referent.enhance_referent('stitle', stitle.inner_text)\n end \n \n if atitle = article.at('ArticleTitle')\n request.referent.enhance_referent('atitle', atitle.inner_text)\n end \n \n if pages = article.at('Pagination/MedlinePgn')\n page_str = pages.inner_text\n request.referent.enhance_referent('pages', page_str)\n if spage = page_str.split(\"-\")[0]\n request.referent.enhance_referent('spage', spage.strip)\n end\n end \n \n if author = article.at('AuthorList/Author')\n if last_name = author.at('LastName')\n request.referent.enhance_referent('aulast', last_name.inner_text)\n end\n if first_name = author.at('ForeName')\n request.referent.enhance_referent('aufirst', first_name.inner_text)\n end \n if initials = author.at('Initials')\n request.referent.enhance_referent('auinit', initials.inner_text)\n end \n end \n end \n \n end",
"def extractData()\n\n @es_client = Elasticsearch::Client.new host: 'http://192.168.59.103:9200/', log: true\n gr = RDF::Vocabulary.new(\"http://purl.org/goodrelations/v1#\")\n s = RDF::Vocabulary.new(\"http://schema.org/address\")\n v = RDF::Vocabulary.new(\"http://www.w3.org/2006/vcard/ns#\")\n l = RDF::Vocabulary.new(\"http://www.linked-usdl.org/ns/usdl-core#\")\n\n company = RDF::Node.new\n addTriple( company , RDF.type, @resume_cv.Company)\n addUSDL(company, RDF.type, gr.BusinessEntity)\n\n # content = @doc.css('div').select{|document| document['id'] == \"inhalt\"}[0]\n company_name = extractAnnotation(\"name\").first\n\n add_annotation(\"name\", company_name)\n # description = @doc.css('div').select{|description| description['id'] == \"text\"}[0]\n\n\n website = extractAnnotation(\"website\").first\n streetAddress = extractAnnotation(\"streetAddress\").first\n postal = extractAnnotation(\"postal\").first\n locality = extractAnnotation(\"locality\").first\n country = extractAnnotation(\"country\").first\n phone = extractAnnotation(\"phone\").first\n mail = extractAnnotation( \"mail\").first\n region = country\n\n extractAnnotation(\"product_categories\").each do |i|\n puts \"i: #{i}\"\n product = RDF::Node.new\n addUSDL(product, RDF.type, gr.ProductOrService)\n addUSDL(product, gr.name, i)\n addUSDL(product, gr.hasManufacturer, company)\n addTriple(company, @resume_cv.produces, i)\n end\n\n extractAnnotation(\"produces\").each do |i|\n puts \"prodcat2 : #{i}\"\n offering = RDF::Node.new\n addUSDL(offering, RDF.type, gr.Offering)\n addUSDL(company, gr.offers, offering)\n addUSDL(offering, gr.name , i)\n\n addTriple(company, @resume_cv.sells , i)\n end\n\n extractAnnotation(\"distr_category\").each do |i|\n puts \"distcat : #{i}\"\n addUSDL(company, gr.category, i)\n addTriple(company, @resume_cv.distribution_type, i)\n end\n\n extractAnnotation(\"distributes_for\").each do |i|\n puts \"distfor : #{i}\"\n addUSDL(company, @resume_cv.distribution_for, i)\n addTriple(company, @resume_cv.distribution_for, i)\n end\n\n extractAnnotation(\"provides\").each do |i|\n puts \"provcat : #{i}\"\n offering = RDF::Node.new\n addUSDL(offering, RDF.type, gr.Offering)\n addUSDL(company, gr.offers, offering)\n addUSDL(offering, gr.name , i)\n addTriple(company, @resume_cv.hasSpeciality , i)\n end\n\n extractAnnotation(\"distributed_by\").each do |i|\n puts \"distfor : #{i}\"\n addUSDL(company, @resume_cv.distributed_by, i)\n addTriple(company, @resume_cv.distributed_by, i)\n end\n\n # addTriple(company , @resume_cv.isIndustry, industry)\n # addUSDL(company, gr.category, industry)\n # addTriple(company, @resume_cv.hasSpeciality, s)\n addTriple(company , @resume_cv.hasWebsite, website)\n addUSDL(company, RDF::FOAF.page, website)\n addTriple( company , @resume_cv.name, company_name)\n addUSDL( company, gr.legalName, company_name)\n # # addTriple(company , @resume_cv.hasType, type)\n # # addTriple(company , @resume_cv.wasFounded, founded)\n # # addTriple(company , @resume_cv.hasSize, compsize)\n address = RDF::Node.new\n addUSDL(address, RDF.type , v.Address)\n addUSDL(company, l.hasCommunicationChannel, address)\n\n telephone = RDF::Node.new\n addUSDL(telephone, RDF.type, v.Voice)\n addUSDL(telephone, v.hasValue, phone)\n\n addUSDL(address, v.country_name, country)\n addUSDL(address, v.locality, locality)\n addUSDL(address, v.postal_code, postal )\n addUSDL(address, v.street_address, streetAddress)\n addUSDL(address, v.has_email ,mail)\n\n addTriple(company , @resume_cv.hasLocality, locality)\n addTriple(company , @resume_cv.hasStreetAddress, streetAddress)\n addTriple(company , @resume_cv.locatedInRegion, region)\n addTriple(company , @resume_cv.postalCode, postal)\n addTriple(company , @resume_cv.country, country)\n\n add_annotation( \"locality\", locality)\n add_annotation( \"street\" , streetAddress)\n add_annotation( \"postal\" , postal)\n add_annotation( \"country\", country)\n add_annotation( \"phone\", phone)\n add_annotation( \"mail\" , mail)\n\n company_name\n end",
"def webSiteBuildLinkListForLabels(labels, baseDir)\n # Filter pages.\n pages = docPages()\n pages = pagesForLabels(pages, labels)\n\n # Get all labels except category and type.\n allLabels = pagesGetAllLabels(pages).sort\n allLabels = allLabels - labels\n \n # Generate lists for each label.\n html = \"\"\n allLabels.each do |label|\n html += webSiteBuildLinkListForPages(\n pagesForLabel(pages, label),\n label,\n baseDir)\n end\n\n html\nend",
"def trail_builder(urls)\n urls.each do |trail|\n page = Nokogiri::HTML(open(TARGET_DOMAIN + trail))\n script = page.css('script')[3]\n trail_id = script.children.to_s.match(/TRAIL_ID\\s=\\s\\\"(\\d+)\\\"/)[1]\n gpx_name = script.children.to_s.match(/GPX_URL\\s=\\s\\\"(.+)\\\"/)[1]\n gpx_url = TARGET_DOMAIN + \"/content/gpsData/gps\" + trail_id + \"-\" + gpx_name + \".gpx\"\n end\nend",
"def streamlined_auto_discovery_link_tag()\n return if @syndication_type.nil? || @syndication_actions.nil?\n \n if @syndication_actions.include? params[:action]\n \"<link rel=\\\"alternate\\\" type=\\\"application/#{@syndication_type.downcase}+xml\\\" title=\\\"#{@syndication_type.upcase}\\\" href=\\\"#{params[:action]}/xml\\\" />\"\n end\n end",
"def extract(file,myurl)\n STDERR.puts \"# Scanning: #{myurl} via file:#{file}\"\n doc=\"\"\n dct='http://purl.org/dc/terms/'\n # rdf = \"<dc:Document rdf:about='#{myurl}' xmlns:dc='http://purl.org/dc/terms/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>\\n\"\n nt = ''\n File.read(file).each do |x| \n doc += x\n end\n doc.gsub!(/\\n/, \"\")\n doc.gsub!(/\\s+/, \" \")\n\n if (doc =~ /<title>\\s*([^<]*)\\s*<\\/title>/) \n # puts \"title: #{$1}\"\n t = $1\n t.gsub!(/\\s*$/,\"\")\n nt += \"<#{myurl}> <#{dct}title> \\\"#{t}\\\" . \\n\"\n end\n doc.scan(/<meta name=\"([^\"]*)\" con∫tent=\"([^\"]*)\"\\s*\\/>/) do\n p=$1\n v=$2\n p.downcase!\n puts \"#{p}: #{v}\" \n end\n doc.scan(/<div\\s+class=\"arr\">\\s*<a\\s+href=\"([^\"]*)\">\\s*([^<]*)\\s*<\\/a>\\s*<\\/div>/) do\n rt = $2\n rl = $1\n n = normal(file,rl)\n # puts \"# Starting dotfix with #{n}\"\n n = dotfix(n)\n n.chomp!\n nt += \"<#{myurl}> <#{dct}relation> <#{n}> .\\n\"\n rt.chomp!\n rt.gsub!(/\\s*$/,\"\")\n nt += \"<#{n}> <#{dct}title> \\\"#{rt}\\\" .\\n\"\n end\n puts \"\\n\"\n puts nt\nend",
"def show\n @ensembl = HTTParty.get('http://rest.ensembl.org' + '/lookup/id/' + @transplice.gene,\n :headers =>{'Content-Type' => 'application/json'} )\n if @ensembl[\"display_name\"].nil? \n @name = \"1\"\n else\n @name = @ensembl[\"display_name\"]\n\n @wikis = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @name + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @name,\n :headers =>{'Content-Type' => 'application/json'} )\n \n @omim = HTTParty.get('https://api.omim.org/api/entry/search?search='+ @name+ '&start=0&limit=1&include=text:description&apiKey=6-p06gbQTZiAWNOpPn-CSw&format=xml',:headers =>{'Content-Type' => 'application/xml'} )\n \n \n\n end\nend",
"def streamlined_auto_discovery_link_tag\n # return if @syndication_type.nil? || @syndication_actions.nil?\n # \n # if @syndication_actions.include? params[:action]\n # \"<link rel=\\\"alternate\\\" type=\\\"application/#{@syndication_type.downcase}+xml\\\" title=\\\"#{@syndication_type.upcase}\\\" href=\\\"#{params[:action]}/xml\\\" />\"\n # end\n end",
"def _extract_informations( url )\n\n\t\t\t@_extract_informations ||= { }\n\t\t\t@_extract_informations[ url ] ||= (\n\n\t\t\t\tattributes = Registry::get( 'dom' ).extract_attributes(\n\t\t\t\t\tHTTP.get( URI( url )), {\n\t\t\t\t\t\t'meta' => {\n\t\t\t\t\t\t\t'property' => '#^og:.+#i',\n\t\t\t\t\t\t\t'content'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t)\n\n\t\t\t\tog = { }\n\n\t\t\t\tattributes['meta'].each do | meta |\n\t\t\t\t\tif og.include?( meta['property'])\n\t\t\t\t\t\tog[ meta['property']] = meta['content']\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif !og.include?( 'html' )\n\t\t\t\t\tog['html'] = self._build_HTML( og, url )\n\t\t\t\tend\n\n\t\t\t\tog\n\t\t\t)\n\t\tend",
"def type_images(types)\n @type_map ||= { \n N::TALIA.Source => 'source',\n N::FOAF.Group => 'group',\n N::FOAF.Person => 'person'\n }\n result = ''\n types.each do |t|\n image = @type_map[t] || 'source'\n name = t.local_name.titleize\n result << link_to(image_tag(\"talia_core/#{image}.png\", :alt => name, :title => name),\n :action => 'index', :filter => t.to_name_s('+')\n )\n end\n result\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def gen_url url, text\n scheme, url, id = parse_url url\n\n if %w[http https link].include?(scheme) and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n \"<img src=\\\"#{url}\\\" />\"\n else\n if scheme != 'link' and %r%\\A((?!https?:)(?:[^/#]*/)*+)([^/#]+)\\.(rb|rdoc|md)(?=\\z|#)%i =~ url\n url = \"#$1#{$2.tr('.', '_')}_#$3.html#$'\"\n end\n\n text = text.sub %r%^#{scheme}:/*%i, ''\n text = text.sub %r%^[*\\^](\\d+)$%, '\\1'\n\n link = \"<a#{id} href=\\\"#{url}\\\">#{text}</a>\"\n\n link = \"<sup>#{link}</sup>\" if /\"foot/ =~ id\n\n link\n end\n end",
"def scrape\n google_url = create_google_url\n google_data = Scrubyt::Extractor.define do\n fetch google_url\n\n link_title \"//a[@class='l']\", :write_text => true do\n link_url\n end\n end\n google_data.to_hash.map {|r| r[:link_url]}\n end",
"def webSiteBuildLinkPages\n title = \"C/C++ Coding Guides\"\n webSiteBuildCategoryLinkPage([CPP, GUIDE], \"cpp/guides/\", title)\n \n title = \"C/C++ Tutorials\"\n webSiteBuildCategoryLinkPage([CPP,TUTORIAL], \"cpp/tutorials/\", title)\n \n title = \"C/C++ Examples\"\n webSiteBuildCategoryLinkPage([CPP,EXAMPLE], \"cpp/examples/\", title)\n \n title = \"JavaScript Coding Guides\"\n webSiteBuildCategoryLinkPage([JS,GUIDE], \"js/guides/\", title)\n \n title = \"JavaScript Tutorials\"\n webSiteBuildCategoryLinkPage([JS,TUTORIAL], \"js/tutorials/\", title)\n \n title = \"JavaScript Examples\"\n webSiteBuildCategoryLinkPage([JS,EXAMPLE], \"js/examples/\", title)\n \n title = \"All Examples\"\n webSiteBuildCategoryLinkPage([CPP,JS,EXAMPLE], \"overviews/examples/\", title)\nend",
"def index\n @foafs = Foaf.all\n # if all else fails, make RDF then\n # rapper -o dot -i turtle me.ttl | dot -Tsvg -o me.svg\n respond_to do |format|\n format.html do \n response.headers['Link'] = make_link_header(:html)\n end\n format.ttl do \n response.headers['Link'] = make_link_header(:ttl)\n render text: convert_many_to_rdf(@foafs, :ttl) \n end\n format.rj do \n response.headers['Link'] = make_link_header(:rj)\n render text: convert_many_to_rdf(@foafs, :json) \n end\n format.nt do \n response.headers['Link'] = make_link_header(:nt)\n render text: convert_many_to_rdf(@foafs, :ntriples) \n end\n format.rdf do \n response.headers['Link'] = make_link_header(:rdf)\n render text: convert_many_to_rdf(@foafs, :rdf) \n end\n format.jsonld do \n response.headers['Link'] = make_link_header(:jsonld)\n render text: convert_many_to_rdf(@foafs, :jsonld) \n end\n end\n end",
"def fulltext_links\n\n links = []\n\n ebscolinks = @record.fetch('FullText',{}).fetch('Links',{})\n if ebscolinks.count > 0\n ebscolinks.each do |ebscolink|\n if ebscolink['Type'] == 'pdflink'\n link_label = 'PDF Full Text'\n link_icon = 'PDF Full Text Icon'\n link_url = ebscolink['Url'] || 'detail'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'pdf'})\n end\n end\n end\n\n htmlfulltextcheck = @record.fetch('FullText',{}).fetch('Text',{}).fetch('Availability',{})\n if htmlfulltextcheck == '1'\n link_url = 'detail'\n link_label = 'Full Text in Browser'\n link_icon = 'Full Text in Browser Icon'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'html'})\n end\n\n if ebscolinks.count > 0\n ebscolinks.each do |ebscolink|\n if ebscolink['Type'] == 'ebook-pdf'\n link_label = 'PDF eBook Full Text'\n link_icon = 'PDF eBook Full Text Icon'\n link_url = ebscolink['Url'] || 'detail'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'ebook-pdf'})\n end\n end\n end\n\n if ebscolinks.count > 0\n ebscolinks.each do |ebscolink|\n if ebscolink['Type'] == 'ebook-epub'\n link_label = 'ePub eBook Full Text'\n link_icon = 'ePub eBook Full Text Icon'\n link_url = ebscolink['Url'] || 'detail'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'ebook-epub'})\n end\n end\n end\n\n items = @record.fetch('Items',{})\n if items.count > 0\n items.each do |item|\n if item['Group'] == 'Url'\n if item['Data'].include? 'linkTerm="'\n link_start = item['Data'].index('linkTerm="')+15\n link_url = item['Data'][link_start..-1]\n link_end = link_url.index('"')-1\n link_url = link_url[0..link_end]\n link_label_start = item['Data'].index('link>')+8\n link_label = item['Data'][link_label_start..-1]\n link_label = link_label.strip\n else\n link_url = item['Data']\n link_label = item['Label']\n end\n link_icon = 'Catalog Link Icon'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'cataloglink'})\n end\n end\n end\n\n if ebscolinks.count > 0\n ebscolinks.each do |ebscolink|\n if ebscolink['Type'] == 'other'\n link_label = 'Linked Full Text'\n link_icon = 'Linked Full Text Icon'\n link_url = ebscolink['Url'] || 'detail'\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'smartlinks+'})\n end\n end\n end\n\n ft_customlinks = @record.fetch('FullText',{}).fetch('CustomLinks',{})\n if ft_customlinks.count > 0\n ft_customlinks.each do |ft_customlink|\n link_url = ft_customlink['Url']\n link_label = ft_customlink['Text']\n link_icon = ft_customlink['Icon']\n links.push({url: link_url, label: link_label, icon: link_icon, type: 'customlink-fulltext'})\n end\n end\n\n links\n end",
"def url_to_html\n # Registering Providers - Youtube and Instagram\n OEmbed::Providers.register(OEmbed::Providers::Youtube, OEmbed::Providers::Instagram)\n resource = OEmbed::Providers.get(params[:url])\n respond_to do |format|\n format.html { render json: { error: false, html: resource.html } }\n format.json { render json: { error: false, html: resource.html } }\n end\n rescue\n respond_to do |format|\n format.html { render json: { error: true, message: 'Something wrong with URL' } }\n format.json { render json: { error: true, message: 'Something wrong with URL' } }\n end\n end",
"def url_for_list(type); end",
"def process\n # process url\n urls = self.text.scan(URL_REGEXP)\n urls.each { |url|\n tiny_url = open(\"http://tinyurl.com/api-create.php?url=#{url[0]}\") {|s| s.read} \n self.text.sub!(url[0], \"<a href='#{tiny_url}'>#{tiny_url}</a>\")\n } \n # process @\n ats = self.text.scan(AT_REGEXP)\n ats.each { |at| self.text.sub!(at, \"<a href='/#{at[2,at.length]}'>#{at}</a>\") } \n end",
"def gen_url(url, text)\n if url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n path = $2\n else\n type = \"http\"\n path = url\n url = \"http://#{url}\"\n end\n\n if type == \"link\" then\n url = if path[0, 1] == '#' then # is this meaningful?\n path\n else\n self.class.gen_relative_url @from_path, path\n end\n end\n\n if (type == \"http\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n \"<img src=\\\"#{url}\\\" />\"\n else\n \"<a href=\\\"#{url}\\\">#{text.sub(%r{^#{type}:/*}, '')}</a>\"\n end\n end",
"def process\n # process url\n urls = self.text.scan(URL_REGEXP)\n urls.each { |url|\n tiny_url = open(\"http://tinyurl.com/api-create.php?url=#{url[0]}\") { |s| s.read }\n self.text.sub!(url[0], \"<a href='#{tiny_url}'>#{tiny_url}</a>\")\n }\n \n # process @\n ats = self.text.scan(AT_REGEXP)\n ats.each { |at| \n self.text.sub!(at, \"<a href='/#{at[2,at.length]}'>#{at}</a>\")\n }\n\n end",
"def process_contents\n @img_tags = @contents.xpath( '//img[@src]' )\n @img_tags.each do |tag|\n download_resource(File.join('http://wiki.dublincore.org', tag[:src]), File.join(@image_dir, File.basename(tag[:src])))\n end\n find_links\n end",
"def external_link(link_label, url, options={})\n attributes = options[:attributes] || {}\n children = options[:children] || {}\n image = options[:image] || {}\n\n img =\"\"\n unless image.empty?\n img = self.external_image(image[:url], image, true) \n end\n\n child_elements = self.children_list(children) << img\n link_label = self.tag('label', link_label)\n url = self.tag('url', url)\n link = self.tag('externalLink', url << link_label << child_elements, attributes)\n\n cell = options[:cell] || {}\n row = options[:row] || {}\n self.row_cell(link, cell, row)\n end",
"def create\n @url_article = UrlArticle.new(url_article_params)\n\n #grab title\n @url = @url_article.source\n doc = Nokogiri::HTML(open(@url))\n\n object = LinkThumbnailer.generate(@url)\n titleText = object.title\n\n #titleText = doc.title\n @url_article.title = titleText\n #end of grab title\n\n @url_article.image_source = object.images.first.src.to_s\n\n\n\n\n respond_to do |format|\n if @url_article.save\n format.html { redirect_to @url_article, notice: 'Url article was successfully created.' }\n format.json { render :show, status: :created, location: @url_article }\n else\n format.html { render :new }\n format.json { render json: @url_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_recipe url\n # In practice, grammar mods will get bound to the site\n # The selector will get associated with the recipe's site (as a 'Content' finder)\n # The trimmers will kept on the site as well, to remove extraneous elements\n # The grammar_mods will get applied to the parser's grammar for site-specific modification\n @recipe = load_recipe url, @selector, @trimmers, @grammar_mods\n @page_ref = @recipe.page_ref\n @recipe_page = @page_ref.recipe_page\nend",
"def build_resources_field(feature)\n unless feature[\"links\"].nil?\n resources = []\n feature[\"links\"].each do |l|\n resources << \"<#{l[\"url\"]}|#{l[\"title\"]}>\"\n end\n {\n :title => \"Links & resources\",\n :value => resources.join(\"\\n\")\n }\n end\nend",
"def enhance\n require 'open-uri'\n\n source = open(self.url).read\n return Readability::Document.new(source).content\n end",
"def convert_links\n\n # fetch leaf content\n c = self.content\n\n # regexps\n # url = /( |^)http:\\/\\/([^\\s]*\\.[^\\s]*)( |$)/\n tag_regex = /( |^)#(\\w+)( |$)/\n user_regex = /( |^)@(\\w+)( |$)/\n \n #TODO: make sure no one is typing javascript into the field **IMPORTANT**\n\n #replace #tags with links to that tag search\n while c =~ tag_regex\n c.gsub! \"##{$2}\", \"<a href='/leaves?tagged=#{$2}'>##{$2}</a>\"\n self.has_tags = true\n end\n\n #replace @usernames with links to that user, if user exists\n while c =~ user_regex\n user = $2\n if User.find(user)\n c.sub! \"@#{$2}\", \"<a href='/users/#{$2}'>@#{$2}</a>\"\n end\n end\n\n #replace urls with links\n #while c =~ url\n #name = $2\n #c.sub! /( |^)http:\\/\\/#{name}( |$)/, \" <a href='http://#{name}' >#{name}</a> \"\n #end\n\n self.content = c\n\n end",
"def saveurl\n url_str = link_params[:url]\n url_str.insert(0, 'http://') if url_str.match('^http').nil?\n \n annotations = get_annotations(url_str)\n \n url = Url.find_by_url(url_str)\n if url.nil?\n url = Url.new({:url => link_params[:url], :icon => annotations[:icon]})\n if !url.save\n render :status => 404\n end\n else\n Url.update(url.id, :icon => annotations[:icon]) if url.icon.nil? && annotations[:icon] != ''\n end\n\n @bookmark = Bookmark.new({:url => url, :title => annotations[:title], :description => annotations[:desc], :user => current_user})\n\n @share_with_group = Group.find(params[:id]) if params[:id]\n\n annotations[:keywords].each do |tag|\n if Tag.where(:tagname => tag.strip.gsub(' ', '-').downcase).size == 0\n @tag = Tag.new\n @tag.tagname = tag.strip.gsub(' ','-').downcase\n @bookmark.tags << @tag\n else\n @bookmark.tags << Tag.where(:tagname => tag.strip.gsub(' ', '-').downcase).first\n end\n end\n\n respond_to do |format|\n format.html { render action: 'bookmark_form' }\n format.js\n end\n end",
"def extract_from_page(url, spec={})\n finders = spec[:finders] || all_finders\n if label = spec[:label] # Can specify either a single label or a set\n labels = ((label.class == Array) ? label : [label]).collect { |l| l.to_s }\n finders = finders.keep_if { |t| labels.include? t[:label] }\n else\n labels = SiteServices.data_choices\n end\n begin\n pagetags = PageTags.new(url, @site, finders, spec[:all], false)\n rescue\n puts \"Error: couldn't open page '#{url}' for analysis.\"\n return {}\n end\n results = {}\n # We've cracked the page for all tags. Now report them into the result\n labels.each do |label|\n if foundstr = pagetags.result_for(label)\n # Assuming the tag was fulfilled, there may be post-processing to do\n case label\n when \"Title\"\n # A title may produce both a title and a URL, conventionally separated by a tab\n titledata = foundstr.split('\\t')\n results[:URI] = titledata[1] if titledata[1]\n foundstr = trim_title titledata.first\n when \"Image\", \"URI\"\n # Make picture path absolute if it's not already\n foundstr = resolve foundstr\n end\n results[label.to_sym] = foundstr\n end\n end\n results\n end",
"def url_template; end",
"def url_template; end",
"def links; end",
"def links; end",
"def index\n @urls = ['index', 'fade_replace', 'simple_blind_ror', 'javascript']\n @descriptions = {'index' => \"listing of all demos/methods. This page\",\n \n 'fade_replace' => \"link triggers central page replacement. This will be used in the final project. Uses ror/rjs\",\n 'simple_blind_ror' => \"simplistic scriptaculous effects using ror. demo only.\",\n 'javascript' => \"uses javascript directly. demo only. straight from Scriptaculous site.\"\n }\n end",
"def show\n set_meta_tags og: {\n title: \"Ruby & Rails Glossary - '#{@glossary.term}'\",\n description: @glossary.glossary_definitions.map(&:definition).join(', '),\n image: root_url[0..-2] + ActionController::Base.helpers.asset_url('glossary.png'),\n url: glossary_url(@glossary)\n }, title: \"Ruby and Rails Glossary : '#{@glossary.term}' - #{@glossary.glossary_definitions.map(&:definition).join(', ')}\"\n end",
"def append_link_type(key_url)\n if key_url.start_with?('y/')\n 'https://www.indeed.com/compan' + key_url\n elsif key_url.start_with?('?jk=')\n 'https://www.indeed.com/viewjob' + key_url\n elsif key_url.start_with?('/clk?mo')\n 'https://www.indeed.com/pagead' + key_url\n # elsif key_url.start_with?('????')\n # 'https://www.indeed.com/pagead' + key_url\n else\n 'unknown parameter, adjust in `append_link_type` method in indeed_scraper class...'\n end\n end",
"def parse_url\n set_url_type_and_command\n generate_field\n set_domain\n end",
"def site_type(chart_pages_heading, chart_type)\n gs(Kramdown::Document.new(chart_pages_heading.gsub(/d3pie/, chart_type)).to_html)\nend",
"def nltk_sources\n @reviews = Review.all(:limit => 3, :category => \"amazon\", :state => \"to_analyze\")\n respond_to do |format|\n format.html # nltk_sources.html.erb\n format.xml # nltk_sources.xml.builder\n end\n end",
"def highlight_and_link(source, remove_top_namespace = false)\n\n # debug\n # is_page_of_interest = @context.registers[:page]['fancy_name'] =='reshape') \n \n if remove_top_namespace then \n page_namespace = @context.registers[:page]['namespace'] + \"::\"\n ns = page_namespace.split(\"::\")[0] + \"::\"\n end\n\n highlighted_types = @context.registers[:site].data['highlighted_types'] \n \n # for all types in highlighted_types, \n # - find them \n # - replace them with _X0001X_, _X0002X, which the highlighter will not cut\n # - highlight by calling Rouge\n # - replace back the _X0001X_, _X0002X with the name and adequate url\n # if remove_top_namespace is true, we rerun this a second type with the top namespace removed from the type\n # It is useful for signature when the namespace is not always explicit and would be verbose (e.g. nda:: everywhere in all nda:: functions ?)\n #\n repl_to_original = {}\n c = 1\n highlighted_types.each do |type, url|\n\n type_to_replace = type\n # we are going to run this twice : once with the full type, \n # once with the type_to_replace truncated from top ns if remove_top_namespace is true\n # lambda are closure, it will see the change in type_to_replace\n worker = lambda { \n # the type_to_replace, not followed by a word (e.g. array does not match array_adapter, and not preceded by a :)\n # e.g. array will match array, not nda::array (which could be matched in another part of the loop...), and NOT std::array !\n re = Regexp.new '(?<!:)' + type_to_replace + '(?!\\w)' \n source = source.gsub(re){ |w|\n repl = \"_X000\" + c.to_s + \"X_\"\n repl_to_original[repl] = type # Must be the full type\n c = c + 1\n repl\n }\n }\n worker.call\n if remove_top_namespace then\n type_to_replace = type.gsub(ns, '')\n worker.call\n end\n end\n\n formatter = Rouge::Formatters::HTML.new\n lexer = Rouge::Lexers::Cpp.new\n r = formatter.format(lexer.lex(source))\n r = '<figure class=\"highlight\"><pre><code class=\"language-c--\" data-lang=\"c++\">' + r.strip + '</code></pre></figure>'\n\n repl_to_original.each do |repl, type|\n url = highlighted_types[type] \n\n if remove_top_namespace then\n type = type.gsub(ns, '')\n end\n re = Regexp.new '(' + repl + ')(?!\\w)'\n r = r.gsub(re){ |w| '<a href=\"%s\">%s</a>' %[url, type]}\n end\n\n return r\n end",
"def generate_html\n @main_url = main_url\n @sorted_files = @files.sort\n @sorted_classes = @classes.sort\n @sorted_methods = RDoc::Generator::Method.all_methods.sort\n\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n values = {\n :title_suffix => CGI.escapeHTML(\"[#{@options.title}]\"),\n :charset => @options.charset,\n :style_url => style_url('', @options.css),\n }\n\n @template.write_extra_pages(values) if\n @template.respond_to?(:write_extra_pages)\n end",
"def poll_extractions url=nil\n url ||= site.sample\n finders = all_finders\n begin\n pagetags = PageTags.new(url, @site, finders, true, false)\n correct_result = nil\n finders.each do |finder|\n pagetags.results_for(finder[:id]).each do |result|\n # pagetags.results_for(label).each do |result|\n # finder = result.finder\n puts \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n puts \"URL: #{url}\"\n label = finder[:label]\n finder.each { |key, value| puts \"\\t(#{key}: #{value})\" unless [:label, :count, :foundlings].include?(key) }\n # accepted = false\n if (foundstr = result.out.shift)\n unless column = correct_result && (foundstr == correct_result) && :yes_votes\n puts \"#{label}: #{foundstr}\"\n site_option = [\"Description\", \"Site Name\", \"Title\", \"Image\", \"Author Name\", \"Author Link\", \"Tags\"].include?(label) ? \" S(ave value to Site) \" : \"\"\n puts \"Good? [y](es) n(o) #{site_option} Q(uit)\"\n answer = gets.strip\n case answer[0]\n when 'Q'\n return nil\n when 'N', 'n'\n column = :no_votes\n if answer[0] == 'N'\n @site.reviewed = nil\n @site.save\n return false\n end\n when 'Y', 'y', nil\n column = :yes_votes\n # accepted = (answer[0] == 'Y')\n correct_result = foundstr\n # Include the finder on the site\n unless @site.finders.exists?(finds: finder[:label], selector: finder[:path], read_attrib: finder[:attribute])\n if existing = @site.finders.where(finds: finder[:label]).first\n existing.selector = finder[:path]\n existing.read_attrib = finder[:attribute]\n existing.save\n else\n @site.finders.create(finds: finder[:label], selector: finder[:path], read_attrib: finder[:attribute])\n @site.save\n end\n end\n # Saved the title finder: take a crack at the editing RegExp\n if label == \"Title\"\n done = false\n until done\n trimmed = trim_title foundstr\n puts \"Title In: #{foundstr}\"\n puts \"Title Out: #{trimmed}\"\n puts \"Good? (sS to save, qQ to quit, otherwise type new regexp for title) \"\n answer = gets.strip\n case answer\n when 's', 'S'\n site.save\n done = true\n when 'q', 'Q'\n done = true\n else\n @site.ttlcut = answer\n end\n end\n end\n when 'S'\n # Copy the value to the corresponding field on the site\n rest_of_line = answer[1..-1].strip\n field_val = rest_of_line.blank? ? foundstr : rest_of_line\n case label\n when \"Image\"\n @site.logo = field_val\n @site.save\n when \"Description\"\n @site.description = field_val\n @site.save\n when \"Site Name\", \"Title\"\n @site.name = field_val\n @site.save\n when \"Author Name\"\n TaggingServices.new(@site).tag_with field_val, User.super_id, type: \"Author\"\n @site.save\n when \"Author Link\"\n # Add a reference to the author, if any\n @site.tags(User.super_id, tagtype: \"Author\").each { |author|\n Reference.assert field_val, author, \"Home Page\"\n }\n when \"Tags\"\n ts = TaggingServices.new @site\n field_val.split(',').collect { |tagname|\n tagname = tagname.split(':').last.strip\n tagname if (tagname.length>0)\n }.compact.each { |tagname|\n ts.tag_with tagname, User.super_id\n }\n else\n puts \"There's no field on the site for #{label}\"\n end\n end\n end\n if column\n finder[column] = 0 unless finder[column]\n finder[column] = finder[column]+1\n end\n end\n end\n end\n return true\n rescue Exception => e\n puts \"Error: couldn't open page '#{url}' for analysis:\"\n puts e.to_s\n return false\n end\n end",
"def show\n respond_to do |format|\n format.html do \n if @custom_search_engine.publish? || current_user == @custom_search_engine.author\n @valid_labels = @custom_search_engine.labels.map { |l| l.name }\n @labels_hash = Hash.new\n @no_labels_arr = Array.new\n @custom_search_engine.annotations.score_desc.each do |a|\n if a.labels_list.any?\n a.labels_list.each do |l|\n if @valid_labels.include?(l)\n @labels_hash[l] = Array.new if @labels_hash[l].nil?\n @labels_hash[l].push(a)\n else\n @no_labels_arr.push(a)\n end\n end\n else\n @no_labels_arr.push(a)\n end \n end\n if @custom_search_engine.status == 'publish' && current_user != @custom_search_engine.author\n @custom_search_engine.inc(:browse_count, 1)\n end\n render 'show'\n else\n flash[:error] = I18n.t('human.errors.only_publish_cse_available')\n redirect_to nodes_path \n end\n end\n #format.json { render json: @custom_search_engine }\n format.xml { @labels = @custom_search_engine.labels }\n end\n end",
"def create\n\n if params[:sample]\n analyse = Ca::Analyse.new(HTMLReader.instance.page(params[:sample][:address]));\n end\n if params[:text]\n analyse = Ca::Analyse.new(params[:text][:content]);\n end\n descript = analyse.description\n @problems = descript.problems\n @text = descript.text\n @best_phrases = Hash[analyse.description.first_n]\n @nr_of_chars = descript.text_number_of_chars\n @nr_of_words = descript.text_number_of_words\n @nr_of_nodes = descript.nr_of_nodes\n @score = descript.score\n @plagiarism = descript.plagiarism\n @html = descript.text.to_s.force_encoding(\"UTF-8\")\n @tags_problem = descript.tag_problem_flag\n end",
"def scrape(url)\n html = ScraperWiki.scrape(url)\n doc = Nokogiri::HTML(html)\n doc.search('object').each do |object|\n obj = object['data']\n if obj\n puts obj\n ScraperWiki.save(['URL', 'SOURCE'], {'URL' => obj, 'SOURCE' => url})\n end\n end\nend",
"def scrape(url)\n html = ScraperWiki.scrape(url)\n doc = Nokogiri::HTML(html)\n doc.search('object').each do |object|\n obj = object['data']\n if obj\n puts obj\n ScraperWiki.save(['URL', 'SOURCE'], {'URL' => obj, 'SOURCE' => url})\n end\n end\nend",
"def look_up_link(result)\n case name\n when \"IGN\" then return result.attributes[\"href\"].value\n when \"GameSpot\" then return \"http://\" + base_url + result.attributes[\"href\"].value\n when \"GiantBomb\" then return \"http://\" + base_url + result.attributes[\"href\"].value\n end\n end",
"def to_rdf(format, options = {})\n \n # TODO: type of tagging\n \n httpURI = options[:httpURI] ||= \"http://example.com/missingBaseURI\"\n host = options[:host] ||= \"http://maphub.info\"\n \n # Defining the custom vocabulary # TODO: move this to separate lib\n oa_uri = RDF::URI('http://www.w3.org/ns/openannotation/core/')\n oa = RDF::Vocabulary.new(oa_uri)\n oax_uri = RDF::URI('http://www.w3.org/ns/openannotation/extensions/')\n oax = RDF::Vocabulary.new(oax_uri)\n maphub_uri = RDF::URI('http://maphub.info/ns/vocab#')\n maphub = RDF::Vocabulary.new(maphub_uri)\n foaf_uri = RDF::URI('http://xmlns.com/foaf/spec/')\n foaf = RDF::Vocabulary.new(foaf_uri)\n dcterms_uri = RDF::URI('http://purl.org/dc/dcmitype/')\n dcterms = RDF::Vocabulary.new(dcterms_uri)\n dc_uri = RDF::URI('http://purl.org/dc/elements/1.1/')\n dc = RDF::Vocabulary.new(dc_uri)\n \n # Building the annotation graph\n baseURI = RDF::URI.new(httpURI)\n graph = RDF::Graph.new\n graph << [baseURI, RDF.type, oa.Annotation]\n graph << [baseURI, RDF.type, oax.Tagging]\n graph << [baseURI, RDF.type, maphub.GeoReference]\n unless self.created_at.nil?\n graph << [\n baseURI,\n oa.annotated, \n RDF::Literal.new(self.created_at, :datatype => RDF::XSD::dateTime)]\n end\n unless self.updated_at.nil?\n graph << [\n baseURI,\n oa.generated, \n RDF::Literal.new(self.updated_at, :datatype => RDF::XSD::dateTime)]\n end\n graph << [baseURI, oa.generator, RDF::URI(host)]\n \n # Adding user and provenance data\n user_uuid = UUIDTools::UUID.timestamp_create().to_s\n user_node = RDF::URI.new(user_uuid)\n graph << [baseURI, oa.annotator, user_node]\n graph << [user_node, foaf.mbox, RDF::Literal.new(self.user.email)]\n graph << [user_node, foaf.name, RDF::Literal.new(self.user.username)]\n\n \n # Adding the body\n unless self.geonames_uri.nil?\n graph << [baseURI, oax.hasSemanticTag, RDF::URI(self.geonames_uri)] \n end\n\n # Adding the target\n specific_target_uuid = UUIDTools::UUID.timestamp_create().to_s\n specific_target = RDF::URI.new(specific_target_uuid)\n graph << [baseURI, oa.hasTarget, specific_target]\n graph << [specific_target, RDF.type, oa.SpecificResource]\n source_node = RDF::URI.new(self.map.raw_image_uri)\n graph << [specific_target, oa.hasSource, source_node]\n \n # Source details\n graph << [source_node, RDF.type, dcterms.StillImage]\n graph << [source_node, dc.format, \"image/jp2\"]\n \n # the Point selector\n point_selector_uuid = UUIDTools::UUID.timestamp_create().to_s\n point_selector_node = RDF::URI.new(point_selector_uuid)\n graph << [specific_target, oa.hasSelector, point_selector_node]\n graph << [point_selector_node, RDF.type, oa.FragmentSelector]\n graph << [point_selector_node, RDF.value, self.fragment]\n \n # Serializing RDF graph to string\n RDF::Writer.for(format.to_sym).buffer do |writer|\n writer.prefix :dcterms, RDF::URI('http://purl.org/dc/terms/')\n writer.prefix :oa, oa_uri\n writer.prefix :oax, oax_uri\n writer.prefix :rdf, RDF::URI(RDF.to_uri)\n writer.prefix :maphub, maphub_uri\n writer.prefix :foaf, foaf_uri\n writer.prefix :dcterms, dcterms_uri\n writer.prefix :dc, dc_uri\n writer << graph\n end\n \n end",
"def index\n\n extra_head_content << '<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS for results\" href=\"'+ url_for(params.merge(\"format\" => \"rss\")) + '\">'\n extra_head_content << '<link rel=\"alternate\" type=\"application/atom+xml\" title=\"Atom for results\" href=\"'+ url_for(params.merge(\"format\" => \"atom\")) + '\">'\n\n (@response, @document_list) = get_search_results\n @filters = params[:f] || []\n\n if Blacklight.config[:data_augmentation][:enabled] and !(params[:q].blank? and params[:f].blank? and params[:search_field].blank?)\n get_gdata_for_result_list\n end\n\n respond_to do |format|\n format.html { save_current_search_params }\n format.mobile { save_current_search_params }\n format.rss { render :layout => false }\n format.atom { render :layout => false }\n end\n end",
"def show\n @link = Link.find(params[:id])\nif @link['id']==2\n require 'rubygems'\nrequire 'nokogiri'\nrequire 'open-uri'\nurl=@link['name']\nputs url\ndoc = Nokogiri::HTML(open(url))\n@title = doc.at_css(\"title\").text\n@imguLink = doc.at_css('.article-body')\n@imgLink = @imguLink.to_s\n@imgLink = @imgLink.gsub(/<\\/?[^>]+>/, '')\n@imgLink = @imgLink.gsub(/{\\/?[^}]+}/, '')\n@imgLink = @imgLink.gsub(/[()]/, \"\")\n#@imgLink = @imgLink.gsub(/if SBN.OpenX.isTablet else/, \"\")\n\n#@imgLink=doc.xpath(\"//text()\").to_s\nend\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def ⚘ *args\n href, *title = args.flatten\n title = title.join(SEPARATOR).strip\n harvest __callee__, %Q(\n<figure>\n <img src='#{href.unbowl}'/>\n <figcaption>\n <p>#{title}</p>\n </figcaption>\n</figure>\n)\n end",
"def custom_display_as_html(code, file_url)\n begin\n review_scores = self.scores\n\n #********************Learning Targets******************\n code = code + \"<h2>Learning Targets</h2><hr>\"\n if review_scores[0].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They state what the reader should know or be able to do after reading the lesson<br/>\" \n end\n\n if review_scores[1].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are specific<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are specific<br/>\"\n end\n\n if review_scores[2].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are appropriate and reasonable i.e. not too easy or too difficult for TLED 301 students<br/>\"\n end\n\n if review_scores[3].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They are observable i.e. you wouldn't have to look inside the readers' head to know if they met this target<br/>\"\n end\n\n code = code + \"<br/><i>Number of Learning Targets: </i>#{review_scores[4].comments.gsub(/\\\"/,'"').to_s}<br/>\"\n code = code + \"<br/><i>Grade: </i>#{review_scores[5].comments.gsub(/\\\"/,'"').to_s}<br/>\"\n code = code + \"<br/><i>Comment: </i> <dl><dd>#{review_scores[6].comments.gsub(/\\\"/,'"').to_s}</dl></dd>\"\n\n #*******************Content************************\n code = code + \"<h2>Content</h2><hr>\"\n code = code + \"<i>File:</i>\"\n if file_url.nil?\n code = code + \"File has not been uploaded<br/>\"\n else\n code = code + file_url.to_s + \"<br/>\"\n end\n \n code = code + \"<i>Compliment:</i>\"\n code = code + \"<ul><li>#{review_scores[8].comments.gsub(/\\\"/,'"').to_s}</li><li>#{review_scores[9].comments.gsub(/\\\"/,'"').to_s}</li></ul>\"\n code = code + \"<i>Suggestion:</i>\"\n code = code + \"<ul><li>#{review_scores[10].comments.gsub(/\\\"/,'"').to_s}</li><li>#{review_scores[11].comments.gsub(/\\\"/,'"').to_s}</li></ul>\"\n\n #*******************Sources and Use of Source Material************************\n code = code + \"<h2>Sources and Use of Source Material</h2><hr>\"\n code = code + \"<br/>How many sources are in the references list?: #{review_scores[12].comments.gsub(/\\\"/,'"').to_s}<br/>\"\n code = code + \"<br/>List the range of publication years for all sources, e.g. 1998-2006: <b>#{review_scores[13].comments.gsub(/\\\"/,'"').to_s} - #{review_scores[14].comments.gsub(/\\\"/,'"').to_s}</b><br/><br/>\"\n\n if review_scores[15].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> It lists all the sources in a section labeled \\\"References\\\"<br/>\"\n end\n\n if review_scores[16].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites each of these sources in the lesson<br/>\"\n end\n\n if review_scores[17].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The citations are in APA format<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The citations are in APA format<br/>\"\n end\n\n if review_scores[18].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The author cites at least 2 scholarly sources<br/>\"\n end\n\n if review_scores[19].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Most of the sources are current (less than 5 years old)<br/>\"\n end\n\n if review_scores[20].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> Taken together the sources represent a good balance of potential references for this topic<br/>\"\n end\n\n if review_scores[21].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The sources represent different viewpoints<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The sources represent different viewpoints<br/>\"\n end\n\n code = code + \"<br/><b>What other sources or perspectives might the author want to consider?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[22].comments.gsub(/\\\"/,'"').to_s}</dl></dd>\"\n \n if review_scores[23].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible. <br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> All materials (such as tables, graphs, images or videos created by other people or organizations) posted are in the lesson in accordance with the Attribution-Noncommercial-Share Alike 3.0 Unported license, or compatible<br/>\"\n end\n\n code = code + \"<br/><b>If not, which one(s) may infringe copyrights, or what areas of text may need citations, revisions or elaboration?</b><br/>\"\n code = code + \"<dl><dd>#{review_scores[24].comments.gsub(/\\\"/,'"').to_s}</dl></dd>\"\n\n code = code + \"<br/>Please make a comment about the sources. Explain how the author can improve the use of sources in the lesson.<br/>\"\n code = code + \"<dl><dd>#{review_scores[25].comments.gsub(/\\\"/,'"').to_s}</dl></dd>\"\n\n #*******************Multiple Choice Questions************************\n code = code + \"<h2>Multiple Choice Questions</h2><hr>\"\n if review_scores[26].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There are 4 multiple-choice questions<br/>\"\n end\n\n if review_scores[27].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> They each have four answer choices (A-D)<br/>\"\n end\n\n if review_scores[28].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> There is a single correct (aka: not opinion-based) answer for each question<br/>\"\n end\n\n if review_scores[29].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions assess the learning target(s)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions assess the learning target(s)<br/>\"\n end\n\n if review_scores[30].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The questions are appropriate and reasonable (not too easy and not too difficult)<br/>\"\n end\n\n if review_scores[31].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The foils (the response options that are NOT the answer) are reasonable i.e. they are not very obviously incorrect answers<br/>\"\n end\n\n if review_scores[32].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The response options are listed in alphabetical order<br/>\"\n end\n\n if review_scores[33].comments == \"1\"\n code = code + \"<img src=\\\"/images/Check-icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n else\n code = code + \"<img src=\\\"/images/delete_icon.png\\\"> The correct answers are provided and listed BELOW all the questions<br/>\"\n end\n\n code = code + \"<br/><h3>Questions</h3>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[34].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[35].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[36].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[37].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[38].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[39].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[40].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[41].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[42].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<i>Type: </i><b>#{review_scores[43].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[44].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[45].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n\n #*******************Rubric************************\n code = code + \"<h2>Rubric</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code +\n \"<div align=\\\"center\\\">The information selected by the author:</div><table class='general'>\n <tr>\n <th>5 - Very Important </th>\n <th>4 - Quite Important </th>\n <th>3 - Some Importance </th>\n <th>2 - Little Importance</th>\n <th>1 - No Importance </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[46].comments == \"1\"\n code = code + \"<li>Is very important for future teachers to know</li>\"\n end\n if review_scores[47].comments == \"1\"\n code = code + \"<li>Is based on researched information</li>\"\n end\n if review_scores[48].comments == \"1\"\n code = code + \"<li>Is highly relevant to current educational practice</li>\"\n end\n if review_scores[49].comments == \"1\"\n code = code + \"<li>Provides an excellent overview and in-depth discussion of key issues</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[50].comments == \"1\"\n code = code + \"<li>Is relevant to future teachers</li>\"\n end\n if review_scores[51].comments == \"1\"\n code = code + \"<li>Is mostly based on researched information</li>\"\n end\n if review_scores[52].comments == \"1\"\n code = code + \"<li>Is applicable to today's schools</li>\"\n end\n if review_scores[53].comments == \"1\"\n code = code + \"<li>Provides a good overview and explores a few key ideas</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[54].comments == \"1\"\n code = code + \"<li>Has useful points but some irrelevant information</li>\"\n end\n if review_scores[55].comments == \"1\"\n code = code + \"<li>Is half research; half the author's opinion</li>\"\n end\n if review_scores[56].comments == \"1\"\n code = code + \"<li>Is partially out-dated or may not reflect current practice</li>\"\n end\n if review_scores[57].comments == \"1\"\n code = code + \"<li>Contains good information but yields an incomplete understanding</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[58].comments == \"1\"\n code = code + \"<li>Has one useful point</li>\"\n end\n if review_scores[59].comments == \"1\"\n code = code + \"<li>Is mostly the author's opinion.</li>\"\n end\n if review_scores[60].comments == \"1\"\n code = code + \"<li>Is mostly irrelevant in today's schools</li>\"\n end\n if review_scores[61].comments == \"1\"\n code = code + \"<li>Focused on unimportant subtopics OR is overly general</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\" \n if review_scores[62].comments == \"1\"\n code = code + \"<li>Is not relevant to future teachers</li>\"\n end\n if review_scores[63].comments == \"1\"\n code = code + \"<li>Is entirely the author's opinion</li>\"\n end\n if review_scores[64].comments == \"1\"\n code = code + \"<li>Is obsolete</li>\"\n end\n if review_scores[65].comments == \"1\"\n code = code + \"<li>Lacks any substantive information</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code +\n \"<div align=\\\"center\\\">To attract and maintain attention, the lesson has:</div><table class='general'>\n <tr>\n <th>5 - Extremely Interesting </th>\n <th>4 - Quite Interesting </th>\n <th>3 - Reasonably Interesting </th>\n <th>2 - Little Interest</th>\n <th>1 - No Interest </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[66].comments == \"1\"\n code = code + \"<li>A sidebar with new information that was motivating to read/view</li>\"\n end\n if review_scores[67].comments == \"1\"\n code = code + \"<li>Many creative, attractive visuals and engaging, interactive elements</li>\"\n end\n if review_scores[68].comments == \"1\"\n code = code + \"<li>Multiple perspectives</li>\"\n end\n if review_scores[69].comments == \"1\"\n code = code + \"<li>Insightful interpretation & analysis throughout</li>\"\n end\n if review_scores[70].comments == \"1\"\n code = code + \"<li>Many compelling examples that support the main points (it \\\"shows\\\" not just \\\"tells\\\")</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[71].comments == \"1\"\n code = code + \"<li>A sidebar that adds something new to the lesson</li>\"\n end\n if review_scores[72].comments == \"1\"\n code = code + \"<li>A few effective visuals or interactive elements</li>\"\n end\n if review_scores[73].comments == \"1\"\n code = code + \"<li>At least one interesting, fresh perspective</li>\"\n end\n if review_scores[74].comments == \"1\"\n code = code + \"<li>Frequent interpretation and analysis</li>\"\n end\n if review_scores[75].comments == \"1\"\n code = code + \"<li>Clearly explained and well supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[76].comments == \"1\"\n code = code + \"<li>A sidebar that repeats what is in the lesson</li>\"\n end\n if review_scores[77].comments == \"1\"\n code = code + \"<li>An effective visual or interactive element</li>\"\n end\n if review_scores[78].comments == \"1\"\n code = code + \"<li>One reasonable (possibly typical) perspective</li>\"\n end\n if review_scores[79].comments == \"1\"\n code = code + \"<li>Some interpretation and analysis</li>\"\n end\n if review_scores[80].comments == \"1\"\n code = code + \"<li>Supported points</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[81].comments == \"1\"\n code = code + \"<li>A quote, link, etc. included as a sidebar, but that is not in a textbox</li>\"\n end\n if review_scores[82].comments == \"1\"\n code = code + \"<li>Visuals or interactive elements that are distracting</li>\"\n end\n if review_scores[83].comments == \"1\"\n code = code + \"<li>Only a biased perspective</li>\"\n end\n if review_scores[84].comments == \"1\"\n code = code + \"<li>Minimal analysis or interpretation</li>\"\n end\n if review_scores[85].comments == \"1\"\n code = code + \"<li>At least one clear and supported point</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[86].comments == \"1\"\n code = code + \"<li>No side bar included</li>\"\n end\n if review_scores[87].comments == \"1\"\n code = code + \"<li>No visuals or interactive elements</li>\"\n end\n if review_scores[88].comments == \"1\"\n code = code + \"<li>No perspective is acknowledged</li>\"\n end\n if review_scores[89].comments == \"1\"\n code = code + \"<li>No analysis or interpretation</li>\"\n end\n if review_scores[90].comments == \"1\"\n code = code + \"<li>No well-supported points</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n code = code + \"<h3>Credibility</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To demonstrate its credibility the lesson:</div><table class='general'>\n <tr>\n <th>5 - Completely Credible </th>\n <th>4 - Substantial Credibility </th>\n <th>3 - Reasonable Credibility </th>\n <th>2 - Limited Credibility</th>\n <th>1 - Not Credible </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[91].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources in proper APA format</li>\"\n end\n if review_scores[92].comments == \"1\"\n code = code + \"<li>Provides citations for all presented information</li>\"\n end\n if review_scores[93].comments == \"1\"\n code = code + \"<li>Readily identifies bias: both the author's own and others</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[94].comments == \"1\"\n code = code + \"<li>Cites 5 or more diverse, reputable sources with few APA errors</li>\"\n end\n if review_scores[95].comments == \"1\"\n code = code + \"<li>Provides citations for most information</li>\"\n end\n if review_scores[96].comments == \"1\"\n code = code + \"<li>Clearly differentiates between opinion and fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[97].comments == \"1\"\n code = code + \"<li>Cites 5 or more reputable sources</li>\"\n end\n if review_scores[98].comments == \"1\"\n code = code + \"<li>Supports some claims with citation</li>\"\n end\n if review_scores[99].comments == \"1\"\n code = code + \"<li>Occasionally states opinion as fact</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[100].comments == \"1\"\n code = code + \"<li>Cites 4 or more reputable sources</li>\"\n end\n if review_scores[101].comments == \"1\"\n code = code + \"<li>Has several unsupported claims</li>\"\n end\n if review_scores[102].comments == \"1\"\n code = code + \"<li>Routinely states opinion as fact and fails to acknowledge bias</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[103].comments == \"1\"\n code = code + \"<li>Cites 3 or fewer reputable sources</li>\"\n end\n if review_scores[104].comments == \"1\"\n code = code + \"<li>Has mostly unsupported claims</li>\"\n end\n if review_scores[105].comments == \"1\"\n code = code + \"<li>Is very biased and contains almost entirely opinions</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n\n code = code + \"<h3>Pedagogy</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">To help guide the reader:</div><table class='general'>\n <tr>\n <th>5 - Superior </th>\n <th>4 - Effective </th>\n <th>3 - Acceptable </th>\n <th>2 - Deficient</th>\n <th>1 - Absent </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[106].comments == \"1\"\n code = code + \"<li>Specific, appropriate, observable learning targets establish the purpose of the lesson</li>\"\n end\n if review_scores[107].comments == \"1\"\n code = code + \"<li>The lesson accomplishes its established goals</li>\"\n end\n if review_scores[108].comments == \"1\"\n code = code + \"<li>Excellent knowledge and application MC questions align with learning targets and assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[109].comments == \"1\"\n code = code + \"<li>Specific and reasonable learning targets are stated</li>\"\n end\n if review_scores[110].comments == \"1\"\n code = code + \"<li>The lesson partially meets its established goals</li>\"\n end\n if review_scores[111].comments == \"1\"\n code = code + \"<li>Well constructed MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[112].comments == \"1\"\n code = code + \"<li>Reasonable learning targets are stated</li>\"\n end\n if review_scores[113].comments == \"1\"\n code = code + \"<li>The content relates to its goals</li>\"\n end\n if review_scores[114].comments == \"1\"\n code = code + \"<li>MC questions assess important content</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[115].comments == \"1\"\n code = code + \"<li>A learning target is included</li>\"\n end\n if review_scores[116].comments == \"1\"\n code = code + \"<li>Content does not achieve its goal, or goal is unclear</li>\"\n end\n if review_scores[117].comments == \"1\"\n code = code + \"<li>4 questions are included</li>\"\n end\n\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[118].comments == \"1\"\n code = code + \"<li>Learning target is missing/ not actually a learning target</li>\"\n end\n if review_scores[119].comments == \"1\"\n code = code + \"<li>Lesson has no goal/ content is unfocused</li>\"\n end\n if review_scores[120].comments == \"1\"\n code = code + \"<li>Questions are missing</li>\"\n end\n\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n code = code + \"<h3>Writing Quality</h3>\"\n\n code = code +\n \"<div align=\\\"center\\\">The writing:</div><table class='general'>\n <tr>\n <th>5 - Excellently Written </th>\n <th>4 - Well Written </th>\n <th>3 - Reasonably Written </th>\n <th>2 - Fairly Written</th>\n <th>1 - Poorly Written </th>\n </tr>\n <tr>\"\n\n code = code + \"<td><ul>\"\n if review_scores[121].comments == \"1\"\n code = code + \"<li>Is focused, organized, and easy to read throughout</li>\"\n end\n if review_scores[122].comments == \"1\"\n code = code + \"<li>Uses rich, descriptive vocabulary and a variety of effective sentence structures</li>\"\n end\n if review_scores[123].comments == \"1\"\n code = code + \"<li>Contains few to no mechanical errors</li>\"\n end\n if review_scores[124].comments == \"1\"\n code = code + \"<li>Has an effective introduction and a conclusion that synthesizes all of the material presented</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[125].comments == \"1\"\n code = code + \"<li>Is organized and flows well</li>\"\n end\n if review_scores[126].comments == \"1\"\n code = code + \"<li>Uses effective vocabulary and sentence structures</li>\"\n end\n if review_scores[127].comments == \"1\"\n code = code + \"<li>Contains a few minor mechanical errors</li>\"\n end\n if review_scores[128].comments == \"1\"\n code = code + \"<li>Has an effective introduction and conclusion based on included information</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[129].comments == \"1\"\n code = code + \"<li>Is mostly organized</li>\"\n end\n if review_scores[130].comments == \"1\"\n code = code + \"<li>Uses properly constructed sentences</li>\"\n end\n if review_scores[131].comments == \"1\"\n code = code + \"<li>Has a few distracting errors</li>\"\n end\n if review_scores[132].comments == \"1\"\n code = code + \"<li>Includes an introduction and a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[133].comments == \"1\"\n code = code + \"<li>Can be difficult to follow</li>\"\n end\n if review_scores[134].comments == \"1\"\n code = code + \"<li>Contains several awkward sentences</li>\"\n end\n if review_scores[135].comments == \"1\"\n code = code + \"<li>Has several distracting errors</li>\"\n end\n if review_scores[136].comments == \"1\"\n code = code + \"<li>Lacks either an introduction or a conclusion</li>\"\n end\n code = code + \"</ul></td>\"\n\n code = code + \"<td><ul>\"\n if review_scores[137].comments == \"1\"\n code = code + \"<li>Has minimal organization</li>\"\n end\n if review_scores[138].comments == \"1\"\n code = code + \"<li>Has many poorly constructed sentences</li>\"\n end\n if review_scores[139].comments == \"1\"\n code = code + \"<li>Has many mechanical errors that inhibit comprehension</li>\"\n end\n if review_scores[140].comments == \"1\"\n code = code + \"<li>Has neither a clear introduction nor a conclusion</li>\"\n end\n code = code + \"</ul></td></tr>\"\n\n code = code + \"</table>\"\n\n #*******************Ratings************************\n code = code + \"<h2>Ratings</h2><hr>\"\n\n code = code + \"<h3>Importance</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[141].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[142].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Interest</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[143].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[144].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Credibility</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[145].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[146].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Pedagogy</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[147].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[148].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n\n code = code + \"<h3>Writing Quality</h3>\"\n code = code + \"<i>Grade: </i><b>#{review_scores[149].comments.gsub(/\\\"/,'"').to_s}</b><br/>\"\n code = code + \"<i>Comment: </i><dl><dd>#{review_scores[150].comments.gsub(/\\\"/,'"').to_s}</dl></dd><br/>\"\n rescue\n code += \"Error \" + $! \n end \n code\nend",
"def modifier_lien\n if params[:lien] != \"\" \n @lien = Lien.find(params[:id])\n @donnee_url = OpenGraph.fetch(params[:lien])\n \n @url_lien = params[:lien]\n element = @url_lien.split(\".\")\n tab = @url_lien.split(\"//\")\n if tab[0] == \"http:\"\n @url = @url_lien\n else\n @url = \"http://\"+@url_lien\n end\n name = \"/images_liens/thumb#{Time.now.to_i}.jpg\"\n if @donnee_url\n\t titre = @donnee_url.title\n\t desc = @donnee_url.description\n\t image = @donnee_url.image\n image_or = Magick::Image.read(image)[0]\n image = image_or.crop_resized!(297, 195, Magick::NorthGravity)\n image.write(\"#{RAILS_ROOT}/public\"+name) do self.quality = 100 end\n else\n\t begin\n uri =URI(@url)\n #htmlcontent = #Net::HTTP.get(uri)\n #soup = BeautifulSoup.new(htmlcontent)\n hdrs = {\"User-Agent\"=>\"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1\", \"Accept-Charset\"=>\"utf-8\", \"Accept\"=>\"text/html\"}\n my_html = \"\"\n \n open(@url, hdrs).each{|s| my_html << s}\n doc = Hpricot(my_html)\n desc = HTMLEntities.new.decode(doc.search(\"meta[@name*=description]\").map {|e| e.get_attribute(\"content\") }.to_s)#soup.find('meta', {'name' => 'description'})['content']\n titre = HTMLEntities.new.decode(doc.at(\"html/head/title\").inner_html)#soup.html.head.title.string\n\t rescue\n titre = \"\"\n flash[:error] = \"Ce lien est certainement plein de joie mais malheureusement, le format n'est pas conforme à la Boite à Joie, peut être existe t-il un autre lien qui vous rende joyeux ?\"\n redirect_to (:controller => 'liens', :action => \"new\", :p => \"home\")\n return 0\n end\n \n #desc = \"\"\n\t name = \"http://api.url2png.com/v3/P4F280C28BB8E7/#{Digest::MD5.hexdigest('S94BC47B3A5190+'+@url)}/297x195/#{@url}\"#\"https://www.apercite.fr/api/apercite/800x600/oui/oui/#{@url}\"\n end\n \n \n respond_to do |format|\n if Lien.update(params[:id], :titre_lien =>titre, :description_lien => desc, :url_lien => params[:lien], :image_lien => name)\n format.html { redirect_to(:controller => 'auteurs', :action => 'new', :id => params[:idauteur], :p => \"user\", :idlien => params[:id], :auteur => params[:auteur][:pseudo_auteur]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\", :p => \"home\" }\n format.xml { render :xml => @lien.errors, :status => :unprocessable_entity }\n end\n end\n else\n flash[:notice] = \"Désolé monsieur ou madame !!\"\n redirect_to :back\n end\n end",
"def _build_HTML( og, url )\n\n\t\t\ttitle = og['og:title'] || ''\n\t\t\thtml = ''\n\n\t\t\tif og.include?( 'og:video' )\n\t\t\t\thtml = '<iframe src=\"%{url}\" alt=\"%{title}\" width=\"%{width}\" height=\"%{height}\" frameborder=\"0\" allowfullscreen mozallowfullscreen webkitallowfullscreen></iframe>' % {\n\t\t\t\t\t'url' => og['og:video'],\n\t\t\t\t\t'title' => title,\n\t\t\t\t\t'width' => og['og:video:width'] || 560,\n\t\t\t\t\t'height' => og['og:video:height'] || 315\n\t\t\t\t}\n\t\t\telse\n\t\t\t\thtml = '<a href=\"%{url}\" alt=\"%{title}\">%{title}</a>' % {\n\t\t\t\t\t'url' => og['og:url'] || url,\n\t\t\t\t\t'title' => title\n\t\t\t\t}\n\t\t\tend\n\n\t\t\thtml\n\t\tend",
"def render_display_link args\n label = blacklight_config.display_link[args[:field]][:label]\n links = args[:value]\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} links = #{links.inspect}\")\n links ||= args[:document].fetch(args[:field], :sep => nil) if args[:document] and args[:field]\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} links = #{links.inspect}\")\n render_format = args[:format] ? args[:format] : 'default'\n\n value = links.map do |link|\n #Check to see whether there is metadata at the end of the link\n url, *metadata = link.split('|')\n if links.size == 1 && render_format == 'url'\n return url.html_safe\n end\n if metadata.present?\n label = metadata[0]\n end\n link_to(process_online_title(label), url.html_safe, {:class => 'online-access', :onclick => \"javascript:_paq.push(['trackEvent', 'itemView', 'outlink']);\"})\n end\n\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} field = #{args[:field].inspect}\")\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} render_format = #{render_format.inspect}\")\n #Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} value = #{value.inspect}\")\n if render_format == 'raw'\n return value\n else\n case args[:field]\n when'url_findingaid_display'\n return value[0]\n when 'url_bookplate_display'\n Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} field = #{args[:field].inspect}\")\n return value.uniq.join(',').html_safe\n when 'url_other_display'\n return value.join('<br>').html_safe\n else\n fp = Blacklight::FieldPresenter.new( self, args[:document], blacklight_config.show_fields[args[:field]], :value => label)\n fp.render\n end\n end\n end",
"def search_ah_link(atk, health, content)\n string = \"<a href='#{@search_url}type=troop&atk=#{atk}&health=#{health}'>#{content}</a>\"\nend",
"def insert_links_with_numbers(output_file)\n str_html = File.read(output_file)\n # First Gsub: Inserting '#' links if IMG has alt-number\n # Second Gsub: Inserting 'CODE' text if IMG has alt-letters of code \n str_html = str_html.gsub(/(<img.*alt=\")(\\d.*)(\">)/, '<a href=\"\\\\2\" target=\"_blank\">\\\\1\\\\2\" title=\"\\\\2\\\\3</a>').gsub(/(min-width:.*)(\">\\n\\t\\t.*)(<img.*alt=\")([a-zA-Z]+)(\">)/, 'font-size:20px !important; font-family:Helvetica Neue, Helvetica, Arial, serif; color:#030303; text-align:center; letter-spacing:1px; \\\\1\"><strong>\\\\4</strong>')\n # With this code, the links in CSV must be in order (same as photoshop slices)\n doc = Nokogiri::HTML(str_html)\n # Making a new array for Nokogiri alts - Picture's number should be same as link's number\n pic_number = doc.xpath(\"//a//img//@alt\").map { |alt| alt.to_s }\n # Inserting links. \n doc.xpath(\"//a\").each_with_index { |a, i| a[\"href\"] = @content[pic_number[i].to_i].values.last } # Links \n # Changing alt & title tag to prodouct details. \n doc.xpath(\"//a//img\").each_with_index do |img, n|\n img[\"title\"] = @content[pic_number[n].to_i].values.first # Hover Text(title)\n img[\"alt\"] = @content[pic_number[n].to_i].values.first # Alt text(alt)\n end \n # Wrting the result\n File.open(output_file, \"w\") {|out| out << doc.to_s }\n end",
"def generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n end",
"def link() url; end",
"def link() url; end",
"def parse_original_url\n self.title ||= self.original_url\n case self.original_url\n when /digitalgallery\\.nypl\\.org/ && /imageID/\n self.type = \"DgImage\"\n self.remote_ref = self.original_url.gsub(/^.*imageID=([^&]+).*$/, '\\1')\n self.title.gsub!(\"NYPL Digital Gallery | \", \"\")\n when /ebooks\\.nypl\\.org/ && /ContentDetails/\n self.type = \"Ebook\"\n self.remote_ref = self.original_url.gsub(/^.*ContentDetails.htm?id=([^&]+).*$/, '\\1')\n self.title.gsub!(\"The New York Public Library, eNYPL - \", \"\")\n when /catalog\\.nypl\\.org/\n self.type = \"BibRecord\"\n when /nypl\\.org\\/locations/\n self.type = \"LibLocation\"\n self.title.gsub!(\" | The New York Public Library\", \"\")\n when /nypl\\.org\\/events\\/.*\\/\\d\\d\\d\\d\\/\\d\\d\\/\\d\\d/\n self.type = \"Event\"\n date = url.gsub(/^.*nypl\\.org\\/events\\/.*\\/(\\d\\d\\d\\d)\\/(\\d\\d)\\/(\\d\\d).*/, '\\2-\\3-\\1')\n self.title.gsub!(\" | The New York Public Library\", \"\")\n self.title = \"#{date}: #{self.title}\"\n else\n self.type = \"Bookmark\"\n self.title.gsub!(\" | The New York Public Library\", \"\")\n end\n end",
"def g\n link = params[:link]\n @cont = Cont.where(:link => link)\n\t@cont = @cont.first\n\tif @cont.nil?\n\t p 'extracting .............'\n\t error_type = 0 #success\n\t content = ''\n\t html = ''\n\t error_msg = ''\n\t title = ''\n\t #st = Time.now\n\t begin\n a = open(link); p \"header charset: #{a.charset}\"\n text = a.read; p \"text encoding: #{text.encoding.to_s}\"\n\t #p \"get raw html time: #{Time.now - st}\"\n\t\tenc = a.meta['content-encoding']\n\t\tif enc == 'gzip' || enc == 'inflate'\n\t\t text = uncompress(text, enc)\n cs = get_charset(text); p \"ziped charset: #{cs}\"\n\t\t text = text.force_encoding(cs).encode('UTF-8')\n text = text.sub(cs, 'UTF-8')\n\t\tend\n cs = get_charset(text); p \"charset: #{cs}\"\n\t\thtml = text\n\t\tif \"iso-8859-1\".casecmp(cs) == 0 || \"utf-8\".casecmp(text.encoding.to_s) !=0\n\t\t if \"utf-8\".casecmp(cs) != 0 && \"utf-8\".casecmp(text.encoding.to_s) !=0\n\t\t p 'wrong charset, change'\n\t\t html = text.force_encoding('GBK').encode('UTF-8')\n\t\t end\n\t\tend\n\t\thtml = html.force_encoding('utf-8')\n html = html.sub(cs, 'UTF-8')\n\t rescue => e\n\t error_type = 1 #HTML error\n\t\terror_msg = e.message.to_s\n\t\tp e.message\n\t\tp e.backtrace\n\t end\n\t #p \"get html time: #{Time.now - st}\"\n\n st = Time.now\t \n\t if error_type == 0\n\t begin \n# doc = Readability::Document.new(html, :debug=>true)\n doc = Readability::Document.new(html)\n content = doc.content\n\t\t title = trim_title(doc.html.title)\n rescue => e\n\t\t error_type = 2 # READABILITY ERROR\n\t\t error_msg = e.message.to_s\n\t\t p e.message\n\t\t p e.backtrace\n\t\tend\n\t end\n\t p \"get readability time: #{Time.now - st}\"\n\n @cont = Cont.new(\n\t :link => link,\n\t :html => '', #html,\n\t :content => content,\n\t\t:title => title,\n\t :error_type => error_type,\n\t :error_msg => error_msg\n\t )\n @cont.save\n\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cont }\n end\n end",
"def create\n @scrap = Scrap.new(params[:scrap])\n\n\n\n require 'scrapifier'\n require 'nokogiri'\n require 'open-uri'\n require 'addressable/uri'\n require 'mechanize'\n require 'pattern-match'\n require 'rubygems'\n \n\n r = @url\n \n case r\n when /http?:\\/\\/www.gizmobaba.com[\\S]+/\n\tpage = Nokogiri::HTML(open(url,'User-Agent'=>'Mozilla/5.0 (Windows NT 6.0; rv:12.0) Gecko/20100101 Firefox/12.0 FirePHP/0.7.1')) \n \t#@url = r\n\t@title = page.xpath(\"//div[@class='ctl_aboutbrand']/h1\").text\n \t@desc = page.xpath(\"//p[@itemprop='description']\").text\n \t@price = page.xpath(\"//span[@itemprop='price']\").text\n \t@img = page.xpath(\"////img[@id='bankImage']/@src\")\n\n when /http?:\\/\\/www.myntra.com[\\S]+/\n\tpage = Nokogiri::HTML(open(url,'User-Agent'=>'Mozilla/5.0 (Windows NT 6.0; rv:12.0) Gecko/20100101 Firefox/12.0 FirePHP/0.7.1'))\n \t#@url = r\n\t@title = page.xpath(\"//h1[@class='title']\").text\n \t@desc = page.xpath(\"//div[@class='description']/p\").text\n \t@price = page.xpath(\"//div[@class='price']\").text\n \t@img = page.xpath(\"//div[@class='blowup']/img/@src\")\n\n else\n agent = Mechanize.new\n\tdata = r.scrapify(images: [:jpg] )\n\t@url = data[:uri]\n\t@title = data[:title]\n\t@desc = data[:description] \n\tcase r\n\t\twhen /http?:\\/\\/www.jabong.com[\\S]+/\n \t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@itemprop='price']\") \n \t @image = code.at(\"//img[@itemprop ='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.flipkart.com[\\S]+/\n\t code = agent.get(r)\n \t\t@price = code.at(\"//span[@class='fk-font-verybig pprice vmiddle fk-bold']\")\n \t\t@image = code.at(\"//img[@id ='visible-image-small']/@src\")\n \n \t\twhen /http?:\\/\\/www.99lens.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t @image = code.at(\"//img[@id ='image']/@src\")\t\n\n\t\twhen /http?:\\/\\/www.amazon.in[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='priceblock_ourprice']\")\n\t\t@image = code.at(\"//img[@id ='landingImage']/@src\")\n\n\t\twhen /http?:\\/\\/www.americanswan.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='product-price-12782']\")\n\t\t@image = code.at(\"//img[@id ='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.babyoye.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='current_product_price']\")\n\t\t@image = code.at(\"//img[@class ='google-analytics-event']/@src\")\n\n\t\twhen /http?:\\/\\/www.basicslife.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//a[@class='MagicZoomPlus']/img/@src\")\n\n\t\twhen /http?:\\/\\/www.bhaap.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//div[@class='product-img-box']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.coke2home.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//p[@class='online_price29']\")\n\t\t@image = code.at(\"//a[@class='jqzoom2']/@href\")\n\n\t\twhen /http?:\\/\\/crazyflorist.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='regular-price']\")\n \t@image = code.at(\"//img[@itemprop='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.dailyobjects.com[\\S]+/\t\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//div[@class='do_detail_page_product_price']\")\n\t\t@image = code.at(\"//img[@itemprop='image']/@src\")\n\n \t\twhen /http?:\\/\\/www.fashionara.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@itemprop='lowprice']\")\n\t\t@image = code.at(\"//img[@itemprop='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.fnp.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='INR']\")\n\t\t@image = code.at(\"//div[@class='slider']/ul/li/img/@src\")\n\n\t\twhen /http?:\\/\\/www.freecultr.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='product-price-14473']\")\n\t\t@image = code.at(\"//img[@id='zoom1']/@src\")\n\n\t\twhen /http?:\\/\\/www.gizmobaba.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='offer']\")\n\t\t@image = code.at(\"//img[@id='bankImage']/@src\")\n\n\t\twhen /http?:\\/\\/www.grabmore.in[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//div[@class='appr_price']\")\n\t\t@image = code.at(\"//img[@id='zoom1']/@src\")\n\n\t\twhen /http?:\\/\\/www.haladirams.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//img[@id='zoom_Img']/@src\")\n\t\n\t\twhen /http?:\\/\\/www.healthgenie.in[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='product-price-8924']\")\n\t\t@image = code.at(\"//img[@id='image1']/@src\")\n\n\t\twhen /http?:\\/\\/www.high5store.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='our_price_display']\")\n\t\t@image = code.at(\"//img[@id='bigpic']/@src\")\n\n\t\twhen /http?:\\/\\/www.indireads.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//p[@class='price']\")\n\t\t@image = code.at(\"//img[@class='attachment-shop_single wp-post-image']/@src\")\n\n\t\twhen /http?:\\/\\/www.kidzdeals.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//p[@class='product-image product-image-zoom']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.metroshoes.net[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@itemprop='price']\")\n\t\t@image = code.at(\"//img[@id='bankImage']/@src\")\n\n\n\t\twhen /http?:\\/\\/www.pannkh.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='mrp']\")\n\t\t@image = code.at(\"//img[@id='largeImage']/@src\")\n\n\t\twhen /http?:\\/\\/www.pepperfry.com[\\S]+/\n \t\tcode = agent.get(r)\n\t @price = code.at(\"//li[@class='you_pay_price']\")\n\t\t@image = code.at(\"//img[@id='zoom_01']/@src\")\n\n\t\twhen /http?:\\/\\/www.planetsportsonline.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='offer']\")\n\t\t@image = code.at(\"//img[@id='bankImage']/@src\")\n\n\t\twhen /http?:\\/\\/www.purplle.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@class='normal-price d-b']\")\n\t\t@image = code.at(\"//img[@class='product-img']/@src\")\n\n\t\twhen /http?:\\/\\/www.shopatplaces.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//div[@class='price']\")\n\t\t@image = code.at(\"//img[@id='image']/@src\")\n\n\n\t\twhen /http?:\\/\\/www.slassy.com[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@itemprop='price']\")\n\t\t@image = code.at(\"//a[@class='productzoom']/@href\")\n\n\t\twhen /http?:\\/\\/www.smiledrive.in[\\S]+/\n\t\tcode = agent.get(r)\n\t @price = code.at(\"//span[@id='product-price-77']\")\n\t\t@image = code.at(\"//a[@id='zoom1']/img/@src\")\n\n\t\twhen /http?:\\/\\/www.stalkbuylove.com[\\S]+/\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//img[@class='my_image_box']/@src\")\n\n\t\twhen /http?:\\/\\/www.yebhi.com[\\S]+/\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@itemprop='price']\")\n \t@image = code.at(\"//img[@itemprop='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.yepme.com[\\S]+/\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@id='lblPayHead']\")\n\t\t@image = code.at(\"//img[@id='img2']/@src\")\n\n\t\twhen /http?:\\/\\/www.zovi.com[\\S]+/\n\t\tcode = agent.get(r)\n \t\t@price = code.at(\"//label[@id='price']\")\n\t\t@image = code.at(\"//section[@id='detail-image']/img/@src\")\n\n\t\twhen /http?:\\/\\/www.fabally.com[\\S]+/\n\t\tcode = agent.get(r)\n\t\t@price = code.at(\"//div[@class='codeArea']/span\")\n\t\t@image = code.at(\"//img[@id='prdimage']/@src\")\n\n\t\twhen /http?:\\/\\/www.beebayonline.com[\\S]+/\n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"//span[@class='price']\")\n\t\t@image = code.at(\"//p[@class='product-image product-image-zoom']/a/@href\")\n\n\t\twhen /http?:\\/\\/www.foodpanda.in[\\S]+/ \n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"//div[@class='restaurant-list-table last']\")\n\t\t@image = code.at(\"//div[@class='restaurant-content clearfix']/img/@src\")\n\n\t\twhen /http?:\\/\\/www.jewelskart.com[\\S]+/ \n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"div[@class='lenskart']\")\n\t\t@image = code.at(\"//div[@id='slide-img']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.lenskart.com[\\S]+/ \n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"div[@class='lenskart']\")\n\t\t@image = code.at(\"//div[@id='slide-img']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.moodsofcloe.com[\\S]+/ \n\t\tcode = agent.get(r)\n\t\t@price = code.at(\"//p[@class='productPrice color']\")\n\t\t@image = code.at(\"//div[@class='zImg om']/a/@href\")\n\n\t\twhen /http?:\\/\\/www.watchkart.com[\\S]+/ \n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"div[@class='lenskart']\")\n\t\t@image = code.at(\"//div[@id='slide-img']/a/img/@src\")\n\n\t\twhen /http?:\\/\\/www.clapone.com[\\S]+/\n \t\tcode = agent.get(r)\n\t\t@price = code.at(\"//div[@class='price']\")\n\t\t@image = code.at(\"//img[@id='image']/@src\")\n\n\t\twhen /http?:\\/\\/www.fabfurnish.com[\\S]+/\n \t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@class='special_price_box']\")\n\t\t#@image = \n\n\t\twhen /http?:\\/\\/www.fashionequation.com[\\S]+/\n\t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@class='money']\")\n\t\t#@image = \n\n\t\twhen /http?:\\/\\/www.shopclues.com[\\S]+/\n \t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@id='sec_discounted_price_2631066']\")\n\t\t#@image = \n\n\t\twhen /http?:\\/\\/www.miladyavenue.com[\\S]+/\n \t\tcode = agent.get(r)\n \t@price = code.at(\"//span[@class='price-new']\")\n\t\t#@image = \n\n\t\twhen /http?:\\/\\/www.limeroad.com[\\S]+/\n \t\tcode = agent.get(r)\n \t\t#@price = code.at(\"//span[@class='price']\")\n\t\t#@image = \n\t\t\n\t\telse\n\t\t puts \" waiting for authentication to publish\"\n\t\n\n end\n\n end\n \n \[email protected] \n\n\n respond_to do |format|\n if @scrap.save\n format.html { redirect_to @scrap, notice: 'Scrap was successfully created.' }\n format.json { render :show, status: :created, location: @scrap }\n else\n format.html { render :new }\n format.json { render json: @scrap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def url\n self.compile\n url = \"#{properties[:endpoint]}/render/?width=586&height=308&#{properties_to_url}&target=\" + CGI.escape(targets.map{|i| i.compile}.compact.join(\"&target=\"))\n end",
"def create\n @custom_search_engine = CustomSearchEngine.new(params[:custom_search_engine])\n @custom_search_engine.author = current_user\n @custom_search_engine.status = 'draft'\n @custom_search_engine.annotations.each do |a|\n prefix = a.about.slice(/http(s)?:\\/\\//)\n a.about = prefix.nil? ? \"http://#{a.about}\" : \"#{a.about}\"\n end\n respond_to do |format|\n if @custom_search_engine.save\n add_cse_to_dashboard(@custom_search_engine)\n link_cse(@custom_search_engine)\n flash[:success] = I18n.t('human.success.create', \n item: I18n.t('human.text.cse'))\n format.html { redirect_to node_cse_path(@node, @custom_search_engine)}\n format.json { render json: @custom_search_engine, status: :created, \n location: @custom_search_engine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @custom_search_engine.errors, \n status: :unprocessable_entity }\n end\n end\n end",
"def replace(content)\n \n # pre-structuring\n content.gsub!( /^(\\w.*)\\n(\\w.*)/ ) { \"#{$1} #{$2}\" } # remove single line breaks between text in order to avoid false paragraph markup\n content.gsub!( /<!--/ ) { \"--\" } # replace opening html commentaries\n content.gsub!( /-->/ ) { \"--\" } # replace closing html commentaries\n \n # templates\n content.gsub!( /\\{\\{Zitat\\|(.*)\\|.*\\}\\}\\s*$\\n/ ) { \"\\{p\\}\\\"#{$1}\\\"\\{/p\\}\\n\" } # citation\n content.gsub!( /\\{\\{.*(Finale Version).*\\}\\}/ ) { \"{status}<font color=\\\"#FF0000\\\">#{$1}</font>{/status}<br>\" } # final version\n content.gsub!( /\\{\\{Vorlage:(Dokument.*)\\n*(.*)\\}\\}/ ) { \"{status}<font color=\\\"#FF0000\\\">#{$1} #{$2}</font>{/status}<br>\" } # document status\n content.gsub!( /\\{\\{.*\\}\\} *$/ ) { '' } # remove single line templates\n content.gsub!( /\\{\\{.*\\n?.*\\}\\} *$/ ) { '' } # remove all remaining templates\n \n # tags\n content.gsub!( /<nowiki>(.*?)<\\/nowiki>/ ) { \"<pre>#{$1}</pre>\" }\n content.gsub!( /^ +(.*)/ ) { \"<pre>#{$1}</pre>\" }\n\n # special markup of qualidative data analysis\n content = content + \"\\n\\n{!end}\"\n \n # categories\n content.gsub!( /\\[\\[Kategorie:(.*?)\\]\\]/i ) { \"{category}<font color=\\\"#FF0000\\\">Kategorie:#{$1}</font>{/category}<br>\" }\n \n # images\n content.gsub!( /\\[\\[Bild:(.*?)\\]\\]/i ) { \"{image}Bild:#{$1.gsub!(/.*\\|/,'')}{/image}<br>\"} # Bild:lpscreen.jpg|thumb|Bereichseite des Landesportals\n\n # bold\n content.gsub!(/'''(.*?)'''/) {\"<strong>#{$1}</strong>\"}\n content.gsub!(/'''(.*?)$/) {\"<strong>#{$1}</strong>\"}\n\n # italics\n content.gsub!(/''(.*?)''/) {\"<em>#{$1}</em>\"}\n content.gsub!(/''(.*?)$/) {\"<em>#{$1}</em>\"}\n\n # headings\n 6.downto(1) { |i| content.gsub!( /^={#{i}}(.*?)={#{i}} *$/ ) { \"<h#{i}>\\{h>#{i}\\}#{$1}\\{/h>#{i}\\}</h#{i}>\" } }\n \n # links, internal\n content.gsub!( /\\[\\[([^\\[\\n]*?)\\| *(.*?)\\]\\]/ ) { \"<a class=\\\"internal\\\" href=\\\"#{$1}\\\">#{$2}</a>\" } # with piped text\n content.gsub!( /\\[\\[(.*?)\\]\\]/ ) { \"<a class=\\\"internal\\\" href=\\\"#{$1}\\\">#{$1}</a>\" } # without piped text\n\n # links, external\n content.gsub!( /\\[([^\\[\\n]*?)\\| *(.*?)\\]/ ) { \"<a class=\\\"external\\\" href=\\\"#{$1}\\\">#{$2}</a>\" } # with piped text\n content.gsub!( /\\[(.*?)\\]/ ) { \"<a class=\\\"external\\\" href=\\\"#{$1}\\\">#{$1}</a>\" } # without piped text\n \n # lists\n content.gsub!(/^:+/,'') # remove forced indenting\n content.gsub!( /^((?:\\*.*\\n+)+)/ ) { \"\\{l>ul\\}<ul>\\n#{$1.split(/\\n/).collect { |line| \"<li>#{line.gsub!(/^\\*/,'')}</li>\\n\" }.join}</ul>\\{/l>ul\\}<br>\\n\" } # first level ul\n content.gsub!( /^((?:#.*\\n+)+)/ ) { \"\\{l>ol\\}<ol>\\n#{$1.split(/\\n/).collect { |line| \"<li>#{line.gsub!(/^#/,'')}</li>\\n\" }.join}</ol>\\{/l>ol\\}<br>\\n\" } # first level ol\n content.gsub!( /<li>\\s*<\\/li>\\n/ ) { '' } # remove empty list entries (this may occur if first-level wiki-lists are entered with \\n\\n; they look like a single list when, in fact, they are but multiple single lists)\n content.gsub!( /^((?:<li>\\*.*\\n+)+)/ ) { \"<ul>\\n#{$1.gsub(/^<li>\\*/,\"<li>\")}</ul>\\n\" } # second level ul\n content.gsub!( /^((?:<li>#.*\\n+)+)/ ) { \"<ol>\\n#{$1.gsub(/^<li>#/,\"<li>\")}</ol>\\n\" } # second level ol\n content.gsub!( /^((?:<li>\\*.*\\n+)+)/ ) { \"<ul>\\n#{$1.gsub(/^<li>\\*/,\"<li>\")}</ul>\\n\" } # third level ul\n content.gsub!( /^((?:<li>#.*\\n+)+)/ ) { \"<ol>\\n#{$1.gsub(/^<li>#/,\"<li>\")}</ol>\\n\" } # third level ol\n\n # tables\n # the table conversion barely works, cf. http://johbuc6.coconia.net/doku.php/mediawiki2html_machine/code?DokuWiki=7c542b97df2bc0f82fec0f4875265a20 for an implementation in PHP\n content.gsub!( /^\\{\\|(.*)/ ) { \"\\{table\\}\\n<table #{$1}>\" }\n content.gsub!( /\\|\\}/ ) { \"</table>\\n\\{/table\\}\" }\n content.gsub!( /^\\|-(.*)/ ) { \"<tr>#{$1}\" }\n content.gsub!( /^!(.*?)\\|(.*)/ ) { \"<th #{$1}>#{$2}</th>\" } # table header with piped markup\n content.gsub!( /^!(.*)/ ) { \"<th>#{$1}</th>\" } # table header without piped markup\n content.gsub!( /^\\|(.*?)\\|(.*)/ ) { \"<td #{$1}>#{$2}\" } # table data with piped markup\n content.gsub!( /^\\|(.*)/ ) { \"<td>#{$1}\" } # table data without piped markup\n \n # line breaks\n content.gsub!( /(^(?:\\w|<strong|<em|<a|\\\").*)\\n\\s*\\n/ ) {\"<p>\\{p\\}#{$1}\\{/p\\}</p>\\n\"}\n \n # special markup of qualidative data analysis\n content.gsub!( /(\\{id\\}.*\\{\\/title\\})/ ) { \"<p><strong><em>#{$1.gsub(/_/,' ')}</em></strong></p>\" }\n \n# //$html = nl2br($html);\n# \t// line breaks\n# \t$html = preg_replace('/[\\n\\r]{4}/',\"<br/><br/>\",$html);\n# \t$html = preg_replace('/[\\n\\r]{2}/',\"<br/>\",$html);\n\n# \t$html = preg_replace('/[>]<br\\/>[<]/',\"><\",$html);\n \n# // allowed tags\n# \t$html = preg_replace('/<(\\/?)(small|sup|sub|u)>/','<${1}${2}>',$html);\n#\n# \t$html = preg_replace('/\\n*<br *\\/?>\\n*/',\"\\n\",$html);\n# \t$html = preg_replace('/<(\\/?)(math|pre|code|nowiki)>/','<${1}pre>',$html);\n# \t$html = preg_replace('/<!--/','<!--',$html);\n# \t$html = preg_replace('/-->/',' -->',$html);\n# \n return content\n\nend",
"def show\n # Hack to make ontologyid and conceptid work in addition to id and ontology params\n params[:id] = params[:id].nil? ? params[:ontologyid] : params[:id]\n params[:ontology] = params[:ontology].nil? ? params[:id] : params[:ontology]\n\n # PURL-specific redirect to handle /ontologies/{ACR}/{CLASS_ID} paths\n if params[:purl_conceptid]\n params[:purl_conceptid] = \"root\" if params[:purl_conceptid].eql?(\"classes\")\n if params[:conceptid]\n params.delete(:purl_conceptid)\n else\n params[:conceptid] = params.delete(:purl_conceptid)\n end\n redirect_to \"/ontologies/#{params[:acronym]}?p=classes#{params_string_for_redirect(params, prefix: \"&\")}\", :status => :moved_permanently\n return\n end\n\n if params[:ontology].to_i > 0\n acronym = BPIDResolver.id_to_acronym(params[:ontology])\n if acronym\n redirect_new_api\n return\n end\n end\n\n # Note: find_by_acronym includes ontology views\n @ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first\n not_found if @ontology.nil?\n \n # Handle the case where an ontology is converted to summary only. \n # See: https://github.com/ncbo/bioportal_web_ui/issues/133.\n if @ontology.summaryOnly && params[:p].present?\n pages = KNOWN_PAGES - [\"summary\", \"notes\"]\n if pages.include?(params[:p])\n redirect_to(ontology_path(params[:ontology]), status: :temporary_redirect) and return\n end\n end\n\n @ob_instructions = helpers.ontolobridge_instructions_template(@ontology)\n\n # Retrieve submissions in descending submissionId order (should be reverse chronological order)\n @submissions = @ontology.explore.submissions.sort {|a,b| b.submissionId.to_i <=> a.submissionId.to_i } || []\n LOG.add :error, \"No submissions for ontology: #{@ontology.id}\" if @submissions.empty?\n\n # Get the latest submission (not necessarily the latest 'ready' submission)\n @submission_latest = @ontology.explore.latest_submission rescue @ontology.explore.latest_submission(include: \"\")\n\n # Is the ontology downloadable?\n restrict_downloads = $NOT_DOWNLOADABLE\n @ont_restricted = restrict_downloads.include? @ontology.acronym\n\n # Fix parameters to only use known pages\n params[:p] = nil unless KNOWN_PAGES.include?(params[:p])\n\n # This action is now a router using the 'p' parameter as the page to show\n case params[:p]\n when \"terms\"\n params[:p] = 'classes'\n redirect_to \"/ontologies/#{params[:ontology]}#{params_string_for_redirect(params)}\", :status => :moved_permanently\n return\n when \"classes\"\n self.classes #rescue self.summary\n return\n when \"mappings\"\n self.mappings #rescue self.summary\n return\n when \"notes\"\n self.notes #rescue self.summary\n return\n when \"widgets\"\n self.widgets #rescue self.summary\n return\n when \"properties\"\n self.properties #rescue self.summary\n return\n when \"summary\"\n self.summary\n return\n else\n self.summary\n return\n end\n end",
"def find_links\n @links = {}\n @contents.xpath('//a[@href]').each do |tag|\n if tag[:href].include? \"http://wiki.dublincore.org/index.php\"\n tag[:href] = tag[:href].sub(\"http://wiki.dublincore.org/index.php\", \"\")\n tag[:href] = @base_url + tag[:href] unless tag[:href].include? \"File:\"\n elsif tag[:href].include? \"/index.php\"\n tag[:href] = tag[:href].sub(\"/index.php\", \"\")\n tag[:href] = @base_url + tag[:href] unless tag[:href].include? \"File:\" \n end\n if tag[:href].include? \"File:\"\n if tag.children[0][:src].nil?\n file_name = tag[:href].sub(\"/File:\", \"\")\n source = html_get(URI.parse(URI.escape(File.join('http://wiki.dublincore.org/index.php', tag[:href]))))\n contents = Nokogiri::HTML(source)\n file_path = contents.xpath(\"//a[@class='internal']/@href\")\n # download_resource(File.join('http://wiki.dublincore.org/index.php', file_path.to_s), File.join(@file_dir, file_name))\n tag[:href] = File.join(@base_url, \"files/#{file_name}\")\n else\n tag[:href] = File.join(@base_url, \"images/#{File.basename(tag.children[0][:src])}\")\n tag.children[0][:src] = File.join(@base_url, \"images/#{File.basename(tag.children[0][:src])}\")\n end\n end\n @links[tag[:href]] = (tag[:title] || '') if (! @links.include? tag[:href])\n end\n end",
"def format_link(url_pair)\n # image display output\n if url_pair[:format] == :image\n return \"<div class='image'>\\n <div class='image-inner'>\\n <a href='\" + \n url_pair[:post_url] + \n \"' target='_blank'>\\n <img src='\" +\n url_pair[:image_url] +\n \"'>\\n </a>\\n </div>\\n</div>\"\n end\n\n # imgur gifv output\n if url_pair[:format] == :gifv\n return \"<div class='video-container'>\\n <div class='video-inner'>\\n <a href='\" +\n url_pair[:post_url] +\n \"' target='_blank'>\\n <video autoplay='autoplay' type='video/mp4' id='video' loop='loop' muted='muted' preload='auto' src='\" +\n url_pair[:image_url] +\n \"'></video>\\n </a>\\n </div>\\n</div>\"\n end\n end",
"def make_breeds\n html = Nokogiri::HTML(open(\"http://www.vetstreet.com/cats/breeds\")) \n html.css(\"div.desktop-experience #hub-breed-list-container\").children[3].css(\"a\").each do |b| \n breed = CatBreeds::Breed.new(b.text) \n breed.web = URL+b.attribute(\"href\").value \n end \n\n end",
"def structure_definition_url_to_ig_url(url)\n # Transform this: http://hl7.org/fhir/us/vrdr/StructureDefinition/vrdr-decedent-education-level\n # Into this: http://build.fhir.org/ig/HL7/vrdr/StructureDefinition-vrdr-decedent-education-level.html\n url.gsub('http://hl7.org/fhir/us/vrdr/StructureDefinition/', 'http://build.fhir.org/ig/HL7/vrdr/StructureDefinition-') + '.html'\nend",
"def embed(src, mime_type, label)\nend",
"def show\n respond_to do |format|\n format.html {}\n format.json {}\n format.rdf { render rdf: @paper }\n end\n end",
"def run\n super\n\n # first, ensure we're fingerprinted\n require_enrichment\n\n uri = _get_entity_name\n html = http_get_body(\"https://URL/plugins/servlet/oauth/users/icon-uri?consumerUri=https://www.whatismyip.com/\")\n \n if html =~ /<title>What Is My IP/ \n _create_linked_issue(\"atlassian_jira_oauth_plugin_ssrf\", {\n proof: {\n response_body: html\n }\n })\n end\n \n end",
"def url_content\n urn\n end",
"def linkgen\n\n LinkGenerator.new(request)\n end",
"def process_html\n benchmark \"Process HTML for #{self.url}\" do\n doc = Readability::Document.new(self.html)\n html = doc.html\n self.title = content_for_open_graph_tag('og:title', html) || doc.title\n self.description =\n content_for_open_graph_tag('og:description', html) ||\n content_for_meta_tag('name=\"description\"', html) ||\n html.xpath('//head/meta/@description', html).first.try(:content)\n image_url = content_for_open_graph_tag('og:image', html) || doc.images.first\n self.image_url = image_url if image_url =~ URI.regexp\n self.site_name = content_for_open_graph_tag('og:site_name', html) || get_url_domain.try(:humanize)\n self.content_html = doc.content.encode_from_charset!(doc.html.encoding)\n self.content = Nokogiri::HTML(self.content_html).text\n end\n self\n end",
"def index\n @foafs = Foaf.all\n # if all else fails, make RDF then\n # rapper -o dot -i turtle me.ttl | dot -Tsvg -o me.svg\n respond_to do |format|\n format.html #{ render text: convert_one_to_rdf(@foaf, :html) }\n format.ttl { render text: convert_many_to_rdf(@foafs, :ttl) }\n format.rj { render text: convert_many_to_rdf(@foafs, :json) }\n format.nt { render text: convert_many_to_rdf(@foafs, :ntriples) }\n format.rdf { render text: convert_many_to_rdf(@foafs, :rdf) }\n format.jsonld { render text: convert_many_to_rdf(@foafs, :jsonld) }\n end\n end",
"def gen_url(url, appended_val, test)\n\n\t\tif(!url.include? 'http')\n \t\turl = \"http://\" + url\n ht_flag = \"T\" #Added to check if there is an http added automatically to a vanity/pixel url\n\t\tend\n\n\t\t# Generate the URI Objects\n\t\turl_uri = URI.parse(URI.encode(url.to_s.strip))\n\t\tappend_uri = URI.parse(URI.encode(appended_val.to_s.strip.gsub(/^(&)/,'?')))\n\n\t\turl_query = url_uri.query\n\t\tappend_query = append_uri.query\n \n\n\t\t# Get the parameters from each\n\t\turl_parameters = CGI.parse(url_query) if(url_query)\n\t\tappend_parameters = CGI.parse(append_query) if(append_query)\n\n\t\t# merge the parameters\n\t\tparameters = {}\n\t\tparameters.merge!(url_parameters) if(url_parameters)\n\t\tparameters.merge!(append_parameters) if(append_parameters)\n\n\t\t# add test value if needed\n\t\tif(test)\n\t\t\tparameters.merge!({\"mmcore.gm\" => [\"2\"]})\n\t\tend\n\n\t\t# change hash to string format\n\t\tquery_string = hash_to_querystring(parameters)\n\n\n\t\t# clean out spare '/' marks\n\t\tpath_url = url_uri.path\n\t\tpath_append = append_uri.path\n \n\t\t# combine everything back into URI\n\t\tpath_url = '' if(path_url == '/')\n\t\tpath_append = '' if(path_append == '/')\n \n\t\t#url_uri.query = query_string \n \n\t\tcombine_path = path_url + path_append\n\t\tcombine_path = '/' if combine_path[0] != '/'\n\n url_uri.path = combine_path\n url_uri.query = nil\n final_url = url_uri.to_s\n\t\tfinal_url = [url_uri.to_s, query_string].join('?') if(!query_string.empty?)\n\t\t# return the URI as string\n # Adding to remove an extra http added to the vanity url, linked to 41, here from 88-93\n if (ht_flag != 'T')\n return final_url.to_s.gsub('%7C','|').gsub('%23','#').gsub('%25','%') \n else\n return final_url.to_s.gsub('%7C','|').gsub('%23','#').gsub('%25','%').gsub('http://','')\n end\n #return final_url.to_s.gsub('%7C','|').gsub('%23','#').gsub('%25','%')\n\tend",
"def handle_links(json) end",
"def easy\n url = params[:url]\n\n # Well, this would be super slow for mainstream processors, but\n # might be good enough for Mom's & Dad's shop\n link = Link.find_by_url(url)\n\n # Oops, we don't have this Url in tables yet\n if link.nil?\n link = Link.new\n link.url = url\n link.save\n end\n\n render :text => SHORT_URL + \"/\" + Base32::Crockford.encode(link.id)\n end",
"def parse_link; end",
"def show_unknown_list\n\t\tif @setup.secure then\n\t\t\turls = DispRef2Latest_cache.unknown_urls\n\t\telsif @setup['no_cache'] then\n\t\t\turls = DispRef2Latest.new( @cgi, 'latest.rhtml', @conf, @setup ).unknown_urls\n\t\telse\n\t\t\turls = DispRef2Cache.new( @setup ).unknown_urls\n\t\tend\n\t\tr = <<-_HTML\n\t\t\t<h3>URL Conversion</h3>\n\t\t\t<input name=\"dr2.current_mode\" value=\"#{RefList}\" type=\"hidden\">\n\t\t_HTML\n\t\tif @cache then\n\t\t\tr << \"<p>Picking up #{@setup['unknown.label']} from the cache.\"\n\t\telse\n\t\t\tr << \"<p>Picking up #{@setup['unknown.label']} from the latest view.\"\n\t\tend\n\t\tr << <<-_HTML\n\t\t\tURLs that match the Excluding list or the Ignore list are not\n\t\t\tlisted here.\n\t\t</p>\n\t\t<p>\n\t\t\tIf you don't want to see the URLs that you neither put into the\n\t\t\tConversion list or the Excluding list can be put in the Ignore\n\t\t\tlist. The Ignore list only affects the list shown here.\n\t\t\tPlease check <input name=\"dr2.clear_ignore_urls\" value=\"true\"\n\t\t\ttype=\"checkbox\">here if you want to reset the Ignore list.\n\t\t</p>\n\t\t_HTML\n\t\tif urls.size > 0 then\n\t\t\tr << <<-_HTML\n\t\t\t\t<p>Please fill in the titles for the URL(s) in the lower text\n\t\t\t\t\tbox(es) to put the URL(s) into the Conversion list. Please\n\t\t\t\t\tcheck the check box(es) if you want to put the URL(s) into the\n\t\t\t\t\tExcluding list.\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\tRegular expressions are made up automatically. You can edit them\n\t\t\t\t\tif you want.\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\tIn the titles, you can refer to the strings between\n\t\t\t\t\tparenthesis in the regular expression with something like\n\t\t\t\t\t"\\\\1" (backslash plus a number). You can also use\n\t\t\t\t\ta script fragment like "sprintf('[tdiary:%d]', $1.to_i+1)".\n\t\t\t\t</p>\n\t\t\t_HTML\n\t\t\tif ENV['AUTH_TYPE'] and ENV['REMOTE_USER'] and @setup['configure.use_link'] then\n\t\t\t\tr << <<-_HTML\n\t\t\t\t\t<p>\n\t\t\t\t\t\t[NOTE] Be aware that by clicking the URLs below, the author\n\t\t\t\t\t\tof the www site might know the URL of this page to edit and\n\t\t\t\t\t\tconfigure your diary.\n\t\t\t\t\t</p>\n\t\t\t\t_HTML\n\t\t\tend\n\t\t\tr << <<-_HTML\n\t\t\t\t<p>\n\t\t\t\t\tPlease edit URLs not shown here through "<a\n\t\t\t\t\thref=\"#{@conf.update}?conf=referer\">Today's link</a>"\n\t\t\t\t</p>\n\t\t\t\t<dl>\n\t\t\t_HTML\n\t\t\ti = 0\n\t\t\turls.sort.each do |url|\n\t\t\t\tshown_url = DispRef2String::escapeHTML( @setup.to_native( DispRef2String::unescape( url ) ) )\n\t\t\t\tif ENV['AUTH_TYPE'] and ENV['REMOTE_USER'] and @setup['configure.use_link'] then\n\t\t\t\t\tr << \"<dt><a href=\\\"#{url}\\\">#{shown_url}</a>\"\n\t\t\t\telse\n\t\t\t\t\tr << \"<dt>#{shown_url}\"\n\t\t\t\tend\n\t\t\t\tr << <<-_HTML\n\t\t\t\t\t<dd>\n\t\t\t\t\t\tAdd this URL to\n\t\t\t\t\t\t<input name=\"dr2.#{i}.noref\" value=\"true\" type=\"checkbox\">Excluding list\n\t\t\t\t\t\t<input name=\"dr2.#{i}.ignore\" value=\"true\" type=\"checkbox\">Ignore list<br>\n\t\t\t\t\t\t<input name=\"dr2.#{i}.reg\" value=\"#{DispRef2String::escapeHTML( DispRef2String::url_regexp( url ) )}\" type=\"text\" size=\"70\"><br>\n\t\t\t\t\t\t<input name=\"dr2.#{i}.title\" value=\"\" type=\"text\" size=\"70\">\n\t\t\t\t_HTML\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\tr << <<-_HTML\n\t\t\t\t<input name=\"dr2.urls\" type=\"hidden\" value=\"#{i}\">\n\t\t\t\t</dl>\n\t\t\t_HTML\n\t\t\tunless @setup.secure or @setup['no_cache'] then\n\t\t\t\tr << <<-_HTML\n\t\t\t\t\t<p>\n\t\t\t\t\t\tUpdating the cache might take some time. Please wait after\n\t\t\t\t\t\tclicking the OK button.\n\t\t\t\t\t</p>\n\t\t\t\t_HTML\n\t\t\tend\n\t\telse\n\t\t\tr << <<-_HTML\n\t\t\t\t<p>Currently there is no #{@setup['unknown.label']}.</p>\n\t\t\t_HTML\n\t\tend\n\t\tr << <<-_HTML\n\t\t\t<h3>Regular expressions for antennae</h3>\n\t\t\t<p>URLs or titles matching these expression will be categorized as\n\t\t\t\tantennae.</p>\n\t\t\t<ul>\n\t\t\t<li>URL:\n\t\t\t\t<input name=\"dr2.antenna.url\" value=\"#{DispRef2String::escapeHTML( @setup.to_native( @setup['antenna.url'] ) )}\" type=\"text\" size=\"70\">\n\t\t\t\t<input name=\"dr2.antenna.url.default\" value=\"true\" type=\"checkbox\">Use default\n\t\t\t<li>Title:<input name=\"dr2.antenna.title\" value=\"#{DispRef2String::escapeHTML( @setup.to_native( @setup['antenna.title'] ) )}\" type=\"text\" size=\"70\">\n\t\t\t\t<input name=\"dr2.antenna.title.default\" value=\"true\" type=\"checkbox\">Use default\n\t\t\t</ul>\n\t\t\t_HTML\n\t\tr\n\tend",
"def run\n super\n\n uri = _get_entity_attribute \"name\"\n\n # Scanner options\n @opt_threads = _get_option(\"threads\").to_i\n @opt_max_pages = _get_option(\"max_pages\").to_i\n #@opt_user_agent = _get_option \"user_agent\"\n @opt_extract_uris = _get_option \"extract_uris\" # create an object for each page\n @opt_extract_dns_records = _get_option \"extract_dns_records\" # create an object for each dns_record\n @opt_extract_file_metadata = _get_option \"extract_file_metadata\" # create a Uri object for each page\n @opt_extract_patterns = _get_option(\"extract_patterns\").split(\",\") # only extract entities withthe following patterns\n\n crawl_and_extract(uri)\n\n end",
"def process_images\n # Split \"\" into [\"\"]\n # TODO: handle properly escaped values, escaped ) and surrounded by <>\n imgRE = /(!\\[.*?\\]\\()(.+?)(\\))/\n new_content = \"\"\n pos = 0\n source_dir = Pathname.new(@dir)\n out_dir = Pathname.new(\"images\")\n base_url = Pathname.new(\"{{site.baseurl}}\")\n images = []\n while !(i = self.content.index(imgRE, pos)).nil?\n match = self.content.match(imgRE, i)\n url = match[2]\n path = Pathname.new(url)\n # Only replace relative URLs\n next if !path.relative?\n images << path\n new_url = base_url.join(out_dir, source_dir, url).cleanpath.to_s\n # TODO: normalize path to forward-slashes.\n new_image_link = match[1] + new_url + match[3]\n new_content += self.content[pos...i] + new_image_link\n \n pos = i + match[0].length\n end\n # Get any post-URL end content.\n new_content += match.post_match\n self.content = new_content\n\n file_source = Pathname.new(@_pages_dir).join(source_dir)\n # Add images to static files.\n images.each do |path|\n site.static_files << NoteImageFile.new(@site,\n @base,\n file_source.join(path).dirname.to_s,\n path.basename.to_s,\n out_dir.join(source_dir, path).dirname.to_s)\n end\n end",
"def images_from_extension\n # нахожу все урлы с jpg, png, gif...\n @images_links = URI.extract(@doc.to_s.encode(\"UTF-16be\", :invalid => :replace, :replace => \"?\").encode('UTF-8')).select { |l| l[/\\.(?:gif|png|jpe?g)\\b/] }\n @handler_link.handler_links(@images_links, @link) # обрабатываю урлы\n @handler_link.remove_unless_symbols(@images_links)\n @handler_link.remove_unless_link(@images_links)\n @images_links.uniq\n end",
"def fix_image_links(text, raw_uri, additional_path = '')\n readme_doc = Nokogiri::HTML(text)\n readme_doc.xpath(\"//img[@src]\").each() do |el|\n #puts 'img: '+el['src'].to_s\n unless el['src'].start_with?('http')\n el['src'] = ('%s/%s/' % [raw_uri, additional_path])+el['src']\n end\n end\n\n return readme_doc.to_s, readme_doc\nend",
"def urls\n @url.map do |el|\n case el\n when %r{^IANA$}\n IANA_URL % [ @media_type, @sub_type ]\n when %r{^RFC(\\d+)$}\n RFC_URL % $1\n when %r{^DRAFT:(.+)$}\n DRAFT_URL % $1\n when %r{^LTSW$}\n LTSW_URL % @media_type\n when %r{^\\{([^=]+)=([^\\}]+)\\}}\n [$1, $2]\n when %r{^\\[([^=]+)=([^\\]]+)\\]}\n [$1, CONTACT_URL % $2]\n when %r{^\\[([^\\]]+)\\]}\n CONTACT_URL % $1\n else\n el\n end\n end\n end",
"def add_link\n @bib.link.each do |l|\n case l.type&.downcase\n when \"doi\" then @item.doi = l.content\n when \"file\" then @item.file2 = l.content\n when \"src\" then @item.url = l.content\n end\n end\n end",
"def getItemHtml(content_type, id)\n return false if content_type != \"text/html\"\n if USE_MRTEXPRESS\n fileURL = \"https://#{ENV['MRTEXPRESS_HOST'] || raise(\"missing env MRTEXPRESS_HOST\")}\" +\n \"/dl/ark:/13030/#{id}/content/#{id}.html\"\n else\n fileURL = \"http://submit.escholarship.org:18881/data_pairtree/#{id.scan(/\\w\\w/).join('/')}/#{id}/content/#{id}.html\"\n end\n fetcher = MerrittFetcher.new(fileURL)\n buf = []\n fetcher.streamTo(buf)\n buf = buf.join(\"\")\n # Hacks for LIMN\n buf.gsub! %r{<head.*?</head>}im, ''\n buf.gsub! %r{<style.*?</style>}im, ''\n buf.gsub! %r{<iframe.*?</iframe>}im, ''\n buf.gsub! %r{<script.*?</script>}im, ''\n htmlStr = stringToXML(buf).to_xml\n htmlStr.gsub!(/(href|src)=\"((?!#)[^\"]+)\"/) { |m|\n attrib, url = $1, $2\n url = url.start_with?(\"http\", \"ftp\") ? url : \"/content/#{id}/inner/#{url}\"\n \"#{attrib}=\\\"#{url}\\\"\" + ((attrib == \"src\") ? \"\" : \" target=\\\"new\\\"\")\n }\n\n # Browsers don't seem to like <a name=\"foo\"/>. Instead they want <a name=\"foo\"></a>\n htmlStr.gsub!(%r{<a name=\"([^\"]+)\"/>}, '<a name=\"\\1\"></a>')\n\n # DOJ articles often specify target=\"new\" on links, but that's no longer best practice.\n htmlStr.gsub!(%r{<a([^>]*) target=\"[^\"]*\"([^>]*)>}, '<a\\1\\2>')\n\n # All done\n return htmlStr\nend",
"def interpret(d)\n article = Article.new\n article.title = !d['webTitle'].nil? ? d['webTitle'] : 'n/a'\n article.source = @source\n article.pub_date = !d['webPublicationDate'].nil? ? (DateTime.parse d['webPublicationDate']) : nil\n article.author = !d['fields']['byline'].nil? ? d['fields']['byline'] : 'n/a'\n article.link = !d['webUrl'].nil? ? d['webUrl'] : 'n/a'\n\n re = /<(\"[^\"]*\"|'[^']*'|[^'\">])*>/\n summary = !d['fields']['body'].nil? ? d['fields']['body'] : 'n/a'\n summary.gsub!(re, '')\n article.summary = summary[0...126] + '...'\n\n article.image = !d['fields']['thumbnail'].nil? ? d['fields']['thumbnail'] : 'n/a'\n article\n end",
"def measurement_source\n { 'http://eol.org/schema/terms/NumberOfSequencesInGenBank' =>\n '<a href=\"https://www.ncbi.nlm.nih.gov/genbank\">GenBank</a> sequences '\\\n '<a href=\"http://eol.org/schema/terms/NumberOfSequencesInGenBank\">?</a>',\n 'http://eol.org/schema/terms/NumberRichSpeciesPagesInEOL' =>\n '<a href=\"http://eol.org\"><abbr title=\"Encyclopedia of Life\">EOL</abbr>'\\\n '</a> rich pages <a '\\\n 'href=\"http://eol.org/schema/terms/NumberRichSpeciesPagesInEOL\">?</a>',\n 'http://eol.org/schema/terms/NumberSpecimensInGGBN' =>\n '<a href=\"http://ggbn.org\"><abbr title=\"Global Genome Biodiversity '\\\n 'Network\">GGBN</abbr></a> records '\\\n '<a href=\"http://eol.org/schema/terms/NumberSpecimensInGGBN\">?</a>',\n 'http://eol.org/schema/terms/NumberRecordsInGBIF' =>\n '<a href=\"http://gbif.org\"><abbr title=\"Global Biodiversity Information'\\\n 'Facility\">GBIF</abbr></a> records '\\\n '<a href=\"http://eol.org/schema/terms/NumberRecordsInGBIF\">?</a>',\n 'http://eol.org/schema/terms/NumberPublicRecordsInBOLD' =>\n '<a href=\"http://boldsystems.org\"><abbr title=\"Barcode of Life Data\">'\\\n 'BOLD</abbr></a> records '\\\n '<a href=\"http://eol.org/schema/terms/NumberPublicRecordsInBOLD\">?</a>',\n 'http://eol.org/schema/terms/NumberReferencesInBHL' =>\n '<a href=\"http://biodiversitylibrary.org\"><abbr title=\"Biodiversity '\\\n 'Heritage Library\">BHL</abbr></a> pages <a '\\\n 'href=\"http://eol.org/schema/terms/NumberReferencesInBHL\">?</a>' }\n end",
"def list\n extract_names_and_urls = lambda do |doc|\n [extact_url(@url, document), extract_titles(document)]\n end\n \n html.css('a').map(&extract_names_and_urls)\n end",
"def index\n #pageUrl = 'http://www.lazada.vn/dong-ho/'\n pageUrl = 'http://ione.vnexpress.net/photo'\n #pageUrl = 'http://www.xemanh.net/category/anh-girl-xinh/anh-sexy'\n @arr = true\n\t\turi = URI(pageUrl)\n\t\tputs '============================================uri.host: ' + uri.host\n\t\tcase uri.host\n\t\twhen \"www.lazada.vn\"\n\t\t\t#@parsers = Array.new\n\t\t\t@parsers = lazada_dongho(pageUrl)\n\t\t\t#puts \"@parsers\"\n\t\twhen \"ione.vnexpress.net\"\n\t\t puts \"===========================================ione\"\n\t\t @arr = false\n\t\t @parser = ione_photo(pageUrl)\n\t\twhen \"www.xemanh.net\"\n\t\t @parser = xemanh_sexy(pageUrl)\n\t\telse\n\t\t\t@content = unknow(pageUrl)\n\t\tend\n\t\t@url = pageUrl\n end",
"def index(url)\n open(url, \"User-Agent\" => USER_AGENT){ |doc| \n h = Hpricot(doc)\n title, body = h.search('title').text.strip, h.search('body')\n %w(style noscript script form img).each { |tag| body.search(tag).remove}\n array = []\n body.first.traverse_element {|element| array << element.to_s.strip.gsub(/[^a-zA-Z ]/, '') if element.text? }\n array.delete(\"\")\n yield(array.join(\" \").words, title)\n } \n end",
"def get_additional_info(index)\n url = \"#{CraftsIntoURI}#{index}\"\n uri = URI.parse(url)\n Nokogiri::HTML(open(uri))\nend",
"def url\n end"
] | [
"0.59719193",
"0.59663725",
"0.5683812",
"0.56199765",
"0.55774945",
"0.54888636",
"0.54784566",
"0.54565483",
"0.5448286",
"0.5396483",
"0.53901935",
"0.537453",
"0.5353635",
"0.5343655",
"0.53160065",
"0.53033465",
"0.52974087",
"0.52973413",
"0.52867323",
"0.52809066",
"0.52754587",
"0.5268835",
"0.52596337",
"0.5257126",
"0.5254898",
"0.52468187",
"0.523368",
"0.52332217",
"0.51994175",
"0.51972574",
"0.51945853",
"0.5170488",
"0.5148839",
"0.5148839",
"0.5141084",
"0.5141084",
"0.513522",
"0.5129597",
"0.51259035",
"0.5116386",
"0.5114003",
"0.5100554",
"0.5092219",
"0.5091359",
"0.5086228",
"0.5082227",
"0.5073935",
"0.50658506",
"0.50658506",
"0.5059718",
"0.5052526",
"0.5051152",
"0.50476694",
"0.5046405",
"0.5041887",
"0.50415474",
"0.5035312",
"0.50314486",
"0.50285435",
"0.5021853",
"0.50148296",
"0.5013077",
"0.5013077",
"0.5011267",
"0.49993548",
"0.4995608",
"0.49939454",
"0.49937445",
"0.49930114",
"0.4984292",
"0.498304",
"0.49800584",
"0.49786234",
"0.49781454",
"0.49768132",
"0.4976172",
"0.4973982",
"0.49694017",
"0.49607655",
"0.49568665",
"0.4948163",
"0.49436197",
"0.4942111",
"0.49353355",
"0.49274597",
"0.49187604",
"0.49182683",
"0.491719",
"0.4913188",
"0.4913051",
"0.49124807",
"0.49123445",
"0.4910718",
"0.49098933",
"0.490978",
"0.49068287",
"0.49061123",
"0.49020195",
"0.48988613",
"0.48987916"
] | 0.6599654 | 0 |
This uses the programmes RDF to find interesting information about a programme Channel, category, Series / Brand (this also covers people) could also use the endpoint | def enhance_data(arr)
puts "Enhancing data"
valscount = {}
####
if (use_store())
require 'lib/four_store/store'
store = FourStore::Store.new 'http://dbtune.org/bbc/programmes/sparql/'
arr.each do |pid|
q = "SELECT ?vals WHERE
{{<http://www.bbc.co.uk/programmes/#{pid}#programme>
<http://purl.org/ontology/po/masterbrand> ?vals .} UNION
{<http://www.bbc.co.uk/programmes/#{pid}#programme>
<http://purl.org/ontology/po/category> ?vals . } UNION
{<http://www.bbc.co.uk/programmes/#{pid}#programme>
<http://purl.org/ontology/po/genre> ?vals . } UNION
{?vals <http://purl.org/ontology/po/episode>
<http://www.bbc.co.uk/programmes/#{pid}#programme> . }}"
puts "Making query for #{pid}\n#{q}"
response = store.select(q)
response.each do |r|
url = r["vals"]
if(valscount[url]==nil)
valscount[url]=1
else
count = valscount[url]
count = count+1
valscount[url]=count
end
end
sleep 2
end
else
#not store
arr.each do |pid|
url = "http://www.bbc.co.uk/programmes/#{pid}.rdf"
puts "pid url is #{url}"
#occassionally we get a duff pid
m = ModelFactory.createDefaultModel()
begin
m.read(url)
q = "SELECT ?vals WHERE
{{<http://www.bbc.co.uk/programmes/#{pid}#programme>
<http://purl.org/ontology/po/masterbrand> ?vals .} UNION
{<http://www.bbc.co.uk/programmes/#{pid}#programme>
<http://purl.org/ontology/po/category> ?vals . } UNION
{<http://www.bbc.co.uk/programmes/#{pid}#programme>
<http://purl.org/ontology/po/genre> ?vals . } UNION
{?vals <http://purl.org/ontology/po/episode>
<http://www.bbc.co.uk/programmes/#{pid}#programme> . }}"
puts "Making query for #{pid}\n#{q}"
qexec = QueryExecutionFactory.create(q, m) ;
response = qexec.execSelect()
# ResultSetFormatter.out(java.lang.System.out, response)
response.each do |r|
url = r.get("vals").to_s
puts "got result #{url}"
if(valscount[url]==nil)
valscount[url]=1
else
count = valscount[url]
count = count+1
valscount[url]=count
end
end
rescue
puts "duff url, continuing"
end
sleep 2
end
end
pp valscount
####
return valscount
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractData()\n\n @es_client = Elasticsearch::Client.new host: 'http://192.168.59.103:9200/', log: true\n gr = RDF::Vocabulary.new(\"http://purl.org/goodrelations/v1#\")\n s = RDF::Vocabulary.new(\"http://schema.org/address\")\n v = RDF::Vocabulary.new(\"http://www.w3.org/2006/vcard/ns#\")\n l = RDF::Vocabulary.new(\"http://www.linked-usdl.org/ns/usdl-core#\")\n\n company = RDF::Node.new\n addTriple( company , RDF.type, @resume_cv.Company)\n addUSDL(company, RDF.type, gr.BusinessEntity)\n\n # content = @doc.css('div').select{|document| document['id'] == \"inhalt\"}[0]\n company_name = extractAnnotation(\"name\").first\n\n add_annotation(\"name\", company_name)\n # description = @doc.css('div').select{|description| description['id'] == \"text\"}[0]\n\n\n website = extractAnnotation(\"website\").first\n streetAddress = extractAnnotation(\"streetAddress\").first\n postal = extractAnnotation(\"postal\").first\n locality = extractAnnotation(\"locality\").first\n country = extractAnnotation(\"country\").first\n phone = extractAnnotation(\"phone\").first\n mail = extractAnnotation( \"mail\").first\n region = country\n\n extractAnnotation(\"product_categories\").each do |i|\n puts \"i: #{i}\"\n product = RDF::Node.new\n addUSDL(product, RDF.type, gr.ProductOrService)\n addUSDL(product, gr.name, i)\n addUSDL(product, gr.hasManufacturer, company)\n addTriple(company, @resume_cv.produces, i)\n end\n\n extractAnnotation(\"produces\").each do |i|\n puts \"prodcat2 : #{i}\"\n offering = RDF::Node.new\n addUSDL(offering, RDF.type, gr.Offering)\n addUSDL(company, gr.offers, offering)\n addUSDL(offering, gr.name , i)\n\n addTriple(company, @resume_cv.sells , i)\n end\n\n extractAnnotation(\"distr_category\").each do |i|\n puts \"distcat : #{i}\"\n addUSDL(company, gr.category, i)\n addTriple(company, @resume_cv.distribution_type, i)\n end\n\n extractAnnotation(\"distributes_for\").each do |i|\n puts \"distfor : #{i}\"\n addUSDL(company, @resume_cv.distribution_for, i)\n addTriple(company, @resume_cv.distribution_for, i)\n end\n\n extractAnnotation(\"provides\").each do |i|\n puts \"provcat : #{i}\"\n offering = RDF::Node.new\n addUSDL(offering, RDF.type, gr.Offering)\n addUSDL(company, gr.offers, offering)\n addUSDL(offering, gr.name , i)\n addTriple(company, @resume_cv.hasSpeciality , i)\n end\n\n extractAnnotation(\"distributed_by\").each do |i|\n puts \"distfor : #{i}\"\n addUSDL(company, @resume_cv.distributed_by, i)\n addTriple(company, @resume_cv.distributed_by, i)\n end\n\n # addTriple(company , @resume_cv.isIndustry, industry)\n # addUSDL(company, gr.category, industry)\n # addTriple(company, @resume_cv.hasSpeciality, s)\n addTriple(company , @resume_cv.hasWebsite, website)\n addUSDL(company, RDF::FOAF.page, website)\n addTriple( company , @resume_cv.name, company_name)\n addUSDL( company, gr.legalName, company_name)\n # # addTriple(company , @resume_cv.hasType, type)\n # # addTriple(company , @resume_cv.wasFounded, founded)\n # # addTriple(company , @resume_cv.hasSize, compsize)\n address = RDF::Node.new\n addUSDL(address, RDF.type , v.Address)\n addUSDL(company, l.hasCommunicationChannel, address)\n\n telephone = RDF::Node.new\n addUSDL(telephone, RDF.type, v.Voice)\n addUSDL(telephone, v.hasValue, phone)\n\n addUSDL(address, v.country_name, country)\n addUSDL(address, v.locality, locality)\n addUSDL(address, v.postal_code, postal )\n addUSDL(address, v.street_address, streetAddress)\n addUSDL(address, v.has_email ,mail)\n\n addTriple(company , @resume_cv.hasLocality, locality)\n addTriple(company , @resume_cv.hasStreetAddress, streetAddress)\n addTriple(company , @resume_cv.locatedInRegion, region)\n addTriple(company , @resume_cv.postalCode, postal)\n addTriple(company , @resume_cv.country, country)\n\n add_annotation( \"locality\", locality)\n add_annotation( \"street\" , streetAddress)\n add_annotation( \"postal\" , postal)\n add_annotation( \"country\", country)\n add_annotation( \"phone\", phone)\n add_annotation( \"mail\" , mail)\n\n company_name\n end",
"def fetch_programmes_for(entity, type)\n response = get(\"http://www.bbc.co.uk/#{type.to_s}/programmes/topics/#{CGI::escape(entity.url_key)}.json\")\n return nil unless response.code == 200\n json_data = JSON.parse(response.body)\n\n json_data['category_page']['available_programmes'].map do |json|\n Programme.new(\n pid: json['pid'],\n title: json['display_titles']['title'],\n subtitle: json['display_titles']['subtitle'],\n synopsis: json['short_synopsis'],\n type: type\n )\n end\n end",
"def get_ontology_terms(repositoryName = \"ComputerScience\")\n puts \"get_ontology_terms from catalog: \" + repositoryName\n # Repository management\n server = AllegroGraph::Server.new :username => $AGRAPH['user'], :password => $AGRAPH['pass'], :host => $AGRAPH['host'], :port => $AGRAPH['port']\n repository = AllegroGraph::Repository.new server, repositoryName\n repository.create_if_missing!\n\n # SparQL queries\n repository.query.language = :sparql\n res = repository.query.perform \"SELECT distinct ?Class ?Subclass WHERE { ?Subclass rdfs:subClassOf ?Class . } Order by ?Class \"\n\n terms = Set.new\n # I know this could be done more efficiently...\n res['values'].each do |pair|\n terms.add(clean_uri(pair[0]))\n terms.add(clean_uri(pair[1])) \n end\n \n terms\n \nend",
"def go(uri)\n\n foaf='http://xmlns.com/foaf/0.1/' \n contact=\"http://www.w3.org/2000/10/swap/pim/contact#\" \n air= 'http://www.megginson.com/exp/ns/airports#'\n\n ayf = SimpleScutter.new uri\n\n pagecount=0\n # a code block to output basic info about each RDF page encountered\n # \n page_summary = Proc.new do |crawler,page| \n puts \"RDFDOC: count='#{pagecount}': uri:#{crawler.uri} gave RDF graph #{page} \\\n\twith #{page.size} triples\\n\" \n pagecount=pagecount+1\n end\n\n # a code block to see if some page provides nearestAirport information: \n #\n # <contact:nearestAirport><wn:Airport air:icao=\"EGGD\" air:iata=\"BRS\"/>...\n #\n airports = Proc.new do |crawler,page| \n\n #page.reg_xmlns 'http://www.megginson.com/exp/ns/airports#', 'air'\n \n rs = page.ask Statement.new(nil, air+\"iata\", nil)\n rs.objects.each do |a|\n a.graph=page\n puts \"AIRPORT: #{a} got airport code in #{crawler.uri})\" if (a.to_s =~ /\\S/) \n end\t\t\t\t\t# the 'if' is fix for parser bug\n end\n\n\n # the mugshots and htmler blocks are related, and share some state:\n report=\"\"\n seenpic=Hash.new(0) \t# counter\n\n # basic image metadata harvesting\n #\n mugshots = Proc.new do |crawler,page|\n images=[]\n img = page.ask Statement.new(nil, foaf+'img', nil)\n img.objects.each {|a| images.push a.to_s }\n img = page.ask Statement.new(nil, foaf+'depiction',nil)\n img.objects.each {|a| images.push a.to_s }\n\t\t # todo: store this state locally instead of inside crawler\n images.each do |pic|\n next if (!pic =~ /\\S/) #bug in Liber RDF parser.\n if seenpic[pic]==0 ### how to do this as a Proc? fixme\n report += \"<img src='#{pic}' width='128' height='128' />\" \n report += \"<!-- linked at: #{crawler.uri} -->\\n\\n\"\n end\n seenpic[pic]=seenpic[pic]+1\n end\n end\n\n # a code block that writes an html page based on the crawler's .out property \n #\n htmler = Proc.new do |crawler,page|\n html = \"<html><head><title>all your foaf depictions...</title></head>\\n<body>\\n\"\n html += \"<h1>AllYourFoaf Image Index</h1>\\n\" \n html += \"<p><strong>stats:</strong>: left.size=#{crawler.left.size} \\\n\tseen.size=#{crawler.seen.size} seenpic.size=#{seenpic.size} current:#{crawler.uri} </p> \"\n html += \"<hr />\\n\\n\" + report\n html += \"</body></html>\\n\\n\"\n SimpleScutter.writefile(crawler.outfile,html)\n end\n\n # stats to be output at start of each loop \n #\n loopstats = Proc.new do |s|\n puts \"INIT: s.left.size=#{s.left.size} s.seen.size=#{s.seen.size} current: #{s.uri}\"\n end\n\n error_logger = Proc.new {|e| puts \"ERROR: #{e}\" }\n\n # register some handlers:\n ayf.pagehandlers.push page_summary, airports, mugshots, htmler\n ayf.inithandlers.push loopstats\n ayf.errorhandlers.push error_logger \n ayf.run # set crawler running!\nend",
"def cinii_issn(issn)\n doc = Nokogiri::XML(open(\"http://ci.nii.ac.jp/books/opensearch/search?issn=#{issn}\", proxy: IllConfig.config[\"proxy_server_url\"]))\n namespaces = {\n \"xmlns\" => \"http://www.w3.org/2005/Atom\", \n \"xmlns:dc\" => \"http://purl.org/dc/elements/1.1/\",\n \"xmlns:cinii\" => \"http://ci.nii.ac.jp/ns/1.0/\",\n \"xmlns:dcterms\" => \"http://purl.org/dc/terms/\" ,\n \"xmlns:opensearch\" => \"http://a9.com/-/spec/opensearch/1.1/\" ,\n \"xmlns:prism\" => \"http://prismstandard.org/namespaces/basic/2.0/\"\n } \n i = 1\n results = []\n while i <= doc.xpath('//opensearch:totalResults', namespaces).text.to_i\n result = {}\n result[:title] = doc.xpath(\"//xmlns:entry[#{i}]/xmlns:title\", namespaces).text\n result[:author] = doc.xpath(\"//xmlns:entry[#{i}]/xmlns:author/xmlns:name\", namespaces).text\n result[:publisher] = doc.xpath(\"//xmlns:entry[#{i}]/dc:publisher\", namespaces).text\n result[:pubdate] = doc.xpath(\"//xmlns:entry[#{i}]/prism:publicationDate\", namespaces).text\n results << result\n i += 1\n end\n results\nend",
"def fetch_by_issn(issn)\r\n xml = fetch_xml(issn)\r\n\r\n\r\n results = BentoSearch::Results.new.concat(\r\n xml.xpath(\"./rdf:RDF/rss:item\", xml_ns).collect do |node|\r\n item = BentoSearch::ResultItem.new\r\n\r\n item.format = \"Article\"\r\n\r\n item.issn = issn # one we searched with, we know that!\r\n\r\n item.title = xml_text(node, \"rss:title\")\r\n item.link = xml_text(node, \"rss:link\")\r\n\r\n item.publisher = xml_text(node, \"prism:publisher\") || xml_text(node, \"dc:publisher\")\r\n item.source_title = xml_text(node, \"prism:PublicationName\")\r\n item.volume = xml_text(node, \"prism:volume\")\r\n item.issue = xml_text(node, \"prism:number\")\r\n item.start_page = xml_text(node, \"prism:startingPage\")\r\n item.end_page = xml_text(node, \"prism:endingPage\")\r\n\r\n # Look for something that looks like a DOI in dc:identifier\r\n node.xpath(\"dc:identifier\").each do |id_node|\r\n if id_node.text =~ /\\ADOI (.*)\\Z/\r\n item.doi = $1\r\n # doi's seem to often have garbage after a \"; \", especially\r\n # from highwire. heuristically fix, sorry, a real DOI with \"; \"\r\n # will get corrupted.\r\n if (parts = item.doi.split(\"; \")).length > 1\r\n item.doi = parts.first\r\n end\r\n\r\n break\r\n end\r\n end\r\n\r\n # authors?\r\n node.xpath(\"dc:creator\", xml_ns).each do |creator_node|\r\n name = creator_node.text\r\n name.strip!\r\n\r\n # author names in RSS seem to often have HTML entities,\r\n # un-encode them to literals.\r\n name = HTMLEntities.new.decode(name)\r\n\r\n\r\n item.authors << BentoSearch::Author.new(:display => name)\r\n end\r\n\r\n # Date is weird and various formatted, we do our best to\r\n # look for yyyy-mm-dd at the beginning of either prism:coverDate or\r\n # dc:date or prism:publicationDate\r\n date_node = xml_text(node, \"prism:coverDate\") || xml_text(node, \"dc:date\") || xml_text(node, \"prism:publicationDate\")\r\n if date_node && date_node =~ /\\A(\\d\\d\\d\\d-\\d\\d-\\d\\d)/\r\n item.publication_date = Date.strptime( $1, \"%Y-%m-%d\")\r\n elsif date_node\r\n # Let's try a random parse, they give us all kinds of things I'm afraid\r\n item.publication_date = Date.parse(date_node) rescue ArgumentError\r\n end\r\n\r\n # abstract, we need to strip possible HTML tags (sometimes they're\r\n # there, sometimes not), and also decode HTML entities. \r\n item.abstract = xml_text(node, \"rss:description\").try do |text| \r\n HTMLEntities.new.decode(strip_tags(text))\r\n end\r\n\r\n item\r\n end\r\n )\r\n\r\n # Items seem to come back in arbitrary order, we want to sort\r\n # by date reverse if we can\r\n if results.all? {|i| i.publication_date.present? }\r\n results.sort_by! {|i| i.publication_date}.reverse!\r\n end\r\n\r\n fill_in_search_metadata_for(results)\r\n\r\n return results\r\n end",
"def to_rdf_graph(doc)\n graph = ::RDF::Graph.new\n node = ::RDF::Node.new\n\n doc.authors.each do |a|\n name = +''\n name << \"#{a.prefix} \" if a.prefix\n name << a.last.to_s\n name << \" #{a.suffix}\" if a.suffix\n name << \", #{a.first}\"\n graph << [node, ::RDF::Vocab::DC.creator, name]\n end\n graph << [node, ::RDF::Vocab::DC.issued, doc.year] if doc.year\n\n citation = +''\n citation << doc.journal if doc.journal\n citation << (doc.volume ? \" #{doc.volume}\" : ' ')\n citation << \"(#{doc.number})\" if doc.number\n citation << \", #{doc.pages}\" if doc.pages\n citation << \". (#{doc.year})\" if doc.year\n graph << [node, ::RDF::Vocab::DC.bibliographicCitation, citation]\n\n ourl = ::RDF::Literal.new(\n '&' + RLetters::Documents::AsOpenUrl.new(doc).params,\n datatype: ::RDF::URI.new('info:ofi/fmt:kev:mtx:ctx')\n )\n graph << [node, ::RDF::Vocab::DC.bibliographicCitation, ourl]\n\n graph << [node, ::RDF::Vocab::DC.relation, doc.journal] if doc.journal\n graph << [node, ::RDF::Vocab::DC.title, doc.title] if doc.title\n graph << [node, ::RDF::Vocab::DC.type, 'Journal Article']\n graph << [node, ::RDF::Vocab::DC.identifier, \"info:doi/#{doc.doi}\"] if doc.doi\n\n graph\n end",
"def query\n sparql = <<-SPARQL\n SELECT ?item ?itemLabel ?steamAppId {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:P1733 ?steamAppId. # items with a Steam App ID.\n FILTER NOT EXISTS { ?item wdt:P404 ?gameMode . } # with no game mode\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". }\n }\n SPARQL\n\n sparql\nend",
"def make_html_and_rdf(valscount)\n puts \"Making RDF and html\"\n\n types = {}\n labels = {}\n types_urls = {}\n puts \"\\nFound #{valscount.length} URLs\"\n\n if (use_store())\n require 'lib/four_store/store'\n store = FourStore::Store.new 'http://dbtune.org/bbc/programmes/sparql/'\n valscount.each_key do |url|\n q = \"SELECT distinct ?label ?type WHERE { <#{url}> <http://www.w3.org/2000/01/rdf-schema#label> ?label .}\"\n q2 = \"SELECT distinct ?label ?type WHERE {<#{url}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .}\"\n puts \"Enhancing #{url}\\n\\n#{q}\\n#{q2}\\n\"\n response = store.select(q)\n sleep 2\n response2 = store.select(q2)\n sleep 2\n# Get types\n response2.each do |r|\n ty = r[\"type\"]\n types[url] = ty\n if(types_urls[ty]==nil)\n arr = Array.new\n arr.push(url)\n types_urls[ty]=arr\n else\n arr = types_urls[ty]\n arr.push(url)\n end\n end\n# Get labels\n \n response.each do |r|\n label = r[\"label\"]\n labels[url] = label\n end\n end\n\n else\n valscount.each_key do |url|\n puts \"valscount url is #{url}\"\n#serivces are problematic in the url retrival case so we bypass them\n#genres can also be problematic\n# http://www.bbc.co.uk/programmes/genres/comedy/\n if url.match(\"service\")\n label = url.gsub(/\\#.*/,\"\")\n label = label.gsub(/http:\\/\\/www\\.bbc\\.co\\.uk\\//,\"\")\n ty = \"http://purl.org/ontology/po/Service\"\n types[url]=ty\n labels[url]=label\n\n if(types_urls[ty]==nil)\n arr = Array.new\n arr.push(url)\n types_urls[ty]=arr\n else\n arr = types_urls[ty]\n arr.push(url)\n end\n\n elsif url.match(\"genres\")\n label = url.gsub(/\\#.*/,\"\")\n label = label.gsub(/http:\\/\\/www\\.bbc\\.co\\.uk\\/programmes\\/genres\\//,\"\")\n ty = \"http://purl.org/ontology/po/Genre\"\n types[url]=ty\n labels[url]=label\n\n if(types_urls[ty]==nil)\n arr = Array.new\n arr.push(url)\n types_urls[ty]=arr\n else\n arr = types_urls[ty]\n arr.push(url)\n end\n\n else\n uu = url.gsub(/\\#.*$/,\".rdf\")\n\n m = ModelFactory.createDefaultModel()\n m.read(uu)\n\n q = \"SELECT distinct ?label WHERE { <#{url}> <http://purl.org/dc/elements/1.1/title> ?label .}\"\n\n q2 = \"SELECT distinct ?type WHERE {<#{url}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .}\"\n qexec = QueryExecutionFactory.create(q, m) ;\n qexec2 = QueryExecutionFactory.create(q2, m) ;\n response = qexec.execSelect()\n response2 = qexec2.execSelect()\n# ResultSetFormatter.out(java.lang.System.out, response)\n# ResultSetFormatter.out(java.lang.System.out, response2)\n\n# Get types\n\n response2.each do |r|\n ty = r.get(\"type\").to_s\n types[url] = ty\n if(types_urls[ty]==nil)\n arr = Array.new\n arr.push(url)\n types_urls[ty]=arr\n else\n arr = types_urls[ty]\n arr.push(url)\n end\n end\n\n# Get labels\n \n response.each do |r|\n label = r.get(\"label\").to_s\n labels[url] = label\n end\n\n end\n end\n end\n\n# pp valscount\n\n# Make the html\n \n cc = 0\n str = \"<html><body>\"\n \n types_urls.each_key do |t|\n str = str + \"<h3>\" + t + \"</h3>\\n<p>\"\n u = types_urls[t]\n u.each do |uu|\n label = labels[uu] \n c = valscount[uu]\n cc = cc + c\n str = \"#{str} <a href='#{uu}'>#{label}</a>: #{c} <br />\\n\"\n end\n\n str = str + \"</p>\\n\"\n \n end\n\n str = str + \"</body></html>\"\n \n# Now the rdf\n \n topstr = \"<rdf:RDF\nxmlns:owl=\\\"http://www.w3.org/2002/07/owl#\\\"\nxmlns:rdf=\\\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\\\"\nxmlns:foaf=\\\"http://xmlns.com/foaf/0.1/\\\"\nxmlns:wi=\\\"http://xmlns.notu.be/wi#\\\"\nxmlns:xsd=\\\"http://www.w3.org/2001/XMLSchema#\\\"\nxmlns:tl=\\\"http://perl.org/NET/c4dm/timeline.owl#\\\"\nxmlns:days=\\\"http://ontologi.es/days#\\\"\nxmlns:po=\\\"http://purl.org/ontology/po/\\\"\nxmlns:rdfs=\\\"http://www.w3.org/2000/01/rdf-schema#\\\"\n> \n<foaf:Person>\n\"\n endstr = \"\n</foaf:Person>\n<wi:Context rdf:about=\\\"#default\\\">\n<wi:timePeriod> \n <days:DayInterval> <!-- i.e. every day, all day -->\n <tl:at rdf:datatype=\\\"http://www.w3.org/2001/XMLSchema#time\\\">00:00:00</tl:at>\n <tl:end rdf:datatype=\\\"http://www.w3.org/2001/XMLSchema#time\\\">23:59:59</tl:end>\n </days:DayInterval>\n</wi:timePeriod>\n</wi:Context>\n</rdf:RDF>\n\"\n totalnums = cc.to_f\n str2 = topstr\n \n valscount.each_key do |u|\n t = types[u]\n label = labels[u]\n label.gsub!(\"&\",\"and\")\n c = valscount[u].to_f \n weight = c\n puts \"weight is #{c} #{totalnums}\"\n tmpl =\n\"\n<wi:preference>\n <wi:WeightedInterest>\n <wi:topic rdf:resource=\\\"#{u}\\\" />\n <rdf:type rdf:resource=\\\"#{t}\\\"/>\n <rdfs:label>#{label}</rdfs:label>\n <wi:weight>#{weight}</wi:weight>\n <wi:scale>0..#{cc}</wi:scale>\n <wi:reason>You watched #{weight} of a total of #{cc} items in topic #{label}</wi:reason>\n <wi:context rdf:resource=\\\"#default\\\" />\n </wi:WeightedInterest>\n</wi:preference>\n\"\n str2 = str2 + tmpl \n end\n str2 = str2 + endstr\n return str,str2\n end",
"def sparql_query\n return <<-SPARQL\n SELECT ?item ?itemLabel ?steamAppId WHERE {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:P1733 ?steamAppId. # items with a Steam App ID.\n FILTER NOT EXISTS { ?item wdt:P5794 ?igdbId. } # with no IGDB ID\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en,en\". }\n }\n SPARQL\nend",
"def show\n @ensembl = HTTParty.get('http://rest.ensembl.org' + '/lookup/id/' + @transplice.gene,\n :headers =>{'Content-Type' => 'application/json'} )\n if @ensembl[\"display_name\"].nil? \n @name = \"1\"\n else\n @name = @ensembl[\"display_name\"]\n\n @wikis = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @name + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @name,\n :headers =>{'Content-Type' => 'application/json'} )\n \n @omim = HTTParty.get('https://api.omim.org/api/entry/search?search='+ @name+ '&start=0&limit=1&include=text:description&apiKey=6-p06gbQTZiAWNOpPn-CSw&format=xml',:headers =>{'Content-Type' => 'application/xml'} )\n \n \n\n end\nend",
"def find_wikidata_item_by_steam_app_id(app_id)\n endpoint = \"https://query.wikidata.org/sparql\"\n \n client = SPARQL::Client.new(\n \"https://query.wikidata.org/sparql\",\n method: :get,\n headers: { 'User-Agent': \"Connor's Random Ruby Scripts Data Fetcher/1.0 ([email protected]) Ruby 2.6\" }\n )\n sparql = query(app_id)\n begin\n rows = client.query(sparql)\n rescue SocketError => e\n puts e\n sleep 5\n return nil\n end\n\n # If there are 0 rows (no data returned) or more than one row, just skip it.\n if rows.size != 1\n print '.'\n return nil\n end\n return_row = {}\n rows.each do |row|\n return_row = { url: row.to_h[:item].to_s, title: row.to_h[:itemLabel].to_s }\n end\n\n return return_row\nend",
"def vivo_profile(uri)\n g = RDF::Graph.new\n q = rdf_subject_select(uri)\n solutions = RDF_REPO.client.query(q)\n solutions.each do |s|\n p = s[:p]\n o = s[:o]\n g << [uri, p, o]\n if vivo_profile_expand_object?(o)\n g << rdf_subject_graph(o) if o.node?\n g << rdf_subject_graph(o) if o.uri?\n end\n end\n g\nend",
"def index\n logger.error(\"@programs has #{@programs.count} entries\") if @programs\n basic_params = %i(function read_format platform name_cont)\n advanced_params = %i(summary_cont interface speciality write_format for_audience language display_function header_function network_function programming_function other_function author)\n qparams = params[:q] ? params[:q].permit(basic_params + advanced_params) : nil\n if qparams\n # You could use the :active and :imaging scopes in the query. Result is the same as the scopes are chained.\n # @q = Program.active.imaging.ransack(qparams)\n @q = Program.ransack(qparams.merge(active: true, imaging: true))\n @q.sorts = 'rating desc' if @q.sorts.empty?\n make_search_params(qparams)\n @programs = @q.result.includes(:languages, :platforms, :source_urls, :ratings).page(params[:page]).per(10)\n else\n @q = Program.none.ransack\n @programs = nil\n end\n end",
"def query(steam_app_id)\n sparql = <<-SPARQL\n SELECT ?item ?itemLabel WHERE {\n ?item wdt:P1733 \"#{steam_app_id}\".\n FILTER NOT EXISTS { ?item wdt:P6337 ?pcgw_id . } # with no PCGW ID\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],en\". }\n }\n LIMIT 10\n SPARQL\n\n return sparql\nend",
"def fetch_rdf\n @doc = Nokogiri::XML(open(@url))\n @root_node = @doc.xpath(\"/rdf:RDF/rdf:Description\", @@NAMESPACES)\n end",
"def show\n respond_to do |format|\n format.html {}\n format.json {}\n format.rdf { render rdf: @paper }\n end\n end",
"def get_trainer(uri)\n sparql = \"SELECT DISTINCT ?uri ?name ?surname ?givenName ?fullname ?birth_date ?image_url ?thumbnail_url ?abstract ?team_uri\n WHERE {\n ?uri <http://dbpedia.org/property/name> ?name .\n <#{uri}> <http://dbpedia.org/property/name> ?name .\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/surname> ?surname }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/givenName> ?givenName }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/fullname> ?fullname }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/birthDate> ?birth_date . }.\n OPTIONAL { <#{uri}> <http://xmlns.com/foaf/0.1/depiction> ?image_url . }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/thumbnail> ?thumbnail_url . }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/abstract> ?abstract . FILTER ( LANG(?abstract) = 'de' ) }.\n OPTIONAL { ?team_uri <http://dbpedia.org/ontology/coach> <#{uri}> . }.\n }\"\n solution = DBPEDIA.query(sparql).first\n end",
"def find_tv_programmes_by_person(person)\n response = get(\"http://www.bbc.co.uk/programmes/topics/#{CGI::escape(person.name.gsub(' ', '_'))}.json\")\n return nil unless response.code == 200\n json_data = JSON.parse(response.body)\n\n p = json_data['category_page']['available_programmes'].take(30).map do |json|\n programme = Programme.new(\n pid: json['pid'],\n title: json['display_titles']['title'],\n subtitle: json['display_titles']['subtitle'],\n synopsis: json['short_synopsis']\n )\n programme.created_at = json['first_broadcast_date']\n\n return nil if json['media_type'] == 'audio'\n programme\n\n end\n p.compact!\n p\n end",
"def index\n\t\tquery = params[:query].presence || '*'\n @materials = Material.search query, aggs: [:section, :cat_1, :cat_2, :cat_3]\n @companies = @materials.map(&:companies).flatten.uniq\n\t\t@aggs = @materials.aggs\n\n\t\t# Needs to be refactored\n\t\tif @companies.map(&:name).include? query\n\t\t\[email protected] do |company|\n\t\t\t\tif company.name = query\n\t\t\t\t\t@companies = [company]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def full_paper_info(keywords, searchType)\n keyword = concat_keywords(keywords, searchType)\n uri = URI('https://api.labs.cognitive.microsoft.com/academic/v1.0/evaluate')\n query = URI.encode_www_form({\n 'expr' => keyword,\n 'model' => 'latest',\n 'count' => '50',\n 'offset' => '0',\n 'attributes' => 'Id,Ti,AA.AuN,Y,D,F.FN,E,RId'\n })\n\n if uri.query && uri.query.length > 0\n uri.query += '&' + query\n else\n uri.query = query\n end\n\n get(uri)\n end",
"def publishing_format\n :rdf\n end",
"def run(content)\n puts \"Running company extractor\"\n @graph = RDF::Graph.new\n @graph_usdl = RDF::Graph.new\n\n init(content)\n\n begin\n @company_name = extractData\n rescue Exception => e\n puts \"Extraction failed for company\"\n puts e\n @company_name = \"failed\"\n return \"failed\"\n end\n puts returnUSDL\n store_wordlists\n end",
"def get_metadata\n doc = download_ais(@program_id)\n streamUri = (doc/\"//streamuri\").text\n @metadata[:fileType] = streamUri[-3..-1]\n @metadata[:programName] = (doc/\"//brandtitle\").text\n @metadata[:episodeId] = (doc/\"//programmenumber\").text\n\n assetInfo = download_asset(@program_id)\n @metadata[:episodeNumber] = (assetInfo/\"//episodenumber\").text\n @metadata[:seriesNumber] = (assetInfo/\"//seriesnumber\").text\n @metadata[:episodeInfo] = (assetInfo/\"//episodeinfo\").text\n @metadata[:episodeTitle] = (assetInfo/\"//episodetitle\").text\n @metadata[:brandTitle] = (assetInfo/\"//brandtitle\").text\n @metadata[:epId] = (assetInfo/\"//programmeid\").text\n @metadata[:imagePath] = (assetInfo/\"//imagepath\").text\n\n @metadata[:title1] = (assetInfo/\"//title1\").text\n @metadata[:title2] = (assetInfo/\"//title2\").text\n\n #progGuideUrl is used to pull out metadata from the CH4 website\n progGuideUrl = (assetInfo/\"//episodeguideurl\").text\n\n begin\n #read program guide to get additional metadata\n seriesInfo = download_progguide(progGuideUrl)\n\n synopsisElem = seriesInfo.at(\"//meta[@name='synopsis']\")\n @metadata[:description] = synopsisElem.nil? ? \"\" : synopsisElem['content']\n rescue\n @log.error \"Unable to read program guide data - the video file will not be fully tagged\"\n @log.debug \"Program Guide URL: #{progGuideUrl}\"\n end\n end",
"def getKnowledge\n\t\t\n\tend",
"def solutions\n return nil unless self.result\n result = RDF::URI(self.result)\n\n # Use alternate results for RDF 1.1\n file_11 = result.to_s.\n sub(BASE_URI_10, BASE_DIRECTORY).\n sub(BASE_URI_11, BASE_DIRECTORY).\n sub(/\\.(\\w+)$/, '_11.\\1')\n result = RDF::URI(file_11) if File.exist?(file_11)\n\n case form\n when :select, :ask\n case File.extname(result.path)\n when '.srx'\n SPARQL::Client.parse_xml_bindings(RDF::Util::File.open_file(result, &:read))\n when '.srj'\n SPARQL::Client.parse_json_bindings(RDF::Util::File.open_file(result, &:read))\n when '.csv'\n SPARQL::Client.parse_csv_bindings(RDF::Util::File.open_file(result, &:read))\n when '.tsv'\n SPARQL::Client.parse_tsv_bindings(RDF::Util::File.open_file(result, &:read))\n else\n if form == :select\n parse_rdf_bindings(RDF::Graph.load(result))\n else\n RDF::Graph.load(result).objects.detect {|o| o.literal?}\n end\n end\n when :describe, :create, :construct\n RDF::Repository.load(result, base_uri: result, format: :ttl)\n end\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 american\n puts \"Let's explore the whiskies of the United States of America\"\n #call method to list whiskies for this particular type\n list_whiskies('c/33/american-whiskey?filter=true&rfdata=~size.76#productlist-filter')\n end",
"def program\n ::HubEdos::Common::Reference::Descriptor.new(@data['program']) if @data['program']\n end",
"def fetch_thesauri\n doc = create_doc('gaz-thesauri/administrativeThesaurus.xml')\n ## loop through each <term> element in the thesaurus\n vocabs=[]\n (doc/\"thesaurus/root/term\").each do |term|\n STDOUT << puts \n STDOUT << term.inspect\n STDOUT << puts \n\n end\n vocabs\n end",
"def rels_ext pid\n\n str = <<-XML\n <rdf:RDF xmlns:fedora=\"info:fedora/fedora-system:def/relations-external#\"\n xmlns:fedora-model=\"info:fedora/fedora-system:def/model#\"\n xmlns:islandora=\"http://islandora.ca/ontology/relsext#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <rdf:Description rdf:about=\"info:fedora/#{pid}\">\n <fedora-model:hasModel rdf:resource=\"info:fedora/#{@content_model}\"></fedora-model:hasModel>\n XML\n @collections.each do |collection|\n str += <<-XML\n <fedora:isMemberOfCollection rdf:resource=\"info:fedora/#{collection}\"></fedora:isMemberOfCollection>\n XML\n end\n\n if @manifest.page_progression\n str += <<-XML\n <islandora:hasPageProgression>#{@manifest.page_progression}</islandora:hasPageProgression>\n XML\n end\n\n if @inherited_policy_collection_id\n str += Utils.rels_ext_get_policy_fields(@config, @inherited_policy_collection_id)\n end\n\n str += <<-XML\n </rdf:Description>\n </rdf:RDF>\n XML\n\n return str.gsub(/^ /, '')\n end",
"def ontology; ontologies.first; end",
"def ontology; ontologies.first; 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 extract_uris( graph ) \n graph.terms.map{|t| t.to_s if t.uri?}.compact\nend",
"def rels_ext pid\n str = <<-XML\n <rdf:RDF xmlns:fedora=\"info:fedora/fedora-system:def/relations-external#\"\n xmlns:fedora-model=\"info:fedora/fedora-system:def/model#\"\n xmlns:islandora=\"http://islandora.ca/ontology/relsext#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <rdf:Description rdf:about=\"info:fedora/#{pid}\">\n <fedora-model:hasModel rdf:resource=\"info:fedora/#{@content_model}\"></fedora-model:hasModel>\n <fedora:isMemberOf rdf:resource=\"info:fedora/#{@newspaper_id}\"></fedora:isMemberOf>\n XML\n\n if @manifest.page_progression\n str += \" <islandora:hasPageProgression>#{@manifest.page_progression}</islandora:hasPageProgression>\"\n end\n\n if @inherited_policy_collection_id\n str += Utils.rels_ext_get_policy_fields(@config, @inherited_policy_collection_id)\n str += \" <islandora:inheritXacmlFrom rdf:resource=\\\"info:fedora/#{@inherited_policy_collection_id}\\\"></islandora:inheritXacmlFrom>\\n\"\n end\n\n str += <<-XML\n <islandora:isSequenceNumber>#{@issue_sequence}</islandora:isSequenceNumber>\n <islandora:dateIssued>#{@date_issued}</islandora:dateIssued>\n </rdf:Description>\n </rdf:RDF>\n XML\n\n return str.gsub(/^ /, '') # prettify XML somewhat\n end",
"def rdf\n @rdf_data.join(\"\\n\")\n end",
"def itemtype\n format = self[:format_main_ssim] || []\n genre = self[:genre_ssim] || []\n case\n when genre.include?('Thesis/Dissertation')\n 'http://schema.org/Thesis'\n when genre.include?('Video games')\n 'http://schema.org/VideoGame'\n when format.include?('Equipment')\n 'http://schema.org/Thing'\n when format.include?('Book')\n 'http://schema.org/Book'\n when format.include?('Dataset')\n 'http://schema.org/Dataset'\n when format.include?('Image')\n 'http://schema.org/ImageObject'\n when format.include?('Journal/Periodical')\n 'http://schema.org/Periodical'\n when format.include?('Map')\n 'http://schema.org/Map'\n when format.include?('Music recording')\n 'http://schema.org/MusicRecording'\n when format.include?('Newspaper')\n 'http://bib.schema.org/Newspaper'\n when format.include?('Software/Multimedia')\n 'http://schema.org/SoftwareApplication'\n when format.include?('Sound recording')\n 'http://schema.org/AudioObject'\n when format.include?('Video')\n 'http://schema.org/VideoObject'\n else\n 'http://schema.org/CreativeWork'\n end\n end",
"def generate_rdf_catlink(b,ty)\n ul = \"http://catalog.library.cornell.edu/catalog/#{id}\"\n # if no elect access data, 'description' field.\n b.dc(:description,ul)\n end",
"def parse_profile_data_rdf(profile_string)\n \n # OK, so the following is clunky: because the RDF::Graph.load method won't follow URL redirects,\n # we have to pretent the RDF string is a file, and then parse it with a Reader object\n profile_rdf = StringIO.new profile_string\n repo = RDF::Repository.new\n reader = RDF::Reader.for(:turtle).new(profile_rdf) do |r|\n puts \"Set of statements found by Reader to be inserted into repository:\"\n r.each_statement do |statement|\n repo.insert statement\n end\n end\n # Let's see the list of triples we've found in there\n puts \"Set of triple assertions in final repository:\"\n repo.each_statement do |statement|\n puts ' -> ' + statement.inspect\n end\n \n # Set up a simple graph pattern to pull out basic profile info from the graph\n query = RDF::Query.new({\n :person => {\n #RDFS.label => :label,\n FOAF.firstName => :firstname,\n FOAF.lastName => :lastname,\n }\n })\n solution = query.execute(repo).first\n print \"Query solution: \"\n solution.each_binding do |n,v|\n puts \" #{n}=#{v}\"\n end\n print \"\\n\"\n \n # Maybe need one or two more graph patterns to get the publications out. OR\n # just keep it simple and only get basic bio for now.\n\n # Turn the profile info into a hash that we can use\n profile_hash = solution.to_hash\n puts \"raw solution hash=\"\n pp profile_hash\n \n # Clean up a few attributes we don't want downstream\n profile_hash.delete(:person)\n #profile_hash.stringify_keys! # Change hash keys from symbols to strings\n profile_hash.each do |key, val|\n puts \"checking if val for key #{key} is a URI or a literal: #{val.inspect} \"\n profile_hash[key] = val.to_s if val.respond_to? :to_s\n end\n\n puts \"Final hash with profile data from RDF:\"\n pp profile_hash\n return profile_hash \n end",
"def instances(return_type)\n return nil unless(active_rdf? && is_iri?)\n qry = ActiveRDF::Query.new(URI).distinct.select(:s)\n qry.where(:s, RDF.type, self)\n qry.execute\n end",
"def aviator \n aviator_output = {}\n source = \"Aviator-aero\"\n url = 'https://newsroom.aviator.aero/rss/'\n open(url) do |rss|\n feed = RSS::Parser.parse(rss)\n\n feed.items.each_with_index {|item, index|\n title = item.title\n description = item.description.gsub(/<\\/?[^>]*>/, \"\")\n category = item.category\n link = item.link \n \n aviator_output[index] = {\n :title => title,\n :description => description,\n :link => link,\n :source => source\n }\n }\n end\n aviator_output\n end",
"def familiarity artist\n url = \"http://developer.echonest.com/api/v4/artist/familiarity?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\n result = parseURL url\n result[\"response\"][\"artist\"][\"familiarity\"]\nend",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def games_query\n sparql = <<-SPARQL\n SELECT ?item WHERE {\n ?item wdt:P31 wd:Q7889; # Instances of video games.\n rdfs:label ?label filter(lang(?label) = \"en\"). # with a label\n }\n SPARQL\n\n return sparql\n end",
"def all_items_url engine_id, query, format\n\n\n if engine_id == 'summon_bento'\n query = query.gsub('&', '%26')\n \"https://proxy.library.cornell.edu/login?url=http://cornell.summon.serialssolutions.com/search?s.fvf=ContentType,Newspaper+Article,t&s.q=#{query}\"\n elsif engine_id == 'summonArticles'\n query = query.gsub('&', '%26')\n \"https://proxy.library.cornell.edu/login?url=http://cornell.summon.serialssolutions.com/search?s.fvf=ContentType,Newspaper+Article&s.q=#{query}\"\n elsif engine_id == 'digitalCollections'\n query = query.gsub('&', '%26')\n \"https://digital.library.cornell.edu/catalog?utf8=%E2%9C%93&q=#{query}&search_field=all_fields\"\n elsif engine_id == 'institutionalRepositories'\n query = query.gsub('&', '%26')\n \"institutional_repositories/index?q=#{query}\"\n elsif engine_id =='libguides'\n query = query.gsub('&', '%26')\n \"http://guides.library.cornell.edu/srch.php?q=#{query}\"\n elsif engine_id == 'ebsco_eds'\n query = query.gsub('&', '%26')\n query = \"https://proxy.library.cornell.edu/login?url=https://discovery.ebsco.com/c/u2yil2/results?q=#{query}\"\n else\n # Need to pass pluses through as urlencoded characters in order to preserve\n # the Solr query format.\n path = '/'\n if format == 'all'\n escaped = { q: query }.to_param\n else\n escaped = { \"f[format][]\" => format, q: query, search_field: 'all_fields' }.to_param\n end\n escaped_search_url = path + '?' + escaped\n end\n end",
"def index\n @brand = Brand.find(params[:brand_id])\n if current_user.is_approver? || current_user.is_super_admin? || current_user.is_admin? || current_user.is_g360?\n @programs = @brand.programs\n else\n @programs = current_user.programs.where(brand_id: @brand.id)\n end\n end",
"def show\n @query = params[:query]\n\n if @query\n if redirectOnSpecialCode @query\n return\n end\n end\n \n if @query\n @query = params[:query]\n @laws = @tag.laws.search_by_name(@query).with_pg_search_highlight\n @stream = Article.where(law: @tag.laws).search_by_body_highlighted(@query).group_by(&:law_id)\n @result_count = @laws.size\n @articles_count = @stream.size\n legal_documents = Set[]\n\n @laws.each do |law|\n legal_documents.add(law.id)\n end\n \n @grouped_laws = []\n @stream.each do |grouped_law|\n law = {count: grouped_law[1].count, law: Law.find_by_id(grouped_law[0]), preview: (\"<b>Artículo \" + grouped_law[1].first.number + \"</b> \" + grouped_law[1].first.body[0,300] + \"...\").html_safe}\n law[:materia_names] = law[:law].materia_names\n @grouped_laws.push(law)\n @result_count += grouped_law[1].count\n legal_documents.add(grouped_law[0])\n end\n @grouped_laws = @grouped_laws.sort_by{|k|k[:count]}.reverse\n @legal_documents_count = legal_documents.size\n if @result_count == 1\n @result_info_text = number_with_delimiter(@result_count, :delimiter => ',').to_s + ' resultado encontrado en la materia ' + @tag.name\n else\n @result_info_text = number_with_delimiter(@result_count, :delimiter => ',').to_s + ' resultados encontrados en la materia ' + @tag.name\n end\n titles_result = number_with_delimiter(@laws.size, :delimiter => ',')\n if @laws.size == 1\n @titles_result_text = titles_result.to_s + ' resultado'\n else\n @titles_result_text = titles_result.to_s + ' resultados'\n end\n articles_result = number_with_delimiter(@result_count - @laws.size, :delimiter => ',')\n if @result_count == 1\n @articles_result_text = articles_result.to_s + ' resultado'\n else\n @articles_result_text = articles_result.to_s + ' resultados'\n end\n\n if current_user\n $tracker.track(current_user.id, 'Site Search', {\n 'query' => @query,\n 'location' => @tag.name,\n 'location_type' => \"Tag\",\n 'results' => titles_result + articles_result\n })\n end\n else\n @laws = @tag.laws\n .left_joins(:articles)\n .group(:id)\n .order('COUNT(articles.id) DESC')\n @result_count = @laws.count.values.size\n if @result_count == 1\n @result_info_text = number_with_delimiter(@result_count, :delimiter => ',').to_s + ' ley'\n else\n @result_info_text = number_with_delimiter(@result_count, :delimiter => ',').to_s + ' leyes'\n end\n end\n end",
"def fetch_contrib_programmes_for(entity, type, availability_type=:episode)\n programmes = []\n pids = []\n contrib_pid = fetch_contributor_pid_for(entity.url_key)\n return nil unless contrib_pid.present?\n params = {\n people: contrib_pid,\n availability_entity_type: availability_type,\n availability: 'available',\n media_set: 'pc',\n mixin: 'titles'\n }\n params['media_type'] = type == :radio ? 'audio' : 'audio_video' ;\n url = remove_brackets api_endpoint_for('programmes', params)\n response = get(url)\n return nil unless response.code == 200\n begin\n xml_doc = Nokogiri::XML(response.body)\n if availability_type == 'clip'\n # debugger\n end\n pids = extract_pids(xml_doc)\n rescue\n nil\n end\n\n pids.each do |pid|\n programmes << ::Programmes.fetch_programme(pid)\n end\n programmes.compact\n end",
"def to_open_search_granules(doc, hits, params, url)\n doc, subtitle_node = to_open_search_common(doc, hits, params, 'granule')\n add_nav_links(doc, subtitle_node, hits, params, url)\n add_esipbp_uplink(doc, subtitle_node, url)\n doc.root.children.each do |node|\n if node.name == 'entry'\n id_node, last_link, start_time, end_time, mbr = nil\n non_atom = []\n # if/elsif is faster than case.\n node.children.each do |sub_node|\n if sub_node.name == 'title'\n sub_node[:type] = 'text' if sub_node.element?\n elsif sub_node.name == 'link'\n # resolve the ambiguous CMR #data ( OpenSearch enclosure) links which in some cases result in more than one\n # enclosure link but only one valid link for the actual data retrieval\n if sub_node['rel'].end_with?('/data#') && sub_node.at_xpath('echo:inherited', 'echo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom')\n # the 'GET DATA' link should bot be there in the first place, it is inherited from the collection and does\n # not allow direct access to the granule data file\n sub_node.remove\n else\n decorate_link(node, sub_node)\n last_link = sub_node\n end\n elsif sub_node.name == 'id'\n id_node = sub_node\n elsif sub_node.name == 'start'\n start_time = sub_node.content\n elsif sub_node.name == 'end'\n end_time = sub_node.content\n elsif sub_node.name == 'georss:polygon' or sub_node.name == 'georss:line' or sub_node.name == 'georss:point'\n mbr = generate_mbr(doc, sub_node)\n end\n non_atom << sub_node.remove if sub_node.namespace.nil? or sub_node.namespace.href != 'http://www.w3.org/2005/Atom'\n end\n\n last_link = doc.root.children.last if last_link.nil?\n guid = id_node.content\n id_node.content = \"#{ENV['opensearch_url']}/granules.atom?uid=#{guid}\"\n add_cmr_metadata_link(doc, last_link, node, guid)\n add_dc_identifier(doc, guid, node)\n add_dc_temporal_extent(doc, node, start_time, end_time) unless start_time.nil? and end_time.nil?\n # Add non-atom element array\n non_atom.each do |element|\n node.add_child(element)\n end\n node.add_child(mbr) unless mbr.nil?\n end\n end\n doc.xpath('//echo:onlineAccessFlag', 'echo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//echo:browseFlag', 'echo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//echo:dayNightFlag', 'echo' => 'https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#atom').remove\n doc.xpath('//time:start', 'time' => 'http://a9.com/-/opensearch/extensions/time/1.0/').remove\n doc.xpath('//time:end', 'time' => 'http://a9.com/-/opensearch/extensions/time/1.0/').remove\n opensearch_doc = Nokogiri::XML(doc.to_xml) do |config|\n config.default_xml.noblanks\n end\n\n opensearch_doc\n end",
"def items_with_esrb_id_and_no_qualifiers_query\n <<-SPARQL\n SELECT DISTINCT ?item ?itemLabel ?esrbId WHERE {\n OPTIONAL {\n ?item p:P8303 ?statement. # Get the statement of the ESRB game ID\n ?statement ps:P8303 ?esrbId. # Get the actual ESRB game ID\n FILTER(NOT EXISTS { ?statement pq:P400 ?platform. }) # Filter out items where the ESRB game ID has platform qualifiers\n FILTER(NOT EXISTS { ?statement pq:P1810 ?subject_stated_as. }) # Filter out items where the ESRB game ID has 'subjected stated as' qualifiers\n }\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE]\". }\n }\n SPARQL\nend",
"def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end",
"def app_search(search_term)\n query = search_term.gsub(\" \",\"+\")\n response = HTTParty.get(\"https://itunes.apple.com/search?term=#{query}&entity=software&limit=1\")\n\n unless response.nil?\n\n res = response[\"results\"][0]\n @app_id = res[\"artistId\"]\n @app_name = res[\"trackName\"]\n @store_url = res[\"trackViewUrl\"]\n\n @features = res[\"features\"] # array, incl. Universal\n @app_icon = res[\"artworkUrl512\"]\n @developer = res[\"artistName\"]\n @developer_company = res[\"sellerName\"]\n @developer_company_website = res[\"sellerUrl\"]\n\n @price = res[\"price\"]\n @currency = res[\"currency\"]\n @formatted_price = res[\"formattedPrice\"]\n\n @current_version = res[\"version\"]\n @current_release_notes = res[\"releaseNotes\"]\n @description = res[\"description\"]\n\n @current_user_rating = res[\"averageUserRatingForCurrentVersion\"]\n @current_user_rating_count = res[\"userRatingCountForCurrentVersion\"]\n @total_user_rating = res[\"averageUserRating\"]\n @total_user_rating_count = res[\"userRatingCount\"]\n\n @content_rating = res[\"contentAdvisoryRating\"] # \"trackContentRating\"\n @categories = res[\"genres\"] # array of app store catgories\n @category_ids = res[\"genreIds\"] # array of corresponding ids; not sure how I'd use, but could be useful?\n @primary_category = res[\"primaryGenreName\"]\n @primary_category_id = res[\"primaryGenreId\"]\n\n @original_release_date = res[\"releaseDate\"]\n @supported_languages = res[\"languageCodesISO2A\"]\n @file_size_bytes = res[\"fileSizeBytes\"]\n end\nend",
"def extract_page_data(data)\n comment_url = \"https://www.spear.land.vic.gov.au/spear/pages/public-and-other-users/objectors.shtml\"\n\n apps = []\n # Skip first two row (header) and last row (page navigation)\n\n\n JSON.parse(data)[\"resultRows\"].each do |row|\n \n # Type appears to be either something like \"Certification of a Plan\" or \"Planning Permit and Certification\"\n # I think we need to look in detail at the application to get the description\n # TODO: Figure out whether we should ignore \"Certification of a Plan\"\n #type = values[3].inner_html.strip\n #status = values[4].inner_html.strip\n # I'm going to take a punt here on what the correct thing to do is - I think if there is a link available to\n # the individual planning application that means that it's something that requires deliberation and so interesting.\n # I'm going to assume that everything else is purely \"procedural\" and should not be recorded here\n\n # If there is a link on the address record this development application\n \n info_url = \"https://www.spear.land.vic.gov.au/spear/applicationDetails/RetrievePublicApplication.do?cacheApplicationListContext=true&spearNum=#{row['spearReference']}\"\n # puts row.to_yaml\n record = {\n # We're using the SPEAR Ref # because we want that to be unique across the \"authority\"\n 'council_reference' => row['spearReference'],\n 'address' => row['property'],\n 'date_received' => Date.strptime(row['submittedDate'], \"%d/%m/%Y\").to_s,\n 'info_url' => info_url,\n 'comment_url' => comment_url,\n 'date_scraped' => Date.today.to_s\n }\n\n # Get more detailed information by going to the application detail page (but only if necessary)\n record[\"description\"] = extract_description(info_url)\n #p record\n ScraperWiki.save_sqlite(['council_reference'], record)\n\n end\nend",
"def orchio_get_graph(kind)\n # add_relation_kind kind\n if cache.enabled? and response = cache_request.get_graph(id, kind)\n if response.header.status == :cache\n docs = response.body.documents\n count = docs.length\n end\n else\n response = client.send_request :get, inst_args(kind: kind)\n docs = response.body.results.map { |result|\n Document.new(\n result['value'].merge(id: result['path']['key']),\n Metadata.new(\n :collection => result['path']['collection'],\n :key => result['path']['key'],\n :ref => result['path']['ref'],\n :kind => kind,\n :from_collection => ocollection,\n :from_key => @id,\n ))}\n cache.save_graph(id, kind) if cache.enabled? and count == 0\n end\n Result.new(\n status: orchio_status(response, 200),\n response: response,\n count: response.body.count,\n results: docs\n )\n end",
"def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend",
"def show\n @memory = Memory.find(params[:id])\n \n Spira.add_repository! :hardware, RDF::Mongo::Repository.new\n @memory_rdf = SPARQL.execute(\"SELECT * WHERE { <#{MemoryRdf.for(@memory.item).subject.to_s}> ?p ?o }\", MemoryRdf.repository)\n \n @recommendations = Semantics::Recommendations.new.for_memory(@memory)\n\n @computer = Semantics::Recommendations.new.build_computer(@memory)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @memory }\n end\n end",
"def query\n sparql = <<-SPARQL\n SELECT ?item ?itemLabel ?giantBombId {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:P5247 ?giantBombId. # items with a GiantBomb ID.\n FILTER NOT EXISTS { ?item wdt:P11400 ?microtransactionZoneId . } # with no microtransaction zone ID\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". }\n }\n SPARQL\n\n sparql\nend",
"def _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 search(user_query)\n\n characters = @client.characters(name: user_query)\n # comics = @client.comics(name: user_query)\n # creators = @client.creators(name: user_query)\n # events = @client.events(name: user_query)\n # series = @client.series(name: user_query)\n # stories = @client.stories(name: user_query)\n\n puts characters\n # I'm finally getting return goobledigook! But Derek also used this API and is getting different return than me. His was formulated like a nice little hash. \n\n end",
"def urn_rdf( hash, rdf )\n graph = RDF::Graph.new\n rdf.each do |tri|\n tri.subject = RDF::Resource.new( hash['@id'] )\n tri.object = urn_obj( tri.object )\n graph << tri\n end\n graph\n end",
"def query\n return <<-SPARQL\n SELECT ?item ?itemLabel ?igdbId WHERE {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:#{IGDB_GAME_PID} ?igdbId. # items with an IGDB ID.\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en,en\". }\n }\n SPARQL\nend",
"def parse_unesco(params)\n \"{{Infobox UNESCO World Heritage Site\n | Official_name = #{params['whs_name']}\n | Criteria = #{params['whs_criteria']} \n | ID = #{params['whs_number']}\n | Year = #{params['whs_year']}\n | child = yes\n}}\"\n end",
"def index\n @foafs = Foaf.all\n # if all else fails, make RDF then\n # rapper -o dot -i turtle me.ttl | dot -Tsvg -o me.svg\n respond_to do |format|\n format.html #{ render text: convert_one_to_rdf(@foaf, :html) }\n format.ttl { render text: convert_many_to_rdf(@foafs, :ttl) }\n format.rj { render text: convert_many_to_rdf(@foafs, :json) }\n format.nt { render text: convert_many_to_rdf(@foafs, :ntriples) }\n format.rdf { render text: convert_many_to_rdf(@foafs, :rdf) }\n format.jsonld { render text: convert_many_to_rdf(@foafs, :jsonld) }\n end\n end",
"def gather_uri(key = nil, cat = nil, val = nil)\n uri = \"http://jservice.io/api/\"\n if !key.nil? && !cat.nil?\n category = return_categories(key)\n category = category.select {|c| c[\"title\"] == cat}[0] if category.kind_of? Array\n uri += \"clues?category=#{category['id']}\"\n if !val.nil?\n uri += \"&value=#{val}\"\n end\n else\n uri += \"random?count=1\"\n end\n uri\nend",
"def extract_department(dept_uri, vivo_loc, username, password)\n client = VivoWebApi::Client.new(vivo_loc)\n client.authenticate(username, password)\n\n person_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX foaf: <http://xmlns.com/foaf/0.1/>\nPREFIX core: <http://vivoweb.org/ontology/core#>\n\nconstruct { \n ?person core:personInPosition ?pos .\n ?person foaf:firstName ?firstName .\n ?person foaf:lastName ?lastName .\n ?person core:authorInAuthorship ?authorship .\n ?person rdf:type ?type .\n ?person rdfs:label ?label \n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n\n ?person foaf:firstName ?firstName .\n ?person foaf:lastName ?lastName .\n ?person rdf:type ?type .\n ?person rdfs:label ?label .\n\n optional { ?person core:authorInAuthorship ?authorship }\n}\n EOH\n\n authorship_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX core: <http://vivoweb.org/ontology/core#>\n\nconstruct { \n ?authorship core:linkedAuthor ?person .\n ?authorship core:authorRank ?authorRank .\n ?authorship core:linkedInformationResource ?publication .\n\n ?authorship rdf:type ?type .\n ?authorship rdfs:label ?label \n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n\n ?authorship core:linkedAuthor ?person .\n ?authorship core:linkedInformationResource ?publication .\n\n ?authorship rdf:type ?type .\n optional { ?authorship rdfs:label ?label }\n optional { ?authorship core:authorRank ?authorRank }\n}\n EOH\n\n publication_construct = <<-EOH\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nPREFIX core: <http://vivoweb.org/ontology/core#>\nPREFIX bibo: <http://purl.org/ontology/bibo/>\n\nconstruct {\n ?publication rdf:type ?type .\n ?publication rdfs:label ?label . \n\n ?authorship core:linkedInformationResource ?publication .\n ?publication core:informationResourceInAuthorship ?authorship .\n ?publication bibo:pageStart ?pageStart .\n ?publication bibo:pageEnd ?pageEnd .\n ?publication bibo:volume ?volume .\n ?publication bibo:issue ?issue .\n ?publication core:yearMonth ?yearMonth .\n ?publication core:doi ?doi\n}\nwhere {\n <#{dept_uri}> core:organizationForPosition ?pos .\n ?person core:personInPosition ?pos .\n ?person core:authorInAuthorship ?authorship .\n ?authorship core:linkedInformationResource ?publication .\n\n ?publication rdf:type ?type .\n ?publication rdfs:label ?label . \n\n ?authorship core:linkedInformationResource ?publication .\n ?publication core:informationResourceInAuthorship ?authorship .\n optional { ?publication bibo:pageStart ?pageStart }\n optional { ?publication bibo:pageEnd ?pageEnd }\n optional { ?publication bibo:volume ?volume }\n optional { ?publication bibo:issue ?issue }\n optional { ?publication core:yearMonth ?yearMonth }\n optional { ?publication core:doi ?doi }\n}\n EOH\n\n person_results = client.execute_sparql_construct(username, password, \n person_construct)\n authorship_results = client.execute_sparql_construct(username, password, \n authorship_construct)\n publication_results = client.execute_sparql_construct(username, password, \n publication_construct)\n\n results = []\n person_results.each do |statement| \n results << statement\n end\n\n authorship_results.each do |statement| \n results << statement\n end\n\n publication_results.each do |statement| \n results << statement\n end\n\n return results\nend",
"def discover\n # Look for rss link, e.g.\n # <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\"\n # href=\"http://feeds.feedburner.com/TheRssBlog\">\n # Tricky: Hpricot CSS attribute selectors are written like XPath selectors\n [:atom, :rss].each do |flavor|\n if [email protected](\"head link[@type=application/#{flavor}+xml]\")\n return x[:href]\n end\n end\n if [email protected](\"head link[@type=text/xml]\")\n return x[:href]\n end\n return nil\n end",
"def generate_rdf(params = {})\n # If the fields are not valid nothing is added\n @rdf_data << \"\" unless valid?(params)\n\n params.each do |entry_id, values|\n puts \"\\nTransforming #{entry_id} to RDF ...\"\n value = Ontology::ontology_struct values\n next if value == false\n @rdf_data << value.join(\"\\n\")\n end\n end",
"def index\n @episodes = Episode.online.desc_human.recommend_before_today\n\n _project_ids = @episodes.pluck(:project_list).map{|x| x.split(\",\") }\n project_ids = _project_ids.flatten.map(&:to_i)\n\n projects = Project.online.where(id: project_ids).includes(:github_info, :category => :catalog)\n\n # @recommend_gems = projects.gemspec.includes(:github_info, :category => :catalog)\n\n # @recommend_pods = projects.pod.includes(:github_info, :category => :catalog)\n end",
"def show\n results = Dbpedia.sparql.query(\"SELECT ?person ?abstract ?name WHERE {\n ?person rdf:type <http://dbpedia.org/ontology/Person>.\n ?person foaf:name ?name.\n ?person dbpedia-owl:abstract ?abstract .\n FILTER (LANG(?abstract)='pl' && ?name=\\\"\"[email protected]_name+\"\\\"@en)\n }\")\n if results.first != nil\n @bio=results.first[:abstract] \n end\n end",
"def extract(file,myurl)\n STDERR.puts \"# Scanning: #{myurl} via file:#{file}\"\n doc=\"\"\n dct='http://purl.org/dc/terms/'\n # rdf = \"<dc:Document rdf:about='#{myurl}' xmlns:dc='http://purl.org/dc/terms/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>\\n\"\n nt = ''\n File.read(file).each do |x| \n doc += x\n end\n doc.gsub!(/\\n/, \"\")\n doc.gsub!(/\\s+/, \" \")\n\n if (doc =~ /<title>\\s*([^<]*)\\s*<\\/title>/) \n # puts \"title: #{$1}\"\n t = $1\n t.gsub!(/\\s*$/,\"\")\n nt += \"<#{myurl}> <#{dct}title> \\\"#{t}\\\" . \\n\"\n end\n doc.scan(/<meta name=\"([^\"]*)\" con∫tent=\"([^\"]*)\"\\s*\\/>/) do\n p=$1\n v=$2\n p.downcase!\n puts \"#{p}: #{v}\" \n end\n doc.scan(/<div\\s+class=\"arr\">\\s*<a\\s+href=\"([^\"]*)\">\\s*([^<]*)\\s*<\\/a>\\s*<\\/div>/) do\n rt = $2\n rl = $1\n n = normal(file,rl)\n # puts \"# Starting dotfix with #{n}\"\n n = dotfix(n)\n n.chomp!\n nt += \"<#{myurl}> <#{dct}relation> <#{n}> .\\n\"\n rt.chomp!\n rt.gsub!(/\\s*$/,\"\")\n nt += \"<#{n}> <#{dct}title> \\\"#{rt}\\\" .\\n\"\n end\n puts \"\\n\"\n puts nt\nend",
"def graph_class\n RDF::Graph\n end",
"def wheelchair\n query_root_node(\"lgdo:wheelchair/@rdf:resource\", @@NAMESPACES).to_s\n end",
"def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end",
"def get_stadium(uri)\n sparql = \"\n SELECT DISTINCT ?uri ?name ?city_uri ?city ?population ?lat ?long ?capacity ?seatingCapacity ?image_url ?thumbnail_url ?abstract\n WHERE {\n ?uri <#{RDF::RDFS.label}> ?name .\n <#{uri}> <#{RDF::RDFS.label}> ?name .\n <#{uri}> <http://dbpedia.org/ontology/location> ?city_uri .\n ?city_uri <#{RDF::RDFS.label}> ?city .\n ?city_uri <http://dbpedia.org/ontology/populationTotal> ?population .\n <#{uri}> <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat .\n <#{uri}> <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long .\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/capacity> ?capacity }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/seatingCapacity> ?seatingCapacity }.\n OPTIONAL { <#{uri}> <http://xmlns.com/foaf/0.1/depiction> ?image_url }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/thumbnail> ?thumbnail_url }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/abstract> ?abstract }.\n FILTER (str(?uri) = '#{uri}' && lang(?city) = 'en' && lang(?name) = 'en' && ?population > 5000)\n }\n \"\n solutions = DBPEDIA.query(sparql).find_all { |sol| !sol.city_uri.to_s.eql?('http://dbpedia.org/resource/Brazil') }.first\n end",
"def extract_concepts( content , page , location = LOC_CONTENT)\n #$lgr.info(\"Content : #{content} \")\n content.scan( PTN_CONCEPT ).each do |concept_title|\n if /(\\w+):=(.*)/ =~ concept_title[0]\n Property.create!( :page => page , :name => $1 , :value => $2 )\n next\n end\n refs = PTN_CONCEPT_RELATION.match(concept_title[0])\n #$lgr.info refs.to_a.inspect\n data = [] #Concept instance for odd index, ConceptRelation instance for even index\n if refs.size % 2 != 0 then flash[:notice] = \"Illegal concept definition! #{refs[0]}\" end\n \n refs.to_a.each_with_index do |match_str , i|\n #$lgr.info(\" [#{i}]=>[#{match_str}] / \")\n if match_str == nil || match_str.length == 0 then break end\n if i == 0 then next end\n if i % 2 == 1 #Concept\n data[i] = Concept.find_by_title( match_str )\n if data[i] == nil\n data[i] = Concept.create!( :title=>match_str )\n end\n #ConceptOccurrence will be handled by Organizer\n ConceptOccurrence.create!( :page => page , :concept => data[i] , :location => location)\n #Finalize ConceptRelation\n if i > 1\n data[i-1].other_concept = data[i]\n data[i-1].page = page\n data[i-1].save\n #$lgr.info data[i-1].inspect\n end\n elsif i % 2 == 0 #ConceptRelation\n data[i] = ConceptRelation.new\n data[i].concept = data[i-1]\n data[i].kind = match_str\n end\n end # end of block\n end #end of block\n end",
"def identifier\n rdf_resource\n end",
"def get_film_urls(character)\n character_hash = look_up('http://www.swapi.co/api/people/')\n film_urls = character_hash[\"results\"].find do |element|\n element[\"name\"].downcase == character\n end[\"films\"]\nend",
"def get_art_for_page( rb, tagged, page )\n\n # Get the body of the page of art.\n if tagged then\n verbose( \"Getting page #{page} of your #{$params[ :product ]} tagged with \\\"#{tagged}\\\"\" )\n else\n verbose( \"Getting page #{page} of your #{$params[ :product ]}\" )\n end\n art = grab_art_page( rb, tagged, page )\n\n # Get the works from the body.\n works = art.elements.to_a( \"//span[@class='work-info']\" )\n\n # For each work found...\n works.each do |work|\n # ...emit the basic details for it.\n puts extract_work_id( work.elements.to_a( \"span[@class='title']/a\" ).first.attributes[ \"href\" ] ) +\n \"\\t\" +\n work.elements.to_a( \"span[@class='title']/a\" ).first.attributes[ \"title\" ] +\n \"\\t\" +\n work.elements.to_a( \"a/img\" ).first.attributes[ \"src\" ]\n end\n\n verbose( \"Done.\" )\n \nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def scrap_data_from_page link\n p link\n page = @agent.get(link)\n\n # get all categories\n get_items_with_all_category(page)\nend",
"def extract_vocab(graph, ndx)\n vocab_stmt = graph.statements.detect do |s|\n %w(subClassOf subPropertyOf domain range).\n map {|t| RDF::RDFS[t.to_sym]}.\n include?(s.predicate)\n end\n\n if vocab_stmt\n vocab_subject = vocab_stmt.subject\n base = if vocab_subject.fragment\n vocab_subject = vocab_subject.dup\n vocab_subject.fragment = \"\"\n vocab_subject\n else\n vocab_subject.join(\"\")\n end\n RDF::Vocabulary.from_graph(graph, url: base, class_name: \"RDFMT#{ndx}\")\n end\nend",
"def get_all_das_in_page(page)\n\n # Todo: For each element of the page that contains the Development Application, get Development Application Summary.\n\n # For example:\n\n page.search('table.ContentPanel tr[class$=ContentPanel]').each do |da_container|\n\n get_development_application(page, da_container)\n\n end\n\n \n\nend",
"def get_all_das_in_page(page)\n\n # Todo: For each element of the page that contains the Development Application, get Development Application Summary.\n\n # For example:\n\n page.search('table.ContentPanel tr[class$=ContentPanel]').each do |da_container|\n\n get_development_application(page, da_container)\n\n end\n\n \n\nend",
"def fetch\n if self.rdf_subject.to_s.include?('itis.gov')\n fetch_itis\n elsif self.rdf_subject.to_s.include?('ubio.org')\n fetch_ubio\n else\n if self.rdf_subject.to_s.include?('wikidata') then\n self.rdf_subject.to_s.gsub!('http://www.wikidata.org/entity/', 'https://www.wikidata.org/wiki/Special:EntityData/')\n self.rdf_subject.to_s.concat('.nt')\n end\n\n super\n\n if self.rdf_subject.to_s.include?('wikidata') then\n self.rdf_subject.to_s.gsub!('https://www.wikidata.org/wiki/Special:EntityData/', 'http://www.wikidata.org/entity/')\n self.rdf_subject.to_s.gsub!('.nt', '')\n end\n end\n end",
"def upload_eng_mod(sparql)\n sparql.query(\n <<-SPARQL\n SELECT DISTINCT ?concept ?description\n WHERE {\n ?concept dbo:abstract ?description .\n ?concept rdfs:label \"#{en_title}\"@en .\n FILTER ( lang(?description) = \"en\" )\n }\n SPARQL\n )\n end",
"def process_specification_page(response_body, short_dataset_only=true)\n hash = {}\n\n if !response_body.nil?\n doc = Nokogiri.HTML(response_body)\n\n # msrp\n hash['msrp'] = nil\n x = doc.css('#style-price a').first\n hash['msrp'] = x.text.gsub('$', '').gsub(',', '').to_i if !x.nil? && x.text.length > 0\n\n get_specifications_value(doc, hash, 'style', 'Style Name')\n get_specifications_value(doc, hash, 'body_style', 'Body Style')\n get_specifications_value(doc, hash, 'passenger_doors', 'Passenger Doors', integer: true)\n get_specifications_value(doc, hash, 'transmission', 'Transmission')\n\n # DIMENSIONS\n get_specifications_value(doc, hash, 'epa_classification', 'EPA Classification')\n get_specifications_value(doc, hash, 'passenger_capacity', 'Passenger Capacity', integer: true)\n get_specifications_value(doc, hash, 'front_head_room', 'Front Head Room (in)', float: true)\n get_specifications_value(doc, hash, 'front_shoulder_room', 'Front Shoulder Room (in)', float: true)\n get_specifications_value(doc, hash, 'front_hip_room', 'Front Hip Room (in)', float: true)\n get_specifications_value(doc, hash, 'front_leg_room', 'Front Leg Room (in)', float: true)\n get_specifications_value(doc, hash, 'second_head_room', 'Second Head Room (in)', float: true)\n get_specifications_value(doc, hash, 'second_shoulder_room', 'Second Shoulder Room (in)', float: true)\n get_specifications_value(doc, hash, 'second_hip_room', 'Second Hip Room (in)', float: true)\n get_specifications_value(doc, hash, 'second_leg_room', 'Second Leg Room (in)', float: true)\n get_specifications_value(doc, hash, 'third_head_room', 'Third Head Room (in)', float: true)\n get_specifications_value(doc, hash, 'third_shoulder_room', 'Third Shoulder Room (in)', float: true)\n get_specifications_value(doc, hash, 'third_hip_room', 'Third Hip Room (in)', float: true)\n get_specifications_value(doc, hash, 'third_leg_room', 'Third Leg Room (in)', float: true)\n\n get_specifications_value(doc, hash, 'width', 'Width, Max w/o mirrors (in)', float: true)\n get_specifications_value(doc, hash, 'height', 'Height, Overall (in)', float: true)\n get_specifications_value(doc, hash, 'length', 'Length, Overall (in)', float: true)\n get_specifications_value(doc, hash, 'ground_clearance', 'Min Ground Clearance (in)', float: true)\n\n get_specifications_value(doc, hash, 'trunk_volume', 'Trunk Volume (ft³)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_width', 'Cargo Box Width @ Wheelhousings (in)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_height', 'Cargo Box (Area) Height (in)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_length_floor_to_seat2', 'Cargo Area Length @ Floor to Seat 2 (in)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_volume_to_seat1', 'Cargo Volume to Seat 1 (ft³)', float: true)\n get_specifications_value(doc, hash, 'cargo_area_volume_to_seat2', 'Cargo Volume to Seat 2 (ft³)', float: true)\n get_specifications_value(doc, hash, 'cargo_are_volume_to_seat3', 'Cargo Volume to Seat 3 (ft³)', float: true)\n\n\n # FUEL ECONOMY\n get_specifications_value(doc, hash, 'fuel_tank_capacity', 'Fuel Tank Capacity, Approx (gal)', integer: true)\n get_specifications_value(doc, hash, 'mpg_city', 'EPA Fuel Economy Est - City (MPG)', integer: true)\n get_specifications_value(doc, hash, 'mpg_highway', 'EPA Fuel Economy Est - Hwy (MPG)', integer: true)\n get_specifications_value(doc, hash, 'mpg_combined', 'Fuel Economy Est-Combined (MPG)', integer: true)\n get_specifications_value(doc, hash, 'battery_range', 'Battery Range (mi)')\n get_specifications_value(doc, hash, 'mpg_equivalent_city', 'EPA MPG Equivalent - City')\n get_specifications_value(doc, hash, 'mpg_equivalent_hwy', 'EPA MPG Equivalent - Hwy')\n get_specifications_value(doc, hash, 'mpg_equivalent_combined', 'EPA MPG Equivalent - Combined')\n\n\n # PERFORMANCE SPECS\n get_specifications_value(doc, hash, 'engine_type', 'Engine Type')\n get_specifications_value(doc, hash, 'engine_displacement', 'Displacement')\n get_specifications_value(doc, hash, 'horsepower', 'SAE Net Horsepower @ RPM')\n get_specifications_value(doc, hash, 'fuel_system', 'Fuel System')\n\n get_specifications_value(doc, hash, 'brakes_abs', 'Brake ABS System')\n get_specifications_value(doc, hash, 'brakes_disc_front', 'Disc - Front (Yes or )')\n get_specifications_value(doc, hash, 'brakes_disc_rear', 'Disc - Rear (Yes or )')\n get_specifications_value(doc, hash, 'brakes_drum_rear', 'Drum - Rear (Yes or )')\n\n get_specifications_value(doc, hash, 'steering_type', 'Steering Type')\n get_specifications_value(doc, hash, 'turning_diameter', 'Turning Diameter - Curb to Curb (ft)', float: true)\n\n\n # SAFETY FEATURES\n get_specifications_value(doc, hash, 'air_bag_front_driver', 'Air Bag-Frontal-Driver')\n get_specifications_value(doc, hash, 'air_bag_front_passenger', 'Air Bag-Frontal-Passenger')\n get_specifications_value(doc, hash, 'air_bag_front_passenger_switch', 'Air Bag-Passenger Switch (On/Off)')\n get_specifications_value(doc, hash, 'air_bag_side_head_front', 'Air Bag-Side Head-Front')\n get_specifications_value(doc, hash, 'air_bag_side_body_front', 'Air Bag-Side Body-Front')\n get_specifications_value(doc, hash, 'air_bag_side_head_rear', 'Air Bag-Side Head-Rear')\n get_specifications_value(doc, hash, 'air_bag_side_body_rear', 'Air Bag-Side Body-Rear')\n get_specifications_value(doc, hash, 'brakes_abs', 'Brakes-ABS')\n get_specifications_value(doc, hash, 'child_door_locks', 'Child Safety Rear Door Locks')\n get_specifications_value(doc, hash, 'other_features', 'Other Features')\n\n\n\n # if the entire dataset is desired, continue\n if !short_dataset_only\n\n # DIMENSIONS\n get_specifications_value(doc, hash, 'base_curb_weight', 'Base Curb Weight (lbs)', integer: true)\n get_specifications_value(doc, hash, 'passenger_volume', 'Passenger Volume (ft³)', float: true)\n get_specifications_value(doc, hash, '', 'Gross Combined Wt Rating (lbs)')\n get_specifications_value(doc, hash, '', 'Curb Weight - Front (lbs)')\n get_specifications_value(doc, hash, '', 'Curb Weight - Rear (lbs)')\n get_specifications_value(doc, hash, '', 'Gross Axle Wt Rating - Front (lbs)')\n get_specifications_value(doc, hash, '', 'Gross Axle Wt Rating - Rear (lbs)')\n get_specifications_value(doc, hash, '', 'Gross Vehicle Weight Rating Cap (lbs)')\n\n get_specifications_value(doc, hash, 'wheelbase', 'Wheelbase (in)', float: true)\n get_specifications_value(doc, hash, 'track_width_front', 'Track Width, Front (in)', float: true)\n get_specifications_value(doc, hash, 'track_width_rear', 'Track Width, Rear (in)', float: true)\n get_specifications_value(doc, hash, 'liftover_height', 'Liftover Height (in)', float: true)\n get_specifications_value(doc, hash, '', 'Ground Clearance, Front (in)')\n get_specifications_value(doc, hash, '', 'Overhang, Rear w/o bumper (in)')\n get_specifications_value(doc, hash, '', 'Ground to Top of Frame (in)')\n get_specifications_value(doc, hash, '', 'Cab to End of Frame (in)')\n get_specifications_value(doc, hash, '', 'Ground Clearance, Rear (in)')\n get_specifications_value(doc, hash, '', 'Length, Overall w/o rear bumper (in)')\n get_specifications_value(doc, hash, '', 'Front Bumper to Back of Cab (in)')\n get_specifications_value(doc, hash, '', 'Frame Width, Rear (in)')\n get_specifications_value(doc, hash, '', 'Overhang, Front (in)')\n get_specifications_value(doc, hash, '', 'Ground to Top of Load Floor (in)')\n get_specifications_value(doc, hash, '', 'Cab to Axle (in)')\n get_specifications_value(doc, hash, '', 'Rear Door Type')\n get_specifications_value(doc, hash, '', 'Rear Door Opening Height (in)')\n get_specifications_value(doc, hash, '', 'Step Up Height - Side (in)')\n get_specifications_value(doc, hash, '', 'Side Door Opening Width (in)')\n get_specifications_value(doc, hash, '', 'Overhang, Rear w/bumper (in)')\n get_specifications_value(doc, hash, '', 'Rear Door Opening Width (in)')\n get_specifications_value(doc, hash, '', 'Step Up Height - Front (in)')\n get_specifications_value(doc, hash, '', 'Length, Overall w/rear bumper (in)')\n get_specifications_value(doc, hash, '', 'Side Door Opening Height (in)')\n\n\n get_specifications_value(doc, hash, '', 'Cargo Box Length @ Floor (in)')\n get_specifications_value(doc, hash, '', 'Cargo Box Width @ Floor (in)')\n get_specifications_value(doc, hash, '', 'Cargo Box Width @ Top, Rear (in)')\n get_specifications_value(doc, hash, '', 'Cargo Volume (ft³)')\n get_specifications_value(doc, hash, '', 'Ext\\'d Cab Cargo Volume (ft³)')\n get_specifications_value(doc, hash, '', 'Cargo Area Width @ Beltline (in)')\n get_specifications_value(doc, hash, '', 'Cargo Area Length @ Floor to Seat 1 (in)')\n get_specifications_value(doc, hash, '', 'Tailgate Width (in)')\n get_specifications_value(doc, hash, '', 'Cargo Area Length @ Floor to Seat 4 (in)')\n get_specifications_value(doc, hash, '', 'Cargo Area Length @ Floor to Console (in)')\n get_specifications_value(doc, hash, '', 'Cargo Area Length @ Floor to Seat 3 (in)')\n get_specifications_value(doc, hash, '', 'Cargo Volume to Seat 4 (ft³)')\n get_specifications_value(doc, hash, '', 'Cargo Volume with Rear Seat Up (ft³)')\n get_specifications_value(doc, hash, '', 'Cargo Volume with Rear Seat Down (ft³)')\n\n # PERFORMANCE SPECS\n get_specifications_value(doc, hash, 'torque', 'SAE Net Torque @ RPM')\n get_specifications_value(doc, hash, 'engine_order_code', 'Engine Order Code')\n\n get_specifications_value(doc, hash, '', 'Aux Fuel Tank Location')\n get_specifications_value(doc, hash, '', 'Aux Fuel Tank Capacity, Approx (gal)')\n get_specifications_value(doc, hash, '', 'Fuel Tank Location')\n\n get_specifications_value(doc, hash, '', 'Engine Oil Cooler')\n\n get_specifications_value(doc, hash, 'drivetrain', 'Drivetrain')\n get_specifications_value(doc, hash, 'first_gear_ratio', 'First Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Second Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Third Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Fourth Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Fifth Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Sixth Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Seventh Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Eighth Gear Ratio (:1)')\n get_specifications_value(doc, hash, '', 'Clutch Size (in)')\n get_specifications_value(doc, hash, '', 'Transfer Case Gear Ratio (:1), Low')\n get_specifications_value(doc, hash, '', 'Transfer Case Model')\n get_specifications_value(doc, hash, '', 'Trans Power Take Off')\n get_specifications_value(doc, hash, '', 'Transfer Case Power Take Off')\n get_specifications_value(doc, hash, '', 'Transfer Case Gear Ratio (:1), High')\n get_specifications_value(doc, hash, '', 'Trans PTO Access')\n\n get_specifications_value(doc, hash, '', 'Axle Type - Front')\n get_specifications_value(doc, hash, '', 'Axle Capacity - Front (lbs)')\n get_specifications_value(doc, hash, '', 'Axle Ratio (:1) - Front')\n get_specifications_value(doc, hash, '', 'Axle Type - Rear')\n get_specifications_value(doc, hash, '', 'Axle Ratio (:1) - Rear')\n get_specifications_value(doc, hash, '', 'Axle Capacity - Rear (lbs)')\n get_specifications_value(doc, hash, '', 'Spring Capacity - Front (lbs)')\n get_specifications_value(doc, hash, '', 'Shock Absorber Diameter - Front (mm)')\n get_specifications_value(doc, hash, '', 'Stabilizer Bar Diameter - Front (in)')\n get_specifications_value(doc, hash, '', 'Spring Capacity - Rear (lbs)')\n get_specifications_value(doc, hash, '', 'Shock Absorber Diameter - Rear (mm)')\n get_specifications_value(doc, hash, '', 'Stabilizer Bar Diameter - Rear (in)')\n\n get_specifications_value(doc, hash, 'reverse_ratio', 'Reverse Ratio (:1)', float: true)\n get_specifications_value(doc, hash, 'final_drive_axle_ratio', 'Final Drive Axle Ratio (:1)', float: true)\n get_specifications_value(doc, hash, 'trans_type', 'Trans Type')\n get_specifications_value(doc, hash, 'trans_desc_cont', 'Trans Description Cont.')\n get_specifications_value(doc, hash, 'trans_desc_cont2', 'Trans Description Cont. Again')\n get_specifications_value(doc, hash, 'trans_order_code', 'Trans Order Code')\n\n get_specifications_value(doc, hash, 'brakes_front_drum_thickness', 'Front Brake Rotor Diam x Thickness (in)', float: true)\n get_specifications_value(doc, hash, 'brakes_rear_drum_thickness', 'Rear Brake Rotor Diam x Thickness (in)', float: true)\n get_specifications_value(doc, hash, 'brakes_rear_drum_width', 'Rear Drum Diam x Width (in)', float: true)\n get_specifications_value(doc, hash, '', 'Brake Type')\n get_specifications_value(doc, hash, '', 'Brake ABS System (Second Line)')\n\n get_specifications_value(doc, hash, '', 'Steering Ratio (:1), On Center')\n get_specifications_value(doc, hash, '', 'Turning Diameter - Wall to Wall (ft)')\n get_specifications_value(doc, hash, '', 'Steering Ratio (:1), At Lock')\n\n get_specifications_value(doc, hash, '', 'Revolutions/Mile @ 45 mph - Rear')\n get_specifications_value(doc, hash, '', 'Spare Tire Capacity (lbs)')\n get_specifications_value(doc, hash, '', 'Front Tire Capacity (lbs)')\n get_specifications_value(doc, hash, '', 'Revolutions/Mile @ 45 mph - Spare')\n get_specifications_value(doc, hash, '', 'Revolutions/Mile @ 45 mph - Front')\n get_specifications_value(doc, hash, '', 'Rear Tire Capacity (lbs)')\n\n get_specifications_value(doc, hash, 'tire_front_size', 'Front Tire Size')\n get_specifications_value(doc, hash, 'tire_front_code', 'Front Tire Order Code')\n get_specifications_value(doc, hash, 'tire_rear_size', 'Rear Tire Size')\n get_specifications_value(doc, hash, 'tire_rear_code', 'Rear Tire Order Code')\n get_specifications_value(doc, hash, 'tire_spare_size', 'Spare Tire Size')\n get_specifications_value(doc, hash, 'tire_spare_code', 'Spare Tire Order Code')\n\n get_specifications_value(doc, hash, 'wheel_front_size', 'Front Wheel Size (in)')\n get_specifications_value(doc, hash, 'wheel_front_material', 'Front Wheel Material')\n get_specifications_value(doc, hash, 'wheel_rear_size', 'Rear Wheel Size (in)')\n get_specifications_value(doc, hash, 'wheel_rear_material', 'Rear Wheel Material')\n get_specifications_value(doc, hash, 'wheel_spare_size', 'Spare Wheel Size (in)')\n get_specifications_value(doc, hash, 'wheel_spare_material', 'Spare Wheel Material')\n\n get_specifications_value(doc, hash, 'suspension_type_front', 'Suspension Type - Front')\n get_specifications_value(doc, hash, 'suspension_type_front2', 'Suspension Type - Front (Cont.)')\n get_specifications_value(doc, hash, 'suspension_type_rear', 'Suspension Type - Rear')\n get_specifications_value(doc, hash, 'suspension_type_rear2', 'Suspension Type - Rear (Cont.)')\n\n\n # SAFETY FEATURES\n get_specifications_value(doc, hash, 'daytime_lights', 'Daytime Running Lights')\n get_specifications_value(doc, hash, 'fog_lamps', 'Fog Lamps')\n get_specifications_value(doc, hash, 'night_vision', 'Night Vision')\n get_specifications_value(doc, hash, 'backup_camera', 'Back-Up Camera')\n get_specifications_value(doc, hash, 'parking_aid', 'Parking Aid')\n get_specifications_value(doc, hash, 'traction_control', 'Traction Control')\n get_specifications_value(doc, hash, 'tire_pressure_monitor', 'Tire Pressure Monitor')\n get_specifications_value(doc, hash, 'stability_control', 'Stability Control')\n get_specifications_value(doc, hash, 'rollover_protection_bars', 'Rollover Protection Bars')\n\n\n # WARRANTY\n get_specifications_value(doc, hash, 'warranty_years', 'Basic Years', integer: true)\n get_specifications_value(doc, hash, 'warranty_miles', 'Basic Miles/km')\n get_specifications_value(doc, hash, 'warranty_drivetrain_year', 'Drivetrain Years', integer: true)\n get_specifications_value(doc, hash, 'warranty_drivetrain_mils', 'Drivetrain Miles/km')\n get_specifications_value(doc, hash, 'warranty_corrosion_years', 'Corrosion Years', integer: true)\n get_specifications_value(doc, hash, 'warranty_corrosion_miles', 'Corrosion Miles/km')\n get_specifications_value(doc, hash, 'warranty_roadside_years', 'Roadside Assistance Years', integer: true)\n get_specifications_value(doc, hash, 'warranty_roadside_miles', 'Roadside Assistance Miles/km')\n get_specifications_value(doc, hash, '', 'Hybrid/Electric Components Miles/km')\n get_specifications_value(doc, hash, '', 'Hybrid/Electric Components Years')\n get_specifications_value(doc, hash, '', 'Maintenance Miles/km')\n get_specifications_value(doc, hash, '', 'Maintenance Years')\n get_specifications_value(doc, hash, '', 'Drivetrain Note')\n get_specifications_value(doc, hash, '', 'Maintenance Note')\n get_specifications_value(doc, hash, '', 'Roadside Assistance Note')\n get_specifications_value(doc, hash, '', 'Emissions Miles/km')\n get_specifications_value(doc, hash, '', 'Emissions Years')\n\n\n\n # OTHER SPECS\n get_specifications_value(doc, hash, 'cold_cranking_amps', 'Cold Cranking Amps @ 0° F (Primary)', integer: true)\n get_specifications_value(doc, hash, '', 'Total Cooling System Capacity (qts)')\n get_specifications_value(doc, hash, '', 'Maximum Alternator Watts')\n get_specifications_value(doc, hash, '', 'Cold Cranking Amps @ 0° F (2nd)')\n get_specifications_value(doc, hash, 'max_alternator_capacity', 'Maximum Alternator Capacity (amps)', integer: true)\n get_specifications_value(doc, hash, 'max_trailering_capacity', 'Maximum Trailering Capacity (lbs)', integer: true)\n get_specifications_value(doc, hash, 'max_trailer_weight_distributing_hitch', 'Wt Distributing Hitch - Max Trailer Wt. (lbs)', integer: true)\n get_specifications_value(doc, hash, 'max_tongue_weight_distributing_hitch', 'Wt Distributing Hitch - Max Tongue Wt. (lbs)', integer: true)\n get_specifications_value(doc, hash, 'max_trailer_weight_dead_weight_hitch', 'Dead Weight Hitch - Max Trailer Wt. (lbs)', integer: true)\n get_specifications_value(doc, hash, 'max_tongue_weight_dead_weight_hitch', 'Dead Weight Hitch - Max Tongue Wt. (lbs)', integer: true)\n get_specifications_value(doc, hash, '', 'Fifth Wheel Hitch - Max Tongue Wt. (lbs)')\n get_specifications_value(doc, hash, '', 'Fifth Wheel Hitch - Max Trailer Wt. (lbs)')\n get_specifications_value(doc, hash, '', 'Wt Distributing Hitch - Max Trailer Wt. (lbs)')\n\n end\n\n end\n\n return hash\nend",
"def get_player(uri)\n sparql = \"SELECT DISTINCT ?uri ?name ?surname ?givenName ?fullname ?position ?birth_date ?current_club_uri ?current_club ?image_url ?thumbnail_url ?abstract ?team ?team_uri ?caps ?goals\n WHERE {\n ?uri <http://dbpedia.org/property/name> ?name .\n <#{uri}> <http://dbpedia.org/property/name> ?name .\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/surname> ?surname }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/givenName> ?givenName }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/fullname> ?fullname }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/nationalcaps> ?caps }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/nationalgoals> ?goals }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/nationalteam> ?team_uri .\n ?team_uri <#{RDF::RDFS.label}> ?team .\n ?team_uri <http://dbpedia.org/property/fifaRank> ?fifa_rank .\n FILTER(LANG(?team) = 'de')\n }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/position> ?position }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/birthDate> ?birth_date }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/currentclub> ?current_club_uri .\n ?current_club_uri <#{RDF::RDFS.label}> ?current_club\n FILTER ( LANG(?current_club) = 'de')\n }.\n OPTIONAL { <#{uri}> <http://xmlns.com/foaf/0.1/depiction> ?image_url }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/thumbnail> ?thumbnail_url }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/abstract> ?abstract .\n FILTER(LANG(?abstract) = 'de') .\n }.\n }\n ORDER BY DESC(?caps) DESC(?goals)\"\n solution = DBPEDIA.query(sparql).first\n end",
"def resourceType\n 'MedicinalProductContraindication'\n end",
"def programmes\n Programme.where(id: programme_id)\n end",
"def programmes\n Programme.where(id: programme_id)\n end",
"def steam_query\n sparql = <<-SPARQL\n SELECT ?item ?steamAppId WHERE {\n ?item wdt:P31 wd:Q7889; # Instances of video games\n wdt:P1733 ?steamAppId. # Items with a Steam App ID.\n }\n SPARQL\n\n return sparql\n end",
"def index\n # @offerings = Offering.all\n if params[:query].present?\n # sql_query = \" \\\n # offerings.name @@ :query \\\n # OR offerings.genre @@ :query \\\n # \"\n # @offerings = Offering.where(sql_query, query: \"%#{params[:query]}%\")\n @offerings = policy_scope(Offering.search_by_genre_and_name(\"%#{params[:query]}%\"))\n else\n @offerings = policy_scope(Offering)\n @offering = Offering.all\n end\n end",
"def program(id)\n get(\"/catalog/titles/programs/#{id.to_s}\")\n end",
"def filter(referent)\n issn = get_identifier(:urn, \"issn\", referent)\n\n return unless issn\n \n # normalize removing hyphen\n issn.gsub!('-', '')\n \n if ( @@da_issns.find { |i| i == issn } )\n # || lc($jtitle) =~ /dissertation/i || lc($jtitle2) =~ /dissertation/i)\n\n referent.enhance_referent(\"genre\", \"dissertation\")\n \n metadata = referent.metadata\n # Reset it's title to the dissertation title\n title = metadata['atitle'] || metadata['title']\n referent.enhance_referent(\"btitle\", title)\n referent.enhance_referent(\"title\", title, true, false, :overwrite => true)\n # Now erase titles that do not apply \n referent.remove_value(\"atitle\")\n referent.remove_value(\"jtitle\")\n referent.remove_value(\"stitle\")\n # issn or isbn are wrong, probably point to Dissertation Abstracts\n referent.remove_value(\"issn\")\n referent.remove_value(\"isbn\")\n # Same with all article level metadata\n referent.remove_value(\"volume\")\n referent.remove_value(\"issue\")\n referent.remove_value(\"issue_start\")\n referent.remove_value(\"spage\")\n referent.remove_value(\"epage\")\n end\n\n end",
"def index\n @foafs = Foaf.all\n # if all else fails, make RDF then\n # rapper -o dot -i turtle me.ttl | dot -Tsvg -o me.svg\n respond_to do |format|\n format.html do \n response.headers['Link'] = make_link_header(:html)\n end\n format.ttl do \n response.headers['Link'] = make_link_header(:ttl)\n render text: convert_many_to_rdf(@foafs, :ttl) \n end\n format.rj do \n response.headers['Link'] = make_link_header(:rj)\n render text: convert_many_to_rdf(@foafs, :json) \n end\n format.nt do \n response.headers['Link'] = make_link_header(:nt)\n render text: convert_many_to_rdf(@foafs, :ntriples) \n end\n format.rdf do \n response.headers['Link'] = make_link_header(:rdf)\n render text: convert_many_to_rdf(@foafs, :rdf) \n end\n format.jsonld do \n response.headers['Link'] = make_link_header(:jsonld)\n render text: convert_many_to_rdf(@foafs, :jsonld) \n end\n end\n end",
"def biography artist\n url = \"http://developer.echonest.com/api/v4/artist/biographies?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\nend",
"def find_rdfa_by_id rdf_start_class , id\n #map each var on its classname\n id = id.to_s\n rdfa_string = \"<div about=\\\"#{rdf_start_class+\"/\"<<id}\\\" typeof=\\\"#{@class_map[rdf_start_class.to_sym]}\\\">\\n\"\n #get configuration start ->classes\n m = find_models(rdf_start_class,true)\n if m\n m.values[0].each do |mod,attributes|\n unless mod.to_s.eql?(\"sql_query\")\n t_mod = Model.new(mod, rdf_start_class)\n #if sql...\n item=t_mod.get_row_by_id(id).first\n t_mod.model_attributes.each do |name,link_field|\n #property\n #link to other ress\n if name.to_s.include? \"->\"\n m_class,role_mod = name.to_s.split \"->\"\n\n if role_mod.eql?(\"sql_query\")\n hello=\"\"\n else\n if link_field.include?(\"*\")\n field_class,field= link_field.to_s.split(\"*\")\n if field_class.to_s[0..5]==\"MODEL(\"\n field_class.gsub!(\"MODEL(\",\"Model.new(\")\n submodel= eval(field_class.to_s).get_rows\n rdfa_string<<\"<div rel=\\\"#{m_class}\\\">\\n\"\n submodel.each do |line|\n rdfa_string<<find_rdfa_by_id(role_mod , eval(\"line.#{field.to_s}\"))\n end\n rdfa_string<<\"</div>\\n\"\n else\n subitem = eval(\"item.#{field_class}\")\n rdfa_string<<\"<div rel=\\\"#{m_class}\\\">\\n\"\n subitem.each do |subline|\n rdfa_string<< find_rdfa_by_id(role_mod , eval(\"subline.#{field.to_s}\"))\n end\n rdfa_string<<\"</div>\\n\"\n end\n else\n rdfa_string<<\"<div rel=\\\"#{m_class}\\\">\\n\"\n rdfa_string << find_rdfa_by_id(role_mod , eval(\"item.#{link_field.to_s}\"))\n rdfa_string<<\"</div>\\n\"\n end\n end\n else\n write=true\n #just a property\n #CONST(\n #Model(\n if link_field.to_s[0..5] ==\"CONST(\"\n write=false\n val,data_type= t_mod.get_const(link_field)\n if data_type==\"LINK\"\n #link\n rdfa_string<<\"<div rel= \\\"#{name}\\\" resource=\\\"#{val}\\\"> </div>\\n\"\n else\n #value\n rdfa_string<<\"<div property= \\\"#{name}\\\" content=\\\"#{val}\\\" datatype=\\\"#{data_type}\\\"> </div>\\n\"\n end\n else\n m_class,field= link_field.to_s.split(\"*\")\n if name.to_s[0..5]==\"MODEL(\"\n m_class.gsub!(\"MODEL(\",\"Model.new(\")\n submodel= eval(m_class.to_s).get_rows\n submodel.each do |line|\n datatype=\"string\"\n rdfa_string<<\"<div property= \\\"#{ref_pred}\\\" content=\\\"#{eval(\"line.#{field.to_s.downcase}\")}\\\" datatype=\\\"#{data_type}\\\"> </div>\\n\"\n end\n end\n if field\n write = false\n #rdfa_string<<find_rdfa_by_id(\"\",\"\")\n end\n end\n rdfa_string<<\"<div property= \\\"#{name}\\\" content=\\\"#{eval(\"item.#{link_field}\")}\\\"></div>\\n\" if write\n end\n end\n end\n end\n end\n rdfa_string << \"</div>\\n\"\n end"
] | [
"0.60540897",
"0.58985424",
"0.5818628",
"0.5775839",
"0.56452876",
"0.56423736",
"0.56393725",
"0.5596244",
"0.5564488",
"0.5506046",
"0.5482427",
"0.546571",
"0.54532784",
"0.5434789",
"0.5406931",
"0.54031247",
"0.53856945",
"0.53853494",
"0.5355324",
"0.5338014",
"0.5336211",
"0.53266245",
"0.53232914",
"0.531784",
"0.5308961",
"0.53086716",
"0.52701724",
"0.52534837",
"0.52512246",
"0.52441496",
"0.5241435",
"0.5239473",
"0.5239473",
"0.5235806",
"0.5234876",
"0.52191114",
"0.52157694",
"0.5214404",
"0.5211304",
"0.52085644",
"0.52083826",
"0.5190999",
"0.5188636",
"0.5169583",
"0.5167027",
"0.5152187",
"0.51504683",
"0.51392084",
"0.5126074",
"0.51147556",
"0.51107424",
"0.5096842",
"0.50940835",
"0.509388",
"0.5084686",
"0.50715065",
"0.5061724",
"0.5049222",
"0.504546",
"0.5031074",
"0.50257885",
"0.50245655",
"0.50233513",
"0.5023042",
"0.50228375",
"0.50213975",
"0.5014719",
"0.50078326",
"0.5003976",
"0.49984193",
"0.49976832",
"0.49960443",
"0.49955496",
"0.49945784",
"0.49871406",
"0.49864504",
"0.4986217",
"0.49807778",
"0.49764687",
"0.49761778",
"0.49761778",
"0.49761778",
"0.49761778",
"0.49725327",
"0.49683893",
"0.49683893",
"0.4962608",
"0.49571568",
"0.49515203",
"0.49498555",
"0.49493948",
"0.49489865",
"0.49489865",
"0.4948815",
"0.49471375",
"0.49453092",
"0.49447393",
"0.4930242",
"0.49255848",
"0.49202836"
] | 0.58116037 | 3 |
Get url (assumed to be json) and returns the parsed json | def get_json_url(url)
useragent = "NotubeMiniCrawler/0.1"
u = URI.parse url
req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})
begin
res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }
end
j = nil
begin
j = JSON.parse(res.body)
rescue OpenURI::HTTPError=>e
case e.to_s
when /^404/
raise 'Not Found'
when /^304/
raise 'No Info'
end
end
return j
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"def json_get(url)\n get url, :parse=>true\n end",
"def get_json(url)\n JSON.parse(get(url, :json, :json))\n end",
"def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend",
"def readJSONFromUrl(url)\n # use GET request to retrieve the json\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json = JSON.parse(response)\n return json\nend",
"def get_json(url)\n r = RestClient.get url, request_options\n JSON.parse(r)\n end",
"def parse_json( url )\n result = @http.get( url )\n\n begin\n json = JSON.parse( result.body )\n rescue JSON::ParserError => e\n ap \"JSON::ParserError: #{e}\"\n end\n\n return json\nend",
"def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end",
"def get_json(url, options = {})\n\t\t\tresponse = get_file(url, options)\n\t\t\traw_json = response.scan(/\\w+\\((.+)\\);\\z/)[0][0]\n\t\t\treturn JSON.parse(raw_json)\n\t\tend",
"def json(url)\n r = response(url).body\n JSON.parse(r)\n end",
"def json(url)\n Rails.logger.info \"Retrieving json for url: #{url}\"\n r = response(url).body\n JSON.parse(r)\n end",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def parse_fetched_json(json_from_url)\n JSON.parse(json_from_url)\n end",
"def parsed_json\n @parsed_json ||= JSON.parse(open(url).read)\n end",
"def rest_get(url)\n JSON.parse(RestClient.get(url))\n end",
"def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend",
"def get_json(url)\n r = Mei::WebServiceBase.fetch(url)\n JSON.parse(r.body)\n end",
"def return_result(url)\n json_file = open(url) { |f| f.read }\n JSON.parse(json_file)\n end",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend",
"def get_json(url)\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tdata_hash = JSON.parse(response)\n\t#puts data_hash\n\treturn data_hash\nend",
"def get\n JSON.parse(self.class.get(url).response.body)\n end",
"def get_json(url, args = {})\n response = adapter.get(url, args) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['Accept'] = 'application/json'\n end\n body = response.body\n JSON.parse(body)\n end",
"def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end",
"def get_json(url, options = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n conn = Faraday.new(url: url) do |faraday|\n faraday.request :url_encoded\n faraday.use FaradayMiddleware::FollowRedirects\n if defined?(Rails) # && Rails.env.development?\n faraday.response :logger, Rails.logger\n else\n faraday.response :logger\n end\n\n faraday.adapter :net_http\n end\n\n begin\n r = conn.get do |req|\n req.headers['Accept'] = 'application/json'\n req.params.merge! options\n end\n\n raise \"Failed to read from #{url}: #{r.status.inspect}\" unless (200..207).cover?(r.status)\n JSON.parse(r.body)\n end\n end",
"def open_jsonurl(url)\n data = self.openurl(url)\n if data != '' and data != nil\n json = JSON.parse(data)\n if json.has_key? 'error_messages'\n raise Puppet::Error, 'Error retrieving url data: ' + json['error_messages'].to_s()\n end\n return json\n else\n return nil\n end\n end",
"def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"def request_json(url)\n JSON.parse(@access_token.get(\"#{SITE}#{url}\").body)\n end",
"def load_json(url)\n uri = URI(url)\n response = Net::HTTP.get(uri)\n return JSON.parse(response, symbolize_names: true)\n end",
"def open_as_json(json_url)\n uri = URI.parse(json_url)\n response = Net::HTTP.get_response(uri)\n return {} unless response.code == \"200\"\n JSON.parse(response.body)\n end",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def swapi_fetch(url)\n JSON.parse(open(url).read)\nend",
"def url\n data['url']\n end",
"def url\n response[\"url\"]\n end",
"def get_json(url:, query:)\n response = HTTParty.get(url, query: query, format: :json, timeout: 5)\n response.parsed_response\n rescue HTTParty::Error, Timeout::Error => e\n raise NetError, e.message\n rescue JSON::ParserError, TypeError\n raise ParseError, e.message\n end",
"def get url, params={}, headers={}\n uri = URI.parse(url)\n path = uri.path + \"?\" + query_string(default_params.merge(params))\n response = http(uri.host, uri.port).get(path, default_headers.merge(headers))\n JSON.parse(response.body)\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def getData(url)\n data = RestClient.get url \n result = JSON.parse data.to_str\n return result\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def url_hash(url)\n response_string = RestClient.get(url)\n JSON.parse(response_string)\nend",
"def get_json(address)\n data = download_json(address)\n return nil if data.nil?\n return parse_json(data)\nend",
"def json\n raise StandardError, 'No JSON library initialized' unless URL.json_handler\n @json ||= URL.json_handler.new(self).parse\n end",
"def load_from_url!(url)\n uri = URI(url)\n req = Net::HTTP::Get.new(uri)\n req['Accept'] = 'application/json'\n\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n\n # TODO: handle redirects\n raise IOError, \"Unable to load URL #{url}\" unless res.is_a?(Net::HTTPOK)\n\n load_from_json!(res.body)\n end",
"def get(url)\n faraday = Faraday.new(url) do |faraday|\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n\n response = faraday.get do |request|\n request.url(url)\n end\n response.body\nend",
"def parse\n JSON.parse(open(github_url).read)\n end",
"def call_poke_url(url)\n JSON.parse(\n HTTP\n .get(URI(url))\n )\nend",
"def get(url)\n result = JSON.parse self.class.get(url, @request_options).body\n status = result['status']\n fail StandardError, \"Returned status: #{status}\" unless status == 'OK'\n result['response']\n end",
"def get_json_hash(url)\n JSON.parse(@access_token.get(url).body)\nend",
"def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"def data\n construct_url\n JSON.parse(response)\n end",
"def get(url); end",
"def run_and_get_json_result(url)\n r = @w.get_request url\n result = r.result\n result_as_json = JSON.parse result\n puts \"url: #{url} result: \"+result_as_json.inspect unless TRACE == FalseClass\n result_as_json\n end",
"def handle_links(json) end",
"def request_data(request_url)\n\n uri = URI.parse(request_url)\n response = Net::HTTP.get_response(uri)\n data = JSON.parse(response.body)\n return data\n\nend",
"def get_json(path)\n url = [base_url, path].join\n resp = HTTParty.get(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def get(url, options = {})\n options[\"apikey\"] = @api_key\n uri = generate_uri(url, @default_options.merge(options))\n\n response = Net::HTTP.get_response(uri)\n json? ? JSON.parse(response.body) : response.body\n end",
"def get_json(url, expand_path: true, &block)\n url = tenancy_url(url) if expand_path\n url = \"#{url}.json\" unless url.end_with?('.json')\n call(url, auth: false, expand_path: false, &block)\n end",
"def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end",
"def initialize url\n open(url) {|f| @json = f.read}\n @root = JSON.parse @json\n end",
"def parse_url(url)\n response_str = RestClient.get(url)\n characters_arr = JSON.parse(response_str)\nend",
"def request_api(url)\n begin\n response = RestClient.get(url)\n print(\"response: \", response)\n JSON.parse(response)\n rescue\n return nil\n end\n \n \n end",
"def http_get(url)\n require \"open-uri\"\n URI.parse(url).read\n end",
"def get_json(url)\n JSON.parse(Net::HTTP.get(URI(url)))\nrescue StandardError => e\n puts \"Could not fetch notes from the GitHub API (#{e})\"\nend",
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def get_url(url)\n myurl = URI.parse(url)\n req = Net::HTTP::Get.new(url)\n res = Net::HTTP.start(myurl.host, myurl.port) { |http|\n http.request(req)\n }\n \n res.body # return\n end",
"def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end",
"def parse_json(url, resp)\n case resp.code\n when 200\n JSON.parse(resp.body, symbolize_names: true)\n when 404\n {}\n else\n raise ServiceUnavailable.new(\"#{url} failed with #{resp.code}\")\n end\n end",
"def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end",
"def jsonUrl=(url)\n @jsonUrl = url\n end",
"def data_retrieve(url_string)\n url = url_string # open url\n\n begin\n data_read =open(url).read # read the url\n rescue SocketError => e\n return {}\n end\n\n @data_result = JSON.parse(data_read) # parse JSON received from the api\n\n return @data_result #return parsed JSON data to an instance variable\n\n end",
"def get_json(uri)\n start = Time.now\n attempt = 0\n begin\n res = @http.get(\n uri,\n 'Accept' => 'text/plain',\n 'User-Agent' => user_agent,\n 'Accept-Encoding' => ''\n )\n raise Error, \"Failed to retrieve #{uri} (#{res.code}): #{res.body}\" unless res.code == '200'\n info(\"GET #{uri}: #{res.code}/#{res.body.length}b in #{age(start)}\")\n JSON.parse(res.body)\n rescue StandardError => e\n attempt += 1\n raise e if attempt >= @attempts\n retry\n end\n end",
"def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend",
"def run_json_http_request\n uri = URI.parse @json_url\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n # set up request\n request = Net::HTTP::Get.new uri.request_uri\n \n # get response, convert to hash\n response = http.request request\n response_hash = JSON.parse response.body\n end",
"def http_get(url)\n Net::HTTP.get_response(URI.parse(url)).body.to_s\n end",
"def get_url(url)\n url = URI.parse(URI.escape(url))\n res = Net::HTTP.get_response(url)\n return res\nend",
"def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend",
"def get(url)\n r = {}\n resp = open(url)\n r[:meta] = resp\n r[:body] = resp.read\n return r\nend",
"def get_url(url, params)\n response = @conn.get(url, params)\n JSON.parse(response.body, symbolize_names: true)[:body][:players]\n end",
"def get\n\tresponse = RestClient.get(country_url)\n\t@parsed_response = JSON.parse(response)\nend",
"def get_url\n @url\n end",
"def parse_api(link)\n movie_data ={}\n movie_url_link = RestClient.get(link)\n movie_data = JSON.parse(movie_url_link)\n # binding.pry\nend",
"def getUrl(url)\n puts url if @options[\"show-url\"]\n RestClient.get(url)\n end",
"def get(url)\n call(url: url)\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def get_json_parsed_response_body(url)\n begin\n response = Net::HTTP.get(URI(url))\n JSON.parse(response)\n rescue Errno::ETIMEDOUT\n raise \"Cannot connect to set top box\"\n rescue Errno::EHOSTUNREACH\n raise \"Unreachable host likely caused by no internet connect\"\n end\n end",
"def get_url\n Nokogiri::HTML(open(@url))\n end",
"def get(url)\n self.class.get(url)\n end",
"def get(url)\n\n data = nil\n resp = HTTParty.get(url)\n\n if resp.code == 200\n return resp.body\n end\n end",
"def fetch_data(api_url)\n JSON.parse(RestClient.get(api_url))\nend",
"def get_response url, format\r\n begin\r\n response = Net::HTTP.get_response(URI.parse(url))\r\n if format.to_sym == :json\r\n res = JSON.parse response.body\r\n else\r\n res = response.body\r\n end\r\n rescue Exception => e\r\n res = \"ERROR: There is a problem while fetching data, please check whether OpenTSDB is running or not.\"\r\n end\r\n res\r\n end",
"def geturl() \n\t\treturn self.response.geturl()\n end",
"def get(url, representer)\n response = begin\n RestClient.get(url).body\n rescue RestClient::Exception => e\n raise RequestError, e.message\n end\n\n representer.from_json(response)\n end",
"def get(path, redirect_limit=5)\n parse_json do |parser|\n @http_client.get(path, redirect_limit) {|chunk| parser << chunk }\n end\n end",
"def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end",
"def get(url)\n uri = URI(url)\n Net::HTTP.get(uri)\nend",
"def raw\n begin\n @raw ||= request_json(url)\n rescue OpenURI::HTTPError => e\n Rails.logger.error \"#{e.message}: #{url}\"\n raise\n end\n end",
"def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend",
"def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend"
] | [
"0.8395543",
"0.814876",
"0.80368215",
"0.7899679",
"0.7781885",
"0.7708647",
"0.76706815",
"0.76151866",
"0.7569689",
"0.7558275",
"0.7536204",
"0.751677",
"0.7497337",
"0.7491255",
"0.7409972",
"0.7403708",
"0.7396908",
"0.73769325",
"0.7362471",
"0.7347227",
"0.7314235",
"0.7295632",
"0.7281471",
"0.7269434",
"0.72631377",
"0.7252799",
"0.72490466",
"0.7242596",
"0.7202414",
"0.7176892",
"0.717464",
"0.7172978",
"0.7158854",
"0.715284",
"0.70735514",
"0.70694005",
"0.703957",
"0.70327556",
"0.70327556",
"0.70155793",
"0.6938509",
"0.68928343",
"0.68886846",
"0.68716717",
"0.6867433",
"0.6812922",
"0.6812547",
"0.68121797",
"0.67993283",
"0.6760964",
"0.67465913",
"0.67380583",
"0.67143375",
"0.67052984",
"0.66922665",
"0.6681227",
"0.6642202",
"0.66297126",
"0.66207623",
"0.6618063",
"0.66022146",
"0.6601423",
"0.6600479",
"0.65978795",
"0.65969855",
"0.657714",
"0.6574404",
"0.65673494",
"0.648094",
"0.6477484",
"0.64742607",
"0.6458027",
"0.645541",
"0.6447721",
"0.6447094",
"0.64417666",
"0.64256155",
"0.64144254",
"0.64068747",
"0.64002216",
"0.6397807",
"0.6395783",
"0.63930357",
"0.63916075",
"0.6391491",
"0.6386729",
"0.63778615",
"0.63564366",
"0.6337387",
"0.6325608",
"0.6307873",
"0.6301017",
"0.62969774",
"0.6284189",
"0.6273903",
"0.6264522",
"0.6259205",
"0.62438977",
"0.62436914",
"0.62436914"
] | 0.78328633 | 4 |
GET /search_terms/1 GET /search_terms/1.xml | def show
@search_term = SearchTerm.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @search_term }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_terms(params)\n send_get \"get_terms\", params\n end",
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def terms id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/terms?date=#{date}&page=#{page}}\"\n fetch uri\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def do_search(term = nil)\n @terms = term unless term.nil? #replace saved term with argument, if passed\n @attempts += 1\n @doc = Nokogiri::XML(open(build_call(@terms)))\n parse\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def show\n @term = Term.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def show\n @term = Term.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @search_term = SearchTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_term }\n end\n end",
"def terms\n\n end",
"def terms\n\n end",
"def new\n @seo_search_term = Seo::SearchTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seo_search_term }\n end\n end",
"def perform\n raise ArgumentError, \"Need phrase to perform search\" unless @phrase\n uri = Addressable::URI.parse(FT.conf[:url])\n uri.query_values = {\n key: FT.conf[:key],\n phrase: @phrase,\n extension: ( @ext ? @ext : nil ),\n page: ( @page ? @page : nil )\n }\n\n http = Curl.get(uri.to_s)\n \n Crack::XML.parse(http.body_str)\n end",
"def index\n @recipes = Recipe.search(params[:search], params[:page],10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipes }\n end\n end",
"def index\n @ingrediences = Ingredience.search(params[:search], params[:page],10) \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingrediences }\n end\n end",
"def terms\n end",
"def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend",
"def index\n @searchterms = Searchterm.all\n end",
"def fetch_thesauri\n doc = create_doc('gaz-thesauri/administrativeThesaurus.xml')\n ## loop through each <term> element in the thesaurus\n vocabs=[]\n (doc/\"thesaurus/root/term\").each do |term|\n STDOUT << puts \n STDOUT << term.inspect\n STDOUT << puts \n\n end\n vocabs\n end",
"def search\n send_request\n parse_response\n end",
"def index\n @search_topics = SearchTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @search_topics }\n end\n end",
"def index\n @keywords = Keyword.order('title')\n \n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @keywords.to_xml }\n end\n end",
"def index\n @shipping_terms = ShippingTerm.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shipping_terms }\n end\n end",
"def terms\n\tend",
"def terms(attributes = nil)\r\n field = attributes.keys.first\r\n query = { field => attributes.values.flatten }\r\n\r\n body = { query: { terms: query } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end",
"def search_url(term='')\n param = URI.encode_www_form('term' => term)\n \"http://api.urbandictionary.com/v0/define?#{param}\"\n end",
"def search(terms)\n agent = Mechanize.new\n agent.get 'http://kattorrents.me/'\n search_form = agent.page.form_with(id:'searchform')\n search_form.q = terms\n search_form.submit\n parse_html(agent.page)\n end",
"def index\n @diaries = Diary.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @diaries }\n\n @search = Diary.search do\n fulltext params[:search]\n end\n @diaries = @search.results\n end\nend",
"def terms_get(opts = {})\n data, _status_code, _headers = terms_get_with_http_info(opts)\n data\n end",
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def search_terms=(value)\n @search_terms = value\n end",
"def do_search(results, term, options)\n wait\n \n esearch_url = expand_uri(@uri_template, options.merge({:term => term}))\n doc = Nokogiri::XML( open esearch_url )\n\n results.count = doc.xpath('/eSearchResult/Count').first.content.to_i\n \n doc.xpath('/eSearchResult/IdList/Id').each {|n| results.pmids << n.content.to_i}\n \n doc.xpath('/eSearchResult/TranslationStack/TermSet/Term').each do |n|\n if n.content =~ /\"(.*)\"\\[MeSH Terms\\]/\n results.exploded_mesh_terms << $1\n end\n end\n \n doc.xpath('/eSearchResult/ErrorList/PhraseNotFound').each {|n| results.phrases_not_found << n.content }\n\n results\n end",
"def show\n @search_phrase = SearchPhrase.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @search_phrase }\n end\n end",
"def search\n @c14s = C14.search(params[:q])\n\n respond_to do |format|\n format.html { \n @pagy, @c14s = pagy(@c14s)\n render :index\n }\n format.json {\n render :index\n }\n end\n end",
"def index_info(params={})\n params[:numTerms]||=0\n send_request @opts[:luke_path], params\n end",
"def get(**args)\n solr_service.get(build, **args)\n end",
"def opensearch\n respond_to do |format|\n format.xml { render layout: false }\n format.json { render json: search_service.opensearch_response }\n end\n end",
"def show\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term_count }\n end\n end",
"def index\n @admin_terms = Admin::Term.search(params[:query]).order('lower(title) ASC').page(params[:page]).per(32)\n #@admin_terms = Admin::Term.all\n end",
"def index\n @nodes = Node.all\n @title = \"List of taxonomy nodes - Browse organisms\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @documentocategorias = Documentocategoria.nombre_like(params[:search]).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentocategorias }\n end\n end",
"def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end",
"def index\n @search = Tso::Search.new(params[:search])\n @tsos = Tso.paginate(@search.find_options.merge(:page => params[:page]))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tsos.to_xml(:except => [ :created_at, :updated_at ]) }\n end\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 @terms_of_services = TermsOfService.all\n end",
"def search\n books, editionparams, descriptionparams = searchbooks(params)\n @hitcount = books.size\n filterbooks(books, editionparams, descriptionparams)\n @books = books\n respond_to do |format|\n format.html # search.html.erb\n format.xml\n format.atom\n #format.xml { render :xml => @books }\n end\n end",
"def search_param_terms\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tp['terms']\n\t\tend",
"def url_search_terms\n if openbis?\n []\n else\n super\n end\n end",
"def index\n @search = Arc::Search.new(params[:search])\n @arcs = Arc.paginate(@search.find_options.merge(:page => params[:page], :order => 'location, code'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @arcs.to_xml(:except => [ :created_at, :updated_at ]) }\n end\n end",
"def make_request(search_term)\n JSON.parse(RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"))\nend",
"def search\n @query = params[:q]\n @editions = Book.search(@query)\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @editions }\n end\n end",
"def search(terms)\n agent = Mechanize.new\n agent.get 'https://eztv.ch'\n search_form = agent.page.form('search')\n search_form.SearchString1 = terms\n search_form.submit\n parse_html(agent.page)\n end",
"def show\n# @term = Term.find(params[:id])\n @term = Term.where(:name=>params[:name]).first\n\t\tif @term.nil?\n @term = Term.new\n redirect_to( @term, :notice => \"Term '#{params[:name]}' not exists yet\" )\n return\n\t\tend\n\n @entries = @term.entries\n logger.debug \"entries #{@entries}\"\n @entries.each do |entry|\n logger.debug \"entry.id #{entry.id}\"\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def index\n @search = Sunspot.search Generator do\n fulltext params[:query_generator]\n end\n @generators = @search.results\n respond_to do |format|\n format.html\n format.json {render :json => @generators.map(&:attributes) }\n end\nend",
"def index\n @terms = Term.all\n end",
"def extract_indexterms(terms)\n terms.each_with_object({}) do |t, v|\n term = t&.at(ns(\"./primary\"))&.children&.to_xml\n term2 = t&.at(ns(\"./secondary\"))&.children&.to_xml\n term3 = t&.at(ns(\"./tertiary\"))&.children&.to_xml\n index2bookmark(t)\n v[term] ||= {}\n v[term][term2] ||= {}\n v[term][term2][term3] ||= {}\n v[term][term2][term3][:xref] ||= []\n to = t[\"to\"] ? \"to='#{t['to']}' \" : \"\"\n v[term][term2][term3][:xref] << \"<xref target='#{t['id']}' #{to}pagenumber='true'/>\"\n end\n end",
"def show\n @permitted_params = params.permit(Search::RESULTS_PARAMS +\n Search::SIMPLE_SEARCH_PARAMS)\n @start = [@permitted_params[:start].to_i.abs, MAX_START].min\n @window = window_size\n q = \"%#{@permitted_params[:q]&.downcase}%\"\n @terms = @vocabulary.vocabulary_terms.\n where(\"LOWER(displayed_value) LIKE ? OR LOWER(stored_value) LIKE ?\", q, q).\n order(:displayed_value)\n @count = @terms.count\n @terms = @terms.limit(@window).offset(@start)\n @current_page = ((@start / @window.to_f).ceil + 1 if @window > 0) || 1\n\n if request.xhr?\n render partial: \"terms\"\n else\n render \"show\"\n end\n end",
"def index\n @search = Tag::Search.new(params[:search])\n @tags = Tag.paginate(@search.find_options.merge(:page => params[:page], :include => :arc_tags))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tags }\n end\n end",
"def index\n options = {\n :order => 'name ASC'\n }\n if params[:term]\n options[:conditions] = [\n \"name LIKE :term\",\n {:term => \"%#{params[:term]}%\"}\n ]\n end\n @ingredients = Ingredient.find(:all, options)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingredients}\n end\n end",
"def search\n add_breadcrumb :search\n @start = Time.now\n @search = User.search(:include => [:tags]) do\n fulltext params[:q] do\n fields(:bio, :name => 2.0)\n end\n order_by sort_column, sort_direction\n paginate :page => params[:page], :per_page => 21\n end\n\n respond_to do |format|\n format.html { render :action => \"index\" }\n format.xml { render :xml => @search }\n format.xml { render :json => @search }\n end\n end",
"def query_terms_xml\n bool_operator = boolean_operator\n lambda do |xml|\n xml.QueryTerms {\n xml.BoolOpeator bool_operator\n query_terms.each do |query_term|\n xml << query_term.to_xml\n end\n }\n end\n end",
"def new\n @search_phrase = SearchPhrase.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_phrase }\n end\n end",
"def query_esip_opensearch( search_term )\n query_string = EsipOpensearchQueryBuilder::get_query_string({ :st => search_term })\n\n begin\n file = open(\"#{@base_url}/services/opensearchesip#{query_string}\")\n rescue => e\n raise \"Failed to query GI-Cat ESIP OpenSearch interface.\"\n end\n\n return Nokogiri::XML(file)\n end",
"def get_terms(retina_name=nil, term=nil, get_fingerprint=nil, start_index=0, max_results=10)\n resource_path = '/terms'\n verb = 'GET'\n query_params = { 'retina_name' => retina_name, 'term' => term, 'start_index' => start_index,\n 'max_results' => max_results, 'get_fingerprint' => get_fingerprint }\n post_data = nil\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params,post_data, headers)\n JSON.parse(response.body, symbolize_names: true).map { |r| RetinaSDK::Model::Term.new(r) }\n end",
"def index\n# @search = Category.by_company(current_company.id).search(params[:search])\n @search = Category.search(params[:search])\n @categories = @search.page(params[:page]).per(10)\n respond_to do |format|\n format.html # indexoo.html.erb\n format.xml { render :xml => @categories }\n end\n end",
"def index\n @search = search_hash\n respond_to do |format|\n format.html { render :index }\n format.rss { render :layout => false }\n format.json { render :layout => false }\n end\n end",
"def index\n @search = Article.where(\"ready is true\").search(params[:search])\n @articles = @search.paginate(:per_page => 9, :page => params[:page])\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def index\n @search = Issued.search(params[:search])\n @issueds = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # indexoo.html.erb\n format.xml { render :xml => @issueds }\n end\n end",
"def search\n @documents = api.form(\"everything\")\n .query(%([[:d = fulltext(document, \"#{params[:q]}\")]]))\n .page(params[:page] ? params[:page] : \"1\")\n .page_size(params[:page_size] ? params[:page_size] : \"20\")\n .submit(ref)\n end",
"def search(*args)\n return \"No XML\" if !@ndoc\n @ndoc.search(*args)\n end",
"def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end",
"def index\n\t\t# default search terms will throw off the search, so remove them\n\t\tsearch_params = remove_default_search_terms(params[:search])\n\t\tlogger.debug(\"routes search params: #{search_params.inspect}\")\n\t\t@routes = Route.search(search_params).all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @routes }\n\t\tend\n\tend",
"def show\n @keyword = Keyword.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @keyword }\n end\n end",
"def show\n @search = Search.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @search }\n end\n end",
"def opensearch\n respond_to do |format|\n format.xml do\n render :layout => false\n end\n format.json do\n render :json => search_service.opensearch_response\n end\n end\n end",
"def search_request(params)\n result = @client.connection.get(PATH, params)\n Yelp::Fusion::Error.check_for_error(result)\n result\n end",
"def index\n\n if params[:search].nil?\n @questions = Question.all\n else\n @questions = Question.search params[:search]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end",
"def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def create\n @search = @website.searches.new params[:search]\n\n\t\[email protected] = @website.search_url(params[:search_terms]) if params[:search_terms]\n\n @search.terms = @search.description.split(' ') if params[:use_description_terms]\n\n respond_to do |format|\n if @search.save\n\n format.html { redirect_to website_search_url(@website, @search), notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_people(searchterm,params={})\n @opensearch.search_people(searchterm,params) \n end",
"def opensearch\n respond_to do |format|\n format.xml do\n render :layout => false\n end\n format.json do\n render :json => get_opensearch_response\n end\n end\n end",
"def search( args={} )\n response = request( :method => 'post', :url => @url, :query => generate_xml(args) )\n result = process_tsv( args, response )\n result = conv_results_to_a_of_h( result ) if args[:process_results]\n return result\n end",
"def list_keywords\n @entry = Entry.find(params[:id])\n @keywords = @entry.keywords\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @keywords }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def get(lang, term)\n query = \"#{lang}/#{term}\"\n @response = @conn.get query\n @response.body\n end",
"def make_request(search_term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\")\n final_response = JSON.parse(response)\nend",
"def ar_observe_field_query_terms destination\n observe_field 'query_terms', :frequency => 2,\n :update => \"auto_rest_index_table\",\n :before => \"Element.show('spinner')\",\n :success => \"Element.hide('spinner')\",\n :url => send(\"search_#{destination}_path\"), \n :method => :get,\n :with => \"query_terms\"\n end",
"def index\n @search = TipoRecibo.search(params[:search])\n @tipo_recibos = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erbb\n format.xml { render :xml => @tipo_recibos }\n end\n end",
"def create\n @simple_search = SimpleSearch.new(simple_search_params)\n get_response(params)\n respond_to do |format|\n format.html { render :index}\n format.json { render :index, status: 200 }\n end\n end",
"def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suggestions }\n end\n end",
"def index \t\n @categories = Category.pages(params[:page], params[:q]) \t\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @categories }\r\n end\r\n end",
"def get(keyword)\n # Create URL to Yandex.Xml\n xml_url = create_url(keyword)\n # Get data XML\n xml = Net::HTTP.get_response(URI.parse(xml_url)).body\n # Convert XML to Hash\n converter = Nori.new(:convert_dashes_to_underscores => true)\n hash = converter.parse(xml)\n # Convert Hash to OpenStruct\n data = JSON.parse(hash.to_json, object_class: OpenStruct)\n # Create short route to data\n groups = data.yandexsearch.response.results.grouping.group\n\n result = {}\n\n result[:meta] = {\n keyword: data.yandexsearch.request.query,\n timestamp: Time.now\n }\n\n data_array = []\n\n groups.each_with_index do |i, index|\n result_hash = {\n position: index + 1,\n url: i.doc.url,\n domain: i.doc.domain,\n title: i.doc.title,\n modtime: i.doc.modtime,\n size: i.doc.size,\n charset: i.doc.charset,\n # passage: i.doc.passages.passage, # TODO: not work\n passages_type: i.doc.properties._PassagesType,\n mime_type: i.doc.mime_type,\n saved_copy_url: i.doc.saved_copy_url,\n headline: i.doc.headline,\n turbo_cgi_url: i.doc.properties.TurboCgiUrl,\n turbo_fallback: i.doc.properties.TurboFallback,\n turbo_link: i.doc.properties.TurboLink\n }\n\n data_array << result_hash\n end\n\n result[:data] = data_array\n result\n end",
"def get_frequency(*args)\n http_method = :get\n path = '/words/frequency'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n @research = Research.find(params[:id])\n @page_title = \"Hello Congress research request: \" + @research.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def show\n @glossary = Glossary.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @glossary.to_xml }\n end\n end",
"def index\n\n extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => t('blacklight.search.rss_feed') )\n extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => t('blacklight.search.atom_feed') )\n\n\n if params[\"queries\"]\n do_refine_style_query\n else\n (@response, @document_list) = get_search_results\n end\n\n @filters = params[:f] || []\n\n respond_to do |format|\n format.html { save_current_search_params }\n format.rss { render :layout => false }\n format.atom { render :layout => false }\n format.json do\n @marshalled_results ||= marshall_nodes(@document_list.map{|d| d[\"id\"]})\n if params[\"nodesOnly\"] || params[\"queries\"]\n render json: @marshalled_results\n else\n render json: json_response\n end\n end\n end\n end",
"def index\n @intakes = Intake.search(params[:search])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @intakes }\n end\n end",
"def opensearch\n respond_to do |format|\n format.xml do\n render layout: false\n end\n format.json do\n render json: open_search_data\n end\n end\n end",
"def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end"
] | [
"0.6574636",
"0.6375503",
"0.6367965",
"0.6323818",
"0.6308117",
"0.62936616",
"0.62091875",
"0.62091875",
"0.610542",
"0.6101538",
"0.6101538",
"0.60521615",
"0.6046374",
"0.6009986",
"0.599756",
"0.5984967",
"0.5963555",
"0.5939905",
"0.5915151",
"0.59011525",
"0.58886755",
"0.588088",
"0.58794445",
"0.5873631",
"0.5858926",
"0.5854996",
"0.58405435",
"0.58225745",
"0.5787595",
"0.5769624",
"0.5769624",
"0.5769624",
"0.57695216",
"0.57648736",
"0.5761611",
"0.5748363",
"0.5744708",
"0.57242304",
"0.5719827",
"0.5687713",
"0.56815046",
"0.56762314",
"0.56749934",
"0.5672911",
"0.5672427",
"0.567052",
"0.5670204",
"0.5658763",
"0.5653124",
"0.5645742",
"0.5643917",
"0.5642086",
"0.56334597",
"0.5629971",
"0.5606901",
"0.5598961",
"0.5597266",
"0.5592835",
"0.5590075",
"0.55890536",
"0.55862015",
"0.5582794",
"0.5580033",
"0.5578701",
"0.557655",
"0.5575645",
"0.5573018",
"0.55656755",
"0.5565496",
"0.55479115",
"0.55465484",
"0.5545781",
"0.5544674",
"0.55359167",
"0.5534854",
"0.5530458",
"0.5530078",
"0.55178267",
"0.5508339",
"0.5501704",
"0.54934675",
"0.54923093",
"0.54922646",
"0.54851526",
"0.5482787",
"0.548198",
"0.54785794",
"0.5475878",
"0.54706556",
"0.5469736",
"0.5464481",
"0.5462999",
"0.54627436",
"0.5459594",
"0.5457711",
"0.5457103",
"0.5454168",
"0.5452385",
"0.5447347",
"0.5446559"
] | 0.6267797 | 6 |
GET /search_terms/new GET /search_terms/new.xml | def new
@search_term = SearchTerm.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @search_term }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @seo_search_term = Seo::SearchTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seo_search_term }\n end\n end",
"def create\n params[:search_term][:name] = params[:search_term][:new_name].strip\n params[:search_term].delete :new_name\n @search_term = SearchTerm.new(params[:search_term])\n\n respond_to do |format|\n if @search_term.save\n format.html { redirect_to(search_terms_path, :notice => 'SearchTerm was successfully created.') }\n format.xml { render :xml => @search_term, :status => :created, :location => @search_term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @search_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search }\n end\n end",
"def new\n @search_phrase = SearchPhrase.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_phrase }\n end\n end",
"def new\n @event = Event.find(params[:event_id])\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @url_search = UrlSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_search }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @search_topic = SearchTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_topic }\n end\n end",
"def new\n @keyword = Keyword.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @keyword }\n end\n end",
"def new\n @term_count = TermCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term_count }\n end\n end",
"def new\n @search_tweet = SearchTweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_tweet }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\r\n @keyword = Keyword.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @keyword }\r\n end\r\n end",
"def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end",
"def new\n @ipsearch = Ipsearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ipsearch }\n end\n end",
"def create\n @term = Term.new(params[:term])\n\n respond_to do |format|\n if @term.save\n flash[:notice] = 'Term was successfully created.'\n format.html { redirect_to(terms_url) }\n format.xml { render :xml => @term, :status => :created, :location => @term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @go_term = GoTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term }\n end\n end",
"def new\n @taxonomy_term = TaxonomyTerm.new\n\tset_site_entities @taxonomy_term\n\t\n\trespond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def new\n @noun = Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noun }\n end\n end",
"def new\n @vocabtype = Vocabtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocabtype }\n end\n end",
"def new\n @transaction_term = TransactionTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_term }\n end\n end",
"def new\n @search_log = SearchLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_log }\n end\n end",
"def create\n @search = @website.searches.new params[:search]\n\n\t\[email protected] = @website.search_url(params[:search_terms]) if params[:search_terms]\n\n @search.terms = @search.description.split(' ') if params[:use_description_terms]\n\n respond_to do |format|\n if @search.save\n\n format.html { redirect_to website_search_url(@website, @search), notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tagsearch = Tagsearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tagsearch }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @word }\n end\n end",
"def create\n @term = Term.new(params[:term])\n\n respond_to do |format|\n if @term.save\n format.html { redirect_to(@term, :notice => 'Term was successfully created.') }\n format.xml { render :xml => @term, :status => :created, :location => @term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @wordlist = Wordlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wordlist }\n end\n end",
"def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end",
"def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end",
"def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end",
"def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end",
"def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end",
"def new\n @retain_node_selector = RetainNodeSelector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node_selector }\n end\n end",
"def new\n @bookmark = Bookmark.new(:tags => [Tag.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @tdoc = Tdoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tdoc }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @search_entities = SearchEntities.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_entities }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end",
"def new\n @node = Node.new\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @taxonomy_category = TaxonomyCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_category }\n end\n end",
"def new\n @search = Host.search params[:search]\n @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @host }\n end\n end",
"def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end",
"def new\n @documentation = Documentation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documentation }\n end\n end",
"def new\n @jc_term = JcTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @jc_term }\n end\n end",
"def new\n @tag = @category.tags.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion_type }\n end\n end",
"def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end",
"def new\n @moneda = Moneda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moneda }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end",
"def new\n @twitter_crawler_hash_tag = TwitterCrawlerHashTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitter_crawler_hash_tag }\n end\n end",
"def create\n @errors = []\n term_prms = term_params\n validate_new_term_params(term_prms)\n\n unless @errors.present?\n\n type = term_prms.delete('type')\n term_opts = flat_term_data_to_term_opts(term_prms)\n\n begin\n @term = UriService.client.create_term(type, term_opts)\n rescue UriService::NonExistentVocabularyError, UriService::InvalidUriError, UriService::ExistingUriError, UriService::InvalidAdditionalFieldKeyError, UriService::InvalidOptsError => e\n @errors << e.message\n end\n end\n\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to term_path(@term['internal_id']), notice: 'Term was successfully created.' }\n format.json do\n render json: @term\n end\n else\n format.html { render action: 'new' }\n format.json do\n render json: { errors: @errors }\n end\n end\n end\n end",
"def new\n @recipe = Recipe.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"def new\n @quotetags = Quotetags.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quotetags }\n end\n end",
"def new\n @taxonomy = Taxonomy.new(:taxonomy_type => params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy }\n end\n end",
"def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def new\n @published_document = PublishedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @published_document }\n end\n end",
"def new\n @namespace = Namespace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @namespace }\n end\n end",
"def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end",
"def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end",
"def new\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tag }\n end\n end",
"def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sentence }\n end\n end",
"def new\n @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end",
"def new\n @library_doc = LibraryDoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @library_doc }\n end\n end",
"def new\n @otml_category = OtrunkExample::OtmlCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @otml_category }\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def new\n @index = Indice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end",
"def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @space = Space.where(:wiki_name => params[:space_id])[0]\n @document = @space.documents.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n format.json { render :json => @document.to_json }\n end\n end",
"def new\n @shipping_term = ShippingTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_term }\n end\n end",
"def new\n @terms_of_use = TermsOfUse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @terms_of_use }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @Roc = Roc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Roc }\n end\n end",
"def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"def new\n @sales_term = SalesTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sales_term }\n end\n end",
"def new\n @coupon_search = CouponSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupon_search }\n end\n end",
"def new_rest\n @question_localized = QuestionLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_localized }\n end\n end",
"def new\n @saved_search = SavedSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @saved_search }\n end\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def new_rest\n @answer_localized = AnswerLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @answer_localized }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion }\n end\n end",
"def new\n @suggestion = Suggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"def new\n @question = @keyword.question_sheet.elements.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @question }\n end\n end",
"def new\n @frequentmag = Frequentmag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @frequentmag }\n end\n end",
"def new\n @index = Index.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end",
"def new\n #@search = Search.new\n #\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @search }\n #end\n end"
] | [
"0.73089087",
"0.73089087",
"0.73089087",
"0.7301739",
"0.7143303",
"0.69809717",
"0.6979882",
"0.69009393",
"0.6839215",
"0.68262756",
"0.67831194",
"0.6743191",
"0.67383206",
"0.6631693",
"0.6629398",
"0.6629212",
"0.6597764",
"0.65628123",
"0.6554148",
"0.65103936",
"0.6497938",
"0.6477985",
"0.6460197",
"0.6448279",
"0.6432383",
"0.64285845",
"0.6388033",
"0.6372332",
"0.6346229",
"0.63363147",
"0.6331069",
"0.6315613",
"0.62895006",
"0.62895006",
"0.62895006",
"0.62895006",
"0.62895006",
"0.62588364",
"0.62341756",
"0.62338597",
"0.6229793",
"0.621606",
"0.6205748",
"0.61873066",
"0.61842805",
"0.6179762",
"0.6169492",
"0.61679465",
"0.61677337",
"0.6167539",
"0.615668",
"0.6154719",
"0.615383",
"0.61513937",
"0.61513937",
"0.6149383",
"0.61457926",
"0.6141442",
"0.6135533",
"0.6134977",
"0.6122986",
"0.611365",
"0.61135316",
"0.6113263",
"0.6110577",
"0.61087424",
"0.6106815",
"0.6096365",
"0.6088568",
"0.6088568",
"0.6088568",
"0.6085912",
"0.60820365",
"0.60811263",
"0.6068299",
"0.6061756",
"0.6060078",
"0.60566837",
"0.605646",
"0.6055667",
"0.60522074",
"0.60506296",
"0.60447264",
"0.6039568",
"0.60358864",
"0.6034797",
"0.6026632",
"0.602001",
"0.60184646",
"0.6010277",
"0.6009568",
"0.6009249",
"0.6005451",
"0.60053825",
"0.60053825",
"0.60026616",
"0.60007685",
"0.5992131",
"0.5988885",
"0.5984267"
] | 0.7513866 | 0 |
POST /search_terms POST /search_terms.xml | def create
params[:search_term][:name] = params[:search_term][:new_name].strip
params[:search_term].delete :new_name
@search_term = SearchTerm.new(params[:search_term])
respond_to do |format|
if @search_term.save
format.html { redirect_to(search_terms_path, :notice => 'SearchTerm was successfully created.') }
format.xml { render :xml => @search_term, :status => :created, :location => @search_term }
else
format.html { render :action => "new" }
format.xml { render :xml => @search_term.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_terms(params)\n send_get \"add_terms\", params\n end",
"def terms_post(opts = {})\n data, _status_code, _headers = terms_post_with_http_info(opts)\n data\n end",
"def search_params\n params.permit(:search_terms)\n end",
"def search_terms=(value)\n @search_terms = value\n end",
"def create\n @search = @website.searches.new params[:search]\n\n\t\[email protected] = @website.search_url(params[:search_terms]) if params[:search_terms]\n\n @search.terms = @search.description.split(' ') if params[:use_description_terms]\n\n respond_to do |format|\n if @search.save\n\n format.html { redirect_to website_search_url(@website, @search), notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_param_terms\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tp['terms']\n\t\tend",
"def create\n @term = Term.new(params[:term])\n\n respond_to do |format|\n if @term.save\n flash[:notice] = 'Term was successfully created.'\n format.html { redirect_to(terms_url) }\n format.xml { render :xml => @term, :status => :created, :location => @term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def search(terms)\n agent = Mechanize.new\n agent.get 'http://kattorrents.me/'\n search_form = agent.page.form_with(id:'searchform')\n search_form.q = terms\n search_form.submit\n parse_html(agent.page)\n end",
"def create\n \t\t@searchterm = current_user.searches.create(:search_term=>params[:searchterm],:type=>\"question\")\n \tend",
"def terms\n\n end",
"def terms\n\n end",
"def create\n @term = Term.new(params[:term])\n\n respond_to do |format|\n if @term.save\n format.html { redirect_to(@term, :notice => 'Term was successfully created.') }\n format.xml { render :xml => @term, :status => :created, :location => @term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_terms(params)\n send_get \"get_terms\", params\n end",
"def terms\n end",
"def search(terms)\n agent = Mechanize.new\n agent.get 'https://eztv.ch'\n search_form = agent.page.form('search')\n search_form.SearchString1 = terms\n search_form.submit\n parse_html(agent.page)\n end",
"def do_search(term = nil)\n @terms = term unless term.nil? #replace saved term with argument, if passed\n @attempts += 1\n @doc = Nokogiri::XML(open(build_call(@terms)))\n parse\n end",
"def create\n searchterm = current_user.searches.new(:search_term=>params[:searchterm],:type=>\"case\")\n # check condition for searchterm is saved or not.\n if searchterm.save\n # response to the JSON\n render json: { success: true,message: \"Search Term Successfully Created.\", response: searchterm.as_json('search') },:status=>200\n else\n render :json=> { success: false, message: searchterm.errors },:status=> 203\n end\n end",
"def terms(attributes = nil)\r\n field = attributes.keys.first\r\n query = { field => attributes.values.flatten }\r\n\r\n body = { query: { terms: query } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end",
"def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end",
"def terms\n\tend",
"def create\n @errors = []\n term_prms = term_params\n validate_new_term_params(term_prms)\n\n unless @errors.present?\n\n type = term_prms.delete('type')\n term_opts = flat_term_data_to_term_opts(term_prms)\n\n begin\n @term = UriService.client.create_term(type, term_opts)\n rescue UriService::NonExistentVocabularyError, UriService::InvalidUriError, UriService::ExistingUriError, UriService::InvalidAdditionalFieldKeyError, UriService::InvalidOptsError => e\n @errors << e.message\n end\n end\n\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to term_path(@term['internal_id']), notice: 'Term was successfully created.' }\n format.json do\n render json: @term\n end\n else\n format.html { render action: 'new' }\n format.json do\n render json: { errors: @errors }\n end\n end\n end\n end",
"def create\n if params[:search_term_csv_file].blank?\n @seo_search_term = Seo::SearchTerm.find_by_term(params[:seo_search_term][:term].strip)\n @seo_search_term = Seo::SearchTerm.new(params[:seo_search_term]) if @seo_search_term.nil?\n else\n terms = params[:search_term_csv_file].read.split(/\\n/).collect {|t| t.strip}\n @seo_search_terms = []\n terms.each do |term|\n @seo_search_terms << Seo::SearchTerm.find_or_create_by_term(term)\n end\n end\n\n respond_to do |format|\n if @seo_search_terms or @seo_search_term.save\n flash[:notice] = 'Seo::SearchTerm was successfully created.'\n format.html { redirect_to seo_search_terms_path }\n format.xml do\n render :xml => @seo_search_terms, :status => :created, :location => @seo_search_terms and return if @seo_search_terms\n render :xml => @seo_search_term, :status => :created, :location => @seo_search_term and return\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @seo_search_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patent_search_params\n params.require(:patent_search).permit(:terms, :fields)\n end",
"def create\n @terms_of_service = TermsOfService.new(terms_of_service_params)\n\n respond_to do |format|\n if @terms_of_service.save\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully created.' }\n format.json { render :show, status: :created, location: @terms_of_service }\n else\n format.html { render :new }\n format.json { render json: @terms_of_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms\n redirect_to '/404' unless Rails.configuration.terms\n\n if params[:accept] == \"true\"\n current_user.update_attributes(accepted_terms: true)\n login(current_user)\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def new\n @seo_search_term = Seo::SearchTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seo_search_term }\n end\n end",
"def term_params\n params.require(:term).permit(:name, :starts_on, :ends_on, :school_id)\n end",
"def new\n @search_term = SearchTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_term }\n end\n end",
"def create\n @term = Term.new(term_params)\n\n if @term.save\n render :show, status: :created, location: api_v1_term_url(@term)\n else\n render json: @term.errors, status: :unprocessable_entity\n end\n end",
"def set_search_terms\n if relevent_dish\n self.search_terms = self.name_translations.collect do |key,value|\n next value\n end.join(\" \")\n if self.restaurant\n self.restaurant_name = self.restaurant.name\n end\n if img = self.image.first\n self.top_image = img.img_url_medium\n end\n else\n self.search_terms = nil\n end\n save\n end",
"def create\n @terms_and_condition = TermsAndCondition.new(terms_and_conditions_params)\n\n respond_to do |format|\n if @terms_and_condition.save\n format.html { redirect_to admin_terms_and_conditions_path, notice: 'terms_and_condition was succesfully created.' }\n format.json { render :show, status: :created, location: @terms_and_condition }\n else\n format.html { render :new }\n format.json { render json: @terms_and_condition.errors, status: :unprocesable_entity }\n end\n end\n end",
"def terms_of_service_params\n params.require(:terms_of_service).permit(:store_name, :terms)\n end",
"def add_terms(terms)\n\t\t\tif @search_string == nil\n\t\t\t\t@search_string = terms\n\t\t\telse\n\t\t\t\t@search_string << \"|\" + terms\n\t\t\tend\n\t\tend",
"def search(loc, msgId, keywords, index=false)\n\n# httpuri=URI::parse(\"http://#{loc}/netinfproto/search\")\n# Net::HTTP.post_form(httpuri, 'msgid' => msgId, 'ext' => \"no extension\")\n\n\n httpuri= URI::parse(\"http://#{loc}/netinfproto/search\")\n ext=\"no extension\"\n if index\n ext=\"index\"\n end\n \n res=Net::HTTP.post_form(httpuri, 'tokens' => keywords, 'msgid' => msgId, 'ext' => ext)\n#, \"rform\" => \"json\")\n\n\n end",
"def term_params\n params.require(:term).permit(:name)\n end",
"def query_terms_xml\n bool_operator = boolean_operator\n lambda do |xml|\n xml.QueryTerms {\n xml.BoolOpeator bool_operator\n query_terms.each do |query_term|\n xml << query_term.to_xml\n end\n }\n end\n end",
"def create_saved_search(query)\n post(\"/saved_searches/create.json\", :query => query)\n end",
"def create\n @term = @vocabulary.vocabulary_terms.build(term_params)\n authorize @term, policy_class: VocabularyPolicy\n begin\n @term.save!\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @term.errors.any? ? @term : e },\n status: :bad_request\n else\n toast!(title: \"Term created\",\n message: \"The vocabulary term \\\"#{@term.displayed_value}\\\" has \"\\\n \"been created.\")\n render \"shared/reload\"\n end\n end",
"def seo_submit\n for search_engine in ::Pingr::SUPPORTED_SEARCH_ENGINES\n ::Pingr::Request.new(search_engine, pages_url(format: :xml)).ping\n end\n \n redirect_to({:action => :index}, {:notice => '<strong>Yay!</strong> Sitemap XML has been submitted to all supported search engines!'.html_safe})\n end",
"def create\n\n #@term.start = Date.strptime(params[:term][:start], \"%d/%m/%Y %H:%M\")\n\n\n @term = Term.new(parse_term_params)\n \n\n @term.event_id = params[:event_id]\n\n #create associations between terms and categories via categories_terms table\n @event = Event.find(params[:event_id])\n\n @event.terms << @term\n \n respond_to do |format|\n if @term.save\n flash[:notice] = I18n.t('terms.controller.Successfully_created')\n format.html { redirect_to(@event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @taxonomy_term = TaxonomyTerm.new(params[:taxonomy_term])\n\n respond_to do |format|\n if @taxonomy_term.save\n format.html { redirect_to admin_taxonomy_term_path(@taxonomy_term), notice: 'Taxonomy term was successfully created.' }\n format.json { render json: @taxonomy_term, status: :created, location: @taxonomy_term }\n else\n \tset_site_entities @taxonomy_term\n \t\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @searchterms = Searchterm.all\n end",
"def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end",
"def create\n @transaction_term = TransactionTerm.new(params[:transaction_term])\n\n respond_to do |format|\n if @transaction_term.save\n format.html { redirect_to(@transaction_term, :notice => 'Transaction terms was successfully created.') }\n format.xml { render :xml => @transaction_term, :status => :created, :location => @transaction_term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def search_params\n params.require(:search).permit(:term)\n end",
"def search_params\n params.require(:search).permit(:term)\n end",
"def search_params\n params.require(:search).permit(:term)\n end",
"def create\n @searchterm = Searchterm.new(searchterm_params)\n\n if @searchterm.save\n render json: {\"status\" => \"ok\"}\n else\n render :new\n end\n # respond_to do |format|\n # if @searchterm.save\n # render :show\n # # format.html { redirect_to @searchterm, notice: 'Searchterm was successfully created.' }\n # # format.json { render :show, status: :created, location: @searchterm }\n # else\n # format.html { render :new }\n # format.json { render json: @searchterm.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @tagsearch = Tagsearch.new(params[:tagsearch])\n\n respond_to do |format|\n if @tagsearch.save\n format.html { redirect_to @tagsearch, notice: 'Tagsearch was successfully created.' }\n format.json { render json: @tagsearch, status: :created, location: @tagsearch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagsearch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/terms?date=#{date}&page=#{page}}\"\n fetch uri\n end",
"def create\n @go_term = GoTerm.new(params[:go_term])\n\n respond_to do |format|\n if @go_term.save\n format.html { redirect_to @go_term, notice: 'Go term was successfully created.' }\n format.json { render json: @go_term, status: :created, location: @go_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sanskrit_term_params\n params.require(:sanskrit_term).permit(:term, :definition)\n end",
"def ar_observe_field_query_terms destination\n observe_field 'query_terms', :frequency => 2,\n :update => \"auto_rest_index_table\",\n :before => \"Element.show('spinner')\",\n :success => \"Element.hide('spinner')\",\n :url => send(\"search_#{destination}_path\"), \n :method => :get,\n :with => \"query_terms\"\n end",
"def postCategorySynonym( category_id, synonym, language)\n params = Hash.new\n params['category_id'] = category_id\n params['synonym'] = synonym\n params['language'] = language\n return doCurl(\"post\",\"/category/synonym\",params)\n end",
"def create\n @jc_term = JcTerm.new(params[:jc_term])\n\n respond_to do |format|\n if @jc_term.save\n format.html { redirect_to @jc_term, :notice => 'JC term was successfully created.' }\n format.json { render :json => @jc_term, :status => :created, :location => @jc_term }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @jc_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @terms_of_use = TermsOfUse.new(params[:terms_of_use])\n\n respond_to do |format|\n if @terms_of_use.save\n format.html { redirect_to @terms_of_use, notice: 'Terms of use was successfully created.' }\n format.json { render json: @terms_of_use, status: :created, location: @terms_of_use }\n else\n format.html { render action: \"new\" }\n format.json { render json: @terms_of_use.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms_and_conditions_params\n params.fetch(:terms_and_condition, {}).permit(:terms_and_condition, :status, :summary, :full, :version)\n end",
"def terms_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TermsApi.terms_post ...'\n end\n # resource path\n local_var_path = '/terms'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['version'] = opts[:'version'] if !opts[:'version'].nil?\n form_params['file_content'] = opts[:'file_content'] if !opts[:'file_content'].nil?\n form_params['language'] = opts[:'language'] if !opts[:'language'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TermsOfService')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TermsApi#terms_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @vocabulary_term = VocabularyTerm.new(vocabulary_term_params)\n\n respond_to do |format|\n if @vocabulary_term.save\n format.html { redirect_to @vocabulary_term, notice: 'Vocabulary term was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary_term }\n else\n format.html { render :new }\n format.json { render json: @vocabulary_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @search = Search.new(params[:search])\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to(@search, :notice => 'Search was successfully created.') }\n format.xml { render :xml => @search, :status => :created, :location => @search }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @search.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_create\n user = login\n params = create_term_params\n\n assert_no_difference(\"Image.count\") do\n post(:create, params: params)\n end\n\n term = GlossaryTerm.last\n assert_equal(params[:glossary_term][:name], term.name)\n assert_equal(params[:glossary_term][:description], term.description)\n assert_not_nil(term.rss_log)\n assert_equal(user.id, term.user_id)\n assert_response(:redirect)\n end",
"def create(input)\n @response = self.request(Net::HTTP::Post.new(\n \"/stikkits.atom?raw_text=#{CGI.escape(input)}\"\n ))\n #-- TODO: This should be processed and useful output presented\n #++\n puts @response.body\n end",
"def terms_of_service\n redirect_to document_path('terms-of-service'), :status => :moved_permanently\n end",
"def create\n @indicate_taxonomy = Indicate::Taxonomy.new(indicate_taxonomy_params)\n\n respond_to do |format|\n if @indicate_taxonomy.save\n format.html { redirect_to @indicate_taxonomy, notice: 'Taxonomy was successfully created.' }\n format.json { render :show, status: :created, location: @indicate_taxonomy }\n else\n format.html { render :new }\n format.json { render json: @indicate_taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def terms\n @title = \"community terms\"\n end",
"def create\n @common_term = CommonTerm.new(common_term_params)\n\n respond_to do |format|\n if @common_term.save\n format.html { redirect_to @common_term, notice: 'Common term was successfully created.' }\n format.json { render :show, status: :created, location: @common_term }\n else\n format.html { render :new }\n format.json { render json: @common_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end",
"def get_search_terms(array_of_terms)\n\t\treturn \"q=\"+array_of_terms.join(\"+\")\n\tend",
"def create\n @sales_term = SalesTerm.new(params[:sales_term])\n\n respond_to do |format|\n if @sales_term.save\n format.html { redirect_to @sales_term, notice: 'Sales Term was successfully created.' }\n format.json { render json: @sales_term, status: :created, location: @sales_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def extract_indexterms(terms)\n terms.each_with_object({}) do |t, v|\n term = t&.at(ns(\"./primary\"))&.children&.to_xml\n term2 = t&.at(ns(\"./secondary\"))&.children&.to_xml\n term3 = t&.at(ns(\"./tertiary\"))&.children&.to_xml\n index2bookmark(t)\n v[term] ||= {}\n v[term][term2] ||= {}\n v[term][term2][term3] ||= {}\n v[term][term2][term3][:xref] ||= []\n to = t[\"to\"] ? \"to='#{t['to']}' \" : \"\"\n v[term][term2][term3][:xref] << \"<xref target='#{t['id']}' #{to}pagenumber='true'/>\"\n end\n end",
"def create\n @admin_term = Admin::Term.new(admin_term_params)\n\n respond_to do |format|\n if @admin_term.save\n format.html { redirect_to @admin_term, notice: 'Term was successfully created.' }\n format.json { render :show, status: :created, location: @admin_term }\n else\n format.html { render :new }\n format.json { render json: @admin_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n admin_last_url\n cookies[:product_search] = {:value => YAML::dump(params[:product_search]),\n :path => admin_product_search_path}\n logger.info \"Admin::ProductSearchesController#create params=#{params[:product_search]}\"\n do_search params[:product_search]\n end",
"def create\n @simple_search = SimpleSearch.new(simple_search_params)\n get_response(params)\n respond_to do |format|\n format.html { render :index}\n format.json { render :index, status: 200 }\n end\n end",
"def usage_terms\n if request.post?\n # OPTIMIZE check if really submitted the form (hidden variable?)\n current_user.usage_terms_accepted!\n redirect_to root_path\n else\n @usage_term = UsageTerm.current\n \n @title = \"Medienarchiv der Künste: #{@usage_term.title}\"\n @disable_user_bar = true\n @disable_search = true\n end\n end",
"def create_recent_search\n \t\tcurrent_user.question_recent_search_term << params[:searchterm]\n \tcurrent_user.save\n \tend",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def create\n @people_term = PeopleTerm.new(people_term_params)\n\n respond_to do |format|\n if @people_term.save\n format.html { redirect_to @people_term, notice: 'People term was successfully created.' }\n format.json { render :show, status: :created, location: @people_term }\n else\n format.html { render :new }\n format.json { render json: @people_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enter_terms(test_data)\n test_terms = test_data[Org::ORG_TERM_GRP.name]\n prep_fieldsets_for_test_data([fieldset(Org::ORG_TERM_GRP.name)], test_terms)\n scroll_to_top\n test_terms.each_with_index do |test_term, index|\n enter_org_display_name(test_term[Org::TERM_DISPLAY_NAME.name], index)\n wait_for_element_and_type(org_term_name_input(index), test_term[Org::TERM_NAME.name])\n wait_for_element_and_type(org_term_qualifier_input(index), test_term[Org::TERM_QUALIFIER.name])\n wait_for_options_and_select(org_term_status_input(index), org_term_status_options(index), test_term[Org::TERM_STATUS.name])\n wait_for_options_and_select(org_term_type_input(index), org_term_type_options(index), test_term[Org::TERM_TYPE.name])\n wait_for_options_and_select(org_term_flag_input(index), org_term_flag_options(index), test_term[Org::TERM_FLAG.name])\n wait_for_options_and_select(org_term_language_input(index), org_term_language_options(index), test_term[Org::TERM_LANGUAGE.name])\n wait_for_element_and_click org_term_pref_for_lang_input(index) if test_term[Org::TERM_PREF_FOR_LANGUAGE.name]\n wait_for_element_and_type(main_body_name_input(index), test_term[Org::MAIN_BODY_NAME.name])\n wait_for_element_and_type(addition_to_name_input(index), test_term[Org::ADDITIONS_TO_NAME.name])\n enter_auto_complete(org_term_source_name_input(index), org_term_source_name_options(index), test_term[Org::TERM_SOURCE.name], 'Local Citations')\n wait_for_element_and_type(org_term_source_detail_input(index), test_term[Org::TERM_SOURCE_DETAIL.name])\n wait_for_element_and_type(org_term_source_id_input(index), test_term[Org::TERM_SOURCE_ID.name])\n wait_for_element_and_type(org_term_source_note_input(index), test_term[Org::TERM_SOURCE_NOTE.name])\n end\n end",
"def term\r\n Riddle::Query.escape params[:term]\r\n end",
"def term\r\n Riddle::Query.escape params[:term]\r\n end",
"def term=(value)\n self.content << (value.is_a?(XTF::Search::Element::Term) ? value : XTF::Search::Element::Term.new(value))\n end",
"def search_terms(slug)\n options = {\n slug: slug,\n transaction: \"search-terms\",\n group_by: \"searchKeyword\",\n collect: \"searchUniques:sum\",\n }\n statistics(options)\n end",
"def search_terms\n return @search_terms\n end",
"def create\n @term = Term.where(:name=>params[:term])\n if not @term\n @term = Term.new(params[:term])\n if @term.save\n redirect_to(@term, :notice => 'Term was successfully created.')\n else\n render :action => \"new\"\n end\n\n else\n logger.debug \"term name #{@term.name}\"\n redirect_to(@term, :notice=>'Term already exists')\n end\n \n end",
"def term_params\n if TERM_ADDITIONAL_FIELDS[params[:term]['controlled_vocabulary_string_key']].blank?\n addl_term_params = []\n else\n addl_term_params = TERM_ADDITIONAL_FIELDS[params[:term]['controlled_vocabulary_string_key']].map { |key, _value| key.to_sym }\n end\n params.require(:term).permit([:controlled_vocabulary_string_key, :value, :uri, :type, :authority] + addl_term_params)\n end",
"def <<(term)\n raise \"No document defined\" unless defined? @document\n unless @terms.include? term\n @terms[term] = @terms.length\n end\n i = @terms[term]\n @index[@document] ||= 0\n @index[@document] |= 1 << i\n end",
"def add_tag_to_word(word, *args)\n http_method = :post\n path = '/word/{word}/tag'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def process_input_file\n\t\t\tinput_file = File.open(@params[:input_file], 'r')\n\t\t\tfile_terms = convert_contents_to_search_string(input_file.read)\n\t\t\tadd_terms(file_terms)\n\t\tend",
"def zipsearch\n require 'uri'\n require 'net/http'\n require 'iconv'\n\n dong_name = Iconv.iconv('euc-kr', 'utf-8', params[:query])\n res = Net::HTTP.post_form(URI.parse('http://biz.epost.go.kr/KpostPortal/openapi'), {'regkey' => '18132c774fa887e6d1318210963744', 'target' => 'post', 'query' => dong_name})\n new_response_body = Iconv.iconv('UTF-8//IGNORE', 'euc-kr', res.body).join\n @retval = new_response_body\n respond_to do |format|\n format.xml { render :xml => @retval }\n end\n end",
"def create\n @sanskrit_term = SanskritTerm.new(sanskrit_term_params)\n\n respond_to do |format|\n if @sanskrit_term.save\n format.html { redirect_to @sanskrit_term, notice: 'Sanskrit term was successfully created.' }\n format.json { render :show, status: :created, location: @sanskrit_term }\n else\n format.html { render :new }\n format.json { render json: @sanskrit_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @taxonomy_term = TaxonomyTerm.new\n\tset_site_entities @taxonomy_term\n\t\n\trespond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy_term }\n end\n end",
"def perform_search\n terms = { vehicle_year: 2006,\n vehicle_brand: \"Yamaha\",\n vehicle_model: \"Yz250\",\n vehicle_submodel: \"-- Base\",\n category_name: \"Complete Wheel Assembly\" }\n perform_search(terms)\n end",
"def create_taxonomy(rid, add_params = nil)\n params = {\n uid: uid,\n rid: rid,\n }\n api_call('/stores/:uid/taxonomies/:rid(.:format)',:post,params,add_params)\n end",
"def create\n @neglected_term = NeglectedTerm.new(neglected_term_params)\n\n respond_to do |format|\n if @neglected_term.save\n format.html { redirect_to @neglected_term, notice: 'Neglected term was successfully created.' }\n format.json { render :show, status: :created, location: @neglected_term }\n else\n format.html { render :new }\n format.json { render json: @neglected_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @term_count = TermCount.new(params[:term_count])\n\n respond_to do |format|\n if @term_count.save\n flash[:notice] = 'TermCount was successfully created.'\n format.html { redirect_to(@term_count) }\n format.xml { render :xml => @term_count, :status => :created, :location => @term_count }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def url_search_terms\n if openbis?\n []\n else\n super\n end\n end"
] | [
"0.65566725",
"0.63603777",
"0.63334906",
"0.63238597",
"0.6291281",
"0.61020565",
"0.6014546",
"0.5922155",
"0.5909578",
"0.58918905",
"0.58918905",
"0.5858409",
"0.5766691",
"0.5738655",
"0.5663866",
"0.56549513",
"0.56113076",
"0.5610413",
"0.56029993",
"0.55888176",
"0.5545262",
"0.55442387",
"0.54867214",
"0.5446811",
"0.54436576",
"0.54165435",
"0.54154456",
"0.5393262",
"0.5393255",
"0.53895223",
"0.53776157",
"0.5365143",
"0.53593445",
"0.53555954",
"0.53536177",
"0.5352792",
"0.5348725",
"0.5342008",
"0.53400034",
"0.5333942",
"0.5324638",
"0.53224146",
"0.5319048",
"0.53181094",
"0.5310057",
"0.53059703",
"0.53059703",
"0.53059703",
"0.53018075",
"0.5274806",
"0.5262506",
"0.52615005",
"0.5259992",
"0.525776",
"0.52238405",
"0.5207762",
"0.52014256",
"0.51969755",
"0.5179458",
"0.5178786",
"0.517679",
"0.516947",
"0.516859",
"0.5168589",
"0.5163657",
"0.51457614",
"0.51439166",
"0.51395994",
"0.51395994",
"0.51395994",
"0.5134407",
"0.51265174",
"0.5122477",
"0.5118179",
"0.51057106",
"0.51030785",
"0.5100282",
"0.50954324",
"0.5093218",
"0.5089681",
"0.50882435",
"0.5078474",
"0.5078474",
"0.50727797",
"0.5068658",
"0.50465673",
"0.5042577",
"0.50399363",
"0.5037361",
"0.50363225",
"0.50296056",
"0.50272584",
"0.5022716",
"0.50048083",
"0.5000263",
"0.49986908",
"0.49950266",
"0.49867675",
"0.49861857",
"0.49838236"
] | 0.62503314 | 5 |
PUT /search_terms/1 PUT /search_terms/1.xml | def update
@search_term = SearchTerm.find(params[:id])
respond_to do |format|
if @search_term.update_attributes(params[:search_term])
format.html { redirect_to(@search_term, :notice => 'SearchTerm was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @search_term.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @seo_search_term = Seo::SearchTerm.find(params[:id])\n\n respond_to do |format|\n if @seo_search_term.update_attributes(params[:seo_search_term])\n flash[:notice] = 'Seo::SearchTerm was successfully updated.'\n format.html { redirect_to seo_search_terms_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @seo_search_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @errors = []\n term_opts = flat_term_data_to_term_opts(term_params)\n\n begin\n @term = UriService.client.update_term(@term['uri'], term_opts)\n rescue UriService::NonExistentUriError, UriService::InvalidAdditionalFieldKeyError, UriService::CannotChangeTemporaryTerm => e\n @errors << e.message\n end\n\n respond_to do |format|\n if @errors.blank?\n format.html { redirect_to term_path(@term['internal_id']), notice: 'Term was successfully updated.' }\n format.json do\n render json: @term\n end\n else\n format.html { render action: 'new' }\n format.json do\n render json: { errors: @errors }\n end\n end\n end\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n flash[:notice] = 'Term was successfully updated.'\n format.html { redirect_to(terms_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @term.update_attributes(term_params)\n\n render_item @term, :ok\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n format.html { redirect_to(@term, :notice => 'Term was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n format.html { redirect_to(@term, :notice => 'Term was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @terms_of_service.update(terms_of_service_params)\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully updated.' }\n format.json { render :show, status: :ok, location: @terms_of_service }\n else\n format.html { render :edit }\n format.json { render json: @terms_of_service.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\n @search = Search.find(params[:id])\n #populate_attributes(@search, params[:search])\n @search.update_attributes(params[:search])\n\n if params[:search_terms]\n @search.url = @website.search_url(params[:search_terms])\n end\n\n respond_to do |format|\n\n if @search.save\n format.html { redirect_to [@website, @search], notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @term.update(term_params)\n render :show, status: :ok, location: api_v1_term_url(@term)\n else\n render json: @term.errors, status: :unprocessable_entity\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @terms_of_use = TermsOfUse.find(params[:id])\n\n respond_to do |format|\n if @terms_of_use.update_attributes(params[:terms_of_use])\n format.html { redirect_to @terms_of_use, notice: 'Terms of use was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @terms_of_use.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_terms_of_service\n @terms_of_service = TermsOfService.find(params[:id])\n end",
"def update\n @cycle = Cycle.find(params[:id])\n\n add_terms(params[\"terms-id\"],@cycle)\n respond_to do |format|\n if @cycle.update_attributes(params[:cycle])\n format.html { redirect_to @cycle, notice: 'Cycle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cycle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def put!\n request! :put\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n respond_to do |format|\n if @term.update(term_params)\n format.html { redirect_to @term, notice: 'Term was successfully updated.' }\n format.json { render :show, status: :ok, location: @term }\n else\n format.html { render :edit }\n format.json { render json: @term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end",
"def create\n params[:search_term][:name] = params[:search_term][:new_name].strip\n params[:search_term].delete :new_name\n @search_term = SearchTerm.new(params[:search_term])\n\n respond_to do |format|\n if @search_term.save\n format.html { redirect_to(search_terms_path, :notice => 'SearchTerm was successfully created.') }\n format.xml { render :xml => @search_term, :status => :created, :location => @search_term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @search_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def search_terms=(value)\n @search_terms = value\n end",
"def update\n respond_to do |format|\n if @searchterm.update(searchterm_params)\n format.html { redirect_to @searchterm, notice: 'Searchterm was successfully updated.' }\n format.json { render :show, status: :ok, location: @searchterm }\n else\n format.html { render :edit }\n format.json { render json: @searchterm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n\n respond_to do |format|\n if @taxonomy_term.update_attributes(params[:taxonomy_term])\n format.html { redirect_to admin_taxonomy_terms_path , notice: 'Taxonomy term was successfully updated.' }\n format.json { head :no_content }\n else\n \tset_site_entities @taxonomy_term\n format.html { render action: \"edit\" }\n format.json { render json: @taxonomy_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_term = GoTerm.find(params[:id])\n\n respond_to do |format|\n if @go_term.update_attributes(params[:go_term])\n format.html { redirect_to @go_term, notice: 'Go term was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update_index\n SolrService.add(to_solr, softCommit: true)\n end",
"def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end",
"def add_terms(params)\n send_get \"add_terms\", params\n end",
"def update!(**args)\n @doc_data = args[:doc_data] if args.key?(:doc_data)\n @salient_term = args[:salient_term] if args.key?(:salient_term)\n @version = args[:version] if args.key?(:version)\n end",
"def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end",
"def terms_of_service\n redirect_to document_path('terms-of-service'), :status => :moved_permanently\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def update_terms(old_terms, new_terms)\n delete_terms(*(old_terms - new_terms))\n add_terms(*(new_terms - old_terms))\n end",
"def post_to_solr(params,commit=true)\n url=\"#{Blacklight.default_index.connection.options[:url]}/update?commit=#{commit}\"\n RestClient.post url, params,:content_type => :json, :accept=>:json\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def <<(term)\n raise \"No document defined\" unless defined? @document\n unless @terms.include? term\n @terms[term] = @terms.length\n end\n i = @terms[term]\n @index[@document] ||= 0\n @index[@document] |= 1 << i\n end",
"def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end",
"def update\n @sales_term = SalesTerm.find(params[:id])\n\n respond_to do |format|\n if @sales_term.update_attributes(params[:sales_term])\n format.html { redirect_to @sales_term, notice: 'Sales term was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def update\n @transaction_term = TransactionTerm.find(params[:id])\n\n respond_to do |format|\n if @transaction_term.update_attributes(params[:transaction_term])\n format.html { redirect_to(@transaction_term, :notice => 'Transaction terms was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vocabulary_term.update(vocabulary_term_params)\n format.html { redirect_to @vocabulary_term, notice: 'Vocabulary term was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocabulary_term }\n else\n format.html { render :edit }\n format.json { render json: @vocabulary_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index_document( url_string = 'http://localhost:8983/solr/update' )\n index_doc = create_base_add_doc\n root = index_doc.root\n begin\n doc = to_solr_index_doc\n root << doc\n #set up basic connection\n @url = URI.parse( url_string )\n @http = Net::HTTP.new( @url.host, @url.port )\n \n response, body = @http.post( @url.path, index_doc.to_s, { 'Content-type'=>'text/xml; charset=utf-8' } )\n \n response, body = @http.post( @url.path, \"<commit/>\", { 'Content-type'=>'text/xml; charset=utf-8' } )\n\n rescue Exception => ex\n #puts \"Something went wrong with item: #{item.id}: #{item.title}\"\n puts ex.inspect\n puts ex.backtrace\n end\n end",
"def update\n @tagsearch = Tagsearch.find(params[:id])\n\n respond_to do |format|\n if @tagsearch.update_attributes(params[:tagsearch])\n format.html { redirect_to @tagsearch, notice: 'Tagsearch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tagsearch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id:, url_variables:, body:)\n ensure_service_document\n end",
"def reindex\n Sunspot.index!\n # puts 'reindexed'\n end",
"def update\n DOCUMENT_PATHS.each do |attr_name, path|\n if path.match(/\\*/)\n instance_variable_get(\"@#{attr_name}\").each do |simple_file_name, contents|\n replace_entry(\"word/#{simple_file_name}.xml\", contents.serialize(save_with: 0))\n end\n else\n xml_document = instance_variable_get(\"@#{attr_name}\")\n replace_entry path, xml_document.serialize(save_with: 0) if xml_document\n end\n end\n end",
"def term=(value)\n self.content << (value.is_a?(XTF::Search::Element::Term) ? value : XTF::Search::Element::Term.new(value))\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n @taxonomy = Taxonomy.find(params[:id])\n\n respond_to do |format|\n if @taxonomy.update_attributes(params[:taxonomy])\n format.html { redirect_to edit_admin_taxonomy_path(@taxonomy), notice: 'Taxonomy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :action => 'edit', alert: 'Updating taxonomy was failed.' }\n format.json { render json: @taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @terms_and_condition.update(terms_and_conditions_params)\n format.html { redirect_to admin_terms_and_conditions_path, notice: 'terms_and_condition was succesfully updated.' }\n format.json { render :show, status: :ok, location: @terms_and_condition }\n else\n format.html { render :edit }\n format.json { render json: @terms_and_condition.errors, status: :unprocesable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def set_term\n @term = Term.find(params[:id])\n end",
"def update\n @keyword = Keyword.find(params[:id])\n\n respond_to do |format|\n if @keyword.update_attributes(params[:keyword])\n flash[:notice] = 'Keyword was successfully updated.'\n format.html { redirect_to(@keyword) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @keyword.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def search_params\n params.permit(:search_terms)\n end",
"def update\n respond_to do |format|\n if @indicate_taxonomy.update(indicate_taxonomy_params)\n format.html { redirect_to @indicate_taxonomy, notice: 'Taxonomy was successfully updated.' }\n format.json { render :show, status: :ok, location: @indicate_taxonomy }\n else\n format.html { render :edit }\n format.json { render json: @indicate_taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n if @gene_ontology.update_attributes(params[:gene_ontology])\n format.html { redirect_to(@gene_ontology, :notice => 'Gene ontology was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gene_ontology.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update\r\n @keyword = Keyword.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @keyword.update_attributes(params[:keyword])\r\n format.html { redirect_to(admin_keywords_url, :notice => \"#{@keyword.title} was successfully updated.\") }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @keyword.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @luxire_taxonomy.update(luxire_taxonomy_params)\n format.html { redirect_to @luxire_taxonomy, notice: 'Luxire taxonomy was successfully updated.' }\n format.json { render :show, status: :ok, location: @luxire_taxonomy }\n else\n format.html { render :edit }\n format.json { render json: @luxire_taxonomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @search = Search.find(params[:id])\n\n respond_to do |format|\n if @search.update_attributes(params[:search])\n format.html { redirect_to(@search, :notice => 'Search was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @search.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def update\n update_resource_response(@headline, headline_params)\n end",
"def update\n @search_topic = SearchTopic.find(params[:id])\n\n respond_to do |format|\n if @search_topic.update_attributes(params[:search_topic])\n flash[:notice] = 'SearchTopic was successfully updated.'\n format.html { redirect_to(@search_topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @search_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index_keywords!\n update_attribute(:_keywords, set_keywords)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def update\n @term_count = TermCount.find(params[:id])\n\n respond_to do |format|\n if @term_count.update_attributes(params[:term_count])\n flash[:notice] = 'TermCount was successfully updated.'\n format.html { redirect_to(@term_count) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term_count.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def create\n @term = Term.new(params[:term])\n\n respond_to do |format|\n if @term.save\n flash[:notice] = 'Term was successfully created.'\n format.html { redirect_to(terms_url) }\n format.xml { render :xml => @term, :status => :created, :location => @term }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, options={})\n send_request 'put', path, options\n end",
"def set_term\n @term = Term.find(params[:id])\n end",
"def set_term\n @term = Term.find(params[:id])\n end",
"def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end",
"def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n )))\n end\n set_ref_value response\n orchio_status response, 201\n end",
"def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end",
"def update!(**args)\n @taxonomies = args[:taxonomies] if args.key?(:taxonomies)\n end",
"def update_status\n doc_id = params[:id]\n new_status = params[:new_status]\n doc = Typewright::Document.find_by_id(doc_id)\n old_status = doc.status\n doc.status = new_status\n if !doc.save\n render :text => doc.errors, :status => :error\n return\n end\n\n # need special behavior to handle documents that are complete\n # kick off new logic to grab corrected text, and send it to catalog for\n # re-indexing\n if new_status == 'complete'\n # grab corrected text\n fulltext = Typewright::Overview.retrieve_doc(doc.uri, \"text\")\n\n # get the solr object for this document\n solr = Catalog.factory_create(false)\n solr_document = solr.get_object(doc.uri)\n\n # update the important bits\n solr_document['text'] = fulltext\n solr_document['has_full_text'] = \"true\"\n json_data = ActiveSupport::JSON.encode( solr_document )\n\n # POST the corrected full text to the catalog so it will be\n # stored there and the results reproducable on the next reindex\n catalog_url = \"#{URI.parse(Setup.solr_url())}/corrections\"\n private_token = SITE_SPECIFIC['catalog']['private_token']\n\n begin\n resp = RestClient.post catalog_url, json_data, :'private_token' => private_token, :content_type => \"application/json\"\n Catalog.reset_cached_data()\n render :text => \"OK\", :status => :ok\n rescue RestClient::Exception => rest_error\n puts rest_error.response\n doc.status = old_status\n doc.save\n render :text => rest_error.response, :status => rest_error.http_code\n rescue Exception => e\n puts rest_error.response\n doc.status = old_status\n doc.save\n render :text => e, :status => :internal_server_error\n end\n else\n render :text => \"OK\", :status => :ok\n end\n end",
"def update\n puts \"Updating the following URL in the index: #{url}\".yellow\n keywords = nil\n title = nil\n update_attributes!(:title => title,\n :keywords => keywords,\n :updated_at => Time.now)\n\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def update\n @term.update!(term_params)\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @term.errors.any? ? @term : e },\n status: :bad_request\n else\n toast!(title: \"Term updated\",\n message: \"The vocabulary term \\\"#{@term.displayed_value}\\\" has \"\\\n \"been updated.\")\n render \"shared/reload\"\n end",
"def update\n respond_to do |format|\n @custom_search_engine.updated_at = Time.now\n if @custom_search_engine.update_attributes(params[:custom_search_engine])\n flash[:success] = I18n.t('human.success.update', item: I18n.t('human.text.cse'))\n format.html do\n if @node.present?\n redirect_to node_cse_path(@node, @custom_search_engine)\n else\n redirect_to cse_path(@custom_search_engine)\n end\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @custom_search_engine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @common_term.update(common_term_params)\n format.html { redirect_to @common_term, notice: 'Common term was successfully updated.' }\n format.json { render :show, status: :ok, location: @common_term }\n else\n format.html { render :edit }\n format.json { render json: @common_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.63365084",
"0.6113838",
"0.6043445",
"0.5992252",
"0.5980859",
"0.5970105",
"0.5969134",
"0.587131",
"0.58451706",
"0.58374506",
"0.57851374",
"0.5755232",
"0.5734693",
"0.5720603",
"0.5666318",
"0.5601305",
"0.55901706",
"0.5560446",
"0.5553743",
"0.5534108",
"0.55134183",
"0.5511533",
"0.54919726",
"0.5485278",
"0.5467354",
"0.5461938",
"0.5456864",
"0.5438397",
"0.54189736",
"0.54177237",
"0.5416032",
"0.53797203",
"0.53697747",
"0.5361981",
"0.5357692",
"0.53573585",
"0.53541344",
"0.5332769",
"0.5329142",
"0.53236884",
"0.53203595",
"0.531907",
"0.5314489",
"0.53099257",
"0.52981645",
"0.52927387",
"0.5285615",
"0.52817076",
"0.5276574",
"0.527543",
"0.527543",
"0.527543",
"0.5271356",
"0.52681684",
"0.525149",
"0.525149",
"0.525149",
"0.525149",
"0.525149",
"0.525149",
"0.525149",
"0.525149",
"0.5251111",
"0.5249464",
"0.52423525",
"0.5237927",
"0.5222181",
"0.5222181",
"0.52218217",
"0.5214001",
"0.5207204",
"0.5201484",
"0.5201082",
"0.51978993",
"0.51978797",
"0.5192639",
"0.5189506",
"0.51769596",
"0.5175082",
"0.51726437",
"0.51726437",
"0.5170598",
"0.5167543",
"0.51541126",
"0.51502234",
"0.51462895",
"0.5143354",
"0.5143354",
"0.5143132",
"0.51429725",
"0.5142813",
"0.5142813",
"0.51415426",
"0.51350045",
"0.51319504",
"0.51319504",
"0.5128891",
"0.51173896",
"0.5113796",
"0.51134163"
] | 0.5994832 | 3 |
DELETE /search_terms/1 DELETE /search_terms/1.xml | def destroy
@search_term = SearchTerm.find(params[:id])
@search_term.destroy
respond_to do |format|
format.html { redirect_to(search_terms_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @seo_search_term = Seo::SearchTerm.find(params[:id])\n @seo_search_term.destroy\n\n flash[:notice] = 'Seo::SearchTerm was successfully destroyed.'\n respond_to do |format|\n format.html { redirect_to(seo_search_terms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @term = Term.find(params[:id])\n @term.destroy\n\n respond_to do |format|\n format.html { redirect_to(terms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @term = Term.find(params[:id])\n @term.destroy\n\n respond_to do |format|\n format.html { redirect_to(terms_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @search_phrase = SearchPhrase.find(params[:id])\n @search_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_search_phrases_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @term.destroy\n head :no_content\n end",
"def destroy\n @search = Search.find(params[:id])\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to(searches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { redirect_to(keywords_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { redirect_to(keywords_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n @taxonomy_term.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_taxonomy_terms_path }\n format.json { head :no_content }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @searchterm.destroy\n respond_to do |format|\n format.html { redirect_to searchterms_url, notice: 'Searchterm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxonomy = Taxonomy.find(params[:id])\n taxonomy_type = @taxonomy.taxonomy_type \n @taxonomy.delete_node_keep_sub_nodes\n @taxonomy.reload\n @taxonomy.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_taxonomies_url(:taxonomy_type => taxonomy_type) }\n format.json { head :no_content }\n end\n end",
"def destroy\n UriService.client.delete_term(@term['uri'])\n respond_to do |format|\n format.html { redirect_to terms_controlled_vocabulary_path(@controlled_vocabulary), notice: 'Term has been deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_term = GoTerm.find(params[:id])\n @go_term.destroy\n\n respond_to do |format|\n format.html { redirect_to go_terms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { redirect_to keywords_url }\n format.xml { head :ok }\n end\n end",
"def delete_all\n solr.delete_by_query('*:*')\n solr.commit\n end",
"def delete_doc_with_unique_term(term)\n writer.delete_document(\"Q#{term}\")\n true\n end",
"def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end",
"def destroy\n @transaction_term = TransactionTerm.find(params[:id])\n @transaction_term.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_terms_index_url) }\n format.xml { head :ok }\n end\n end",
"def delete_term(params)\n send_get \"delete_term\", params\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def solr_delete(solr_id)\n Solarize::Post.execute(Solr::Request::Delete.new(:id => solr_id))\n end",
"def destroy\n @advance_search.destroy\n respond_to do |format|\n format.html { redirect_to advance_searches_url }\n format.json { head :no_content }\n end\n end",
"def delete_all(xpath); end",
"def destroy\n @url_search = UrlSearch.find(params[:id])\n @url_search.destroy\n\n respond_to do |format|\n format.html { redirect_to(url_searches_url) }\n format.xml { head :ok }\n end\n end",
"def destory_search_term\n \t\tcurrent_user.searches.and({:search_term =>params[:searchterm]},{:type=>\"question\"}).first.destroy\n \tend",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tdoc = Tdoc.find(params[:id])\n @tdoc.destroy\n\n respond_to do |format|\n format.html { redirect_to(tdocs_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n exec { index.delete(path) }\n end",
"def destroy\n @term.destroy!\n\n head :ok\n end",
"def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tax.destroy\n\n head :no_content\n end",
"def destroy\n @term_count = TermCount.find(params[:id])\n @term_count.destroy\n\n respond_to do |format|\n format.html { redirect_to(term_counts_url) }\n format.xml { head :ok }\n end\n end",
"def delete_from_cloud_search\n self.class.cloud_search_delete_document(\n self.cloud_search_document\n )\n end",
"def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end",
"def delete_terms_in_domain(domain)\n before = query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' RETURN COUNT(term)\")[\"data\"].first.first\n query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' DETACH DELETE term\")\n after = query(\"MATCH (term:Term) WHERE term.uri =~ '#{domain}.*' RETURN COUNT(term)\")[\"data\"].first.first\n raise \"Not all were deleted (before: #{before}, after: #{after})\" if after.positive?\n before\n end",
"def destroy\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n @taxonomy_category.destroy\n\n respond_to do |format|\n format.html { redirect_to taxonomy_categories_url }\n format.json { head :ok }\n end\n end",
"def cloud_search_delete_document(doc)\n doc.version += 1\n self.cloud_search_batcher_command(:delete_document, doc)\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to(docs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @common_term.destroy\n respond_to do |format|\n format.html { redirect_to common_terms_url, notice: 'Common term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n logger.debug(\"#{self.class.name}: Sending delete to Solr for #{id}\")\n\n json_package = {delete: id}\n resp = @http_client.post solr_update_url_with_query(@solr_update_args), JSON.generate(json_package), \"Content-type\" => \"application/json\"\n if resp.status != 200\n raise RuntimeError.new(\"Could not delete #{id.inspect}, http response #{resp.status}: #{resp.body}\")\n end\n end",
"def delete_element(xpath)\n if NOKOGIRI\n @xml.xpath(xpath.to_s).remove\n else\n @xml.delete_element(xpath.to_s)\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @terms_and_condition.destroy\n respond_to do |format|\n format.html { redirect_to admin_terms_and_conditions_url, notice: 'terms_and_conditions was succesfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @search_log = SearchLog.find(params[:id])\n @search_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(search_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @search_keyword.destroy\n respond_to do |format|\n format.html { redirect_to search_keywords_url }\n format.json { head :no_content }\n end\n end",
"def destroy_relevance\n @entry = current_user.entries.find(params[:id])\n @relevance = Relevance.find_by_entry_id_and_keyword_id(params[:id], params[:keyword_id])\n @relevance.destroy\n respond_to do |format|\n format.html { redirect_to(keywords_url) }\n format.xml { render :text => \"success\" }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end",
"def destroy\n @search_topic = SearchTopic.find(params[:id])\n @search_topic.destroy\n\n respond_to do |format|\n format.html { redirect_to(search_topics_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @jc_term = JcTerm.find(params[:id])\n @jc_term.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 @boutique_search.destroy\n respond_to do |format|\n format.html { redirect_to boutique_searches_url, notice: 'Boutique search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @folder = Folder.find(session[:folder_id])\n Searcher.open(Const.get('searcher_db')) do |db|\n db.erase(@content)\n end\n @content.destroy\n\n respond_to do |format|\n #format.html { redirect_to(contents_url) }\n format.html { redirect_to(@folder) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tagsearch = Tagsearch.find(params[:id])\n @tagsearch.destroy\n\n respond_to do |format|\n format.html { redirect_to tagsearches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'La ricerca è stata eliminata.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @terms_of_use = TermsOfUse.find(params[:id])\n @terms_of_use.destroy\n\n respond_to do |format|\n format.html { redirect_to terms_of_uses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_search.destroy\n respond_to do |format|\n redirect_path = params[:redirect_to] || root_path\n format.html { redirect_to redirect_path, notice: t('ransack.saved_search.delete.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocab = Vocab.find(params[:id])\n @vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to(vocabs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @search_entities = SearchEntities.find(params[:id])\n @search_entities.destroy\n\n respond_to do |format|\n format.html { redirect_to(search_entities_url) }\n format.xml { head :ok }\n end \n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n\n end",
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"def destroy\n @terms_of_service.destroy\n respond_to do |format|\n format.html { redirect_to terms_of_services_url, notice: 'Terms of service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @ipsearch = Ipsearch.find(params[:id])\n @ipsearch.destroy\n\n respond_to do |format|\n format.html { redirect_to(ipsearches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to(words_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @search = Search.find(params[:id])\n @search.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 \t@doc = Doc.find params[:id]\n @doc.destroy\nend",
"def destroy\n @luxire_taxonomy.destroy\n respond_to do |format|\n format.html { redirect_to luxire_taxonomies_url, notice: 'Luxire taxonomy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def destroy\n @archdiocese.destroy\n\n head :no_content\n end",
"def destory_search_term\n searchterm = current_user.searches.and({:search_term =>params[:searchterm]},{:type=>\"case\"}).first\n # check condition for searchterm is destroy or not.\n if searchterm.destroy\n # response to the JSON\n render json: { success: true,message: \"Search Term Successfully Deleted.\" },:status=>200\n else\n render :json=> { success: false, message: searchterm.errors },:status=> 203\n end\n end",
"def delete_search_index(name)\n @data[:search_indexes].delete(name)\n true\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url(@externo)) }\n format.xml { head :ok }\n end\n end",
"def unindex(obj)\n XapianDb.database.delete_doc_with_unique_term(obj.xapian_id)\n XapianDb.database.commit\n end",
"def delete\n success = true\n tries ||= 3\n request = Net::HTTP::Delete.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}\")\n WebTranslateIt::Util.add_fields(request)\n begin\n Util.handle_response(Connection.http_connection.request(request), true, true)\n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end",
"def destroy\n @leaf_spot_imm_search.destroy\n respond_to do |format|\n format.html { redirect_to leaf_spot_imm_searches_url, notice: 'Leaf spot imm search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def srch_destroy(opts={})\n\t\t\t\tsrch_client.destroy_document(opts)\n\t\t\tend",
"def delete_tag tag\n delete \"tag/#{tag}\"\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def deleteCategorySynonym( category_id, synonym, language)\n params = Hash.new\n params['category_id'] = category_id\n params['synonym'] = synonym\n params['language'] = language\n return doCurl(\"delete\",\"/category/synonym\",params)\n end",
"def destroy\n @saved_search = SavedSearch.find(params[:id])\n @saved_search.destroy\n\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documentation = Documentation.find(params[:id])\n @documentation.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @search = Search.find(params[:id])\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.68005186",
"0.66285855",
"0.66285855",
"0.65842533",
"0.6573328",
"0.64561653",
"0.6427755",
"0.6420135",
"0.6385023",
"0.6385023",
"0.6372914",
"0.63645303",
"0.6353844",
"0.6336281",
"0.63288444",
"0.6311669",
"0.62850726",
"0.628109",
"0.6264655",
"0.6259841",
"0.62490946",
"0.62449676",
"0.62355316",
"0.62329334",
"0.6229529",
"0.6224765",
"0.62140846",
"0.6211026",
"0.6193367",
"0.6186252",
"0.61562335",
"0.61454755",
"0.6144895",
"0.61318225",
"0.6128067",
"0.6115292",
"0.61063635",
"0.61057067",
"0.6105339",
"0.6096773",
"0.60948753",
"0.60927844",
"0.60927844",
"0.6086644",
"0.60849845",
"0.60803854",
"0.607753",
"0.6075761",
"0.6067188",
"0.60638946",
"0.6063081",
"0.6058653",
"0.6055605",
"0.60483146",
"0.6043411",
"0.6034965",
"0.6021104",
"0.601507",
"0.60112804",
"0.6003117",
"0.60008955",
"0.5999604",
"0.59944445",
"0.59913814",
"0.5990635",
"0.59885466",
"0.5985039",
"0.59849024",
"0.59841424",
"0.5983488",
"0.5981433",
"0.5981093",
"0.5980036",
"0.59793603",
"0.59731025",
"0.59668213",
"0.59642196",
"0.59548813",
"0.59548813",
"0.59548813",
"0.59548813",
"0.59548813",
"0.59545904",
"0.5950448",
"0.5944303",
"0.59354466",
"0.59343606",
"0.59319174",
"0.59301996",
"0.5929868",
"0.59293455",
"0.592751",
"0.59268945",
"0.5926439",
"0.59237045",
"0.5912578",
"0.5911539",
"0.5911008",
"0.5907903",
"0.58992845"
] | 0.7074731 | 0 |
making this a named Proc greatly increases overhead why?? | def test_string_size
ary = []
(1..10000000).each do |i|
i.to_s.size if i.odd?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_proc()\n #This is a stub, used for indexing\n end",
"def proc\n if block_given?\n super\n else\n NamedProc::Proxy::Proc\n end\n end",
"def to_proc() end",
"def to_proc() end",
"def to_proc() self ; end",
"def proc\n return $PROC\n end",
"def fred(param)\n proc {}\nend",
"def talk_about(name, &myproc) #so ruby (and us) know we are adding a proc prefix it with a ambersand &\n puts \"Let me tell you about #{name}\"\n myproc.call(name) #in the body it doesnt need a ambersand & only in the definition\nend",
"def proc_example\n\tsay_hi = proc {|name| puts \"Hi #{name}\"}\n\tsay_hi.call(\"Ganesh\")\nend",
"def call_a_proc(&my_proc)\n my_proc.call\nend",
"def run_proc_closure(p)\n p.call\nend",
"def lambda; end",
"def return_proc\n Proc.new do |name|\n puts \"The length of your name is #{name.length}\"\n end\nend",
"def new_proc\n proc1 = Proc.new{return \"I got it....\"}\n proc1.call\n \n return \".. but not that\"\nend",
"def takes_a_proc( p )\n p.call\nend",
"def run_block\n p = Proc.new # <1>\n p.call\nend",
"def postproc; end",
"def proc_method(&my_proc)\n puts \"method start\"\n my_proc.call\n puts \"method end\"\nend",
"def call_a_proc(&block)\n block.call\nend",
"def to_proc\n # since we're immutable we can keep this\n @extern_proc ||= method(:call).to_proc\n end",
"def proc_math\n Proc.new { return 1 + 1 }.call\n return 2 + 2\nend",
"def proc_math\n Proc.new { return 1 + 1 }.call\n\n return 2 + 2\nend",
"def proc_method\n my_proc = Proc.new { return \"I'm a proc\"}\n my_proc.call\n \"Last line of proc_method\"\nend",
"def go\n a = Proc.new do \n puts 'Proc'\n\n return\n end\n\n methods(&a)\n\n puts 'end go'\nend",
"def create_proc\n proc = Proc.new { puts \"I am a Proc created by Proc.new\"}\n proc.call\nend",
"def batman_ironman_proc #will return batman will win\n victor = Proc.new { |n| return \"Batman will win!#{n}\" }\n victor.call(3)\n \"Iron Man will win!\"\nend",
"def batman_ironman_proc\r\n victor = Proc.new { return \"Batman will win!\" }\r\n victor.call\r\n \"Iron Man will win!\"\r\nend",
"def proc_method\n my_proc = Proc.new { return \"I'm a proc!\"}\n my_proc.call\n \"Last line of proc method\"\nend",
"def run_block\n p = Proc.new\n p.call\nend",
"def lambda_vs_proc\n my_lam = lambda { return puts \"Hi, I'm your lambda!\" }\n my_lam.call\n puts 'Returned from lambda!'\n my_proc = Proc.new { return puts 'Hello from proc!' }\n my_proc.call\n puts 'The proc will not allow this to be seen!'\nend",
"def batman_ironman_proc\r\n victor = Proc.new { return \"Batman will win!\" }\r\n puts victor.call\r\n \"Iron Man will win!\"\r\nend",
"def call_proc(my_proc) \n\tcount = 500 \n\tmy_proc.call\nend",
"def create_proc_with_params\n proc = Proc.new { |a| puts a * 2 }\n #on check on numbers of paramaters\n proc.call(4,6)\n proc.call(5)\nend",
"def batman_ironman_proc #calls a proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend",
"def to_proc\n Proc.new {|*args| self.invoke(*args) }\n end",
"def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend",
"def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" }\n victor.call\n \"Iron Man will win!\"\nend",
"def postproc=(_arg0); end",
"def proc_demo_method\n proc_demo = Proc.new { return \"Only I print!\" }\n proc_demo.call\n \"But what about me?\" # Never reached\nend",
"def outer\n name = 'John'\n\n # creating Proc also possible with `Proc.new`\n proc = Proc.new do\n # know name variable\n puts(name) # puts 'John'\n end\nend",
"def to_proc\n proc { |n| call(n) }\nend",
"def proc_sample\n proc = proc { return 'world' }\n 'hello ' << proc.call\nend",
"def eClosure(ss)\n end",
"def closure! \n end",
"def to_proc\n self\n end",
"def call_proc\n puts \"Before proc\"\n my_proc = Proc.new { return 2 }\n my_proc.call\n puts \"After proc\"\n\nend",
"def another_proc\n\tp = Proc.new {return}\n\tp.call\n\tputs \"After Proc\"\nend",
"def block_to_proc(&p)\n\tp.call\nend",
"def to_proc\n ->(*args, &blk) do\n receiver = args.first\n if (blk)\n receiver.send(self, &blk)\n else\n args[0] = self\n receiver.send(*args)\n end\n end\n end",
"def my_method(&the_proc)\n the_proc\nend",
"def default_proc() end",
"def to_proc\n ->(*args) {call(*args)}\n end",
"def proc_return_demo\n some_proc = Proc.new { return \"proc returns\"}\n some_proc.call\n \"method returns\"\nend",
"def call_proc(my_proc)\n count = 500\n my_proc.call\nend",
"def sampleProc\n procOne = Proc.new { return \"Proc block!\" }\n procOne.call\n \"Last Proc statement!\"\nend",
"def func_one\n proc_new = Proc.new {return \"123\"}\n proc_new.call(1,2)#proc dont care how many argument added\n return \"456\"\nend",
"def call_proc(val, &proc)\n proc ||= Proc.new { |data| data + \" you\" }\n proc.call(val)\nend",
"def call_proc\n puts \"Before proc\"\n my_proc = Proc.new { return 2 }\n my_proc.call\n puts \"After proc\"\nend",
"def to_proc\n Proc.new { |target| self.call(target) }\n end",
"def to_proc\n Proc.new { |target| self.call(target) }\n end",
"def run_couple\n run_a_proc proc { puts 'I am a proc'; return }\n p 'you will not see me'\n run_a_proc lambda { puts 'I am a lambda'; return }\nend",
"def do_self_importantly(some_proc)\n puts \"Everyone listen up! Umm... #{some_proc.call}\"\nend",
"def bound_method(block); end",
"def proc_return\n Proc.new { return \"Proc.new\"}.call\n return \"proc_return method finished\"\nend",
"def procasaurus( &block )\n\tputs \"I am a procasaurus.\"\n\tputs block.class\n\t# note the proc must be the last parameter and must start with ampersand\nend",
"def preproc=(_arg0); end",
"def to_proc\n name, options, registry, variable_name = @name, @options, @registry, @iv_name\n Proc.new do\n build name => options\n registry.inject(instance_variable_get(:\"@#{variable_name}\")) do |value, (method, args, block)|\n value.send(method, *args, &block)\n end\n end\n end",
"def batman_ironman_proc\n victor = Proc.new { return \"Batman will win!\" } # Proc returns immediately, without going back to the batman_ironman_proc method.\n victor.call\n \"Iron Man will win!\"\nend",
"def proc_factor(factor)\n Proc.new { |x| x * factor }\nend",
"def proc_return\n my_proc = Proc.new {return}\n my_proc.call\n puts \"Will this be printed (Proc)\"\nend",
"def my_map_proc(a_proc = nil)\n\t\tnew_ary = []\n\t\tif a_proc.is_a?(Proc)\n\t\t\tfor i in self\n\t\t\t\tnew_ary << a_proc.call(i)\n\t\t\tend\n\t\telse\n\t\t\tfor i in self\n\t\t\t\tnew_ary << yield(i)\n\t\t\tend\n\t\tend\n\t\tnew_ary\n\tend",
"def add(number)\n Proc.new do |num|\n number + num\n end\nend",
"def storage_proc(p)\n p.call\nend",
"def pass_proc1 (proc1, proc2, number, proc3)\n proc1.call\n proc2.call\n proc3.call \n Proc.new { puts \"#{number} procs have been passed as arguments to the currently executing method #{__method__.to_s}\" }.call\n proc5 = Proc.new {puts \"A proc can be output from a method. This is the second property of higher-order functions\"} \nend",
"def invoke; end",
"def doSelfImportantly(someProc)\n puts 'Everybody just HOLD ON! I have something to do...'\n someProc.call\n puts 'Ok everyone, I\\'m done. Go on with what you were doing.'\nend",
"def to_proc\n # Use shadows since instance_eval/exec breaks ivars.\n name, arguments = @name, @arguments\n\n Proc.new { public_send(name, *arguments) }\n end",
"def to_proc\n to_sym.to_proc\n end",
"def my_proc\n\n\tputs \"first proc\"\n\n\tproc1 = proc {\n\n\t\tputs \"second proc\"\n\t\t#breaak or return\n\n\t}\n\n\tproc1.call\n\tputs \"last proc\"\nend",
"def call(*) end",
"def call(*) end",
"def to_proc\n method(:call).to_proc\n end",
"def call_proc\n\tputs \"Before proc\"\n\tmy_proc = Proc.new { return 2 } \n\tmy_proc.call\n\tputs \"After proc\"\nend",
"def to_proc\n lambda{ call }\n end",
"def create_proc_with_return\n proc = Proc.new { return puts \"I am a proc with return\" }\n #on check on numbers of paramaters\n proc.call()\n # will not be executed!\n puts \"I am behind proc's call that with a return \"\nend",
"def be_proc(&block)\n block.call\n puts block.class\nend",
"def talk_about(name, &myproc)\n puts \"tell me about #{name}\"\n myproc.call(name)\nend",
"def procsTest\n arr = [0,1,2,19,17,3,4]\n puts arr.sort_by { |x,y| x <=> y }.to_s\n # but what if we want to reuse this sorting block ???\n sortingBlock = Proc.new { |x,y| x <=> y } # save block (object) into the variable\n puts \"---------- Proc call 1 ----------\"\n puts (arr.sort_by &sortingBlock).to_s # reuse it\n # proc IS THE SAME AS Proc.new\n selectBlock = proc { |x| (x < 2 or x > 17) or (x >= 2 and x <=3) }\n # select() method takes boolean as argument,\n # sort_by() method takes 0, 1, -1 values (equals, bigger, lesser)\n puts ((arr.select &selectBlock).sort_by &sortingBlock).to_s # reuse blocks\n puts \"--- and proc .call() \"\n puts selectBlock.call(1).to_s\nend",
"def say_hello\n Proc.new{ |times,message| message*times }\nend",
"def do_self_importantly(some_proc)\n puts \"Everybody just HOLD ON! I'm doing something...\"\n some_proc.call\n puts \"OK everyone, I am done. As you were.\" \nend",
"def take_proc(proc)\n\t[1,2,3,4].each do |number|\n\tproc.call number\n\tend\nend",
"def my_map_p(proc)\n\t\tresults = []\n\t\tself.my_each do |item|\n\t\t\tresults << proc.call(item)\n\t\tend\n\t\tresults\n\tend",
"def hola &block\n puts block.class.name #esta linea nos dice que esto es un proc\n block.call\nend",
"def do_self_importantly(some_proc)\n puts 'Everybody just HOLD ON! I have something to do...'\n some_proc.call\n puts 'Okay everyone, I\\'m done. Go on with what you were doing.'\nend",
"def talk_about(name, &myproc)\n puts \"Let me tell you about #{name}\"\n myproc.call(name)\nend",
"def do_self_importantly(some_proc)\n puts \"Everybody just HOLD ON! I have something to do...\"\n some_proc.call\n puts \"Ok everyone, I'm done. Go on with what you were doing.\"\nend",
"def my_method\n x = Proc.new{return}\n x.call\n p \"Text from within the method\"\nend",
"def warmup(prc = T.unsafe(nil), &block); end",
"def processor=(_arg0); end",
"def do_self_importantly(some_proc)\n puts \"Everybody just HOLD ON! I'm doing something...\"\n some_proc.call\n puts \"OK everyone, I'm done. As you were.\"\nend",
"def to_proc\n -> target { self.call(target) }\n end"
] | [
"0.6855848",
"0.6758657",
"0.6729047",
"0.6729047",
"0.6636546",
"0.65417796",
"0.6481292",
"0.64400357",
"0.63636404",
"0.63330483",
"0.6301346",
"0.6251738",
"0.6247141",
"0.6219427",
"0.6218368",
"0.6204301",
"0.6181915",
"0.6140355",
"0.613529",
"0.61195683",
"0.61155576",
"0.6114407",
"0.61058694",
"0.61012346",
"0.6094077",
"0.60766995",
"0.60670114",
"0.60637397",
"0.6053375",
"0.60473734",
"0.60403556",
"0.60027826",
"0.59951824",
"0.59916896",
"0.59575015",
"0.5949179",
"0.5949179",
"0.5948512",
"0.5945539",
"0.5941993",
"0.5941181",
"0.5940484",
"0.5936842",
"0.5924592",
"0.5922434",
"0.5920206",
"0.59079283",
"0.59049904",
"0.5904611",
"0.5904611",
"0.5900226",
"0.5898313",
"0.58942586",
"0.5885115",
"0.5866606",
"0.58565944",
"0.5855998",
"0.5850935",
"0.58367324",
"0.58367324",
"0.58310443",
"0.58146656",
"0.57948816",
"0.5791529",
"0.5789494",
"0.5783679",
"0.57815003",
"0.57766986",
"0.5772471",
"0.5770304",
"0.57677555",
"0.57627094",
"0.57620627",
"0.5747318",
"0.5733216",
"0.5730317",
"0.5726839",
"0.572605",
"0.5718362",
"0.57164174",
"0.57164174",
"0.5715065",
"0.5711529",
"0.5709738",
"0.57025325",
"0.5689349",
"0.56885695",
"0.5687404",
"0.56798756",
"0.56767094",
"0.5667916",
"0.5663791",
"0.5657894",
"0.5650717",
"0.56465447",
"0.56429297",
"0.5640814",
"0.5639677",
"0.5633683",
"0.5631322",
"0.5630962"
] | 0.0 | -1 |
Overwrite this method in subclasses to return the result value of this evaluation context. | def evaluation_result
raise NoMethodError, "override me in sub-classes"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluation_result\n return @evaluation_result\n end",
"def value\n @value || __eval\n end",
"def result\n @result ||= calculate_result\n end",
"def to_expr\n return self.return_value\n end",
"def evaluation_result=(value)\n @evaluation_result = value\n end",
"def evaluate\n context = Context.new(self, node)\n context.instance_exec(&block)\n node\n end",
"def result\n @@result\n end",
"def eval(context)\n # The last value evaluated in a method is the return value.\n @nodes.map { |node| node.eval(context) }.last\n end",
"def evaluate(context)\n Parser.new(@expr).parse.evaluate(context)\n end",
"def value(result)\n result\n end",
"def evaluate(*args, &block)\n self.class.evaluate(self, *args, &block)\n self\n end",
"def evaluate(value, _scope)\n value\n end",
"def eval\n yield self\n end",
"def evaluate\n\n end",
"def eval(_)\n value\n end",
"def evaluate()\n raise NotImplementedError.new\n end",
"def context_for_eval; end",
"def result\n calling_mapper.for(value.value).result\n end",
"def evaluate(&block)\n instance_eval(&block)\n end",
"def get_execution_result\n @result\n end",
"def evaluate(&block)\n if block.arity > 0\n yield self\n else\n instance_exec(&block)\n end\n end",
"def evaluated?; @__evaluated end",
"def value\n @value ||= ComputationContext.new(events).compute(&calculated_as)\n end",
"def apply_result\n return @apply_result\n end",
"def evaluate\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 7:26: a= expression EOF\n @state.following.push( TOKENS_FOLLOWING_expression_IN_evaluate_28 )\n a = expression\n @state.following.pop\n match( EOF, TOKENS_FOLLOWING_EOF_IN_evaluate_30 )\n\n # --> action\n value = a \n # <-- action\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n\n end\n\n return value\n end",
"def result\n self\n end",
"def result\n self\n end",
"def evaluate(environment)\n return @tk.value\n end",
"def evaluate(environment)\n return @tk.value\n end",
"def return_value\n @return_value\n end",
"def evaluate(&block)\n if block.arity.zero?\n instance_eval(&block)\n else\n yield(self)\n end\n end",
"def evaluate(environment)\n return @me\n end",
"def result\n @result\n end",
"def result\n operation.result\n end",
"def evaluation(input)\n operand_output = operand.call(input)\n evaluation_success(input, operand_output, !operand_output)\n end",
"def get_result\n\t\texecute unless @result\n\t\treturn @result\n\tend",
"def value\n @value ||= @block.call\n end",
"def evaluate(&block)\n self.original_self = eval \"self\", block.binding\n instance_eval &block\n end",
"def desired_result\n CodeEvaluator.evaluate(result)\n end",
"def get_return_value exp, env = nil\n process_method exp, env\n value = make_return_value\n value.original_line = exp.line\n value\n end",
"def evaluate()\n @effective\n end",
"def evaluate(scope)\n self\n end",
"def evaluator\n @evaluator ||= begin\n klass = Class.new\n klass.send :include, self\n klass.new\n end\n end",
"def value\n return @value if defined? @value\n\n result = @future_result.result\n @value = if @block\n @block.call(result)\n else\n result\n end\n end",
"def evaluate( renderstate )\n\t\tcode = [ self.name.to_s, self.methodchain ].join( '' )\n\t\treturn renderstate.eval( code )\n\tend",
"def result\n @result = yield\n end",
"def result \n @result\n end",
"def result \n return @left_operand + @right_operand\n end",
"def eval_value(*args)\n eval(*args).value\n end",
"def value\n case @value\n when Proc\n @value.call\n else\n @value\n end\n end",
"def value\n @method.call\n end",
"def value\n @value ||= rule.block ? rule.block.call(self) : to_s\n end",
"def evaluate\n raise Error::MethodShouldBeOverridenByExtendingClassError if instance_of? Operand\n super\n end",
"def eval\n @value = convert_obj(@value)\n self\n end",
"def evaluate\n super\n content\n end",
"def result\n if not_already_loaded? && any_to_load?\n lazy_results.merge!(block_results)\n lazy_values.clear\n end\n lazy_results[value]\n end",
"def force!\n return @value if defined?(@value) and @memoized\n @value = Heist.evaluate(@expression, @scope)\n end",
"def call(contract, result, context)\n Evaluator.new(contract, values: result, keys: keys, _context: context, &block)\n end",
"def evaluate(value)\n if value.is_a?(Proc)\n value.call\n else\n value\n end\n end",
"def value_if_true\n return @value_if_true\n end",
"def value\n return @val\n end",
"def result\n if @validate && validation_errors.any?\n return { \"errors\" => validation_errors }\n end\n\n @result ||= Executor.new(self, @operation_name).result\n end",
"def result(_binding=TOPLEVEL_BINDING)\n eval @src, _binding\n end",
"def result(_binding=TOPLEVEL_BINDING)\n eval @src, _binding\n end",
"def evaluate(runtime=\"0\")\n\t\t\[email protected] = BigDecimal(runtime)\n\t\t\tresult = @expression.evaluate()\n\t\t\tinitialize_solver(@expression.expressionCache)\n\n\t\t\t# Catch Not A Number or Infinite cases\n\t\t\tif(result.nan?() or result.infinite?()) then\n\t\t\t\tresult = BigDecimal(\"0\")\n\t\t\tend\n\n\t\t\treturn(result)\n\t\tend",
"def value\n return method(@value_method).call if @value_method != nil\n case @type\n when :switch\n return switch\n when :variable, :bar\n return variable\n else\n 0\n end\n end",
"def result\n end",
"def result\n Namespace.root.context.instance_variable_get(variable_name)\n end",
"def value(ext_call = true)\t\t\t\t\n\t\t@temp_stack = @stack.clone if ext_call\n\t\t# puts \"temp stack value from value: #{@temp_stack}\"\n\t\tcall_op = @temp_stack.pop\t\t\t\n\t\tif call_op == :+\n\t\t\tvalue = calc_plus\n\t\telsif call_op == :-\n\t\t\tvalue = calc_minus\n\t\telsif call_op == :*\n\t\t\tvalue = calc_times\n\t\telsif call_op == :/\n\t\t\tvalue = calc_divide\n\t\tend\n\t\treturn value\n\tend",
"def eval_return(*args)\n eval(*args).return\n end",
"def evaluate(expr)\n TupleExpression.coerce(expr).evaluate(self)\n end",
"def value\n if @continuation\n @result = @continuation.call\n @continuation = nil\n end\n @result\n end",
"def return_value; end",
"def result\n\n fields['__result__']\n end",
"def evaluate(scope, locals, &block); end",
"def v\n @v ||= operand(0).evaluate\n end",
"def result\n return @left_operand - @right_operand\n end",
"def value\n # double-checked locking is safe because we only update once\n return @value if @fulfilled\n\n @mutex.synchronize do\n unless @fulfilled\n begin\n @value = @task.call\n rescue\n @value = @default\n ensure\n @fulfilled = true\n end\n end\n return @value\n end\n end",
"def evaluation(input)\n evaluations = body.each_with_object([]) do |evaluator, aggregate|\n evaluation = evaluator.evaluation(input)\n aggregate << evaluation\n return evaluation_positive(input, aggregate) if evaluation.output\n end\n\n evaluation_negative(input, evaluations)\n end",
"def value_if_false\n return @value_if_false\n end",
"def evaluate(expr)\n @api.function_for_object_method(self, :eval).call(@session, expr)\n end",
"def value\n return method(@value_method).call if @value_method != nil\n case @type\n when :switch\n return switch\n when :variable, :bar\n return variable\n end\n end",
"def _expression\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_assignment)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_value)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_expression unless _tmp\n return _tmp\n end",
"def value\n self.lazy_proc?(@value) ? self.coerce(@value.call) : @value\n end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def value\n if @value\n @value\n else\n @value = resolve( :value )\n end\n end",
"def result(res)\n clear_eval\n puts Debugger::PROMPTS[:result] + res.to_s\n end",
"def result(res)\n clear_eval\n puts Debugger::PROMPTS[:result] + res.to_s\n end",
"def evaluate!(scope, &block)\n new(scope).evaluate(&block)\n end",
"def evaluate(scope)\n # evaluate the first operand, should return a boolean value\n lval = @lval.safeevaluate(scope)\n\n # return result\n # lazy evaluate right operand\n case @operator\n when \"and\"\n if Puppet::Parser::Scope.true?(lval)\n rval = @rval.safeevaluate(scope)\n Puppet::Parser::Scope.true?(rval)\n else # false and false == false\n false\n end\n when \"or\"\n if Puppet::Parser::Scope.true?(lval)\n true\n else\n rval = @rval.safeevaluate(scope)\n Puppet::Parser::Scope.true?(rval)\n end\n end\n end",
"def expr()\n #This is a stub, used for indexing\n end",
"def call\n eruby.result(context)\n end",
"def value\n return @updater.call(*@sources.map { |var| var.value }) if @updater\n return @value if @value\n raise \"No value or updating block set\"\n end"
] | [
"0.7553132",
"0.6969988",
"0.6875267",
"0.67620724",
"0.671921",
"0.67026365",
"0.66520625",
"0.65721554",
"0.65540594",
"0.6550486",
"0.6474332",
"0.646867",
"0.64310485",
"0.6409766",
"0.6396446",
"0.63723046",
"0.6367275",
"0.6362992",
"0.6360221",
"0.6339122",
"0.63364756",
"0.6331345",
"0.63307416",
"0.6320919",
"0.62999016",
"0.6293245",
"0.6293245",
"0.62883914",
"0.62883914",
"0.62230414",
"0.6199951",
"0.6165948",
"0.61632395",
"0.6140991",
"0.6124124",
"0.61235255",
"0.6117122",
"0.6084714",
"0.60739195",
"0.6072741",
"0.60579747",
"0.60394937",
"0.60222685",
"0.6003054",
"0.5970819",
"0.5945121",
"0.5942223",
"0.5937911",
"0.59320664",
"0.59258085",
"0.59251595",
"0.59194994",
"0.59184355",
"0.59137547",
"0.5879586",
"0.5857958",
"0.5854739",
"0.5846514",
"0.5841243",
"0.5838608",
"0.58190143",
"0.5795039",
"0.5789091",
"0.5789091",
"0.57860017",
"0.5773378",
"0.5762105",
"0.5753815",
"0.57507885",
"0.5746539",
"0.57384545",
"0.573368",
"0.5733675",
"0.57321465",
"0.57150406",
"0.57114905",
"0.5709475",
"0.57031804",
"0.5702232",
"0.5695344",
"0.56939155",
"0.56929827",
"0.56825393",
"0.5681666",
"0.5681447",
"0.5681447",
"0.5681447",
"0.5681447",
"0.5681447",
"0.5681447",
"0.5681447",
"0.5681447",
"0.5678458",
"0.56720036",
"0.56720036",
"0.56668127",
"0.5660325",
"0.5660243",
"0.56577057",
"0.56483173"
] | 0.7622572 | 0 |
Extra Credit Try writing a few of your own functions and have them return some values. You can return anything that you can put to the right of an =. | def Add_mult (a,b,c)
puts "REMEBER RIGHT TO LEFT!!, this multiples #{c} and #{b} and then adds #{a}"
a + (b * c)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_something\n x = 100\n y = 101\n z = 110\nend",
"def return_a_value\n \"Nice\"\nend",
"def metodo_con_return\n return 2 + 5\nend",
"def plus(x, y)\n z = x + y\n return z\nend",
"def method_and_value; end",
"def return_guess\n# puts \"What will be the return value here?\"\n\nend",
"def stylish_chef\n best_hairstyle = \"Guy Fieri\"\n return \"Martha Stewart\"\n \"Guy Fieri\"\nend",
"def add_two_numbers(num1, num2)\r\n puts \"OK, I'm solving your math problem!\"\r\n return num1 + num2\r\n #anything after the return keyword will not be evaluated\r\nend",
"def return_value; end",
"def f4(x)\n y = 100\n z = x + y\n return z\nend",
"def add(num1, num2)\n my_result = (num1 + num2)\n \nend",
"def square(value)\n puts value**2\n return value**2\nend",
"def add (a, b)\n answ = a + b\n puts \"Adding #{a} and #{b}...\"\n puts \"Answer is: #{answ}.\"\n return answ\nend",
"def five\n return 5 # Some people choose to use the return statement just to be clear, \n end",
"def my_method(a,b)\n return a*b\n a + b\nend",
"def add_three_again(x)\r\n new_value = x + 3\r\n puts new_value # prints returned value\r\n new_value # == return new_value; implicitly returns\r\nend",
"def addition(a, b) \n return a + b\nend",
"def addition(num_one, num_two)\n return num_one + num_two\nend",
"def beauty_hidden(honest_beauty, trust_beauty)\n puts honest_beauty\n puts trust_beauty\nend",
"def add(a, b) #a and b are the value of two number for addition\nreturn a+b\nend",
"def add(num_1, num_2)\n add = num_1 + num_2\nend",
"def extraNumber(a, b, c)\n \nend",
"def addittion(x, y)\n return (x + y)\nend",
"def returns; end",
"def return_a_value\n name = \"Austin\"\n return name\n name = \"Brian\"\nend",
"def fctReturn5\n return 5\nend",
"def add(x, y)\n return(x + y)\nend",
"def add_two(number)\n number + 2 # res of last line will be returned\nend",
"def candy(sweet)\n yellow = sweet * 1000\n blue = yellow / 100\n red = blue / 50\n return yellow, blue, red\nend",
"def add(number_one, number_two)\n return number_one + number_two\nend",
"def add(num_1, num_2)\n #your code here\n \treturn (num_1 + num_2)\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def addition(num_1, num_2)\n num_1 + num_2\n return num_1 + num_2\nend",
"def sum(a, b)\n points = 100\n return points # => Never give bottom of 'return'\n a + b + points\n puts \"This is after the expicit return statement\"\nend",
"def add (a, b) \n return a + b; \nend",
"def addition (a, b)\n a + b\nend",
"def double(val)\r\n val * 5\r\n # the return is te result of the last expression\r\n val * 2\r\nend",
"def plus(a, b)\n a + b\nend",
"def plus(a, b)\n a + b\nend",
"def add(a,b)\n return (a + b);\nend",
"def print_me_2\n \"I'm printing the return value!!!\"\nend",
"def smart(x, y)\nsum = x.to_i + y.to_i\n \"What's #{x} + #{y}? The answer is #{sum}!\"\nend",
"def score_method \r\n score = (3*$tally)+(5*$strength)+(2* $wealth)+($food)+(30*$monkills) \r\n puts \"YOUR FINAL SCORE IS #{score}.\"\r\n puts \"\\nFAREWELL.\"\r\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def add(num_one, num_two)\n return num_one + num_two\nend",
"def do_something (a,b,c)\n a ** b #bet you didn't expect that!\nend",
"def return_guess\n puts \"What will be the return value here?\"\n return \"What will be the return value here?\"\nend",
"def return_10\n return 10\nend",
"def my_math_method(num1, num2)\n number = num1 + num2\n puts number\nend",
"def return_guess\n puts 'What will be the return value here?'\nend",
"def add_three(number)\n return number + 7\n number + 12\nend",
"def add(x, y)\n puts \"The sum of x & y is: #{x} + #{y}\"\n return x + y\nend",
"def summe(a,b)\r\n a+b\r\nend",
"def plus_three(num)\n num + 3\nend",
"def add_three(number)\n number + 3\n return number + 4\nend",
"def add_two_variables()\n num1 = 3\n num2 = 4\n num1 + num2 #explicit return\n #return num1 + num2 #implicit return\n #return result\nend",
"def multiply(num1, num2)\n puts \"hey you!\"\n return 'I am cool'\n num1 * num2\nend",
"def addition(parameter1, parameter2)\n return parameter1 + parameter2\nend",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n user_input = gets.chomp.downcase\n # \"return user_input\" is implied (Ruby methods ALWAYS returns the last expression)\nend",
"def plus_one(num_2)\n return num_2 +1\n\nend",
"def my_math_method(num1, num2)\n number = num1 + num2\n puts number\nend",
"def add_explicit_return(x, y)\n return x + y\nend",
"def add(number_1, number_2)\n return number_1 + number_2\nend",
"def test(num)\n return \"cowboy bebop\", 1990, num * num * num\nend",
"def add_three(num1, num2, num3)\nreturn num1 + num2 + num3\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n#returns You have </cheese count> cheeses!\n puts \"You have #{cheese_count} cheeses!\"\n #returns You have </cracker count> boxes of crackers!\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n #returns next two lines the same, regardless of function data\n puts \"Man that's enough for a party!\"\n puts \"get a blanket.\\n\"\nend",
"def square(a) #a is the variable\n\t# is the input \n\t# the output is the LAST thing that it does - like the return in javascript\n\ta * a #so this is the last line and it becomes the output to whatever called it\nend",
"def add_num(num1,num2)\r\n return num1 + num2\r\nend",
"def total(a,b)\r\n return (a+b)\r\nend",
"def return_guess\r\n puts \"What will be the return value here?\" # puts nao retorna valor nenhum\r\n print \"Will print be any different?\"\r\nend",
"def addition(a, b)\n\treturn a + b\nend",
"def add (a, b)\n puts \"Adding #{a} + #{b}\"\n return a+b\nend",
"def add(a, b)\n puts \"#{a} + #{b}\"\n return a + b\nend",
"def add(a, b)\n puts \"#{a} + #{b}\"\n return a + b\nend",
"def add(a, b)\n puts \"#{a} + #{b}\"\n return a + b\nend",
"def my_math_method(num1, num2)\n\tanswer = num1 + num2\n\tputs \"The sum of #{num1} and #{num2} is #{answer}.\"\nend",
"def basic_calc\n\n\n print Rainbow(\"(a)\").green + \"dd, \" + Rainbow(\"(s)\").yellow + \"ubtract, \" + Rainbow(\"(m)\").red + \"ultiply, \" + Rainbow(\"(d)\").cyan + \"ivide: \"\n basic_function = gets.chomp.downcase\n print \"Enter first number: \"\n first_number = gets.chomp.to_f\n print \"Enter second number: \"\n second_number = gets.chomp.to_f\n case basic_function\n when \"a\"\n answer = first_number + second_number\n puts \"Your answer is #{answer}\"\n when \"s\"\n answer = first_number - second_number\n puts \"Your answer is #{answer}\"\n when \"m\"\n answer = first_number * second_number\n puts \"Your answer is #{answer}\"\n when \"d\"\n answer = first_number / second_number\n puts \"Your answer is #{answer}\"\n \n else\n puts \"incorrect\"\n end \ngets\nend",
"def my_math_method(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend",
"def my_math_method(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend",
"def add_two(x)\n\tx + 5\nend",
"def add(num_1, num_2)\n #your code here\n \treturn num_1 + num_2\nend",
"def print_me\n 'I\\'m printing the return value!'\nend",
"def addition(a,b)\n\ta + b\nend",
"def add(a,b)\n return a+b\nend",
"def doMath(num1, num2, operator)\n # puts \"#{num1} #{operator} #{num2} \"\n case operator\n when \"+\"\n answer = num1 + num2\n when \"-\"\n answer = num1 - num2\n when \"*\"\n answer = num1 * num2\n when \"/\"\n answer = num1 / num2\n else\n answer = nil\n end\n # puts answer\n return answer\nend",
"def calculate_answer(operator, a, b)\r\n\r\n if operator == \"add\"\r\n return result= a + b\r\n elsif operator == \"subtract\"\r\n return result = a - b\r\n elsif operator == \"multiply\"\r\n return result = a * b\r\n elsif operator == \"divide\"\r\n return result = a / b\r\n\r\n end\r\n\r\nend",
"def average_of_three2(num1, num2, num3)\n return \"potato\"\nend",
"def my_math_method(num1, num2)\n sum = num1 + num2\n\tputs \"The sum of 2 + 2 is #{sum}\"\nend",
"def addition(a, b)\n\ta + b\nend",
"def add(a, b)\n a + b; # 'return' is implicit\nend",
"def add(x, y)\n result = x + y \nend",
"def print_me\n return \"I'm printing the return value!\"\nend",
"def add(num1, num2) # def keyword is used to define a function\n return num1.to_i + num2.to_i # this function return a value\nend",
"def add(x,y)\n return x+y\nend",
"def addition(num1, num2)\n return num1 + num2\nend",
"def z(a)\n # a + a # =>\nend"
] | [
"0.6628795",
"0.64531004",
"0.6342673",
"0.6189537",
"0.60703874",
"0.606514",
"0.60595864",
"0.6055378",
"0.6016425",
"0.60072124",
"0.60071677",
"0.5995293",
"0.5990686",
"0.5975642",
"0.59693676",
"0.595011",
"0.5943823",
"0.5917932",
"0.5912468",
"0.59107715",
"0.5907008",
"0.5878136",
"0.5874061",
"0.58642054",
"0.5854954",
"0.58473873",
"0.5843463",
"0.5836849",
"0.5833649",
"0.58293813",
"0.5827985",
"0.5825527",
"0.5825527",
"0.5825527",
"0.5825527",
"0.5824518",
"0.5823872",
"0.58182746",
"0.5812054",
"0.5807758",
"0.5807459",
"0.5807459",
"0.5802926",
"0.57921505",
"0.5791907",
"0.57914466",
"0.57822335",
"0.57822335",
"0.57822335",
"0.57822335",
"0.5781098",
"0.57763606",
"0.57756627",
"0.5771116",
"0.575774",
"0.57524925",
"0.5748391",
"0.57446486",
"0.5738884",
"0.5737573",
"0.57357544",
"0.5730295",
"0.57255316",
"0.57243896",
"0.5723761",
"0.5721979",
"0.571971",
"0.5714427",
"0.571422",
"0.5713377",
"0.5711738",
"0.5698199",
"0.5691962",
"0.5691482",
"0.5690542",
"0.56825006",
"0.56803423",
"0.5679762",
"0.5679762",
"0.5679762",
"0.5670488",
"0.56653804",
"0.56599617",
"0.56599617",
"0.56577426",
"0.5656509",
"0.5653806",
"0.5651114",
"0.5649138",
"0.56438416",
"0.56376374",
"0.5634773",
"0.5634737",
"0.5632083",
"0.56312644",
"0.5631108",
"0.5630026",
"0.5621282",
"0.56202734",
"0.56202054",
"0.5619584"
] | 0.0 | -1 |
def user_username=(username) if username != nil self.user = User.find_by(username: username) end end | def user_username
if self.user != nil
self.user.username
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user\n @User = User.find_by_username(params[:username])\n end",
"def set_user\n @user = User.find(username: params[:username])\n end",
"def username= username\n\t\t\tcheck_username username\n\t\t\t@username = username\n\t\tend",
"def set_user\n @user = User.find_by(\"username = ?\", params[:username])\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def set_user\n @user = User.where(:username => params[:id]).first!\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def set_user\n @user = User.find_by(username: params[:username])\n end",
"def username=(user) #method name is username= and it takes on the user parameter and sets it equals to the username variable \n @username = user\n end",
"def username=(new_username)\n @username = new_username\n end",
"def set_user\n @user = User.where(username: params[:username]).take\n end",
"def set_user\n if !(User.where(id: params[:id]).empty?)\n @user = User.find(params[:id])\n else\n @user = User.find_by_username(params[:username])\n end\n end",
"def set_user\n if params[:username]\n @user = User.find_by!(username: params.fetch(:username))\n else\n @user = current_user\n end\n end",
"def set_user\n @user = User.find_by(username: params[:id])\n end",
"def user_name_set(name)\n self.username.set name if nil_or_empty?(username[:value])\n end",
"def update_username(username)\n @username = username\n end",
"def username=(username)\n validate_options(username: username)\n @username = username\n end",
"def username= new_username\n @username = new_username\n end",
"def set_username\n user = User.where(ipaddress: request.remote_ip).last\n if user.present?\n @user = user\n else\n username = \"User #{User.count+1}-#{DateTime.now.to_i}\"\n @user = User.create(username: username, ipaddress: request.remote_ip)\n end\n end",
"def set_user\n @user = User.includes(:country, :avatars, resources: :medium).find_by_username!(params[:username])\n end",
"def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end",
"def username=(value)\n @username = (value.nil? ? value : value.upcase)\n end",
"def user=(username)\n contact = if username.is_a?(User)\n username.id\n else\n username\n end\n @tainted = true\n end",
"def username=(un)\n self[:username] = (un.nil? ? nil : un.downcase)\n end",
"def user=(username)\n @user ? find_and_update('//apps:login', userName: [@user, username]) : create('login', username)\n\n @user = username\n end",
"def username=(value)\n write_attribute(:username, value)\n reset_persistence_token if username_changed?\n end",
"def set_user\n return @user = User.find(params[:id || :username]) unless params[:id].nil?\n new\n end",
"def blank_username\n self.username = ''\n end",
"def set_user\n @user = User.includes(:addresses).find_by_username session[:username]\n end",
"def username=(new_name)\n @username = new_name.upcase\n end",
"def username=(username)\n write_attribute(:username, username.downcase)\n end",
"def username=(username)\n write_attribute(:username, username.downcase)\n end",
"def set_username\n return if username?\n return unless email?\n\n base = email.partition('@').first.tr('.', '_')\n\n self.username = generate_username(base)\n end",
"def ensure_username\n if self.username != \"\"\n self.username \n else\n self.username = \"user#{((self.email).hash).to_s[0,6]}\"\n end\n end",
"def set_user\n @user = current_agent.users.where('users.username = ?', params[:id]).first\n end",
"def set_user\n @user = User.find(params[:user_name])\n end",
"def new_username=(value)\n @new_username = (value.nil? ? value : value.upcase)\n end",
"def username(name = nil)\n if !name then @username\n else @username = name\n end\n end",
"def sync_username\n if self.username.to_s.blank? and !self.email.to_s.blank?\n self.username = self.email\n end\n end",
"def set_user\n @user = User.find_by(name: params[:name]) || current_user\n end",
"def user_name=(name)\n self.user = User.find_or_create_by(name: name)\n end",
"def user(username = nil)\n if !username || username == @user.username\n @user\n else\n User.new(self, :username => username)\n end\n end",
"def set_user\n @user = nil\n @user = User.find(params[:user_id]) if !params[:user_id].nil?\n end",
"def set_user\n @user = User.find_by(name: params[:name])\n end",
"def set_user\n @user = params[:id].present? ? User.find(params[:id]) : User.find_by(name: user_params[:name])\n end",
"def set_user\n @user = User.find_by(username: params[:user][:username])\n session[:user_id] = @user.id\n end",
"def set_user\n @user = User.find(params[:id]) or not_found\n end",
"def set_user\n @user = User.find(params[:id]) if params[:id].present?\n return if @user.present?\n @user = user\n end",
"def set_user\n @user = User.find_by_slug(params[:id].downcase)\n end",
"def edit_username(user, username)\n manager = UserManager.new\n if manager.user_exists?(username)\n return false\n else\n manager.remove( :username => user.username )\n user.username = username\n session[\"username\"] = username\n session[\"user\"] = user\n user.save_data\n end\n end",
"def set_user_name_field(user_name)\n end",
"def set_user\n # @user = User.find_by_name create_params[:user_name]\n @user = User.find_by_name session_params[:user_name]\n end",
"def username=(value)\n write_attribute :username, value.downcase\n end",
"def fill_username_input_with(username)\n find(@username_input).set username\n end",
"def username=(value)\n\t write_attribute(:username, value.downcase)\n\tend",
"def set_user\n logger.debug(params[:id].to_i == 0)\n if params[:id].to_i != 0\n @user = User.find(params[:id])\n else\n @user = User.find_by_vanity_url(params[:id].downcase)\n end\n end",
"def set_user\n @user = User.find_by_slug(params[:id])\n end",
"def set_user\n @user = User.friendly.find_by(id: params[:id])\n @user ||= User.find_by(slug: params[:id])\n @user ||= User.find_by id: params[:id]\n end",
"def set_user\n @user = User.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @user = nil\n end",
"def set_account\n @account = Account.find_by_username(params[:username])\n end",
"def ensure_username\n return unless username.blank?\n\n self.username = email.gsub(/@.*$/, '')\n end",
"def user_name= (name)\n options = self.class.rauth_options\n name = name.strip.downcase if options[:clean_username]\n self[:user_name] = name\n end",
"def set_user\n # @user = User.find(params[:id])\n @user = User.find_by_sql(['SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1', params[:id]])[0]\n end",
"def set_user\n @user ||= User.find(params[:user_id])\n end",
"def set_user\n begin\n @user = User.find_by name: params[:id]\n rescue Mongoid::Errors::DocumentNotFound\n begin\n @user = User.find_by email: params[:id]\n rescue Mongoid::Errors::DocumentNotFound\n @user = nil\n end\n end\n end",
"def set_user\n if params[:name]\n @user = User.where(name: params[:name]).first\n else\n count = User.count\n exists = User.exists?(params[:id].to_i)\n if (params[:id].to_i <= count) and exists\n @user = User.find(params[:id])\n end\n end\n end",
"def user_as_string=(user)\n # reset both either way\n self.user_as_model = self.username = nil\n user.is_a?(::ActiveRecord::Base) ?\n self.user_as_model = user :\n self.username = user\n end",
"def set_user\n @user = User.find_by_uuid(params[:id])\n @user ||= User.find(params[:id])\n end",
"def set_user\n @user = User.find_by_token!(params[:id])\n end",
"def set_user\n @user = if params[:user_id].nil?\n User.find(params[:id])\n else\n User.find(params[:user_id])\n end\n end",
"def username\n username = user.username\n end",
"def set_user\n @user = User.select('first_name, last_name, email, username, id').find(params[:id])\n end",
"def user_as_string=(user) #:nodoc:\n # reset both either way\n self.user_as_model = self.username = nil\n user.is_a?(ActiveRecord::Base) ?\n self.user_as_model = user :\n self.username = user\n end",
"def set_user\n if params[:user_id]\n @user = User.find_by(slug: params[:user_id])\n elsif params[:id]\n @user = User.find_by(slug: params[:id])\n end\n end",
"def set_user\n @user = User.find(session[:id]) if @user.nil && session[:id]\n end",
"def set_user\n if User.exists?(params[:id].to_i)\n @user = User.find(params[:id])\n end\n end",
"def set_user\n user_id = params['user_id']\n @user = user_id ? User.find(user_id) : User.find(1)\n end",
"def set_user; end",
"def set_user\r\n @user = User.find(params[:user_id])\r\n end",
"def set_user\n @user = User.find(user_id)\n end",
"def set_user\n if params[:user_id].blank?\n @user = User.find(params[:id])\n else\n @user = User.find(params[:user_id])\n end\n end",
"def set_user\n @user = User.find(params[:id]) || User.find(params[:user_id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n if @user.blank?\n res_not_found(:user)\n end\n end",
"def set_user\n if session[:user_id].nil?\n @user = nil\n else\n @user = User.find(session[:user_id])\n end\n end",
"def set_field\n @user = User.find(params[:id])\n end",
"def set_user\n @user = User.find(params[:user_id])\n end",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def set_user\n\t\t@user = User.find(params[:id])\n\tend",
"def user=(user)\n self.email = user.email\n self.name = user.name\n end",
"def set_user\n \t@user = User.new\n end",
"def username=(s)\n write_attribute(:username, s.to_s.strip.sub(/^@/, '').downcase)\n end"
] | [
"0.8444221",
"0.8411429",
"0.84073454",
"0.8396008",
"0.83611816",
"0.830984",
"0.82962525",
"0.82962525",
"0.8292394",
"0.82283586",
"0.8216151",
"0.8213223",
"0.8186529",
"0.80877125",
"0.79969746",
"0.7985642",
"0.79478276",
"0.7946476",
"0.7933914",
"0.7908043",
"0.7855546",
"0.7855546",
"0.78307265",
"0.77170146",
"0.7615788",
"0.75722504",
"0.75703907",
"0.7568302",
"0.754865",
"0.7506398",
"0.7498074",
"0.7498074",
"0.7480896",
"0.7476186",
"0.74650973",
"0.746404",
"0.7437688",
"0.7431893",
"0.74020326",
"0.7399922",
"0.73823524",
"0.7374482",
"0.73672587",
"0.73194903",
"0.7312363",
"0.7308004",
"0.72591347",
"0.7238034",
"0.7214896",
"0.7207807",
"0.7188093",
"0.7183731",
"0.71825624",
"0.71784955",
"0.7173226",
"0.7173102",
"0.7171721",
"0.716079",
"0.71372306",
"0.7131803",
"0.712642",
"0.71178746",
"0.7102831",
"0.7101381",
"0.7089327",
"0.7081405",
"0.70793515",
"0.7075095",
"0.70686483",
"0.7058847",
"0.705574",
"0.70532626",
"0.705017",
"0.7048634",
"0.7044269",
"0.7042618",
"0.70425254",
"0.7040457",
"0.70401603",
"0.7036368",
"0.7033175",
"0.70300525",
"0.702707",
"0.7021383",
"0.7010759",
"0.7010137",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.7001288",
"0.70002455",
"0.699988",
"0.699719"
] | 0.0 | -1 |
displays the page of current user or the user being viewed | def show
@currentUser= User.find_by_id(session[:remember_token])
@dreamlist = Dream.all
@likeList = Like.all
@requestlist = Array.new
@requestlist = Request.find_all_by_target_id(@currentUser.id)
@user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile\n if(current_user)\n render 'layouts/loggedin'\n else\n render \"layouts/guest\"\n end\n end",
"def index\n if current_user\n render_home_page\n else\n render_welcome_page\n end\n end",
"def show\n redirect_to(default_url) unless logged_in? || User.count > 0\n @user = current_user\n end",
"def show\n unless @user\n render 'not_found_page'\n end\n end",
"def show\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end",
"def show\n\n @user = User.get(params[:id])\n \n if signed_in? && @user.id == current_user.id\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'user'\n else\n redirect_to '/'\n end\n end",
"def show\n update_navbar(@user)\n # 是访客而非页面的主人\n if session[:user_id] != params[:id].to_i\n @user.is_visitor = true\n else\n @user.is_visitor = false\n # 个人主页三大功能之一:创建新的任务\n @mission = Mission.new\n @mission.user_id = session[:user_id]\n @mission.user_token= session[:user_id]\n end\n\n render\n end",
"def profile\n\t@user = current_user\n\t@title = \"This is your profile page\"\n end",
"def show\n @user = User.find(params[:id]) # Find user's page to render\n end",
"def landing_page\n if current_user\n redirect_to actions_path(current_user[:id])\n end\n end",
"def show\n\t\t@user = current_user\n\tend",
"def show\n if @user.id != session[:user_id]\n redirect_to '/', flash: {error: \"You do not have access to this page\"}\n end\n end",
"def home_page\n if current_user.guest?\n user_signup_url\n elsif current_user.administrator?\n admin_films_path\n elsif current_user.judge?\n judging_categories_path\n else\n obejct_url current_user\n end\n end",
"def show\n\t\t@user = current_user\n\t\trender_wizard\n\tend",
"def profile\n @user = @current_user\n\n render :show\n\n end",
"def show\n @user=current_user\n end",
"def show\n # @u = current_user\n end",
"def show\n @user = User.find(params[:id])\n \n # A user cant edit or access another users page\n unless session[:user_id] == @user.id && [email protected]\n flash[:danger] = \"You don't have access to that page!\"\n redirect_to root_url\n end\n end",
"def show\n if !current_user || current_user.status != \"1\"\n redirect_to new_user_session_path\n end\n end",
"def show\n @user = User.find(params[:id])\n\n if @user.state != 'active' or @user.login == 'admin'\n return redirect_to users_path\n end\n \n @page_ancestors = [{:name=>'Community', :url=> users_path}]\n @bc_title = 'User Profile'\n \n respond_to do |format|\n format.html # show.html.erb\n format.iphone\n format.xml { render :xml => @user }\n end\n end",
"def show\n render :show, layout: 'userpage'\n\n end",
"def show\n\n @user = User.get(params[:id])\n \n if admin_signed_in?\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'admin/users/user'\n else\n redirect_to '/'\n end\n end",
"def show\n redirect_to user_articles_path(@user) unless @user == @current_user\n end",
"def index\n if current_user.type == \"Passenger\"\n render :layout => 'passenger'\n elsif current_user.type == \"Driver\"\n render :layout => 'driver'\n elsif current_user.type == \"Company\"\n render :layout => 'company'\n end \n\tend",
"def show\n #@user=current_user\n end",
"def show\n self.current_user\n \n if not @current_user\n redirect_to login_path\n else\n render :action => 'edit'\n end\n end",
"def user_information\n @current_user = current_user\n\n render :partial => 'home/user_info'\n end",
"def show\n if current_user.nil?\n redirect_to '/'\n end\n end",
"def about\n\t\t@user = current_user\n\tend",
"def me\n @user = current_user\n render \"show\"\n end",
"def show\n respond_to do |format|\n if (current_user.is_admin?)\n @user = current_org.users.find(params[:id])\n format.html\n else\n if (current_user.id != params[:id].to_i)\n format.html { redirect_to user_path(current_user.id) }\n else\n @user = current_user\n format.html\n end\n end\n end\n end",
"def show\n @user = current_user\n respond_to do |format|\n format.html # show.html.slim\n end\n end",
"def show\n\t if !current_user #if no current user, default to the \"register new user\" page\n\t \t@user = User.new\n\t \trender :action => 'new_user'\n\t \treturn\n\t end\t \n\tend",
"def members_page(user)\n\t\tcurrent_user?(user) && !current_user.guest?\n\tend",
"def show\n require_user()\n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end \n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end\n end",
"def show\n @user = current_user\n end",
"def link_to_profile_if_logged_in_else_community\n\t\tif current_user && !current_user.guest?\n link_to content_tag(:li, current_user.fullname), user_path(current_user.id) \n else \n link_to content_tag(:li, \"Community\"), users_path \n end \n\tend",
"def index\n \tif current_user\n\t\tredirect_to home_profile_path\n\tend\n end",
"def current_user_link\n view_context.link_to current_user.name, current_user_url\n end",
"def show\n @user = get_user_or_current_user(params[:id])\n @is_current_user = (@user.id == current_user.id)\n end",
"def show\n user = User.find(current_user.username)\n redirect_to user_path(user)\n end",
"def show\n if params[:id]\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n \n if @user == current_user\n render :show_full\n else\n render :show\n end\n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end \n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end \n end",
"def show\n if session[:user_name].nil?\n redirect_to welcomes_path\n end \n end",
"def show\n if current_user.is_normal?\n @user = User.find( params[:id] )\n render :profile\n else\n redirect_to user_profile_path\n end\n end",
"def home\n if logged_in?\n redirect_to user_path(current_user) # Redirect to user show page if logged in\n else\n render layout: 'welcome' # Render home view with welcome layout\n end\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n @user = current_user\n end",
"def show\n load_user\n return if (@user.blank?)\n\n respond_to do|format|\n format.html\n end\n end",
"def show\n login\n render view_for_user\n end",
"def show\n if current_user.application == @application or current_user.is_admin?\n redirect_to user_path(@application.user)\n else\n redirect_to root_path\n end\n end",
"def index\n # If someone is signed in on the browser\n if signed_in?\n # Take the user to their profile page\n redirect_to \"/#{@current_user.name}\"\n # Abort execution\n return\n end\n \n # Don't use an application layout.\n render layout: false\n end",
"def show\n redirect_user\n end",
"def show\n if !current_user.isAdmin? and current_user.id != @user.id\n redirect_to user_path(current_user.id)\n end\n end",
"def show\n #here e find the user by its id to display its information. However, we need to impede users without\n # admin privileges to see other users information.\n #so first we check if someone is logged.\n unless current_user.nil?\n #if someone is logged we need to check if the logged user if admin.\n if current_user.admin?\n #if the user is admin we allow finding a user by its id.\n @user = User.find(params[:id])\n #if the logged user is not admin we add the current user in the variable @user, so the show view\n # will display only the current user information.\n else\n @user = current_user\n end\n end\n end",
"def show\n if Gluttonberg::Member.enable_members == true\n return unless require_member\n unless current_member.does_member_have_access_to_the_page?(page)\n raise CanCan::AccessDenied\n end \n end\n \n template = page.view\n template_path = \"pages/#{template}\"\n \n if File.exists?(File.join(Rails.root, \"app/views/pages/#{template}.#{locale.slug}.html.haml\" ) )\n template_path = \"pages/#{template}.#{locale.slug}\"\n end \n \n # do not render layout for ajax requests\n if request.xhr?\n render :template => template_path, :layout => false\n else\n render :template => template_path, :layout => page.layout\n end\n end",
"def show\n @user = User.find(params[:id])\n # show me the user page\nend",
"def user_nav\n if @current_user\n items = {'Home' => root_path, 'My Account' => account_path, 'My Submissions' => current_user_submissions_path}\n else\n if ApplicationSettings.config['user_registration']\n end\n items = {'Home' => root_path, 'Signup' => signup_path}\n end\n output_nav(items)\n end",
"def show\n if current_user.id == @user.id || is_admin?\n respond_to do |format|\n\n format.js { render partial: 'show_local',\n locals: {user: @user, current_page: @current_page},\n layout: false }\n format.html # show.html.erb\n format.json # show.json.builder\n format.xml { render :xml => @user.to_xml }\n end\n else\n #indicate_illegal_request I18n.t('users.not-your-account')\n indicate_unauthorised_request I18n.t('users.not-your-account')\n end\n end",
"def show_user\n if user_signed_in?\n container = %()\n container << \"<div id='navTop'>\"\n container << \"<div id='tools'>\"\n if flash[:notice]\n container << \"<div class='information'>\"\n container << \"<span id='notice'><span> </span><h1>#{flash[:notice]}</h1></span>\"\n container << \"</div>\"\n end\n container << \"<div class='logged'>\"\n container << \"<span>#{image_tag avatar_url(current_user)}</span>\"\n container << \"<div>\"\n container << \"<h2>#{current_user.name}</h2>\"\n container << \"</div>\"\n container << \"<ul>\"\n container << \"<li>#{link_to('sair do sistema',destroy_user_session_path,:method => :delete,:title => 'efetuar logout')}</li>\"\n container << \"<li>.</li>\"\n container << \"<li>\"\n container << link_to('meus dados',\"javascript:createSearchPopup('/admin/users/#{current_user.id}',740,500);\",:title => 'ver meus dados')\n container << \"</li>\"\n container << \"</ul>\"\n container << \"</div>\"\n container << \"</div>\" #tools\n container << \"<span class='clear'> </span>\"\n container << \"</div>\" #navTop\n end\n container.html_safe\n end",
"def show \n # DIY Authorization\n @some_user = User.find(params[:id]) \n # ^ so users can't access eachothers show page by changing the URL :id\n\n if @some_user.id != session[:user_id]\n redirect_to '/' \n else \n # assign current_user(from AppController) to the instance vari @user\n @user = current_user # looks them up by session[:user_id]\n end\n end",
"def show\n _endpoint \"view?\" do |ctx, seq:, **|\n render \"success\" + ctx[:current_user] + seq.inspect\n end\n end",
"def page_view(title, page, utmhid = random_id)\n check_account_params\n hey(page_view_params(title, page, utmhid))\n end",
"def show\n @user = User.find(params[:id])\n unless @user == current_user\n redirect_to :back, :alert => \"Access denied\"\n end\n end",
"def home\n if current_user\n redirect_to '/dashboard'\n else\n render 'home'\n end\n end",
"def show\n @user = current_user\n render_wizard\n end",
"def show\n @user = current_user\n render_wizard\n end",
"def show\n @user = current_user\n render_wizard\n end",
"def index\n return check_logged_in unless current_user\n @pages = current_user.pages\n end",
"def show\n if current_user && current_user.admin?\n else\n #flash[:notice] = \"No such page exists\"\n redirect_to new_sponsorship_path\n end \n end",
"def show\n render \"recieved\" if !current_user\n end",
"def show\n @page = Page.find_by_permalink(params[:id]) or current_user ? redirect_to(action: :new, id: params[:id]) : redirect_to(root_url, flash: {alert: \"Page not found\"})\n end",
"def home\n if user?\n @fullname = current_user.full_name\n else\n @fullname = \"Not logged in...\"\n end \n end",
"def show\n @user = User.find(params[:id])\n if current_user != @user\n redirect_to @user\n end\n end",
"def check_if_current_user_page\n redirect_to('/') and return unless (current_user.id == User.from_param(params[:id])) || current_user.is_admin?\n end",
"def show\n if logged_in?\n @user = current_user\n render 'show'\n else\n render json: {}, status: 200\n end\n end",
"def view\n\t\t\tparams[:id] ||= current_user.id\n\t\t\tbegin\n\t\t\t\t@user = User.find(params[:id])\n\t\t\trescue\n\t\t\t\tredirect_to '/'\n\t\t\tend \n\t\tend",
"def logged_in_or_invited_layout\n logged_in? ? \"logged_in\" : \"front\"\n end",
"def show\n @user = User.find(params[:id])\n unless current_user.admin?\n unless @user == current_user\n redirect_to :back, :alert => \"Access denied.\"\n end\n end\n end",
"def current_user_url\n view_context.user_url(current_user)\n end",
"def show\n # Can only view page if you are an admin or the logged in user\n if current_user && (current_user.admin || current_user.id.to_f == params[:id].to_f)\n else\n redirect_to current_user\n end\n end",
"def show\n # binding.pry\n if session[:user_id] && session[:user_id] == params[:id].to_i\n render :show\n else\n redirect_to '/'\n end\n end",
"def url_for_user_show(user)\n if logged_in?\n return url_for user_path(user)\n else\n return url_for login_path\n end\n end",
"def show\n drop_breadcrumb(\"用户管理\",users_path)\n drop_page_title(\"用户详情\")\n drop_breadcrumb\n end"
] | [
"0.75281733",
"0.727853",
"0.7238252",
"0.7199717",
"0.71333027",
"0.7075708",
"0.7044425",
"0.6983534",
"0.6952598",
"0.6943665",
"0.69023",
"0.689972",
"0.68532753",
"0.6814814",
"0.6782111",
"0.6758511",
"0.6751849",
"0.6748803",
"0.6732889",
"0.6729591",
"0.6721392",
"0.67108786",
"0.67020124",
"0.6699165",
"0.6698851",
"0.66947234",
"0.6694195",
"0.66931677",
"0.66909075",
"0.6687178",
"0.6683047",
"0.6683002",
"0.6671915",
"0.66684985",
"0.6663608",
"0.6649777",
"0.66483253",
"0.6643321",
"0.6636128",
"0.66328937",
"0.66312015",
"0.6624749",
"0.66157806",
"0.6613239",
"0.6611951",
"0.6611951",
"0.6611951",
"0.6609946",
"0.6591856",
"0.65913934",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.6591159",
"0.65898085",
"0.65831274",
"0.65821743",
"0.6578684",
"0.6578493",
"0.6573424",
"0.6540401",
"0.6537066",
"0.6528027",
"0.6525094",
"0.6521407",
"0.65126836",
"0.65037805",
"0.64931417",
"0.64739895",
"0.6467828",
"0.64618784",
"0.64555466",
"0.64507264",
"0.64507264",
"0.64507264",
"0.6446897",
"0.64423627",
"0.64415944",
"0.6432563",
"0.6432488",
"0.64254504",
"0.641032",
"0.6409862",
"0.64078087",
"0.6403744",
"0.63982886",
"0.63975537",
"0.6396921",
"0.639237",
"0.6388374",
"0.638692"
] | 0.0 | -1 |
GET /users/new GET /users/new.json | def new
@user = User.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end",
"def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end",
"def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end",
"def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end"
] | [
"0.8287397",
"0.8169197",
"0.8155916",
"0.80483407",
"0.8022376",
"0.8021751",
"0.8009459",
"0.7950995",
"0.793078",
"0.793078",
"0.7873476",
"0.7873476",
"0.7873476",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956",
"0.7860956"
] | 0.0 | -1 |
validates parameters of a new signup form and stores the user in the table a user must have a name, email, password and optionally a picture | def create
@user = User.new(params[:user])
if not_sensitive(params[:user][:name]) #1 if - start
if verify_recaptcha(request.remote_ip, params)[:status] == 'false' #2 if - start
@notice = "captcha incorrect"
respond_to do |format|
format.html { render :action => "new" }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
else #2 if - else: captcha right, go on
if @user.save! #3 if -start
@pic = Pic.new(:user_id => @user.id, :url => "../images/default.gif" )
@pic.save!
redirect_to :controller => 'sessions', :action => 'new'
else #3 if - else: user is not saved in the db for some reason, explore why
if User.find_by_email(@user.email) != nil
flash.now[:error1]= "*User email already exists."
end
if @user.name == nil or @user.email == nil or @user.password == nil or @user.password_confirmation == nil
flash.now[:error2]= "*Info not correct! Make sure you your filled up all the info."
end
if @user.password_confirmation != @user.password
flash.now[:error3]= "*Password and confirmation don't match."
end
if @user.check == 0
flash.now[:error3]= "*You need to agree to the Website's policies to register."
end
render'new'
end #3 end
end #2 end
else #1 else
flash.now[:error3]= "*Please don't use names that could cause confusion :P sorry."
render'new'
end #1 end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @user = User.new(params.require(:user).permit(:first_name,:last_name,:email,:password,:password_confirmation,:profile_pic))\n if @user.save\n redirect_to '/mainpage'\n else\n redirect_to '/signup' \n end\n end",
"def signup(params)\n begin\n # This is a object of User model\n user = User.new\n\n if all_params_present(params[:first_name], params[:last_name], params[:sex], params[:date], params[:email], params[:password])\n presentable_error_response('BLANK_USER_DATA')\n end\n presentable_error_response(\"USER_ALREADY_EXISTS\") if user.find_email(params[:email])\n unless(params[:password].to_s.length > 7 && params[:password].to_s.length < 21)\n presentable_error_response(\"WRONG_PASSWORD_LENGTH\")\n end\n presentable_error_response(\"WRONG_GENDER_FORMAT\") unless is_valid_gender(params[:sex])\n presentable_error_response(\"WRONG_DATE_FORMAT\") unless is_valid_date(params[:date])\n\n user.create(params[:first_name], params[:last_name], valid_sex(params[:sex]), params[:date], params[:email], params[:password])\n\n return prepare_success_response({message: SUCCESS_MESSAGES['USER_CREATED']})\n rescue DataBaseException => e\n presentable_error_response('INTERNAL_ISSUE')\n end\n end",
"def signup!(params)\n self.email = params[:user][:email]\n self.name = params[:user][:name]\n self.password = params[:user][:password]\n #save_without_session_maintenance\n end",
"def sign_up_params\n params.require(:user).permit(:name, :email, :password, :uid, :provider, :avatar)\n end",
"def create\n @user = User.create(user_params)\n if @user.valid?\n @user.save\n redirect_to @user\n else\n flash[:alert] = \"The information you entered was invalid.\" \n redirect_to signup_path\n end\n end",
"def sign_up_params\n params.require(:user).permit(:email, :password, :password_confirmation, :role, :bio, :username, :profile_photo)\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :avatar, :last_name, :display_name, :gender, :phone, :email, :password, :password_confirmation, )\n end",
"def sign_up_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation, :images, :isHost, :isCandidate)\n end",
"def sign_up\n user = User.new(user_params); user.id = SecureRandom.uuid # genrating secure uuid token\n if user.save\n image_url = \"\"\n image_url = url_for(user.profile_photo) if user.profile_photo.attached?\n render json: { email: user.email, first_name: user.first_name, last_name: user.last_name, profile_photo: image_url, \"UUID\" => user.id, \"Authentication\" => user.authentication_token }, status: 200\n else\n render json: user.errors.messages, status: 400\n end\n rescue StandardError => e # rescue if any exception occurr\n render json: { message: \"Error: Something went wrong... #{e}\" }, status: 400\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def create\n @user = User.create(user_params)\n unless @user.errors\n redirect_to :signup_success\n else\n render :new\n end\n\n end",
"def register\n #Variable setting\n email = params[:user][:email]\n pw = params[:user][:password]\n pw_confirm = params[:user][:password_confirmation]\n debateName = params[:user][:debateName]\n firstName = params[:user][:firstName]\n lastName = params[:user][:lastName]\n age = params[:user][:age]\n gender = params[:user][:gender]\n location = params[:user][:location]\n about = params[:user][:about]\n\n #user instance we are trying to register\n @user = User.new(:debateName => debateName, :email => email, :password => pw, :password_confirmation => pw_confirm, :firstName => firstName, :lastName => lastName, :age => age, :gender => gender, :admin => false, :avgDuration => 0, :numDebates => 0, :upvotes => 0)\n\n @user.about = about\n @user.location = location\n\n #Does the new user pass validations?\n if @user.valid?\n @user.updateDebateRank\n f = File.new(\"public/blank_profile.png\")\n @user.photo = f\n f.close\n @user.save\n session[:user_id] = @user.id\n redirect_to :controller => :users, :action => :home\n else\n flash[:register_error] = @user.errors\n @user = User.new\n render :index\n end\n end",
"def signup\n if params[:user]\n if User.exists?(id: params[:user_id])\n #check if the user already exists in database\n flash[:notice] = \"User already exists. Please log in\"\n redirect_to root_path()\n else\n auth_user\n end\n else\n auth_user\n end\n \n end",
"def signup\n\n\t\temail = params[:email] # Extract the email from the params of the signup form\n\t\ttimezone = params[:timezone] # Extract the timezone from the params of the signup form\n\n\t\t@url = uniqueUrlKeyGenerator # Generate a unique url key\n\t\told_user = User.find_by_email(email)\n\n\t\t# If user exists\n\t\tif !old_user.nil?\n\t\t # If user is not registered\n\t\t if !old_user.registered?\n\t\t # Send welcome email again and save him\n\t\t old_user.sendWelcomeEmail\n\t\t old_user.save\n\t\t end\n\t\tend\n\n\t\t# Find the user in the user db with the same email as extracted in the params\n\t\tcheck_users = User.find_by_email(email)\n\n\t\t#create a new PotentialUser object with the extarcted email, timezone and url key\n\t\tuser = User.new(email: email, url: @url, timezone: timezone, day: 1, registered: false)\n\n\t\t# If no such user exists\n\t\tif check_users.nil?\n\n\t\t#If the new user is valid and can be saved\n\t\t if user.save\n\t\t user.sendWelcomeEmail\n\t\t @title = \"Thank you for signing up\"\n\t\t @result = \"A confirmation email with instructions has been sent to you\"\n\t\t @result2 = \"Your unique access key is: \" + @url\n\n\t\t#If not valid\n\t\t else\n\t\t #Set @result as the error message\n\t\t @title = \"Looks like something went wrong ...\"\n\t\t @result = \"Email #{user.errors[:email][0]}.\".html_safe\n\t\t end\n\n\t\t#User by this email already exists\n\t\telse\n\n\t\t if !check_users.registered?\n\t\t\t # Result instance variable for the view\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists, but we sent another confirmation email just in case\"\n\t\t\t else\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists\"\n\t\t end\n\n\tend\n\n\t\t# Respond to only javascript, set for AJAX\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def create\n # have name, email, password that person wants to use user_params\n # user model:\n # validate that username is unique (can add in User model)\n # validate against other criteria for user names (can't have a one-letter username, language filter)\n # create obscured version of password with BCrypt::Password.create\n # attempt to save user in database with username, password obscured version of password from the form\n user = User.new(user_params)\n if user.save\n # if user saves properly:\n \t# TODO: redirect to a user created page with instructions for email confirmation\n # log user in\n session[:user_id] = user.id\n \t# redirect to home / success\n redirect_to \"/\"\n else\n # if user does not save:\n \t# flash error message (with specifics!)\n flash[:errors] = user.errors.full_messages.join(\" \")\n \t# redirect to sign up form (/users/new)\n redirect_to signup_path\n end\n\n end",
"def create\n user = User.create(\n username: params[:username],\n email: params[:email],\n bio: params[:bio]\n )\n if user.errors.any?\n @errors = user.errors\n render :new\n else\n redirect_to root_path\n end\n end",
"def registration\n \tif request.post?\n user = User.new(user_params)\n if user.valid?\n user.save\n flash[:notice] = \"Registration Successful. Please Sign In!\"\n redirect_to root_url\n else\n flash[:alert] = user.errors.first[1]\n redirect_to users_registration_url\n end\n \tend\t\n end",
"def create\n @user = User.new(user_params)\n\n # Check if valid user params\n if @user.save\n # Log in user\n log_in_user!(@user)\n # Go to a new load of the signup page\n redirect_to new_user_url\n else\n # if bad user_params\n flash.now[:errors] = @user.errors.full_messages\n # render the same signup page\n render :new\n end\n end",
"def create_form\n @user = User.new(user_params)\n # save profile image\n if user_params.has_key?(:profile)\n dir = \"#{Rails.root}/app/assets/profiles/\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profilename = user_params[:name]+ \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') + \".\" + ActiveStorage::Filename.new(user_params[:profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f|\n f.write(user_params[:profile].read)\n end\n @user.profile = profilename\n end\n\n unless @user.valid?\n render :new\n else\n redirect_to :action => \"create_confirm\", name: @user.name, email: @user.email, password: @user.password, password_confirmation: @user.password_confirmation, role: @user.role, phone: @user.phone, dob: @user.dob, address: @user.address, profile: @user.profile\n end\n end",
"def signup_step1\n unless defined? params[:signup_email] or params[:signup_password]\n flash[:error] = \"Fields can't be blank !\"\n render :js => form_err_js(:signup_email, \"Please put your email and password. Fields can't be blank !\")\n else\n\n @email = params[:signup_email] if defined? params[:signup_email]\n @password = params[:signup_password] if defined? params[:signup_password]\n\n if defined? params[:type]\n case params[:type]\n when 'Student'\n @user = Student.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Teacher'\n @user = Teacher.create(:email => @email, :password => @password, :password_confirmation => @password)\n when 'Coach'\n @user = Coach.create(:email => @email, :password => @password, :password_confirmation => @password)\n end\n redirect_to root_path, notice: \"Please check your Inbox for Account Confirmation Mail!\" if @user\n end\n end\n end",
"def signup!(params)\n self.login = params[:user][:login]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end",
"def signup\n @user = User.new(params[:user])\n return unless request.post?\n if @user.save\n flash[:notice] = \"New user added!\"\n redirect_to :action=>'show', :id=>@user\n end\n end",
"def create\n @user = User.new(fname: params[:user][:fname], lname: params[:user][:lname], username: params[:user][:username], password: params[:user][:password], email: params[:user][:email])\n if @user.save\n flash[:notice] = \"You are now part of the club!!\"\n redirect_to root_path\n \n else\n flash[:notice] = \"There was an error creating your account.\"\n end\n end",
"def signup!(params)\n self.login = params[:user][:login]\n self.email = params[:user][:email]\n generate_temporary_password!\n save_without_session_maintenance\n end",
"def create\n \t@user = User.new(user_params)\n\n # save user data\n if @user.save\n redirect_to new_session_path\n else\n flash.keep[:error] = \"Email address already taken.\" # check if email is already taken\n redirect_to new_user_path\n end\n end",
"def sign_up_params\n params.require(:user).permit(:firstName, :email, :password, :password_confirmation, :lastName, :gender, :age, :bio, :username)\n end",
"def create\n @user = User.new(user_params)\n\n # Ensure the email addres is not a duplicate\n # If blank? returns true, then there is no user in the\n # database that has the same email as the user being created\n if User.where(email_address: @user.email_address).blank?\n if @user.save\n init_recur_plates @user # Setup recurring plate entry\n log_in @user # log in user right after sign up\n flash[:success] = 'Welcome to the LatePlate-o-Tron 3000!'\n redirect_to user_url(@user) # handle successful signup\n else\n render 'new'\n end\n # Make the user retry if the email is already being used\n elsif !User.where(email_address: @user.email_address).blank?\n flash[:danger] = 'A user with this email address already exists!'\n redirect_to root_url\n end\n end",
"def user_params\n params.permit(:name, :password, :email, :picture_url)\n end",
"def create #sign up button\n @user = User.new(user_params)\n if @user.save\n login(@user)\n redirect_to user_url(@user)\n else\n flash.now[:errors] = @user.errors.full_messages\n render :new\n end\n end",
"def sign_up_params\n\t\tparams.require(:user).permit(:firstname, :lastname, :age, :email, :password, :password_confirmation)\n\tend",
"def user_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :picture) #password?\n end",
"def create\n @user = User.new(user_params)\n @user.save\n if @user.save\n redirect_to root_path, :notice => \"Signed up!\"\n else\n redirect_to signup_path\n end\n end",
"def create \n\t\t@user=User.new\n\t\[email protected]=\"native\"\n\t\[email protected]_attributes(signup_params)\n\t\[email protected]!\n\t\tflash[:success]=\"Thanks for joining SPACEF!T, #{@user.name ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\[email protected](\"@\").first }. \"\n\t\tsign_in!(@user, true)\n\t\tredirect_to root_path\n\trescue ActiveRecord::RecordInvalid,\n\t\t\t\t\tActiveRecord::RecordNotUnique => e\n\t\tflash.now[:error]=\"We were not able to sign you up, please correct the following fields\"\n\t\[email protected]\n\t\trender 'new'\n\tend",
"def sign_up_params\n params.require(:user).permit(:email, :password, :password_confirmation, :first_name, :last_name)\n end",
"def create\n @user = User.new user_params #authenticating the user's information. fill in the db with these values.\n if @user.save #if it saves,\n redirect_to \"/users/#{ @user.id }\" #redirect to their profile page\n else\n render :new #if not new form.\n end\n end",
"def create\n\t\t@user = User.new(user_params)\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\t\t\t\[email protected]_activation_email\t\n\t\t\t\tformat.html {redirect_to root_url, notice: \"Thank you for signing up! You will have received a confirmation link in your email shortly which you must click before posting.\"}\n\t\t\t\t#Create User Profile on Successful User Save\n\t\t\t\[email protected]_profile(location: \"Add your location here.\", occupation: \"Add your occupation here.\", about_me: \"Write a little bit about yourself here!\", image_url: \"Add a link to a profile image here\")\n\t\t\telse\n\t\t\t\tformat.html { redirect_to signup_path, notice: \"Please enter a valid e-mail address and a matching password and password confirmation. Your password must contain 8 or more characters, a digit (0-9), at least one lower case character, at least one upper case character, and a symbol.\"}\n\t\t\tend\n\t\tend\n\tend",
"def create\n if params[:user][:email].nil?\n render :status => 400,\n :json => {:message => 'User request must contain the user email.'}\n return\n elsif params[:user][:password].nil?\n render :status => 400,\n :json => {:message => 'User request must contain the user password.'}\n return\n end\n\n if params[:user][:email]\n duplicate_user = User.find_by_email(params[:user][:email])\n unless duplicate_user.nil?\n render :status => 409,\n :json => {:message => 'Duplicate email. A user already exists with that email address.'}\n return\n end\n end\n\n @user = User.create(sign_up_params)\n\n if @user.save\n render(status: 200, json: {message: \"User Successfully Created\"})\n else\n render :status => 400,\n :json => {:message => @user.errors.full_messages}\n end\n end",
"def signup_params\n params.permit(:email, :password, :name)\n end",
"def user_params\n params.require(:user).permit(:username, :email, :password, :picture)\n end",
"def sign_up_params\n # debugger\n params.require(:user).permit(:firstname,:lastname ,:email,:password,:phone,:address,:avatar)\n\n end",
"def create\n logout_keeping_session!\n @user = User.new(params[:user])\n @user.state = 'active'\n# @user.profile ||= {}\n# @user.profile.symbolize_keys!\n# if session[:captcha].upcase != params[:captcha].upcase\n# flash[:error] = '验证码错误'\n# return render( :action => 'new')\n# end\n# @user.register! if @user && @user.valid?\n @user.save if @user && @user.valid?\n success = @user && @user.valid?\n\n if success && @user.errors.empty?\n redirect_back_or_default('/')\n flash[:notice] = I18n.t('thanks_for_signing_up')\n else\n flash[:error] = I18n.t('cannot_set_up_account')\n render :action => 'new'\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"You have successfully created a new user\"\n redirect_to home_path\n else\n render :signup\n #we explicitly choose to render the signup page rather than redirecting because we don't want to show errors in a flas message - it'd be too long\n #when we render it again it's storing the user and saving that instance of a user, because we have the instance variable on the signup page\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n\t sign_in @user unless signed_in?\n\t flash[:success] = \"Signup successful\"\n redirect_to @user\n else\n render 'new'\n end\n end",
"def create\n @sign_up_user = SignUpUser.new(sign_up_user_params)\n # @sign_up_user = SignUpUser.new(user_params)\n\n respond_to do |format|\n if @sign_up_user.save\n format.html { redirect_to @sign_up_user, notice: 'Sign up user was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sign_up_user }\n else\n format.html { render action: 'new' }\n format.json { render json: @sign_up_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :food, :outdoors)\n end",
"def signup(params)\n if self.is_client?\n user = self.employees.create!(name: params[:name],last_name: params[:last_name],\n email: params[:email],password: params[:password],password_confirmation: params[:password_confirmation])\n GroupsUser.create!(user_id: user.id,group_id: params[:group_id])\n user\n else\n user = self.clients.create!(name: params[:name],email: params[:email],password: params[:password],\n password_confirmation: params[:password_confirmation])\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n redirect_to root_url, :notice => \"You have succesfully signed up!\"\n else\n :notice => \"Unable to create profile for user\"\n render :new\n end\n end",
"def create\n first_name, last_name, email, password = *params.values_at(:first_name, :last_name, :email, :password)\n\n if [first_name, last_name, email, password].any?(&:blank?)\n return render_success({status:\"error\", message: 'invalid create parameters'})\n end\n\n #User already exists\n if User.exists?(email: email.downcase)\n return render_success({status:\"error\", message:\"user already exists\"})\n end\n #create user\n User.transaction do\n @user = User.new(\n name: (first_name + \" \" + last_name).titleize,\n email: email.downcase,\n password: password,\n password_confirmation: password\n )\n if @user.save!\n render_success({status:\"success\", message:\"created\"})\n else\n render_success({status:\"error\", message:\"user creation failed\"})\n end\n end\n end",
"def register_user\n if !(User.find_by username: params[:username]).nil?\n flash[:notice] = \"Username taken, try another\"\n redirect_to \"/\"\n elsif validate_password params[:password]\n flash[:notice] = \"Please enter a valid password\"\n redirect_to \"/\"\n elsif params[:first_name].strip.empty? || params[:last_name].strip.empty? || params[:street].strip.empty? || params[:city].strip.empty? || params[:state].strip.empty? || params[:zip].strip.empty? || params[:country].strip.empty? || params[:email].strip.empty?\n flash[:notice] = \"Invalid characters entered\"\n redirect_to \"/\"\n else\n user = User.new\n user.first = params[:first_name]\n user.last = params[:last_name]\n user.street = params[:street]\n user.city = params[:city]\n user.state = params[:state]\n user.zip = params[:zip]\n user.country = params[:country]\n user.email = params[:email]\n user.username = params[:username]\n user.password = params[:password]\n user.save\n #Only add a phone number to the database if a number is entered.\n if !params[:phone1].strip.empty?\n phone = Phone.new\n phone.phone = params[:phone1]\n user.phones << phone\n phone.save\n end\n if !params[:phone2].strip.empty?\n phone = Phone.new\n phone.phone = params[:phone2]\n user.phones << phone\n phone.save\n end\n if !params[:phone3].strip.empty?\n phone = Phone.new\n phone.phone = params[:phone3]\n user.phones << phone\n phone.save\n end\n #After registration is complete, user is taken to a confirmation page.\n redirect_to '/register/confirmation'\n end\n end",
"def sign_up_params\n params.require(:user).permit(:email, :password, :password_confirmation, :first_name, :last_name)\n end",
"def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end",
"def register(attributes = {})\n user = PublicEarth::Db::User.new(attributes)\n \n if attributes[:username].blank?\n user.errors.add(:username, \"A username is required.\") \n elsif attributes[:username] =~ /[^\\w\\-\\_\\!\\@\\$\\?]/\n user.errors.add(:username, \"A username may only contain letters, numbers or the following characters: -_!@$?\") \n elsif PublicEarth::Db::User.find_by_username(attributes[:username])\n user.errors.add(:username, \"The username #{attributes[:username]} is already taken.\") \n end\n \n if attributes[:email].blank?\n user.errors.add(:email, \"An email address is required.\") \n elsif PublicEarth::Db::User.find_by_email(attributes[:email])\n user.errors.add(:email, \"The email address #{attributes[:email]} is already taken.\") \n end\n\n if attributes[:email] !~ /^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,4}$/ \n user.errors.add(:email, \"A valid email address is required (eg, [email protected]).\")\n end\n \n if attributes[:password].blank?\n user.errors.add(:password, \"A password is required.\") \n elsif attributes[:password] != attributes[:password_confirmation]\n user.errors.add(:password, \"The password and its confirmation don't match.\")\n end\n\n if user.errors.empty?\n begin\n user.attributes = one.create(attributes[:username], attributes[:email], attributes[:password], generate_token)\n rescue\n logger.error(\"Failed to create user account for #{attributes.inspect}: #{$!}\")\n user.errors.add_to_base(\"Unable to create a user account for #{attributes[:username]}.\")\n end\n end\n\n user\n end",
"def complete_signup\n @user = User.new(params[:user])\n \n params[:captcha].upcase! if params[:captcha]\n check_for_signup_errors\n\n if @user.errors.empty? && @user.save\n @session['captcha_code'] = nil\n self.current_user = User.authenticate(@user.login,params[:user][:password])\n create_secret_image_code\n log_the_login\n redirect_back_or_default(:controller => '/account', :action => 'congratulations')\n else\n render :action => 'signup'\n end\n end",
"def user_params\n params.require(:user).permit(:first_name, :last_name, :username, :email, :password_digest, :sex, :phone, :location, :image)\n end",
"def sign_up_params\n params.require(:user).permit(:email, :user_name, :password,\n :password_confirmation)\n end",
"def create\n @user = user_from_params\n\n if @user.save\n sign_in @user\n redirect_to home_path, notice: 'Thanks for signing up!'\n\n\n else \n render template: 'users/new'\n end\n end",
"def sign_up_params\n params.require(:user).permit(:name, :last_name, :email, :password, :password_confirmation)\n end",
"def create\n # raise \"hell\"\n @user = User.create(user_params)\n @errors = []\n if @user.email.include? \".\"\n\n if @user.first_name.length > 1 && @user.last_name.length > 1\n #true - check for no special characters and no numbers\n special = \"?<>',?[]}{=-)(*&^%$#`~{}\"\n regex = /[#{special.gsub(/./){|char| \"\\\\#{char}\"}}]/\n if @user.first_name =~ regex || @user.last_name =~ regex\n # contains special char\n @errors << \"Your name cannot contain special characters\"\n session[:errors] = @errors\n redirect_to root_path\n else\n\n def has_digits?(str)\n str.count(\"0-9\") > 0\n end\n\n if has_digits?(@user.first_name)\n @errors << \"Your first name cannot contain numbers\"\n session[:errors] = @errors\n redirect_to root_path\n else\n if has_digits?(@user.last_name)\n @errors << \"Your last name cannot contain numbers\"\n session[:errors] = @errors\n redirect_to root_path\n else\n @user.save\n session[:user] = @user.id\n clear_session(:errors)\n if params[:commit] == 'Sign me up'\n redirect_to success_path\n elsif params[:commit] == 'Build your own newsletter'\n redirect_to build_path\n end\n end\n end\n\n\n end\n else\n @errors << \"Both first and last name must at least be 2 characters long\"\n session[:errors] = @errors\n redirect_to root_path\n end\n else\n @errors << \"An email must contain at least one full stop (.)\"\n session[:errors] = @errors\n redirect_to root_path\n\n end\n end",
"def sign_up_params\n params.require(:user).permit(:title, :email, :password, :password_confirmation, :role, :thumbnail, :description)\n end",
"def user_params\n params.require(:user).permit(:name, :firstname, :description, :email, :phone, :age, :image)\n end",
"def create \n @myuser = User.new(params[:user]) # 'user' is a dictionary created by the signup form and containing the new user's filled-in parameters\n if @myuser.save\n flash[:success] = \"Welcome to the Sample App!\"\n redirect_to @myuser\n else\n render 'new'\n end\n end",
"def user_signup_finished?\n unless is_guest?\n if current_user == User.friendly.find(params[:id])\n @user = current_user\n if @user.valid? == false # If user's attributes are missing, sends them to 'Finish Profile Page'\n flash[:alert] = \"Please finish signing up for Ossemble by entering your First Name, Last Name, Birth Date, Address, and ensuring your location is correct.\"\n redirect_to edit_user_registration_path # Finish Profile Page Setup with form\n end\n end\n end\n end",
"def createUser\n @user = UserTable.new\n value = user_params\n password=params[:user][:password]\n password_confirm=params[:user][:password_confirm]\n @user.assign_attributes(value)\n if password.blank? || password != password_confirm\n flash[:error] = 'Passwords are blank or do not match'\n render :sign_up\n return\n else\n password_v = passwordCheck(password)\n @user.update_attributes(:password_hash => password_v)\n @user.update_attributes(value);\n if [email protected]\n ##@user.errors[:base] << @user.errors\n #flash[:error] = @user.errors\n render :sign_up\n return\n end\n end\n if (!params[:user_table][:email].nil?)\n #testing\n @user.email = params[:user_table][:email]\n @user.validation = randomstring(20)\n if @user.save\n #@user.error[:base] << 'An validation email has been sent to this address'\n UserMailer.welcome_email(@user.id,@user.email, @user.validation).deliver_now\n else\n @user.errors[:base] << 'email cannot be empty error'\n render :sign_up\n return\n end\n render :welcome\n end\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :profile_name, :email, :password, :password_confirmation ) \nend",
"def create\n # redirect user if already logged in\n if current_user\n redirect_to root_path\n else\n user = User.new(user_params)\n if user.save\n session[:user_id] = user.id\n flash[:notice] = \"Successfully signed up.\"\n redirect_to profile_path #root_path\n else\n flash[:error] = user.errors.full_messages.join(', ')\n redirect_to signup_path\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.password = Digest::MD5.hexdigest(params[:user][:password])\n @user.password_confirmation = Digest::MD5.hexdigest(params[:user][:password_confirmation])\n @user.sign_time = Time.now.strftime('%Y-%m-%d %H:%M:%S')\n @user.picture = 'http://dzftp.static1.xiaoma.com/tuofujj/201403/QQ20140327105958.jpg'\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, alert: '用户增加成功!' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def signup\n puts 'signup is happening here'\n permitted = params.require('signup').permit(['email', 'password', 'password_confirmation'])\n @newUser = User.new(permitted)\n if @newUser.save\n head :ok\n else\n render json:{\"reason\": \"could not create user\"}, status: 422\n end\n end",
"def signup\n @user= User.new\n end",
"def signup\n if params['user']\n params['username'] ||= params['user']['name'] if params['user']['name']\n params['password'] ||= params['user']['password'] if params['user']['password']\n params['role'] ||= params['user']['role'] || 'customer' if params['user']['role']\n\n end\n if params['username'] and params['password'] and params['role']\n # This action has been invoked by the signup form.\n @user = User.create(:role => params['role'],\n :name => params['username'],\n :password => params['password'])\n if @user.new_record?\n flash[:error] = @user.errors.messages.collect{|k,v| \"#{k} #{v.join(k.to_s)}\"}\n else\n unless session['user_attributes']\n session['user_attributes'] = @user.attributes\n session['user_attributes']['id'] = @user.id\n\n flash[:notice] = \"Welcome #{@user.name}, you have signed up as a #{@user.role}\"\n if session[:redirect_to]\n redirect_to session[:redirect_to]\n else\n redirect_to(root_url)\n end\n end\n end\n else\n # This action was not invoked by the signup form, redirect\n # to the form.\n\n if params['role'] == 'marketeer'\n # We do not allow users to create marketeer (admin) users by\n # crafting their own URLs.\n flash[:error] = 'Marketeer users may only be created through the Users management page'\n redirect_to(root_url)\n end\n\n @user = User.new(:role => params[:role])\n end\n end",
"def signup\n @user = User.new(params[:user])\n if @user.save\n redirect_to :controller => 'sessions', :action => 'new'\n else\n render'index'\n flash.now[:error]= \"Sign up failure, please try again.\"\n end\n end",
"def signup\n case request.method\n when :post\n @user = User.new(params['user'])\n \n if @user.save \n session['user'] = User.authenticate(@user.login, params['user']['password'])\n flash['notice'] = _(\"Signup successful\")\n redirect_back_or_default :action => \"welcome\" \n end\n end \n end",
"def create\n logout_keeping_session!\n\n\t\t# create a new user with the parameters provided\n @user = User.new(params[:user])\n\t\t\n\t\t# if creation of @user is successful and if it was written to the database successfully\n success = @user && @user.save\n\t\t\n\t\t# if success is TRUE and if there were no errors\n if success && @user.errors.empty?\n\t\t\t# redirect back and flash a pop up regarding successful creation \n redirect_back_or_default('/')\n gflash :success => \"Thanks for signing up! We're sending you an email with your activation code.\"\n else\n\t\t\t# else display pop up error and redirect back to the page\n gflash :error => \"We couldn't set up that account, sorry. Please try again, or contact an admin (link is above).\"\n render :action => 'new'\n end\n end",
"def signup\n @user = User.new\n end",
"def signup\n @user = User.new\n end",
"def create\n \t@user = User.new(user_params)\n if @user.save\n redirect_to login_path, notice: \"The registration success, you can login now.\"\n else\n render 'new'\n end\n end",
"def registration\n @saas = SETTINGS['saas_registration_mode']\n @user = User.new\n initialize_registration_form\n @errors = {\n :general => [],\n :subjects => [],\n :policies => [],\n :purchase => []\n }\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)\n end",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to sign_in_path\n\t\telse\n\t\t\tredirect_to sign_up_path\n\t\tend\n\tend",
"def create\n @user = User.new(user_params)\n file = params[:user][:image]\n @user.set_image(file)\n if @user.save\n sign_in @user\n flash[:success] = \"Welcome to HIKERS!\"\n redirect_to root_url\n else\n render 'new'\n end\n end",
"def sign_up_params\n params.require(:user).permit(\n :email,\n :password,\n :password_confirmation,\n :username,\n :firstname,\n :lastname\n )\n end",
"def user_params\n params.require(:user).permit(:first_name, :last_name, :email, :profilepic)\n end",
"def create\n @user = User.new(user_params) # Instantiate a new user\n\n if @user.save # If user saves log them in by adding their id to the session hash\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n else\n render 'new', layout: 'welcome' # If user does not save re-render sign up form with errors\n end\n\n end",
"def sign_up_params\n params.require(:user).permit(:email, :password)\n end",
"def create\n\t\tUser.create(params.require(:user).permit(:fname,:lname,:username,:email,:address,:password))\n\t\tflash[:notice] = \"Congrats on your new account\"\n\t\tredirect_to '/'\n\tend",
"def signup\n end",
"def signup\n end",
"def signup_new(params)\r\n if params[\"password\"] == params[\"password2\"]\r\n db = connect()\r\n name = params[\"username\"]\r\n password = BCrypt::Password.create(params[\"password\"])\r\n result = db.execute(\"SELECT userid FROM users WHERE username =(?)\", params[\"username\"])\r\n if result != []\r\n return {\r\n error: true,\r\n message: \"Username taken\"\r\n }\r\n else\r\n db.execute(\"INSERT INTO users(firstname, lastname, username, phone, email, password) VALUES((?),(?),(?),(?),(?),(?))\", params[\"firstname\"], params[\"lastname\"], name, params[\"phone\"], params[\"email\"], password) \r\n id = db.execute(\"SELECT userid FROM users WHERE username =(?)\", params[\"username\"])\r\n return {\r\n error: false,\r\n data: id[0][0]\r\n }\r\n end\r\n else\r\n return {\r\n error: true,\r\n message: \"Passwords do not match\"\r\n }\r\n end\r\n end",
"def create\r\n\t\t# check for errors\r\n\t\tif params[:username].blank? || params[:username].blank? || params[:email].blank? || params[:password].blank? || params[:verifypassword].blank? \r\n\t\tredirect_to signup_path, notice: 'Please fill in all the required fields'\r\n\t\telse\r\n\t\t\r\n\t\t\tif !User.exists?(username: params[:username])\r\n\t\t\t\tif params[:password] == params[:verifypassword]\r\n\t\t\t\t\tif !User.exists?(email: params[:email])\r\n\t\t\t\t\t\t@user = User.new(:username => params[:username], :email => params[:email], :password => params[:password], :member_since => Time.now)\r\n\t\t\t\t\t\tif @user.save\r\n\t\t\t\t\t\t\tcreate_cookies(params[:username], params[:password])\r\n\t\t\t\t\t\t\tredirect_to root_path\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tredirect_to signup_path\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tredirect_to signup_path, notice: 'registration is limited per 1 student email acount'\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\t\tredirect_to signup_path, notice: 'Password doesnt match, retype password'\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tredirect_to signup_path, notice: 'Username is taken'\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def create\n\t params[:user][:login] = params[:user][:email_work] if params[:user][:login].blank?\n user = params[:user]\n @user = User.create(user)\n @user.valid? ? after_save(user) : error_responds(@user)\n end",
"def create\n @user = User.create(params[:user]) \n \n if @user.save\n sign_in @user\n flash[:succeess] = \"Sign up successfully\" \n redirect_to @user\n else\n render 'new'\n end\n \n end",
"def sign_up_params()\n params.require(:user).permit(:First_Name, :Last_Name, :UserName, :email, :password, :password_confirmation, :Age_Agreement)\n end",
"def sign_up_params\r\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)\r\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def create\n if params[:user][:avatar] \n $temp = params[:user][:avatar]\n end\n \n params[:user][:avatar] = nil\n session[:signup_params].deep_merge!(params[:user]) if params[:user]\n @user = User.new(session[:signup_params])\n @user.avatar = $temp\n @user.signup_current_step = session[:signup_step]\n\n if @user\n if params[:back_button]\n @user.signup_previous_step\n elsif @user.signup_last_step?\n @user.save if @user.signup_all_valid?\n elsif @user.valid?\n @user.signup_next_step\n# @user.build_company\n end\n session[:signup_step] = @user.signup_current_step\n end\n if @user.new_record?\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n else\n session[:signup_step] = session[:signup_params] = nil\n $temp = nil\n respond_to do |format|\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n end\n end\n end",
"def register\n @user = User.new(user_params)\n\n if @user.valid?\n @user.save\n session[:email] = @user.email\n flash[:notice] = 'Welcome.'\n redirect_to :root\n else\n render :action => \"new_user\"\n end\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)\n end",
"def user_params\n params.require(:user).permit(:name, :email, :password, :image_url)\n end",
"def user_params\n params.require(:user).permit(:name, :email, :password, :image_url)\n end",
"def signup\n \n # Look up for User in database\n @user = User.find_by(name: param_username) \n\n if @user\n\n @user = nil\n render json: {status: status_code(:conflict), message: \"Username already exists. Please sign in using your mobile.\" }\n \n else\n \n @user = User.create(name: param_username, email: param_user_email, password: param_password)\n\n if [email protected]\n render json: {status: status_code(:unprocessable_entity), message: 'Validation errors', data: {errors: @user.errors}}\n return\n end\n\n @user.signin!(request)\n \n render json: {\n status: status_code(:ok),\n message: 'Signed in successfully!',\n data: @user.as_signin_json\n }\n\n end\n\n end"
] | [
"0.74499196",
"0.7374185",
"0.73502374",
"0.7298143",
"0.72451013",
"0.7201371",
"0.71904814",
"0.71831906",
"0.7175687",
"0.71575797",
"0.71575797",
"0.7155236",
"0.715271",
"0.7117982",
"0.7088857",
"0.7086601",
"0.70855665",
"0.7070454",
"0.7029328",
"0.70188516",
"0.70119184",
"0.6999552",
"0.69620085",
"0.6960863",
"0.69469774",
"0.6943463",
"0.6929176",
"0.6919724",
"0.69073826",
"0.6898672",
"0.68967444",
"0.688853",
"0.6887758",
"0.6886718",
"0.686637",
"0.6862672",
"0.685798",
"0.6855167",
"0.68528056",
"0.68433607",
"0.68429625",
"0.6838456",
"0.6835804",
"0.68344057",
"0.682482",
"0.68237877",
"0.68189806",
"0.68175334",
"0.6813123",
"0.6808116",
"0.68072355",
"0.68030494",
"0.6796228",
"0.6791503",
"0.6790514",
"0.6787307",
"0.67776525",
"0.6775854",
"0.67712164",
"0.6765088",
"0.6763237",
"0.67565024",
"0.67555034",
"0.67550546",
"0.67536426",
"0.6741014",
"0.67379385",
"0.6734203",
"0.67323023",
"0.6728799",
"0.6726811",
"0.6725125",
"0.67233914",
"0.6720492",
"0.6717797",
"0.6717797",
"0.6717414",
"0.6715762",
"0.6714792",
"0.67138344",
"0.67123294",
"0.670531",
"0.6703973",
"0.6701777",
"0.66987216",
"0.6698013",
"0.6697386",
"0.6697386",
"0.6696743",
"0.6691688",
"0.6688292",
"0.6686486",
"0.6683734",
"0.6681465",
"0.66767013",
"0.6668084",
"0.6652348",
"0.6652204",
"0.66471064",
"0.66471064",
"0.66460764"
] | 0.0 | -1 |
action end filters usernames that should be used in a username | def not_sensitive(myString)
if ["Admin","admin","Administrator","ADMIN","ADMINISTRATOR"].include? myString
false
else
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_with_filter\n\t\treturn @unf\n\tend",
"def check_username\n @user=User.where('username=?',params[:username])\n @user=[] if user_signed_in? && @user && @user.first==current_user # this means they are editing their username and its themselves, that is ok\n end",
"def search_by_username(search_username)\n #will return all values except the current user\n User.find(:all, :conditions => [\"username LIKE ? AND username <> ?\", \"%#{search_username}%\", \"#{self.username}\"])\n end",
"def user_filter\n username_attribute = options[:ldap][:username_attribute] || default_username_attribute\n\n filter = Net::LDAP::Filter.eq(username_attribute, @username)\n unless @options[:ldap][:filter].blank?\n filter &= Net::LDAP::Filter.construct(@options[:ldap][:filter])\n end\n\n filter\n end",
"def explore\n @users = User.where(\"username LIKE ?\", \"\")\n end",
"def username_is_allowed #same as 'validates_exclusion_of' method\n if FORBIDDEN_USERNAMES.include?(username) # checking to see if the username is in FORBIDDEN_USERNAMES\n errors.add(:username, \"has been restricted from use.\") # if the username is in FORBIDDEN_USERNAMES, it will add an error to the errors array\n end\n end",
"def names_by_user # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:Name, :by_user, :user => user)\n show_selected_names(query)\n end\n end",
"def index\n\t\t\n\t\t# @admins=User.where(admin: true)\n\t #Only show users that aren't admin(only the community are shown)\n\t @users = User.where(admin: false).order(\"first_name ASC\")\n\n\t if params[:search_user].present?\t\n\t \t#Storing user with capital letter on first letter of name and rest downcase.\n\n user_search= params[:search_user].downcase.split(\" \")\n \t\n @users= @users.where(\"first_name ILIKE ? OR last_name ILIKE ? OR last_name ILIKE ?\", \"#{user_search[0]}\", \"#{user_search[1]}\",\"#{user_search[0]}\")\n \n end\n end",
"def search_user_names_for_message\n @users = (session[:from_follower_following] ? @login_user.from_follower_following(params[:term]) : @login_user.all_message_users(params[:term]))\n @usernames = []\n @users.collect{|u| @usernames << u.username}\n respond_to do |format|\n format.json { render :json => @usernames }\n end\n end",
"def usernames\n if @usernames\n @usernames\n else\n users = PadmaUser.paginate(account_name: self.name, per_page: 100)\n @usernames = users.nil? ? nil : users.map(&:username).sort\n end\n end",
"def username_is_allowed\n\t\tif FORBIDDEN_USERNAMES.include?(username)\n\t\t\terrors.add(:username, \"has been restricted from use.\")\n\t\tend\n\tend",
"def search_users_by_username\n @check=0\n @username=updated_user_params[:username]\n if @username.empty?\n flash.now[:error]=\"Please, enter an username \"\n @all_searched_users=Array.new\n render 'search_users'\n else\n @all_searched_users=User.where(\"username like ?\", \"%\"+@username+\"%\").paginate(:page => params[:page], :per_page => 9)\n if @all_searched_users && !@all_searched_users.empty?\n @searched_user=User.new\n render 'search_users'\n else\n @searched_user=User.new\n @all_searched_users=Array.new\n render 'search_users'\n end\n end\n end",
"def clean_username(username)\n\n my_username = username\n #remove all non- alphanumeric character (expect dashes '-')\n my_username = my_username.gsub(/[^0-9a-z -]/i, '')\n\n #remplace dashes() for empty space because if the user add dash mean that it want separate the username\n my_username = my_username.gsub(/[-]/i, ' ')\n\n #remplace the empty space for one dash by word\n my_username.downcase!\n my_username.strip!\n username_split = my_username.split(' ').join('-')\n\n end",
"def usernamesearch(field_hash)\n usersearch(field_hash)\n end",
"def searchUsers(word)\n @cuid = isSignedIn ? current_user.id : nil\n @w = word.downcase()\n @usUnf = User.all # users unfiltered\n @us = []\n @usUnf.each do |u|\n @friendOrAdmin = areFriends(@cuid, u.id) || ((@cuid != nil) ? (User.find_by(id: @cuid).admin == true) : false)\n if u.username.downcase().include?(@w) || \n (@friendOrAdmin ? \n ((u.fname != nil) ? u.fname.downcase().include?(@w) : false) || \n ((u.lname != nil) ? u.lname.downcase().include?(@w) : false)\n : false)\n @us.push(u)\n end\n end\n return @us\n end",
"def username\n params[:username].downcase\n end",
"def filterUsers\n if(params[:search] && params[:search].length >= 1)\n @users = User.where('nickname LIKE ? OR email LIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n else\n @users = {}\n end\n respond_to do |format|\n format.html {render :partial => 'users/userList'}\n format.js\n end\n end",
"def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end",
"def username_reserved?\n ReservedUsernames.include?(username)\n end",
"def name_of_user(username)\n username.split('.').map(&:capitalize)\n end",
"def filter_users\n allowed_keys=[\"email\", \"admin\"]\n filtering_keys=allowed_keys & params.keys\n filtering_keys.each {|key| filter_by_key(key)}\n end",
"def username\n params[:username].downcase\n end",
"def check_username\n if /[a-zA-Z0-9_-]/.match(params[:username])\n user = User.username(params[:username])\n if user.blank?\n render :json => [\"free\", \":)\"]\n else\n render :json => [\"taken\", \"Sorry, username exists!\"]\n end\n else\n render :json => [\"Letters, numbers, dashes and underscores only please :)\"]\n end\n end",
"def users_by_name\n if in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end",
"def searchbyname\n \t\t\t\t@active = User.find(session[:user_id]).try :touch\n \t\t\tname = params[:username]\n \tyear = params[:year]\n \n \t\t @users = User.where(:username => name).all\n \t\t\tif @users.any?\n \t\t\trender(\"index\")\n \t\t\telse\n\t\t\t\t flash[:notice] =\" No user found by the name: #{name}\"\n\t\t\t\t render(:action => \"getnametosearch\")\n return false\n\t\t\tend\n end",
"def usernames\n users = PadmaUser.paginate(account_name: self.name, per_page: 100)\n users.nil? ? nil : users.map(&:username)\n end",
"def list\n @search = {}\n @search[:editor] = true if filter_params[:editor] == '1'\n @search[:admin] = true if filter_params[:admin] == '1'\n @text = ['username ilike :text', text: \"%#{filter_params[:text]}%\"] if filter_params[:text].present?\n @pagy, @users = pagy(User.where(@search).where(@text))\n end",
"def authored_names # :nologin: :norobots:\n query = create_query(:Name, :with_descriptions)\n show_selected_names(query)\n end",
"def username(fname, lname)\n [fname, lname].join('.').downcase\n end",
"def validate_username_reserved\n return unless username_reserved?\n\n errors.add(:username, :exclusion)\n end",
"def preprocess_username\n @username = @options[:ldap][:username_prefix] + @username if @options[:ldap][:username_prefix]\n end",
"def index\n if name = params[:user_name]\n puts \"****************\" \n @users = User.where(\"name ilike '%#{name}%'\")\n else\n \t @users = User.all\n end\n @users = @users.paginate(page: params[:page], :per_page => 10)\n end",
"def usernames\n Message::Statement.display_usernames(raw_data.keys)\n end",
"def name_conditions\n [\"(lower(users.first_name) LIKE ? AND lower(users.last_name) LIKE ?) OR (lower(users.first_name) LIKE ? AND lower(users.last_name) LIKE ?)\", \"%#{first_name}%\", \"%#{last_name}%\", \"%#{last_name}%\", \"%#{first_name}%\"] unless name.blank?\n end",
"def same_visible_username?(username)\n real_username.downcase == username.downcase\n end",
"def search\n @users = User.where('full_name ilike ?', \"%#{params[:query].strip}%\")\n if @users.length.zero?\n flash[:notice] = \"#{params[:query]} not found\"\n redirect_to users_path\n else\n render 'index'\n end\n end",
"def index\n @full_name = params[:full_name] || \"\"\n\n if @full_name != \"\"\n @users = User.all.where(\"lower(first_name) like lower(?)\",\"%#{@full_name}%\").or(User.where(\"lower(last_name) like lower(?)\",\"%#{@full_name}%\")).or(User.where(\"lower(email) like lower(?)\",\"%#{@full_name}%\")).paginate(page: params[:page], per_page: 30).order('id desc')\n else\n @users = User.all.paginate(page: params[:page], per_page: 30).order('id desc')\n end\n end",
"def username=(value)\n if value\n value.downcase!\n value.squish!\n end\n super(value)\n end",
"def existingUserName\n userName = params['userName']\n userName = userName[0] == \"@\" ? userName:\"@\".concat(userName)\n user = UsersRecord.where(\"username like '%#{userName}%' \")\n allRecord = []\n user.each do |rec|\n eachrecord={}\n eachrecord[:username] = rec.username\n eachrecord[:userfullname] = rec.userfullname\n eachrecord[:userid] = rec.userid\n eachrecord[:dp] = (rec.dp.attached?) ? url_for(rec.dp) : \"\"\n allRecord.push(eachrecord)\n end\n render json: allRecord.as_json, status: :ok\n end",
"def pick_username(username)\n name = username\n blacklist = Set.new\n\n while user_exists?(name)\n blacklist << name\n new_name = LoginUserManager.pick_username(name, blacklist)\n\n if blacklist.include?(new_name)\n raise RangeError, \"Misbehaved login policy chose blacklisted name #{new_name}\"\n else\n name = new_name\n end\n end\n\n name\n end",
"def username_complexity\n if username.present? and not username.match(/^(\\w){2,15}$/)\n errors.add :username, 'can only contain alphanumeric characters (letters A-Z, numbers 0-9) and underscores'\n end\n if username.present? and username.match(/^(.*admin.*)$/i)\n errors.add :username, 'cannot contain the word Admin'\n end\n end",
"def index\n #@users = User.all\n if current_user && current_user.role == 'Admin'\n if params[:c]\n @users = User.where(\"name LIKE '%#{params[:c]}%'\").select(\"distinct users.* \")\n else\n q = params[:q] ? \"name LIKE '%#{params[:q]}%'\" : \"\"\n @users = User.where(q).order(:created_at).reverse\n end\n else\n redirect_to '/'\n end\n end",
"def find_all_usernames\n execute_sql(:read, :user) do\n table.select(:username).map do |row|\n row[:username]\n end\n end\n end",
"def filter(username)\n clas = Net::LDAP::Filter.eq('objectClass', @config[:object_class])\n uid = Net::LDAP::Filter.eq(@config[:user_attr], username)\n filter = clas & uid\n if group = @config[:groupdn]\n memberOf = Net::LDAP::Filter.eq('memberOf', group)\n isMemberOf = Net::LDAP::Filter.eq('isMemberOf', group)\n filter = filter & (memberOf | isMemberOf)\n end\n filter\n end",
"def trailer_filter(text)\n text.gsub(FILTER_REGEXP) do |author_match|\n label = $~[:label]\n \"#{label} #{parse_user($~[:author_name], $~[:author_email], label)}\"\n end\n end",
"def users(filter = {})\n handler[:people].filter(filter)\n end",
"def complete_name_list\n #User.select(:name).map{|user_record| user_record.name}\n end",
"def auto_complete\n @users = if params[:term] =~ /(@[^\\s]+)\\s.*/\n elsif user_name = params[:term].match(/(@[^\\s]+)/)\n users = User.select('name').where('name LIKE ?', \"%#{user_name[1].to_s[1..-1]}%\")\n\n users.map {|user| {name: \"#@{user.name}\"} }\n end\n render json: @users.to_json\n end",
"def format_username\n \t_email_base = self.email[/[^@]+/]\n \tself.username ||= _email_base.camelize.underscore.gsub(/\\./,\"_\") unless _email_base.nil?\n\n end",
"def user_item_names(record)\n record.user.send(item_plural(record)).all.collect { |item| item.name.downcase }\n end",
"def by_screenname\n screenname = params['screenname'].gsub('@', '')\n @users = User.where('screenname LIKE ?', '%' + screenname + '%').all\n @users -= [current_user]\n \n respond_to do |format|\n format.json { render 'users/index', status: :ok }\n end\n end",
"def user_search username\n url = API + \"users/search?q=#{username}&access_token=\" + @access_token\n get(url)['data']\n end",
"def names_by_editor # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:Name, :by_editor, :user => user)\n show_selected_names(query)\n end\n end",
"def normalize_user_name\n\t\tself.user_name = user_name.downcase\n\tend",
"def downcase_username\n self.username = self.username.downcase if self.username?\n end",
"def index\n @users = if params[:term]\n puts 'hello'\n User.where('first_name ILIKE ? OR last_name ILIKE ?', \"%#{params[:term]}%\", \"%#{params[:term]}%\")\n else\n User.all\n end\n end",
"def suggest_user\n skope = User.scoped\n skope = skope.where(\"username LIKE ?\", \"%#{params[:term]}%\")\n @team.members.all.each do |member|\n skope = skope.where(User.arel_table[:id].not_eq(member.user.id))\n end\n\n skope = skope.limit(10)\n\n respond_with(skope.all.map{|x| {:label => x.username, :value => x.id}})\n end",
"def downcase_username()\n self.username = username.downcase\n end",
"def username=(val)\n write_attribute(:username, val.downcase.split(\" \").join)\n end",
"def name_filter(results, search)\n words = search.split(' ')\n for i in 0...words.size\n results = results.where(\"UPPER(name) LIKE ?\", \"%#{words[i]}%\")\n end\n return results\n end",
"def downcase_username\n self.username.downcase!\n end",
"def search\n @term = params[:term]\n if @term.blank?\n @users = []\n else\n @users = User.where(\"username like ? or name like ?\", '%' + @term + '%', '%' + @term +'%')\n end\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @users, :except => [:encrypted_password, :salt] }\n end\n end",
"def display_name_without_user_filter(name)\n name[:display_name]\n end",
"def users\n matches = User.where(\"LOWER(name) LIKE ?\", \"%#{@query}%\").limit(10)\n @users = matches.sort_by { |user| SearchScore.name(user.name, @query) }\n\n render \"users\"\n end",
"def index\n authenticate_user\n @users = User.all\n @users = User.find_all_by_last_name(params[:search])\n end",
"def index\n if params[:q]\n @users = User.where(\"lower(name) like lower(?)\", \"%#{params[:q]}%\")\n else \n @users = User.paginate(page: params[:page], :per_page => 10)\n end\n end",
"def index\n if params[:search] then\n @users = User.where(\"(lower(full_name) LIKE :search) OR (lower(forum_name) LIKE :search)\", search: \"%#{params[:search]}%\".downcase)\n @users = @users.order(:aclx_id).paginate(:page => params[:page], :per_page => 5)\n end\n end",
"def username\n email.match(/[^@]+/).to_s\n end",
"def index\n @possible_names = current_user.possible_names.all\n end",
"def username_taken\n username = params[:user][:username].downcase\n render :json => User.find_by_username(username).nil?\n end",
"def user_filter_options username=nil\n user_list = User.by_name.map { |u| [u.username, u.username] }\n user_list.unshift ['All users', 'all']\n\n selected = get_user_filter username\n options_for_select user_list, selected\n end",
"def autoname\n# auto completed to get list of users. Nee to expand it to seach name field and names in the user table\n# puts \"----------->>>>>>>>>>>>>>>>> in Auto Name\"\n \n if (params[:term] && !current_account.user.mycontacts.nil?)\n like= \"%\".concat(params[:term].concat(\"%\"))\n clone_emails = current_account.user.mycontacts.where(\"clone_email LIKE ? OR name LIKE ? \", like, like)\n # puts \"clone emails = \"+clone_emails.inspect\n else\n clone_emails = []\n end\n\n #list = clone_emails.map {|u| Hash[ :id => u.id, :label => (u.clone_email), :name => u.clone_email]}\n list = clone_emails.map {|u| Hash[ :id => u.id, :label => concat_email_name(u), :name => u.clone_email]}\n render :json => list\nend",
"def sanitize_user\r\n self.first_name = Sanitize.clean(self.first_name).gsub('&','&').gsub('>', '>') unless self.first_name.blank?\r\n end",
"def users\n items = B1Admin::User.where([\"name LIKE :term OR email LIKE :term\",term: \"#{params[:term].to_s}%\"]).all\n render json: {success: true, users: items}\n end",
"def user_autocomplete\n @users = @users.order(:username).where(\"username like ?\", \"%#{params[:value]}%\")\n respond_to do |format|\n format.js\n end\n end",
"def username_is_acceptable\n errors.add(:username, \"^That username is unacceptable\") unless User.verify_username_is_acceptable(self.username)\n end",
"def index\n unless params[:display_name]\n redirect_to admin_dashboard_path, notice: 'Please enter a user display name.'\n end\n\n @users = User.where(display_name: params[:display_name])\n end",
"def index\n @users = User.where(\"first_name LIKE ? OR last_name like ?\",\n \"%#{params[:search]}%\", \"%#{params[:search]}%\").paginate(:per_page => 10,:page => params[:page])\n if @users.count == 0\n flash.now[:warning] = t(\"user.search.no_results\")\n end\n end",
"def valid_username?(name)\n\t\t$users_and_passwords.each do |element|\n\t\t\tif element[USERNAME] == name\n\t\t\t\t@username=name\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\t\t\t\n\t\treturn false\n\tend",
"def user_name_follows_rules\n #start\n #@user_name = params[:user_name]\n return true\n end",
"def active\n\t\t\t\t\tfind(:all, :conditions => 'username != \"\"')\n\t\t\t\tend",
"def downcase_username\n self.username = username.downcase\n end",
"def find_user_byname(username)\n # accept a username input parameter\n # use the User Model class to find all Users with the supplied username. \n # NOTE: Username is not unique in the Users table, thus you can have many users with the same username.\n # return a collection of User instances that match the provided username\n @user_names = User.where(:username => username)\n @user_names\n end",
"def index\n if params[:search].nil?\n @users = User.paginate(page: params[:page]).where.not(id: current_user.id)\n else\n @users = User.where(\"lower(first_name) like ? or lower(last_name) like ?\", \"%#{params[:search][:q].downcase}%\", \"%#{params[:search][:q].downcase}%\").paginate(page: params[:page]).where.not(id: current_user.id)\n end\n end",
"def username\n @username ||= match[3]\n end",
"def group_invitable_users\n group = Group.find(params[:group_id])\n @users = User.where(\"LOWER(name) LIKE ?\", \"%#{@query}%\")\n .where.not(id: group.members).limit(10)\n .sort_by { |user| SearchScore.name(user.name, @query) }\n\n render \"users\"\n end",
"def ignore\n users = User.where(username: [params[:username], params[:other_username]])\n raise Discourse::InvalidParameters.new if users.size != 2\n\n DiscourseFingerprint.ignore(users[0], users[1], add: params[:remove].blank?)\n DiscourseFingerprint.ignore(users[1], users[0], add: params[:remove].blank?)\n\n render json: success_json\n end",
"def username=(value)\n\t write_attribute(:username, value.downcase)\n\tend",
"def typeahead\n input = params[:input]\n users = User.all\n valid_users = []\n users.each do |user|\n valid_users.push(\"#{user.firstName} #{user.lastName}\") if user.firstName.include?(input) || user.lastName.include?(input) || user.email.include?(input)\n end\n render json: valid_users, status: :ok\n end",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend",
"def handle_getting_names_for(users, user_role=\"contact\")\n @data.users = users\n @data.index = users.next_to_fill_in\n @data.user_role = user_role\n\n if @data.index\n user = @data.users[@data.index]\n collect_for(user)\n else\n @session.pop\n end\n end",
"def show_user\n usernames = params.require(:usernames)\n\n identities = Hash[User.where(username: usernames).map { |u| [u.username, u.custom_fields[DiscourseEncrypt::PUBLIC_CUSTOM_FIELD]] }]\n\n render json: identities\n end",
"def username_list_helper(array)\n if array.size == 0 or array.size == 1\n return fast_link(display_user_name(array[0]), \"#{array[0].username}\")\n elsif array.size == 2\n return fast_link(display_user_name(array[0]), \"#{array[0].username}\") + \" and \" + fast_link(display_user_name(array[1]), \"#{array[1].username}\")\n else\n index_minus_one = array.size - 2\n s = fast_link(display_user_name(array[0]), \"#{array[0].username}\")\n for i in (1..index_minus_one.to_i)\n s = s + \", \" + fast_link(display_user_name(array[i]), \"#{array[i].username}\")\n end\n s = s + \" and \" + fast_link(display_user_name(array[array.size-1]), \"#{array[array.size-1].username}\")\n \n return s\n end\n end",
"def search_all\n users = User.where([\"name LIKE ?\", \"%#{keywords}%\"])\n end",
"def kon_user_account_checking\n user_array = User.kon_search(params[:name])\n if user_array.length \n end\n end",
"def username=(un)\n self[:username] = (un.nil? ? nil : un.downcase)\n end",
"def search_names(logins)\n logins.select { |x| x[0].end_with?(\"_\")}\nend",
"def downcase_username\n return unless username_changed?\n\n self.username = username.downcase\n end",
"def username\n name\n end",
"def to_param; username end",
"def to_param; username end"
] | [
"0.7411617",
"0.6860443",
"0.6765954",
"0.67236686",
"0.66645545",
"0.66540366",
"0.66232586",
"0.65374655",
"0.65186363",
"0.6513202",
"0.6488171",
"0.64869845",
"0.64705473",
"0.6470224",
"0.6466029",
"0.6462796",
"0.6454437",
"0.64347446",
"0.6400982",
"0.638115",
"0.6374257",
"0.637041",
"0.635545",
"0.6334276",
"0.63093275",
"0.63077575",
"0.63046396",
"0.63026804",
"0.62825435",
"0.6277621",
"0.6275149",
"0.62716633",
"0.62598896",
"0.6250909",
"0.6250808",
"0.6239499",
"0.62230796",
"0.6197041",
"0.6180368",
"0.61663043",
"0.6151092",
"0.6145222",
"0.61238986",
"0.61128145",
"0.60858613",
"0.60819834",
"0.6045224",
"0.60427433",
"0.604166",
"0.6035762",
"0.6033587",
"0.6031199",
"0.60218436",
"0.60207725",
"0.60163087",
"0.600367",
"0.5999142",
"0.599844",
"0.5996245",
"0.59901756",
"0.5982864",
"0.5971919",
"0.5966417",
"0.5964466",
"0.5963437",
"0.59598255",
"0.59498465",
"0.5939228",
"0.59355503",
"0.59352887",
"0.593031",
"0.5916403",
"0.59110004",
"0.5907213",
"0.58983254",
"0.58651733",
"0.5858239",
"0.5853676",
"0.584107",
"0.5836443",
"0.58355886",
"0.582723",
"0.5823133",
"0.5816147",
"0.581081",
"0.5804518",
"0.57991433",
"0.57978046",
"0.5793226",
"0.5787042",
"0.57849926",
"0.5784798",
"0.5778429",
"0.5776843",
"0.576408",
"0.57616144",
"0.57609475",
"0.57582676",
"0.57571876",
"0.5757065",
"0.5757065"
] | 0.0 | -1 |
fires a request to the server to change password | def change_password
@user = User.find_by_id(session[:remember_token])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_password(username, password)\n perform_request({:action => \"client-updatepassword\", :username => username, :password => password})\n statusmsg.match /success/i\n end",
"def change_password\r\n \r\n end",
"def change_password(username, new_password)\n perform_request({:action => \"client-updatepassword\", :username => username, :password => new_password})\n end",
"def change_password!(password)\n json = JSON.generate(:changePassword => { :adminPass => password })\n @compute.connection.req('POST', \"/servers/#{@id}/action\", :data => json)\n @adminPass = password\n end",
"def send_password_change_notification; end",
"def change_password\n # https://github.com/site5/lumberg\n server = Lumberg::Whm::Server.new(host: HOST_NAME, hash: `cat #{HASH_FILE_PATH}`)\n cp_email = Lumberg::Cpanel::Email.new(server: server, api_username: @username)\n @password = SecureRandom.urlsafe_base64(12)\n process_options = { domain: @domain, email: @email, password: @password }\n passwd_result = cp_email.change_password(process_options)\n if passwd_result[:params][:data][0][:reason] == ''\n puts \"Successfully changed password of #{@email}\"\n time = Time.new\n logtime = time.strftime('%Y-%m-%d %H:%M')\n File.open(\"#{LOG_FILE_PATH}\", 'a') { |logfile| logfile.puts \"#{logtime}: #{@email}\" }\n else\n # Print c-panel error message if failed to change the password\n puts \"#{passwd_result[:params][:data][0][:reason]}\"\n end\n end",
"def change_password\n set_breadcrumbs(\"change_password\") \n if request.post? || request.patch? \n admin = Admin.find(current_admin.id)\n @check = params[:admin][:password] == params[:admin][:password_confirmation] && params[:admin][:password].present? && params[:admin][:password_confirmation].present?\n if admin.present? && admin.valid_password?(params[:admin][:old_password])\n if @check \n if admin.update_attribute(:password, params[:admin][:password])\n sign_in admin, :bypass => true\n flash[:notice] = I18n.t('change_password.update.success')\n redirect_to admin_root_path\n else\n flash[:error] = I18n.t('common.error') \n end\n else\n flash[:error] = I18n.t('change_password.failure.password_is_not_match')\n end\n else\n flash[:error] = I18n.t('change_password.failure.invalid_old_password')\n end\n end\n end",
"def change_password(opts = {})\n password(opts.merge(:verb => :put))\n end",
"def change_password\n\t\t\tresult = User.change_password params[:user]\n\n\t\t\trender json: result\n\t\tend",
"def password_change_new\n\n end",
"def change_password!(opts = {})\n password!(opts.merge(:verb => :put))\n end",
"def edit_password; end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def password=(value)\n reset_agent\n @password = value\n end",
"def change_password\n if request.post?\n @account = getAccount()\n pass = true\n err = \"\"\n old = params[:password][:old]\n new1 = params[:password][:new1]\n new2 = params[:password][:new2]\n if new1.length < 6 or new1.length > 18\n pass = false\n err = \"Length of password should be between 6 and 18.\"\n end\n \n if new1 != new2\n pass = false\n err = \"The retyped password doesn't match the new password.\"\n end\n \n if old != @account.password\n pass = false\n err = \"The password you entered doesn't match the password in our system.\"\n end\n \n if pass\n @account.update_attribute(\"password\", new1)\n flash[:notice] = \"Password updated.\"\n redirect_to :action=>'account', :controller=>'go'\n else\n flash[:notice] = err\n redirect_to :action=>'account', :controller=>'go'\n end \n \n else\n flash[:notice] = \"Please login.\"\n redirect_to :action=>'login', :controller=>'go'\n end\n \n if request.get?\n redirect_to(:action => \"index\", :controller =>\"go\")\n end \n end",
"def change_password(target_address, old_password, new_password)\n uri = URI.parse(\"#{target_address}/user/neo4j/password\")\n response = Net::HTTP.post_form(uri, 'password' => old_password, 'new_password' => new_password)\n JSON.parse(response.body)\n end",
"def password=(new_password); end",
"def update_change_password\n @user = @session_user\n uri = session[:original_uri]\n\n respond_to do |format|\n @nav = 'home_nav'\n if (@local_manager.slave?)\n flash[:warning] = \"This action is prohibited on slave systems.\"\n format.html { redirect_to home_users_url }\n format.xml { render :xml => '<errors><error>This action is prohibited on slave systems.</error></errors>', :status => :not_acceptable }\n elsif @user.change_password(params[:new_password], params[:password_confirmation], params[:current_password])\n flash[:notice] = \"Change may take a few minutes to propagate.\"\n format.html do\n if (uri)\n redirect_to(uri)\n else\n redirect_to(home_users_url)\n end\n end\n @local_manager.log(:username => @session_user.username, :user_id=> @session_user.id, :message => \"User changed their login password\")\n format.xml { head :ok }\n else\n format.html { render :action => \"change_password\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reset_password\n if params[:form_reset_password]\n passcode = params[:form_reset_password][:passcode]\n new_password = params[:form_reset_password][:new_password]\n\n response = Password.update(\"[email protected]\",passcode,new_password)\n\n if response.message == \"password changed successfully.\"\n flash[:notice] = \"Your password has been updated. Please connect.\"\n redirect_to url_for(:controller => 'content', :action => 'show') and return\n else\n flash[:notice] = \"Error when trying to update your password. Please check your passcode and password.\"\n redirect_to '/reset_password' and return\n end\n end\n end",
"def update\n error! :bad_request, 'Password must be specified' if params[:password].blank?\n \n if @password_reset_service.reset(params[:password], params[:password_confirmation])\n render :json => {}, :status => :no_content\n else\n error!(:invalid_resource, @user.errors, 'Password has not been reset') \n end\n end",
"def test_change_password_successful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"new-password\"\n }\n\n user_id = 34\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.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 update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def password_change\n respond_to do |format|\n if @user.update_with_password(password_change_params)\n bypass_sign_in(@user)\n format.html { redirect_to request.referer || root_url, notice: 'User password has been successfully updated.' }\n else\n format.html { render 'password_change_new' }\n end\n end\n end",
"def change_password\n @user = User.shod(params[:id])\n authorize! :update, @user\n end",
"def change_password\n request_params = {\n host_url_with_protocol: host_url_with_protocol,\n host_url: host_url,\n entity_type: GlobalConstant::TemplateType.change_password_template_type\n }\n service_response = GlobalConstant::StTokenSale.get_client_details(request_params)\n\n # Check if error present or not?\n unless service_response.success?\n render_error_response(service_response)\n return\n end\n\n @presenter_obj = ::Web::Client::Setup.new(service_response, params)\n redirect_to '/token-sale-blocked-region', status: GlobalConstant::ErrorCode.temporary_redirect and return if @presenter_obj.is_blacklisted_ip?(get_ip_to_aml_countries)\n set_page_meta_info(@presenter_obj.custom_meta_tags)\n end",
"def password_update\n redirect_to lato_core.root_path unless core_getRecoveryPasswordPermission\n user = LatoCore::Superuser.find(params[:id])\n if !user || user.session_code != params[:token]\n flash[:warning] = CORE_LANG['recover_password']['recover_error']\n redirect_to lato_core.login_path and return false\n end\n user.update(password: params[:password], password_confirmation: params[:password])\n if !user.save\n flash[:warning] = CORE_LANG['recover_password']['recover_error']\n redirect_to lato_core.login_path and return false\n end\n\n flash[:success] = CORE_LANG['recover_password']['recover_success']\n redirect_to lato_core.login_path\n end",
"def password_reset_request\n end",
"def change_password\n puts \"Starting password change...\"\n puts params.inspect\n if current_user.authenticate(params[:password][:original_password])\n if params[:password][:password] === params[:password][:password_confirmation]\n @user = User.find_by_id(current_user.id)\n @user.password = params[:password][:password]\n @user.password_confirmation = params[:password][:password_confirmation]\n if @user.save\n render status: 200, json: { message: 'Password successfully updated.' }\n else\n render status: 500, json: { message: 'ERROR: New password could not be saved.' }\n end\n else\n render status: 403, json: { message: 'Password and confirmation passwords do not match.' }\n end\n else\n render status: 403, json: { message: 'Your original password seems to be incorrect. Please try again.' }\n end\n end",
"def update_password username, password, new_password, account: Conjur.configuration.account\n if Conjur.log\n Conjur.log << \"Updating password for #{username} in account #{account}\\n\"\n end\n url_for(:authn_update_password, account, username, password).put new_password\n end",
"def send_password_change_notification\n # do not notify the admins for now\n end",
"def password\n if @user.update_with_password(password_params)\n render_update_success @user\n else\n render_failure @user\n end\n end",
"def changePassword\n @user = User.find_by(email: params[:email])\n @user.password = params[:password]\n @user.save()\n if @user.save\n render :ok, json: {}\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unprocessable_entity\n end\n end",
"def change_password\n @current_password = true\n Rails.logger.info(\"[CNTRL] [HOME] [CHANGE_PASSWORD] Password change request\")\n @user = current_user\n Rails.logger.info(\"[CNTRL] [HOME] [CHANGE_PASSWORD] Params #{params}\") \n if @user.valid_password?(params[:user][:current_password])\n if @user.update_with_password(params[:user])\n sign_in(@user, :bypass => true)\n Rails.logger.info(\"[CNTRL] [HOME] [CHANGE_PASSWORD] Password has been changed successfully\")\n return\n else\n Rails.logger.info(\"[CNTRL] [HOME] [CHANGE_PASSWORD] -- Not able to change password\") \n #render :edit\n end\n else\n Rails.logger.info(\"[CNTRL] [HOME] [CHANGE_PASSWORD] -- Current password is not same\") \n @current_password = false\n \n return \n end\n respond_to do |format|\n format.js\n end \n end",
"def set_change_password(user)\n user.update_column(:must_change_passwd, true)\n session[:pwd] = 1\n end",
"def change_password\n return if generate_filled_in\n if do_change_password_for(@user)\n # since sometimes we're changing the password from within another action/template...\n #redirect_to :action => params[:back_to] if params[:back_to]\n redirect_back_or_default :action => 'change_password'\n end\n end",
"def test_change_password_unsuccessful\n data = {\n current_password: \"1234567890\",\n password: \"new-password\",\n password_confirmation: \"newer-password\"\n }\n\n user_id = 34\n expected = 1001\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s+'/password')\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.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 test_change_password\n response=@root_key_api.change_password(\"[email protected]\",\"password\",@account_id, \"xyzzy\")\n response=@root_key_api.change_password(\"[email protected]\",\"xyzzy\",@account_id, \"password\")\n end",
"def change_password(new_password)\n update_password(new_password)\n @password = new_password\n puts 'Success! Your password has been changed.'.colorize(:light_green)\n @prompt.keypress('Press any key to continue..')\n menu = Menu.new(self)\n menu.account_details\n end",
"def post_password_change(\n result_url: nil,\n user_id: nil,\n connection_id: nil,\n email: nil,\n ttl_sec: nil,\n mark_email_as_verified: nil,\n includeEmailInRedirect: nil,\n new_password: nil,\n client_id: nil,\n organization_id: nil\n )\n\n booleans = [true, false]\n path = \"#{tickets_path}/password-change\"\n request_params = {\n result_url: result_url,\n user_id: user_id,\n connection_id: connection_id,\n email: email,\n ttl_sec: ttl_sec.is_a?(Integer) ? ttl_sec : nil,\n mark_email_as_verified: booleans.include?(mark_email_as_verified) ? mark_email_as_verified : nil,\n includeEmailInRedirect: booleans.include?(includeEmailInRedirect) ? includeEmailInRedirect : nil,\n new_password: new_password\n }\n request_params[:client_id] = client_id unless client_id.nil?\n request_params[:organization_id] = organization_id unless organization_id.nil?\n\n post(path, request_params)\n end",
"def set_password_field(password)\n end",
"def update\n @user = User.find_by_forgot_password_token(params[:forgot_password_token])\n raise_404 unless good_password_change_request?\n\n @user.password_required!\n if @user.update_attributes(password_params)\n signin_user!(@user)\n flash[:success] = \"Changed password successfully!\"\n redirect_to dashboard_url\n else\n flash.now[:alert] = \"Couldn't change password. See below.\"\n render :reset_password\n end\n end",
"def password_change(record, opts={})\n MnoEnterprise::MailClient.deliver('password-change',\n default_sender,\n recipient(record),\n user_vars(record)\n )\n end",
"def change_password(new_password)\n put(\"\", {:password => new_password})\n @password = new_password\n end",
"def update\n auth_password = self.class.klass.auth_password\n self.send(\"current_#{self.class.klass_sym}\")&.update_password(password_params[auth_password])\n render json: { meesage: \"update password successful\"}, status: 200\n rescue UserError => e\n render json: { error: e.message }, status: e.status\n end",
"def change_password(old_password, new_password)\n @call_params[:old_password] = old_password\n @call_params[:new_password] = new_password\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def update_password\n\t\tparameters=params[:body]\n\t\t @my_accounts=@current_user\n\t\t\tif @my_accounts.valid_password?(parameters[:current_password])\n\t\t\t if @my_accounts.updatePassword(parameters)\n\t\t\t\t render :json=>success1\n\t\t\t\telse\n\t\t\t\t render :json=>failure1(:current_password=>[\"Current password is wrong\"])\n\t\t\t end\n\t\t else\n\t\t render :json=>failure1(@my_accounts.errors)\n\t\t end\n\tend",
"def change_password\n #check if user is new or being updated\n if self.encrypted_password.present?\n #verifies password\n if self.password_check\n self.encrypt_password\n else\n raise \"error\"\n end\n else\n raise \"error\"\n end\n end",
"def request_password\n\t\t@user = User.find_by_email(params[:email])\n\t\tif @user == nil || @user == ''\n\t\t\tredirect_to \"/forgot_password\", :notice => \"Please enter a valid email\"\n\t\telse\n\t\t\t@random_string = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n\t\t\t@url = root_url + 'reset_password/' + @random_string\n \t\tUser.where(:id => @user.id).update_all(reset_password_token: @random_string)\n\t\t\t@email = UserMailer.forgot_password(@user, @url).deliver\n\t\t\tredirect_to \"/forgot_password\", :notice => \"Please check your email to reset your password\"\n\t end\n\tend",
"def update_with_password(params, *options); end",
"def update\n super do |resource|\n # TODO (rspeicher): In Devise master (> 3.4.1), we can set\n # `Devise.sign_in_after_reset_password = false` and avoid this mess.\n if resource.errors.empty? && resource.try(:otp_required_for_login?)\n resource.unlock_access! if unlockable?(resource)\n\n # Since we are not signing this user in, we use the :updated_not_active\n # message which only contains \"Your password was changed successfully.\"\n set_flash_message(:notice, :updated_not_active) if is_flashing_format?\n\n # Redirect to sign in so they can enter 2FA code\n respond_with(resource, location: new_session_path(resource)) and return\n end\n end\n end",
"def password_changed_confirm\n pw_change_confirm.click\n end",
"def password \n if params[:reset]\n results = CsApi::Account.reset_password(current_user.username)\n if results['success'].eql?('true')\n redirect_to password_reset_url, :notice => results[\"message\"]\n else \n flash.now[:notice] = results[\"message\"]\n end\n get_account\n end\n @page_title = \"Change Your Password\"\n if !@account[\"login_managed_by\"].eql?('CloudSpokes')\n flash.now[:warning] = \"You are logging into CloudSpokes with your #{@account[\"login_managed_by\"]} account. You will need to change your password at #{@account[\"login_managed_by\"]}\"\n end\n end",
"def update_password\n # check current password is valid\n if params[:account].present? and [email protected]_password?(params[:account][:current_password])\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"Current password incorrectly.\" }\n return\n end\n\n if params[:account].present?\n params[:account].delete(:password) if params[:account][:password].blank?\n params[:account].delete(:password_confirmation) if params[:account][:password].blank? and params[:account][:password_confirmation].blank?\n\n if @account.update_with_password(account_params)\n bypass_sign_in(@account)\n redirect_to gns_core.my_account_backend_accounts_path, flash: { success: \"The new password has been successfully changed.\" }\n else\n if params[:account][:password].nil? or params[:account][:password].length < 6\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"New password must contain at least 6 characters.\" }\n else\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"Repeat password does not match.\" }\n end\n end\n end\n end",
"def update_password\n if resource.update_password(params[resource_name])\n set_flash_message :notice, :password_updated if is_navigational_format?\n sign_in resource_name, resource, :bypass => true\n respond_with resource, :location => after_update_path_for(resource)\n else\n clean_up_passwords(resource)\n render :edit_password\n end\n end",
"def password\n \n if request.post?\n begin\n @user = User.find(User.current_user.id)\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n # Send confirmation email here\n update_session\n flash[:notice], flash[:class] = \"Password changed successfully\", \"good\"\n redirect_to :controller => \"account\", :action => \"index\" and return\n else\n raise \"Sorry, your password couldn't be changed.\"\n end\n rescue Exception => e\n flash.now[:notice], flash.now[:class] = \"#{e}<br /><small>#{@user.errors.full_messages.join(\"<br />\")}</small>\", \"bad\"\n #redirect_to :controller => \"account\", :action => \"password\" and return\n end\n end\n\n end",
"def password_changed(user)\n mail_to user, password_changed_subject\n end",
"def password_updation\n user_id = params[:user_id]\n password = params[:password]\n if password.present?\n @password = User.find(params[:user_id]).update(password: params[:password])\n render json: @password, status: :ok\n else\n render json: { error: 'password can not be nil' }, status: :unauthorized\n end \n end",
"def change_password\n @attributes[:change_password]\n end",
"def password_reset\n password_changed = false;\n\n if allow_password_reset()\n unless params[:password].to_s.strip.empty?\n @password_reset_user.password = params[:password]\n @password_reset_user.save!\n @password_reset_user.initialize_aes_iv_and_key\n @password_reset_user.save!\n GoMailer.password_reset(@password_reset_user, get_host).deliver\n password_changed=true\n end\n end\n\n return HESResponder({:password_changed => password_changed})\n end",
"def update\n @user = current_user\n @user_locations = @user.user_locations\n \n old_password = @user.sync_password\n \n new_password = request_password\n \n # @user_locations.each do |ul|\n request = request_github(@user.user_locations.where({ :location_id => 1 }).first.login_name, old_password, new_password)\n # end\n \n unless request.nil?\n # TXT user\n txt_user(@user.cell_phone, request)\n \n # Save new password to user\n @user.update_attributes({ :sync_password => request })\n \n redirect_to root_url, :notice => \"New password TXT'd to your cell phone.\"\n else\n redirect_to root_url, :notice => 'Authentication Failed. Try again.'\n end\n end",
"def password_change\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def change_password\n if params[:user][:current_password].present? && params[:user][:password].present?\n @user = @current_user.update_with_password(change_password_params)\n if @user\n render_json({:result=>{:messages =>[\"ok\"],:rstatus=>1, :errorcode =>\"\"},:data=>{:messages =>[\"Your Password Successfully updated\"]}}.to_json)\n else\n render_json({:result=>{:messages =>@current_user.display_errors,:rstatus=>0, :errorcode => 404}}.to_json)\n end\n else\n render_json({:result=>{:messages =>[\"Invaild User / Current Password and Password required\"],:rstatus=>0, :errorcode => 404}}.to_json)\n end\n end",
"def change_temp_password\n\tend",
"def public_forgot_password\n end",
"def reset_password!\n @session.nickserv.resetpass(self.name)\n end",
"def change_password(params)\n response = nexus.post(nexus_url(\"service/local/users_changepw\"), :body => create_change_password_json(params), :header => DEFAULT_CONTENT_TYPE_HEADER)\n case response.status\n when 202\n return true\n when 400\n raise InvalidCredentialsException\n else\n raise UnexpectedStatusCodeException.new(response.status)\n end\n end",
"def change_password\n @user = current_user\n @user.update_password(params)\n\n if @user.errors.empty?\n redirect_to profile_path, :notice => I18n.t('profile.password_changed')\n else\n flash.now[:alert] = I18n.t(\"errors.passwords.problem\")\n render 'show', :status => :forbidden\n end\n end",
"def pw_admin\n @user = User.find(params[:id])\n new_password = Devise.friendly_token(50)\n user.reset_password(new_password, new_password)\n user.send_rest_password_instructions\n end",
"def reset_pwd\n user=User.where(:username => params[:username])[0]\n Notifier.reset_pwd(user).deliver\n render :update do |page|\n page<< '$(\"#log_in_menu\").slideUp(\"fast\", function(){});'\n end\n \n end",
"def change_password(username, old_pw, new_pwd)\n self.user.change_password(username, old_pw, new_pwd)\n end",
"def forgot_password\n end",
"def set_password!(opts = {})\n password!(opts.merge(:verb => :post))\n end",
"def update_password\n\t\t@admin = current_admin\n\t\tif(@admin.update_attributes(params[:admin]))\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :action => \"reset\"\n\t\tend\n\tend",
"def change_password\n @user = User.find(params[:id])\n end",
"def change_password\n @user = User.find(params[:id])\n end",
"def password_was_changed_notice\n @email = params[:email]\n @token = params[:token]\n\n mail to: @email, subject: 'Your password was changed'\n end",
"def change_password (old_password, new_password)\n params = {\n :oldPassword => old_password,\n :newPassword => new_password\n }\n invoke :changePassword, params\n end",
"def set_password(opts = {})\n password(opts.merge(:verb => :post))\n end",
"def handle_change_password_third_party(user)\n @data.user = user\n values = {\n 'form_target' => url(:back_from_change_password_third_party),\n 'name' => user.contact.con_name,\n \"p1\" => '',\n \"p2\" => ''\n }\n\n standard_page(\"Enter New Password\",\n values,\n Login::COLLECT_CHANGED_PASSWORD)\n end",
"def change_password(old_password, new_password)\n old_password_tb.type_text(old_password)\n new_password_tb.type_text(new_password)\n password_confirm_tb.type_text(new_password)\n change_pw_btn.click\n end",
"def public_forgot_password_send\n if params[:form_forgot_password]\n results = CsApi::Account.reset_password(params[:form_forgot_password][:username])\n logger.info \"[SessionsController][DEBUG]==== reset results: #{results}\"\n if results['success'].eql?('true')\n flash[:notice] = results[\"message\"]\n redirect_to reset_password_url\n else \n flash[:error] = results[\"message\"]\n redirect_to forgot_password_url\n end\n end\n end",
"def update_password\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.reset_token_account(reset_password_token)\n account.encrypted_password = enc_password\n account.reset_password_token, account.reset_password_expires_at = nil, nil\n account.save!\n {'success' => true}\n end",
"def submit\n @token = params[:token]\n @user = User.load_from_reset_password_token(@token)\n\n if @user.blank?\n not_authenticated\n return\n end\n\n @user.password_confirmation = params[:user][:password_confirmation]\n\n if @user.change_password!(params[:user][:password])\n redirect_to(login_path, success: t(:password_updated))\n else\n render :action => \"edit\", warning: t(:invalid_action)\n end\n end",
"def set_password(requestor, dn, password)\n ops = [\n [:replace, :userpassword, [crypt(password)]]\n ]\n log(\"#{requestor[:name]} #{requestor[:ip]} operation replace password \\\"#{password}\\\" for #{dn}\")\n ret = {\n :status => 1,\n :message => \"Success\",\n :values => \"\"\n }\n @ds.modify(:dn => dn, :operations => ops)\n ret = @ds.get_operation_result\n return ret\n end",
"def update_password(new_password)\n super(new_password).tap do |status|\n UserMailer.password_changed(self).deliver_later if status\n end\n end",
"def change_password\n if current_doctor.present? && current_doctor.valid_password?(params[:password]) \n if (params[:new_password]) == (params[:confirm_password])\n current_doctor.update(password: params[:new_password])\n render json: {message: \"Password Changed Successfully \"}\n else\n render json: {message: \"New Password doesn't match Confirm Password\"}\n end\n else\n render json: {message: \"Current Password is invalid\"}\n end\n end",
"def update_password\n @user = User.find_by_uuid(params[:id])\n if @user.update(user_params_with_password)\n if @user.send_password.present? && @user.send_password.to_i == 1\n @user.send_welcome_email\n end\n flash[:success] = t('messages.default_success')\n redirect_to users_path\n else\n flash[:error] = t('messages.default_error')\n render :edit_password\n end\n end",
"def forgot_password\n\t\tend",
"def change_password(new_pass)\n self.salt = User.gen_salt\n salted_pass = User.salt_password(new_pass, self.salt)\n self.password = salted_pass\n end",
"def edit_password\n @token = params[:token]\n end",
"def set_password_for(user:, password: nil, temporary: false)\n response(\n method: :put,\n data: {\n type: 'password',\n value: password,\n temporary: temporary\n },\n path: \"#{url_for(user)}/reset-password\"\n )\n end",
"def password=(password)\n raise ArgumentError, \"The new password cannot be nil\" unless password\n raise ArgumentError, \"The new password cannot be empty\" if password.empty?\n\n self.service.editObject({ \"password\" => password.to_s })\n self.refresh_details()\n end",
"def password=(password)\n raise ArgumentError, \"The new password cannot be nil\" unless password\n raise ArgumentError, \"The new password cannot be empty\" if password.empty?\n\n self.service.editObject({ \"password\" => password.to_s })\n self.refresh_details()\n end",
"def change_password\n @user = User.find(session[:user_id])\n if params[:user]\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n flash[:notice] = \"Password change successful\"\n end\n end\n end",
"def set_Password(value)\n set_input(\"Password\", value)\n end",
"def set_Password(value)\n set_input(\"Password\", value)\n end",
"def set_Password(value)\n set_input(\"Password\", value)\n end",
"def set_Password(value)\n set_input(\"Password\", value)\n end",
"def set_Password(value)\n set_input(\"Password\", value)\n end",
"def set_Password(value)\n set_input(\"Password\", value)\n end"
] | [
"0.78023684",
"0.7743745",
"0.7643223",
"0.7634875",
"0.7544805",
"0.73943174",
"0.72121555",
"0.71316266",
"0.7126693",
"0.71133095",
"0.7048918",
"0.7007678",
"0.6962668",
"0.6962668",
"0.6962668",
"0.69566095",
"0.69213647",
"0.6886813",
"0.6886473",
"0.6879206",
"0.6876093",
"0.68752944",
"0.68519545",
"0.685092",
"0.68499875",
"0.6840569",
"0.68389475",
"0.6830443",
"0.6828028",
"0.68053406",
"0.68027866",
"0.67710525",
"0.67661995",
"0.674507",
"0.67430866",
"0.6740233",
"0.6720073",
"0.6716064",
"0.6711298",
"0.6698673",
"0.6687994",
"0.6686866",
"0.6686698",
"0.66750413",
"0.6661056",
"0.66590655",
"0.66544664",
"0.6654092",
"0.6653438",
"0.665182",
"0.66498834",
"0.6647103",
"0.6645366",
"0.66399467",
"0.6633724",
"0.6629807",
"0.66190815",
"0.6615619",
"0.6599541",
"0.6589354",
"0.6589114",
"0.658891",
"0.6588806",
"0.65874743",
"0.6574533",
"0.65673816",
"0.6567093",
"0.65608215",
"0.6560247",
"0.653708",
"0.65352297",
"0.6532767",
"0.6531577",
"0.65194094",
"0.6515168",
"0.6515168",
"0.65140295",
"0.6512453",
"0.651019",
"0.6505924",
"0.65031695",
"0.650288",
"0.6497085",
"0.6494693",
"0.6486781",
"0.6485291",
"0.64811397",
"0.64766884",
"0.64609414",
"0.6460515",
"0.64589006",
"0.6458532",
"0.6445704",
"0.6445704",
"0.6442426",
"0.6441504",
"0.6441504",
"0.6441504",
"0.6441504",
"0.6441504",
"0.6441504"
] | 0.0 | -1 |
Updates user info based on input (scaffolding) | def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to @user, :notice => 'User was successfully updated.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.json { render :json => @user.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n clear_screen\n puts \"Please enter a new username\".colorize(:yellow)\n user_input = gets.chomp.downcase\n #binding.pry\n self.user.update(name: user_input)\n # user.name = new_name\n puts \"Your new username is #{user_input}\".colorize(:green)\n puts \"Enter any key to return back to User Menu\".colorize(:yellow)\n answer = gets.chomp.downcase\n logged_in_menu_showcase\n logged_in_menu\nend",
"def update_owner_info\n puts \"\\nPlease enter your first name and then press the RETURN key\"\n first_name = gets.chomp\n owner = Owner.all.find_by(name: first_name)\n if owner.nil?\n puts \"\\nThat user doesn't yet exist. You'll now be transferred to the ADD USER menu.\"\n add_owner\n end\n\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - Your address\" => 1,\n \" 2 - The type of food you leave on the porch (please enter 'wet' or 'dry')\" => 2,\n \" 3 - Your cat ownership status\" => 3,\n \" 4 - Your dog ownership status\" => 4,\n \" 5 - Your current neighborhood\" => 5,\n \" 6 - Return to the Main Menu\" => 6 }\n choice = prompt.select(\"\\nHowdy, #{first_name}! What information would you like to update?\\n\", choices, per_page: 6)\n\n case (choice.to_i)\n when 1 #address\n puts \"\\nWhat is your new address? format: 221-B Baker Street\"\n new_address = gets.chomp\n owner.address = new_address\n when 2 #food\n puts \"\\nWhat type of food are you leaving out on your porch? Please enter 'wet' or 'dry'.\"\n new_food = gets.chomp\n owner.food_provided = new_food\n when 3 #cat?\n cat_status_loop = true\n while cat_status_loop do\n puts \"\\nDo you currently own a cat? Please enter 'y' or 'n'.\"\n cat_status = gets.chomp\n if cat_status == \"y\"\n cat_status = true\n cat_status_loop = false\n elsif cat_status == \"n\"\n cat_status = false\n cat_status_loop = false\n else\n puts \"\\nPlease enter 'y' or 'n'.\"\n end\n end\n owner.cat_already = cat_status\n when 4 #dog?\n dog_status_loop = true\n while dog_status_loop do\n puts \"\\nDo you currently own a dog? Please enter 'y' or 'n'.\"\n dog_status = gets.chomp\n if dog_status == \"y\"\n dog_status = true\n dog_status_loop = false\n elsif dog_status == \"n\"\n dog_status = false\n dog_status_loop = false\n else\n puts \"\\nPlease enter 'y' or 'n'.\"\n end\n end\n owner.dog = dog_status\n when 5 #neighborhood\n puts \"\\nIn which neighborhood are you currently living?\"\n new_hood = gets.chomp\n puts \"\\nCity and state?\"\n city_state = gets.chomp\n hood = Neighborhood.find_by(name: new_hood, location: city_state)\n owner.neighborhood = hood\n if hood.nil?\n new_hood_instance = Neighborhood.create(name: new_hood, location: city_state)\n owner.neighborhood_id = new_hood_instance.id\n end\n when 6\n main_menu\n end\n owner.save\n end",
"def client_program\n puts \"Hello and welcome to my store. What is your name?\"\n $user_information[:client_name] = gets.chomp\n # p $user_information\n\n puts \"Nice to meet you, #{$user_information[:client_name]}\"\n\n puts \"And how old are you?\"\n $user_information[:age] = gets.to_i\n # p $user_information\n\n puts \"How many children do you have?\"\n $user_information[:num_children] = gets.to_i\n # p $user_information\n\n puts \"What kind of theme do you like for decor?\"\n $user_information[:decor_theme] = gets.chomp\n # p $user_information\n\n puts \"Thank you for answering these questions, below you can find a list of the information you provided us. If you would like to change any of this, enter which you would like to change. If not, type none!\"\n p $user_information\n update = gets.chomp\n\n if update.include?(\"client_name\") == true\n puts \"Re-enter your name.\"\n $user_information[:client_name] = gets.chomp\n p $user_information\n\n elsif update.include?(\"decor_theme\") == true\n puts \"Re-enter your theme.\"\n $user_information[:decor_theme] = gets.chomp\n p $user_information\n\n elsif update.include?(\"age\") == true\n puts \"Re-enter your age.\"\n $user_information[:age] = gets.chomp \n p $user_information \n\n elsif update.include?(\"num_children\") == true\n puts \"Re-enter your theme.\"\n $user_information[:num_children] = gets.chomp\n p $user_information\n\n else \n puts \"Thank you for using this program.\"\n p $user_information\n \n end\n\nend",
"def assign_to_hash\n user_info = {\"name\" => nil, \"age\" => nil, \"number_of_children\" => nil, \"decor_theme\" => nil, \"budget\" => nil}\n user_info.each do |key, value|\n puts \"What is your client's #{key}?\"\n user_info[key] = gets.chomp\n puts \"Your client's #{key} is #{user_info[key]}.\"\n end\n #Prompt for updates and convert data to appropriate type\n \t#Gives the user the opportunity to update each key\n p user_info\n puts \"Are there any updates needed? If so, enter Yes, if not enter No.\"\n response = gets.chomp.capitalize\n if response == \"Yes\"\n puts \"Which information would you like to update: name, age, number of children, desired decor theme, or budget?\"\n choice = gets.chomp\n if choice == \"name\"\n puts \"What name would you like to input?\"\n user_info[\"name\"] = gets.chomp\n puts \"Your newly inputted name is #{user_info[\"name\"]}.\"\n elsif choice == \"age\"\n puts \"What age would you like to input?\"\n user_info[\"age\"] = gets.chomp.to_i\n puts \"Your newly inputted name is #{user_info[\"age\"]}.\"\n elsif choice == \"number of children\"\n puts \"What number of children would you like to input?\"\n user_info[\"number_of_children\"] = gets.chomp.to_i\n puts \"Your newly inputted name is #{user_info[\"number_of_children\"]}.\"\n elsif choice == \"decor theme\"\n puts \"What decor theme would you like to input?\"\n user_info[\"decor_theme\"] = gets.chomp\n puts \"Your newly inputted name is #{user_info[\"decor_theme\"]}.\"\n elsif choice == \"budget\"\n puts \"What budget would you like to input?\"\n user_info[\"budget\"] = gets.chomp.to_i\n puts \"Your newly inputted name is #{user_info[\"budget\"]}.\"\n else\n puts \"Are you really sure that there's no information for you to update?\"\n end\n #Print updated and current info for each client\n p \"This is your updated user info: #{user_info}.\"\n else\n p \"This is your current user info: #{user_info}.\"\n end\n\n end",
"def update_meds\n prompt = TTY::Prompt.new\n name = nil\n while name.nil?\n puts \"Can we please confirm your username?\"\n name = user_input\n end\n meds = prompt.ask(\"What medication would you like to update\", required: true)\n new_meds = prompt.ask(\"What's the name of your new medication\", required: true)\n new_time = prompt.ask(\"When do you need to take this (e.g. Morning, Afternoon, Night, 2 times a day)?\", required: true)\n new_duration = prompt.ask(\"How long do you need to take this for (e.g. 12 months, 6 months, 24 months)?\", required: true )\n new_info = prompt.ask(\"When should you take the medication (options: before food, after food)\", required: true)\n begin \n user_list = JSON.parse(File.read(\"./files/user_info.json\"))\n user_list[\"Users\"].each do |user|\n if user[\"Name\"] == name\n user[\"Medication\"].each do |med|\n if med[\"Med_Name\"] == meds\n med[\"Med_Name\"] = new_meds\n med[\"Intake_Time\"] = new_time\n med[\"Duration\"] = new_duration\n med[\"Extra_Info\"] = new_info\n end\n end\n end \n File.write(\"./files/user_info.json\", JSON.generate(user_list))\n end \n rescue Errno::ENOENT\n puts \"We're not able to find this medication. Please check your list or add it in\"\n end\n profile_menu\nend",
"def update!(**args)\n @user_info = args[:user_info] if args.key?(:user_info)\n end",
"def change_user_name_menu(user)\n system('clear')\n\n puts \"\n(NOTE: Usernames are case sensitive)\nPlease enter a new user name, or\npress enter to keep current name:\n\"\n user_input = STDIN.gets.chomp\n if user_input.strip == \"\"\n puts\n puts \"Profile loading, please wait...\"\n user_profile_menu(user)\n\n else\n check_if_user_name_exists(user, user_input)\n end\nend",
"def edit_user(shelter)\n\n #Show the user the list of all animals\n list_all_clients(shelter)\n \n #Ask user for the name of the animal and validate that animal exists\n value = validate_input(shelter.clients) {prompt {\"Enter the ID of the client you want to edit: \"}}\n puts\n\n #Unless user wants to exit\n if value != 'q'\n\n #Store animal to a new variable\n client = shelter.clients[value]\n\n #Ask user for the value they want to edit\n puts \"Name: #{client.name}, ID: #{client.id}, Gender: #{client.gender}, Age: #{client.age}, Pets: #{client.pets.join(', ')}, Kids: #{client.kids}\"\n puts\n puts \"What to you want to edit?\"\n\n #Get user input and validate\n choice = validate_simple_input(%w(n i g a p k)) {prompt {\"(n)ame, (i)d, (g)ender, (a)ge, (p)ets, (k)ids: \"}}\n if choice != 'q'\n case choice\n\n #Edit name\n when 'n'\n shelter.clients[value].name = prompt {\"Enter new name: \"}\n \n when 'i'\n #Get user input and assign changed value to hash\n res = prompt {\"Enter new id: \"} #Get new name\n client.id = res #Store the name into new animal variable\n shelter.clients.store(res, client) #Insert new animal into animals hash\n shelter.clients.delete(value) #Remove animal with old name\n client = shelter.clients[res] #Assign the animal variable for all animal properties\n when 'g'\n #Get user input, validate, and assign changed value to hash\n res = validate_simple_input(%w(m f)) {prompt {\"Enter new gender (m , f): \"}}\n if res != 'q'\n shelter.clients[value].gender = res\n end\n when 'a'\n #Get user input and assign changed value to hash\n shelter.clients[value].age = prompt {\"Enter new age: \"}\n when 'p'\n #Get user input and assign changed value to hash\n shelter.clients[value].pets << prompt {\"Enter new pet: \"}\n when 'k'\n #Get user input, validate, and assign changed value to hash\n shelter.clients[value].kids = prompt {\"Enter new num of kids: \"}\n end\n end\n puts \"Edit completed\"\n # Output new animal\n puts \"Name: #{client.name}, Breed: #{client.id}, Gender: #{client.gender}, Age: #{client.age}, Pets: #{client.pets.join(', ')}, Kids: #{client.kids}\"\n else\n puts \"Aborted\"\n end\n\nend",
"def new_game\n\n enter_name\n nter_name\n user_name = gets.chomp\n current_user = find_or_add_user(user_name)\n space\n element = prompt.select('What is your element?', [\"Water\", \"Earth\", \"Air\"])\n current_user.update(element: element)\n space\n space\n\n ### intro method ###\n\nend",
"def edit_data\n puts \"1-add student\"\n puts \"2-delete student\"\n puts \"3-edit student data\"\n user_selection = gets.chomp\n case user_selection\n when \"1\"\n add_student\n when \"2\"\n delete_student\n when \"3\"\n edit_student_data\n else\n puts @dash+\"error-invalid-selection\"+@dash\n user_menu\n end\n end",
"def user_info \n\tputs \"INTERIOR DECORATIONS\"\n\tputs \"--------------------\"\n\tputs \"Welcome! Please answer the below questions.\"\n\tuser_details = Hash.new\n\tputs \"Enter your Frist name: \"\n\tuser_details[:first_name] = gets.chomp\n\tputs \"Enter your Last name: \"\n\tuser_details[:last_name] = gets.chomp\n\tputs \"What is your age: \"\n\tuser_details[:age] = gets.chomp.to_i\n\tputs \"How many family members are staying in your house? (number): \"\n\tuser_details[:family_members] = gets.chomp.to_i\n\tputs \"Have you ever done interior decoration for your home?( y / n ): \"\n\tuser_details[:interior_decoration_history] = gets.chomp\n\tuntil user_details[:interior_decoration_history].upcase == \"Y\" || user_details[:interior_decoration_history].upcase == \"N\" \n\t\tif user_details[:interior_decoration_history].upcase == \"Y\" \n\t\t\tuser_details[:interior_decoration_history] = true\n\t\telsif user_details[:interior_decoration_history].upcase == \"N\" \n\t\t\tuser_details[:interior_decoration_history] = false\n\t\telse\n\t\t\tputs \"Please enter a valid data. Type (y/n): \"\t\n\t\t\tuser_details[:interior_decoration_history] = gets.chomp\n\t\tend\n\tend \n puts \"Are you the landlord or a tenant ?: (L / T )\"\n user_details[:owner_type] = gets.chomp\n if user_details[:owner_type].upcase == \"L\"\n \tuser_details[:owner_type] = \"I'm the landlord\"\n elsif user_details[:owner_type].upcase == \"T\"\n \tuser_details[:owner_type] = \"I'm a tenant\"\n else\n \tuser_details[:owner_type] = \"Not mentioned / Invalid data\" \n end\n puts \"What is your favorite interior decoration theme?\"\n fav_decor = [\"American Traditional\",\"Art Nouveau\",\"Inidan\",\"Modern\",\"French\",\"Medieval\"]\n puts fav_decor\n puts \"Enter your option from the list or type your own option or (none)\"\n user_details[:decor_theme] = gets.chomp\n info_display(user_details)\nend",
"def update\n\t\t@user = current_user\n\t\[email protected] = params[:name]\n\t\[email protected] = params[:phone]\n\t\[email protected]_operator = params[:phone_operator]\n\t\tif @user.save\n\t\t\tsession[:user_id] = @user.id\n\t\t\tflash[:notice] = \"Details Updated.\"\n\t\t\tredirect_to(dashboard_path)\n\t\telse\n\t\t\tflash[:alert] = \"Unable to update profile\"\n\t\t\trender \"edit\", layout: \"application_inside\"\n\t\tend\n\tend",
"def update_info_input(db)\n\tputs \"-\" * 50\n\tputs \"Update Information: \"\n\tprint \"Enter the horse record you would like to update: \"\n\thorse_selection = gets.split.map(&:capitalize).join(' ')\n\n\twhile true do\n\t\tputs \"-\" * 50\n\t\tputs \"Enter the category that you would like to update: \"\n\t\tputs \" 1. Name\"\n\t\tputs \" 2. Breed\"\n\t\tputs \" 3. Color\"\n\t\tputs \" 4. Age\"\n\t\tputs \" 5. Rideable\"\n\t\tprint \"Please select: \"\n\t\tupdate_selection = gets.to_i\n\n\t\tif update_selection == 1\n\t\t\tprint \"New name: \"\n\t\t\tnew_name = gets.chomp.split.map(&:capitalize).join(' ')\n\t\t\tupdate_info(db, horse_selection, \"name\", new_name)\n\t\t\tbreak\n\t\telsif update_selection == 2\n\t\t\tprint \"New breed: \"\n\t\t\tnew_breed = gets.chomp.split.map(&:capitalize).join(' ')\n\t\t\tupdate_info(db, horse_selection, \"breed\", new_breed)\n\t\t\tbreak\n\t\telsif update_selection == 3\n\t\t\tprint \"New horse_color: \"\n\t\t\tnew_color = gets.chomp.split.map(&:capitalize).join(' ')\n\t\t\tupdate_info(db, horse_selection, \"color\", new_color)\n\t\t\tbreak\n\t\telsif update_selection == 4\n\t\t\tprint \" New age: \"\n\t\t\tnew_age = gets.to_i\n\t\t\tupdate_info(db, horse_selection, \"age\", new_age)\n\t\t\tbreak\n\t\telsif update_selection == 5\n\t\t\tprint \"Rideable (y/n): \"\n\t\t\trideable = gets.chomp.downcase\n\t\t\tif rideable == \"y\"\n\t\t\t\tnew_rideable = \"true\"\n\t\t\telse\n\t\t\t\tnew_rideable = \"false\"\n\t\t\tend\n\t\t\tupdate_info(db, horse_selection, \"rideable\", new_rideable)\n\t\t\tbreak\n\t\telse\n\t\t\tputs \"Not a valid choice. Try again.\"\n\t\tend\n\tend\nend",
"def update\n\nputs \"------------------------------------------------\nWho do you want to update: (Politician or Person)\"\nupdate_input= gets.chomp.downcase\n\n if update_input == \"politician\"\n Politician.update_politician\n elsif update_input == \"person\"\n Person.update_person\n else\n update\n end #end of if\nmain_menu\nend",
"def get_user_info\n system(\"clear\")\n puts \"Thank you for choosing the Bank of Hamish for all your banking needs.\"\n puts\n puts \"Please enter your first name. \"\n @first_name = gets.chomp.capitalize\n puts\n puts \"Lovely to meet you, #{@first_name}.\"\n sleep(3)\n system(\"clear\")\n puts \"Please select a username.\"\n puts \"This must be a unique name, so try think of something special.\"\n @username = gets.chomp.downcase\n new_user?\n puts\n puts \"Good selection. Your username is #{@username}\"\n sleep(3)\n system(\"clear\")\n puts \"Ok #{@first_name}, last bit of information we need from you is a password.\"\n puts \"Make this something thats easy to remember!\"\n @password = gets.chomp\n puts \n puts \"Awesome! You're all signed up #{@first_name}!\"\n puts \"Next time you enter the app, you can chose 'returning user' and login using #{@username} and your password.\"\n sleep(5)\n @balance = 0.00\n create_new_user\n end",
"def client_form\n\tclient_pref = {\n\t\tname: \"\",\n\t\tage: '',\n\t\tchildren: '',\n\t\tdecor: \"\",\n\t}\n\tputs \"Hello, welcome to Interior Solutions. Please help us help you by answering the following questions.\"\n\tclient_pref[:name] = name\n\tclient_pref[:age] = age\n\tclient_pref[:children] = children\n\tclient_pref[:decor] = decor\n\tclient_pref[:color] = color\n\t# Run \"update\" method to determine if any changes need to be made to program\n\tclient_pref = update(client_pref)\n\t# Print the latest version of the hash, and exit the program.\n\tputs \"Here is a summary of your client's information: #{client_pref}.\"\nend",
"def information_edit\n if request.post?\n if current_user.update(params.require(:user).permit(User::INFORMATION_ATTRS))\n render_success_message('Information successfully saved.', render_to_string(partial: 'information', locals:{user: current_user}))\n else\n render_error_model(curent_user)\n end\n else\n render partial: 'information_edit', locals:{user: current_user}\n end\n end",
"def fill_user_form(user)\n fill_name_surname_and_title(user)\n fill_mobile_data(user)\n fill_card_data(user)\n fill_location_data(user)\n end",
"def get_info\n print \"Please enter your full name: \"\n name = gets.chomp.upcase\n @name = name\n print \"Please enter your full address: \"\n address = gets.chomp.upcase\n @address = address\n\n #Calls check_info method\n check_info\n end",
"def update\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n puts params\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n @user = current_user\n @user.update_attributes(user_params)\n current_user.save\n render_wizard @user\n end",
"def update_username\n puts \"\\n\\nChoose your new name: \\n\"\n puts \"To return to menu, enter \" + \"EXIT\\n\\n\".red\n print \">> \"\n\n newname = gets.chomp\n if User.all.any? {|user| user.name.downcase == newname.downcase}\n puts \"\\n\\nThat name already exists.\\n\"\n self.update_username\n elsif newname.downcase == \"exit\"\n menu(self)\n else\n self.name = newname\n self.save\n menu(self)\n end\n end",
"def creator_info\n redirect_to root_path and return if @user != current_user\n if request.put?\n @user.update_attributes(params[:user])\n @user.errors.add(:avatar, \"is required\") if @user.avatar_missing?\n @user.errors.add(:tagline, \"is required\") if @user.tagline.blank?\n redirect_to creator_payment_path(@user) and return unless @user.avatar_missing? || @user.tagline.blank?\n end\n @nav = \"signup\"\n end",
"def edit\n puts \"\\nSelect field to edit in Personal Details\"\n ch = \"1\"\n until ch == \"6\" do\n puts \" 1 => Name\\n 2 => Date Of Birth\\n 3 => Marital Status\\n 4 => Mobile Number\\n 5 => Email\\n 6 => Exit\"\n ch = gets.chomp\n case ch\n when \"1\"\n print \" Name : \"\n name = gets.chomp\n update({:name => name}) unless name == \"\"\n when \"2\"\n print \" Date Of Birth : \"\n dob = gets.chomp\n update({:dob => dob}) unless dob == \"\"\n when \"3\"\n print \" Marital Status : \"\n marital_status = gets.chomp\n update({:marital_status => marital_status}) unless marital_status == \"\"\n when \"4\"\n print \" Mobile Number : \"\n mobile_number = gets.chomp\n update({:mobile_number => mobile_number}) unless mobile_number == \"\"\n when \"5\"\n print \" Email : \"\n email = gets.chomp\n update({:email => email}) unless email == \"\"\n when \"6\"\n \n else\n puts \"Wrong Choice\"\n end\n end\n end",
"def edit_info(params, userid)\n db = connect()\n db.execute('UPDATE users SET Info=? WHERE Id=?', params[\"info\"], userid)\n end",
"def update_user\n end",
"def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"def update\n @user = current_user\n @user.attributes = params[:user]\n render_wizard @user\n end",
"def edit\n @title = \"Edit basic info\"\n @user=User.find(session[:user_id])\n if param_posted?(:user)\n attribute = params[:attribute]\n case attribute\n when \"email\"\n try_to_update @user, attribute\n when \"password\"\n if @user.correct_password?(params)\n try_to_update @user, attribute\n else\n @user.password_errors(params)\n end\n when \"team_id\"\n try_to_update @user, attribute\n end\n end \n #For security purpose, never fill in password fields automatically.\n @user.clear_password!\n end",
"def update!(**args)\n @is_current_user = args[:is_current_user] if args.key?(:is_current_user)\n @person_name = args[:person_name] if args.key?(:person_name)\n end",
"def input_students(current_students) # Ex 7 - Requests name, cohort, hobbies, deals with empty value, allows user to edit.\n# Ex 10 - Replace chomp with .gsub(\"\\n\", \"\")\n finished = false\n until finished\n puts \"add - adds student, edit - edits student, exit - exits program\"\n choice = gets.gsub(\"\\n\", \"\")\n if choice == \"add\"\n puts \"name?\"\n name = gets.gsub(\"\\n\", \"\")\n if name == \"\"\n name = \"no name entered\"\n end\n puts \"cohort?\"\n cohort = gets.gsub(\"\\n\", \"\")\n if cohort == \"\"\n cohort = \"no cohort entered\"\n end\n puts \"hobbies?\"\n hobbies = gets.gsub(\"\\n\", \"\")\n if hobbies == \"\"\n hobbies = \"no hobbies entered\"\n end\n current_students << {name: name.to_sym, cohort: cohort.to_sym, hobbies: hobbies.to_sym}\n elsif choice == \"edit\"\n puts \"enter name of student\"\n edit_student = gets.gsub(\"\\n\", \"\")\n current_students.each do |h|\n if h[:name] == edit_student\n puts \"what would you like to edit?\"\n puts \"name, cohort or hobbies\"\n edit_variable = gets.gsub(\"\\n\", \"\")\n if edit_variable == \"name\"\n puts \"enter what you wish the name to be\"\n name = gets.gsub(\"\\n\", \"\")\n h[:name] = name\n elsif edit_variable == \"cohort\"\n puts \"enter desired cohort\"\n cohort = gets.gsub(\"\\n\", \"\")\n h[:cohort] = cohort\n elsif edit_variable == \"hobbies\"\n puts \"enter desired hobby\"\n hobby = gets.gsub(\"\\n\", \"\")\n h[:hobbies] = hobby\n end\n end\n end\n elsif choice == \"exit\"\n finished = true\n end\n end\n current_students\nend",
"def enter_profile_info(firstname, gender, grade, month, day, year)\n # Input child profile info\n create_profile_form.first_name_txt.set firstname\n create_profile_form.gender_cbo.select gender\n create_profile_form.grade_cbo.select grade\n create_profile_form.month_cbo.select month\n create_profile_form.day_cbo.select day\n create_profile_form.year_cbo.select year\n\n # Click Save and Continue button\n create_profile_form.save_btn.click\n sleep(2)\n end",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def Client_info\n\tinfo = {}\n\t# ...name\n\tputs \"Please enter your name:\"\n\t\tinfo[:name] = gets.chomp\n\t# ...age\n\tputs \"How old are you:\"\n\t\t# convert to an integer\n\t\tinfo[:age] = gets.chomp.to_i\n\t# ...favorite color\n\tputs \"What is your favorite color:\"\n\t\tinfo[:color] = gets.chomp\n\t# ...number of children\n\tputs \"How many children do you have:\"\n\t\t# convert answer to an integer\n\t\tinfo[:children] = gets.chomp.to_i\n\t# ...do they think lead poisioning is a myth\n\tputs \"You don't buy that whole 'lead is bad for you' malarkey do you?(y/n)\"\n\t\t# convert answer to boolean\n\t\tinfo[:lead] = truth(gets.chomp)\n\n\t# print the hash to the screen\n\tinfo.each {|key, value| puts key.to_s + \": \" + value.to_s}\n\n\t# ask the user if all the info is correct\n\tputs \"Does this look right?(y/n)\"\n\t\t# if no...\n\t\tif gets.chomp == \"n\"\n\t\t\t# ask which field is incorrect\n\t\t\tputs \"Where is the problem?\"\n\t\t\tfield = gets.chomp\n\t\t\t# update it \n\t\t\tputs \"what should it be?\"\n\t\t\tif field == \"name\" || field == \"color\"\n\t\t\t\tinfo[field.to_sym] = gets.chomp\n\t\t\telsif field == \"age\" || field == \"children\"\n\t\t\t\tinfo[field.to_sym] = gets.chomp.to_i\n\t\t\telse\n\t\t\t\tinfo[field.to_sym] = truth(gets.chomp)\n\t\t\tend\n\t\t# if yes...\t\n\t\telse\n\t\t\t# move on\n\t\t\tputs \"Great!\"\n\t\tend\n\t# print the hash again\n\tputs info\nend",
"def change_username(new_name)\n update_username(new_name)\n @username = new_name\n puts \"Success! Your new username is #{@username}\".colorize(:light_green)\n @prompt.keypress('Press any key to continue..')\n menu = Menu.new(self)\n menu.account_details\n end",
"def show_personal_stat(user)\n showPersonalStatsMenu\n\n input = gets.chomp.to_i\n\n if input == 1\n user.fastest_completions \n end\n\n if input == 2\n user.success_rate\n end\n\nend",
"def update\n if @current_user.update(user_params)\n if @current_user.saved_change_to_attribute?(\"first_name\") || @current_user.saved_change_to_attribute?(\"last_name\")\n redirect_to home_path, notice: \"Your name has been updated successfully.\"\n elsif @current_user.saved_change_to_attribute?(\"order_categories_by\")\n redirect_to categories_path, notice: \"Journal sorting changed.\"\n else\n redirect_back(fallback_location: root_path)\n end\n else\n render action: 'edit'\n end\n end",
"def edit_cat_info\n puts \"\\nPlease enter your cat's name and then press the RETURN key.\"\n kitty_name = gets.chomp\n kitty = Cat.all.find_by(name: kitty_name)\n if kitty.nil?\n puts \"\\nThat meowzer doesn't yet exist. You'll now be transferred to the ADD CAT menu.\"\n add_cat\n end\n\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - #{kitty_name}'s current owner\" => 1,\n \" 2 - #{kitty_name}'s favorite food\" => 2,\n \" 3 - #{kitty_name}'s temperament with other cats\" => 3,\n \" 4 - Return to the Main Menu\" => 4 }\n choice = prompt.select(\"\\nHowdy, #{kitty_name}'s owner! What information would you like to update?\\n\", choices, per_page: 4)\n\n case (choice.to_i)\n\n when 1 #current owner?\n current_owner_loop = true\n \n puts \"\\nWhat is the first name of #{kitty_name}'s current owner?\"\n new_owner = gets.chomp\n new_owner_id = Owner.all.find_by(name: new_owner)\n if new_owner_id.nil?\n puts \"\\nThat user doesn't yet exist. You'll now be transferred to the ADD USER menu.\"\n add_owner\n else\n kitty.owner_id = new_owner_id.id\n puts \"\\nYay! #{new_owner} is now #{kitty_name}'s owner!\\n\"\n current_owner_loop = false\n end\n \n when 2 #food\n puts \"\\nWhich type of cat food does #{kitty_name} prefer, wet or dry?\"\n new_fav_food = gets.chomp\n kitty.favorite_food = new_fav_food\n when 3 #temperament\n new_temp_loop = true\n while new_temp_loop do\n puts \"\\nDoes #{kitty_name} get along with other cats? Please enter 'y' or 'n'.\"\n new_temperament = gets.chomp\n if new_temperament == \"y\"\n new_temperament = true\n new_temp_loop = false\n elsif new_temperament == \"n\"\n new_temperament = false\n new_temp_loop = false\n else\n puts \"\\nPlease enter 'y' or 'n'.\"\n end\n end\n kitty.temperament = new_temperament\n when 4\n main_menu\n end\n kitty.save\n end",
"def status_update\n current_user.gold = params[:gold]\n current_user.lives = params[:lives]\n current_user.income = params[:income]\n\n # Send out the updated user list to all clients\n update_user_list(current_game.id)\n end",
"def print_update\n puts \"Attribute to Change\"\n puts \"[1] First Name\"\n puts \"[2] Last Name\"\n puts \"[3] E-mail\"\n puts \"[4] Note\"\n puts \"Enter a number\"\n end",
"def update\n\t\t\n\t\t# check if the current use is this person\n\t\t\t\t\n\t\t\n\tend",
"def student_user \n self.line_break\n puts \"Type in your full name to begin:\".colorize(:light_green)\n self.line_break\n student_user = gets.chomp.titleize\n if Student.find_by(name: student_user)\n self.line_break\n puts \"Welcome #{student_user.titleize}!\".colorize(:light_magenta)\n self.student_tasks(student_user)\n else \n puts \"Invalid response. You are not authorized to access the portal.\".colorize(:yellow), \"Please contact student services for additional support. Have a great day!\".colorize(:yellow)\n self.run\n end\n end",
"def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end",
"def set_user_input\n @user_input = UserInput.find(params[:id])\n end",
"def update(hash)\n\tputs \"Here is a summary of your client's information: #{hash}. Would you like to make changes? Type done if you are finished.\"\n\tinput = gets.chomp\n\tif input != \"done\"\n\t\tputs \"State the name of the preference you would like to update: name, age, children, color.\"\n\t\t# Convert any user input to the appropriate data type.\n\t\tupdated_key = gets.chomp.to_sym\n\t\tputs \"How can I update that?\"\n\n\t\tif updated_key == :age || updated_key == :children\n\t\t\tnew_value = gets.chomp.to_i\n\t\telse\n\t\t\tnew_value = gets.chomp\n\t\tend\t\n\t\t# Return updated key-value pair\n\t\thash[updated_key] = new_value\n\tend\n\tputs \"Thank you for using Interior Solutions.\"\t\n\t# Return updated hash\n\treturn hash \nend",
"def update #Modificado para que solo pueda cambiar nombre y apellido (y admin cuando el que hace el cambio sea un admin)\n\tif(!session[:user_id])\n\t\tlash[:error] = \"Acceso denegado\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n \n\tif(!params[:user_id] or !params[:hashed_id] or !params[:name] or !params[:lastname])\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n\tif(params[:admin] and !User.find(session[:user_id]).admin)\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n\tif(Digest::SHA1.hexdigest(params[:user_id].to_s) != params[:hashed_id])\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n @user = User.find(params[:user_id])\n\[email protected] = params[:name]\n\[email protected] = params[:lastname]\n\t\n\tif(User.find(session[:user_id]).admin and session[:user_id] != params[:user_id])\n\t\tif(params[:admin])\n\t\t\[email protected] = true\n\t\telse\n\t\t\[email protected] = false\n\t\tend\n\tend\n\t\n\t\n\[email protected]\n\t\n\tflash[:succes] = \"Datos actualizados satisfactoriamente\"\n\t\n\tif(User.find(session[:user_id]).admin)\n\t\tredirect_to users_path\n\t\treturn\n\tend\n\t\n\tredirect_to \"/profile/#{@user.id}\"\n end",
"def change_info\n if params.include?(:token) and params.include?(:name) and params.include?(:address) and params.include?(:email) and params.include?(:description)\n if User.exists?(:token => params[:token])\n user_temp = {:name => params[:name], :address => params[:address], :email => params[:email], :description => params[:description]}\n user = User.find_by(:token => params[:token])\n if user.update user_temp\n success = true\n message = 'Updated successfully'\n else\n success = false\n message = 'Something wrong happened with database'\n end\n else\n success = false\n message = 'Token does not exist'\n end\n else\n success = false\n message = 'Please check your parameters again'\n end\n result = {:success => success, :message => message}\n render json: result\n end",
"def update\n \n end",
"def create_new_user\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Tell us a little about yourself. It will only take a moment.\"\n puts \"\"\n puts \"What is your name?\"\n puts \"\"\n new_user_full_name = gets.strip\n self.quit if new_user_full_name == \"quit\"\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"Is there something you'd like to be called, other than your first name?\"\n puts \"\"\n puts \" 1. Yes\"\n puts \" 2. No\"\n puts \"\"\n nick_name = gets.strip\n if nick_name == \"1\"\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"\"\n puts \"What would you like us to call you? (In other words, what is your nickname?)\"\n puts \"\"\n new_user_nickname = gets.chomp.split.map(&:capitalize).join(' ')\n User.name_search_and_greeting_new(new_user_full_name, new_user_nickname, self)\n elsif nick_name == \"2\"\n User.name_search_and_greeting_new(new_user_full_name, nil, self)\n user_name_array = new_user_full_name.split(\" \")\n elsif nick_name == \"quit\"\n self.quit\n end\n self.where_are_you_at?\n end",
"def user_profile \n system 'clear'\n CoffeeMan.stay_logo\n choice = @prompt.select(\"~P R O F I L E~\") do |menu|\n puts \"HELLO #{@userid.username}\".colorize(:light_blue)\n menu.choice \"Update Username\", -> {change_username}\n menu.choice \"Update Password\", -> {change_password}\n menu.choice \"Delete Account\", -> {delete_profile}\n menu.choice \"Back\", -> {main_menu}\n end\n sleep 1\n end",
"def update(attribute, value)\n if attribute == \"first name\"\n @first_name = value\n #puts \"The first name was changed to: #{@first_name}\"\n elsif attribute == \"last name\"\n @last_name = value\n #puts \"The last name was changed to: #{@last_name}\"\n elsif attribute == \"email\"\n @email = value\n #puts \"The new email is: #{@email}\"\n elsif attribute == \"note\"\n @note = value\n #puts \"The new note is: #{@note}\"\n # puts \"No match was found. Please try again\"\n end\n end",
"def update\n\n puts \"\n Who do you want to update: (Politician or Person)\"\n update_input= gets.chomp.downcase\n\n if update_input == \"politician\"\n Politician.update_politician\n elsif update_input == \"person\"\n Person.update_person\n else\n update\n\n end #end of if\nend",
"def update\n @user = current_user\n @user.update(user_params)\n render_wizard @user\n end",
"def update\n new_user = !@current_user.username && user_params[:username].present?\n if @current_user.update(user_params)\n if (new_user)\n \n users = UserContact.where(phone: @current_user.phone)\n users.each do |gu|\n Notification.create user_id: gu.user_id, \n name:@current_user.name, \n username:@current_user.username, \n creator_id:@current_user.id,\n user_image:@current_user.image.url, \n link: 'pages/profile/screen',\n description: '[User] has joined Pollzapp ',\n code: '106',\n text: @current_user.name + ' has joined pollzapp', parts: [\n {text: @current_user.name+ ' has joined pollzapp', link: 'pages/profile/screen', context: {user: {id: @current_user.id}}}\n ], icon: @current_user.image\n end\n end\n render :show\n else\n render json: @current_user.errors.full_messages, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n \n \n if @user.update_attributes(params[:user]) \n\n if @user.practiceobjects.count == 1 #this should fix the problem from below- we're only dealing with situations in which the user has 1 PO\n @user.practiceobjects.each do |p| # this makes any changes to user notes/name as announced default changes for any blank parallel fields in the users PO's. \n # mainly to update the practiceobject when the user first fills out that info\n \n # this SHOULD only update the PO when the user has only one PO, because won't have access to the form that hits this action if he has more than one PO\n #NEED TO MAKE SURE OF THIS - MAKE SURE THIS ACTION NOT HIT FROM ANYWHERE ELSE, not hit any other time the PO is updated - IS IT HIT WHEN ADMIN NOTES UPDATED THROUGH BEST IN PLACE?\n # after looking at the terminal output, it doesn't look like best_in_place hits this update action, so it's cool\n #THIS WON\"T WORK - ANY update to the user, e.g. when updating password, will change all PO values back to the default - see fix above\n p.update_attributes(:notes => @user.notes)\n \n \n p.update_attributes(:phonetic => @user.phonetic)\n end \n end \n\n if params[:user][:password] #I think this only occurs when user sets pw for the first time, when signing up.\n \n if is_haltom_user\n flash[:info] = \"Welcome to your VoiceGems Dashboard! You may need to wait a minute and refresh the page to hear your name recording below. Please ensure that your recording plays back, and then signout to allow the next student to record! Thank you!\"\n redirect_to @user\n else \n flash[:info] = \"Welcome to your VoiceGems Dashboard! You may need to wait a minute and refresh the page to hear your recording below.\"\n redirect_to @user\n end\n else\n if params[:user][:email]\n redirect_to @user, notice: 'User update was successful.'\n else \n redirect_to @user, notice: 'Update was successful. If you uploaded a recording, please wait a minute and refresh the page to see the changes take effect.' \n end \n end \n \n \n else\n if params[:user][:password]\n if mobile_device?\n render action: 'mobile_setpassword', :layout => nil\n else \n render action: 'setpassword'\n end \n else\n if params[:user][:email]\n render action: \"edit\"\n else\n flash[:error] = \"Something went wrong, please try again.\"\n redirect_to current_user\n end \n end\n #format.html { render action: \"edit\" } redirect_to(session[:return_to] || edit_user_path)\n # format.html { redirect_to (session[:return_to] || edit_user_path(@user))} \n #format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n \n end",
"def update\n # Button press on edit page\n\n # Read the user and update the attributes (don't save at this point)\n @user = User.find(params[:id])\n render_error h \"Der Spezialbenutzer #{@user.username} kann nicht editiert werden.\" and return if @user.special?\n @user.attributes=params[:user] if params[:user]\n\n # Subpages\n select_person and return if params['select_person']\n\n if params['commit']\n # 'Save' button\n render 'edit' and return if [email protected]\n\n flash[:notice] = \"Der Benutzer #{@user.username} wurde gespeichert.\"\n redirect_to_origin(default=@user)\n return\n end\n\n render 'edit'\n end",
"def fill_users(name, phone, email, cpf)\r\n if @home_screen = page(HomeScreen)\r\n @home_screen.create_new_user\r\n else\r\n p 'try'\r\n end\r\n\r\n enter_text(\"* id:'#{user_name}'\", name)\r\n enter_text(\"* id:'#{user_phone}'\", phone)\r\n enter_text(\"* id:'#{user_email}'\", email)\r\n enter_text(\"* id:'#{user_cpf}'\", cpf)\r\n # enter_text(\"* id:'#{user_description}'\", description)\r\n end",
"def change_designation\n if params[:name] == \"\"\n update_old_data('change_job_title','disp_job_title',@user.designation)\n else\n @user.designation = params[:name]\n @user.ignore_password = true\n show_profile_err('emsg_designation',@user.errors['designation']) unless @user.save\n end\nend",
"def user_name\r\n\t#ask user for name\r\n\tputs \"What is your Name?\"\r\n\t#get users input and assign it to user_name\r\n\tuser_name = gets.chomp\r\nend",
"def set_user_info\n @user_info = UserInfo.find(params[:id])\n end",
"def client_program\n client_info={\n name: \"\",\n age: \"\",\n number_of_children: \"\",\n child_proofing: \"\",\n decor_theme: \"\",\n special_instructions: \"\",\n }\nprint \"What is your name:\"\nname=gets.chomp.capitalize!\nclient_info[:name]=name\nprint \"How old are you:\"\nage=gets.to_i\nclient_info[:age]=age\nprint \"How many children do you have:\"\nnumber_of_children=gets.to_i\nclient_info[:number_of_children]=number_of_children\nprint \"would you like to child-proof your home:(y/n)\"\nchild_proofing=gets.chomp\n if child_proofing==\"y\"\n child_proofing=true\n else\n child_proofing=false\n end\nclient_info[:child_proofing]=child_proofing\nprint \"What decor theme do you prefer:\"\ndecor_theme=gets.chomp\nclient_info[:decor_theme]=decor_theme\nprint \"Any special instructions:\"\nspecial_instructions=gets.chomp\nclient_info[:special_instructions]=special_instructions\nprint client_info\n\nprint \"\\n\\ntype in category that needs to be changed, if everything is accurate type 'none'.\\n\\n\"\nanswer=gets.chomp\n if answer==\"none\"\n print \"Thank you for the information!\"\n else\n answer=answer.tr(\" \",\"_\") #number_of_children\n answer=answer.to_sym\n puts \"What is the new value:\"\n answer_value=gets.chomp\n if (true if Integer(answer_value) rescue false)\n answer_value=answer_value.to_i\n client_info.store(answer,answer_value)\n else\n client_info.store(answer,answer_value)\n end\n\n puts \"Thank you, your changes have been saved.\\n\\n\"\n end\n\n\nprint client_info\n\n\nend",
"def set_username \n puts \"What would you like your new username to be?\"\n set_username = gets.strip\n @username = set_username \n end",
"def update_values\n self.username = self.user.nil??nil:self.user.username\n self.imei = self.device.imei.nil??nil:self.device.imei\n end",
"def update!(**args)\n @username = args[:username] if args.key?(:username)\n @view_count = args[:view_count] if args.key?(:view_count)\n end",
"def find_and_update(update=false)\n @all_users.each do |user|\n if user.email == @email.strip\n if update\n first_name_input\n last_name_input\n user.first_name, user.last_name = @first_name, @last_name\n else\n puts \"Email: #{user.email} First Name: #{user.first_name} Last name: #{user.last_name} \"\n end\n end\n end\n end",
"def modify_existing_contact\n display_all_contacts\n puts \"What ID would you like to modify?\"\n id = gets.to_i\n modify_existing_contact = Contact.find(id)\n\n attribute_list\n\n case user_selected\n when 1 then puts \"Edit First Name\"\n edit = modify_existing_contact.update(:first_name, value =gets.chomp)\n puts\n modify_existing_contact.display_contact\n\n\n\n when 2 then puts \"Edit Last Name\"\n edit = modify_existing_contact.update(:last_name, value =gets.chomp)\n puts\n modify_existing_contact.display_contact\n\n\n\n when 3 then puts \"Edit Email\"\n edit = modify_existing_contact.update(:email, value =gets.chomp)\n puts\n modify_existing_contact.display_contact\n\n\n\n when 4 then puts \"Edit Note\"\n edit = modify_existing_contact.update(:note, value =gets.chomp)\n puts\n modify_existing_contact.display_contact\n\nelse\n puts \"Please select an attribute from 1 to 4\"\n attribute_list\n end\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @is_anonymous = args[:is_anonymous] if args.key?(:is_anonymous)\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @is_anonymous = args[:is_anonymous] if args.key?(:is_anonymous)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def update\n end",
"def set_User(value)\n set_input(\"User\", value)\n end",
"def update\n load_user\n build_user\n assign_roles\n save_user or render :edit\n end",
"def modify_option\n\t\t\n\t\tputs \"What is the ID of the user you seek?\"\n\t\t\n\t\tselected_id = gets.to_i\n\t\t\n\t\tputs @rolodex.find_contact(selected_id)\n\n\t\tputs \"What is the new first name?\"\n\t\tfirst_name = gets.chomp\n\t\t\n\t\tputs \"What's the new last name?\"\n\t\tlast_name = gets.chomp\n\t\t\n\t\tputs \"What's the new email?\"\n\t\temail = gets.chomp\n\t\t\n\t\tputs \"What's the new note?\"\n\t\tnote = gets.chomp\n\n\t\tmodified_contact = Contact.new(first_name,last_name,email,note)\n\n\t\[email protected]_contact(selected_id,modified_contact)\n\n\n#Similarly making life easier by removing this for now. \n\t\t# case user_selected\n\t\t# \twhen 1\n\t\t# \t\t#modify ID\n\t\t# \twhen 2\n\t\t# \t\t#modify First Name\n\t\t# \twhen 3\n\t\t# \t\t#modify Last Name\n\t\t# \twhen 4\n\t\t# \t\t#modify email address\n\t\t# \twhen 5\n\t\t# \t\t#modify note\n\t\t# \twhen 6\n\t\t# \t\tputs \"goodbye\"\n\t\t# \t\treturn\n\t\t# \telse\n\t\t# \t\tputs \"Invalid option. Try again.\"\n\t\t# \t\tprint_modify_menu\n\t\t# end\n\n\tend",
"def update\n\t @user = User.find(params[:id])\n\t @cuser = current_user\n\t @name = params[:name]\t \n\t @email = params[:email]\n\t @password = params[:password]\n\t @prest = params[:prestige]\n\t @prestige = @user.prestige\n\n\t if @user.score > 100\n @prestige = @prestige + 1\n @score = @user.score\n @score = @score - 100\n @user.update_attributes(prestige: @prestige, score: @score)\n end\n\n\t @user.update_attributes(name: @name, email: @email, password: @password)\n\t @log = Log.new\n\t @log.update_attributes(user: @user, userid: @user.id, updated_by: @cuser, event: \"User Information Updated\")\n\t redirect_to user_path(@user)\n\t flash[:success] = \"User Information Updated\"\n\tend",
"def modify_existing_contact\n display_all_contacts\n puts \"Choose the ID you would like to modify\"\n id = gets.chomp.to_i\n modify_contact = Contact.find(id)\n unless modify_contact\n puts \"ID not found\"\n return\n end\n\n attribute_list\n\n while user_selected =gets.to_i\n\n case user_selected\n when 1 then puts \"Enter New First Name\"\n new = modify_contact.update(:first_name, value = gets.chomp)\n puts\n modify_contact.display_contact\n puts\n break\n\n when 2 then puts \"Enter New Last Name\"\n new = modify_contact.update(:last_name, value = gets.chomp)\n puts\n modify_contact.display_contact\n puts\n break\n\n when 3 then puts \"Enter New Email Address\"\n new = modify_contact.update(:email, value = gets.chomp)\n puts\n modify_contact.display_contact\n puts\n break\n\n when 4 then puts \"Enter New Note\"\n new =modify_contact.update(:note, value = gets.chomp)\n puts\n modify_contact.display_contact\n puts\n break\n\n else\n puts \"=======================================\"\n puts \"please enter a number between 1 and 4\"\n puts \"=======================================\"\n attribute_list\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_input.update(user_input_params)\n format.html { redirect_to @user_input, notice: 'User input was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_input }\n else\n format.html { render :edit }\n format.json { render json: @user_input.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run\n self.clear\n greet\n username_input = @@prompt.ask('Tell me your username: ',required: true)\n username_input = username_input.downcase\n user = User.find_create_user(username_input)\n main_menu(user)\n end",
"def edit_animal(shelter)\n\n #Show the user the list of all animals\n list_all_animals(shelter)\n \n #Ask user for the name of the animal and validate that animal exists\n value = validate_input(shelter.animals) {prompt {\"Enter the name of the animal you want to edit: \"}}\n puts\n\n #Unless user wants to exit\n if value != 'q'\n\n #Store animal to a new variable\n animal = shelter.animals[value]\n\n #Ask user for the value they want to edit\n puts \"Name: #{animal.name}, Breed: #{animal.breed}, Gender: #{animal.gender}, Age: #{animal.age}, Toys: #{animal.toys.join(', ')}, Adoption: #{animal.adoption}\"\n puts\n puts \"What to you want to edit?\"\n\n #Get user input and validate\n choice = validate_simple_input(%w(n b g a t d)) {prompt {\"(n)ame, (b)reed, (g)ender, (a)ge, (t)oys, a(d)option: \"}}\n if choice != 'q'\n case choice\n\n #Edit name\n when 'n'\n res = prompt {\"Enter new name: \"} #Get new name\n animal.name = res #Store the name into new animal variable\n shelter.animals.store(res, animal) #Insert new animal into animals hash\n shelter.animals.delete(value) #Remove animal with old name\n animal = shelter.animals[res] #Assign the animal variable for all animal properties\n when 'b'\n #Get user input and assign changed value to hash\n shelter.animals[value].breed = prompt {\"Enter new breed: \"}\n when 'g'\n #Get user input, validate, and assign changed value to hash\n res = validate_simple_input(%w(m f)) {prompt {\"Enter new gender (m , f): \"}}\n if res != 'q'\n shelter.animals[value].gender = res\n end\n when 'a'\n #Get user input and assign changed value to hash\n shelter.animals[value].age = prompt {\"Enter new age: \"}\n when 't'\n #Get user input and assign changed value to hash\n shelter.animals[value].toys << prompt {\"Enter new toy: \"}\n when 'd'\n #Get user input, validate, and assign changed value to hash\n res = validate_simple_input(%w(y n)) {prompt {\"Enter new adoption status (y , n): \"}}\n if res != 'q'\n shelter.animals[value].adoption = res\n end\n end\n end\n puts \"Edit completed\"\n # Output new animal\n puts \"Name: #{animal.name}, Breed: #{animal.breed}, Gender: #{animal.gender}, Age: #{animal.age}, Toys: #{animal.toys.join(', ')}, Adoption: #{animal.adoption}\"\n else\n puts \"Aborted\"\n end\n \nend",
"def refresh_user_data!\n if user = User.fields(:name, :nickname, :user_image, :user_image_original, :avatar_file_name).first(:id => self.user_id)\n self.name = user.name\n self.nickname = user.nickname\n self.user_image = user.user_image\n self.user_image_original = user.user_image_original\n self.has_shelby_avatar = user.has_shelby_avatar\n end\n end",
"def update(update_choice)\n if update_choice == \"v\"\n puts \"Which Voter would you like to update?\"\n voter = gets.chomp.downcase\n voter_find(voter)\n elsif update_choice == \"p\"\n puts \"Which Politician would you like to update?\"\n politician = gets.chomp.downcase\n politician_find(politician)\n else\n end\n end",
"def update\n\n if @user_info.update(user_info_params)\n\n @user_infos = UserInfo.all\n if @user_info.is_default == true\n @user_infos.each do |userinfo|\n if @user_info != userinfo\n userinfo.is_default = false\n userinfo.save\n end\n end\n end\n # @user_info.is_default = true\n\n respond_to do |format|\n format.html {\n redirect_to user_info_path(@user_info)\n }\n format.js # update.js.erb\n end\n\n else\n render :action => \"edit\"\n end\n\n end",
"def player_info\n \n clear_terminal\n @prompt = TTY::Prompt.new\n puts \"Enter the name of the player\"\n query = get_user_input\n if Player.all.find_by(name: \"#{query}\") == nil\n clear_terminal\n puts \"Try with hockey, that guy doesn't play soccer!\"\n pause\n pause\n player_info \n else player_info = Player.all.find_by(name: \"#{query}\") \n end\n clear_terminal\n divider\n choice = @prompt.select(\"#{player_info.name} is a great #{player_info.position} who plays in #{player_info.club_id} and has score #{player_info.goals} playing #{player_info.minutes} minutes this season. He had comitted #{player_info.fouls_committed} fouls and has #{player_info.yellow_cards} yellow cards and #{player_info.red_cards}\",\n [\"-> Back\",\"-> Quit\",\"-> Restart\"])\n case choice\n when \"-> Back\"\n players_home\n when \"-> Quit\" || \"QUIT\"\n when \"-> Restart\" || \"RESTART\"\n run\n else\n error\n end\n end",
"def process_user_input(user_input)\n continue_program = true\n\n case user_input\n when 'h'\n Classifieds::CLI.display_help\n when 'i'\n select_item_type\n when 'p'\n tmp_page_size = Classifieds::CLI.prompt('Enter new page size: ').to_i\n @page_size = tmp_page_size if 0 < tmp_page_size\n when 'q'\n continue_program = false\n# when 's'\n# # list sellers instead of items\n when ''\n # display next summary rows\n else\n if (item_number = user_input.to_i).between?(1, Classifieds::Listing.all.size)\n Classifieds::Listing.all[item_number-1].print_detail(item_number)\n else\n STDERR.puts Classifieds::CLI.red('Invalid selection')\n end\n Classifieds::CLI.prompt 'Press Enter to continue...'\n end\n continue_program\n end",
"def account_details\n selection = account_details_select\n case selection\n when 'View Details'\n @user.details\n when 'Change Username'\n username = @prompt.ask('Please enter your new username >')\n @user.change_username(username)\n else\n case_account_details(selection)\n end\n end",
"def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @gender = args[:gender] if args.key?(:gender)\n @id = args[:id] if args.key?(:id)\n @invitee_info = args[:invitee_info] if args.key?(:invitee_info)\n @type = args[:type] if args.key?(:type)\n end",
"def createnewuser_prompt\n header\n puts \"\\n\\nPlease enter a username.\\n\"\n self.createnewuser_input = STDIN.gets.strip\n self.createnewuser_valid?\nend",
"def set_user_info\n @user_info = UserInfo.find_by_user_id(session[:user_id])\n if (@user_info == nil)\n @user_info = UserInfo.new(:user_id =>session[:user_id]).save\n end\n end",
"def update\n if not params[:id]\n redirect_to root_path\n end\n user = User.find(params[:id])\n # update fields\n user.first_name = user_params[:first_name]\n user.last_name = user_params[:last_name]\n user.age = user_params[:age]\n user.education = user_params[:education]\n user.school = user_params[:school]\n user.expertise = user_params[:expertise]\n user.description = user_params[:description]\n user.certifications = user_params[:certifications]\n user.phone = user_params[:phone]\n user.zip = user_params[:zip]\n # languages\n user.lang1 = user_params[:lang1]\n user.lang1_fluency = user_params[:lang1_fluency]\n user.lang2 = user_params[:lang2]\n user.lang2_fluency = user_params[:lang2_fluency]\n # availability\n user.travel = user_params[:travel]\n user.time_commitment = user_params[:time_commitment]\n user.sunday_availability = user_params[:sunday_availability]\n user.monday_availability = user_params[:monday_availability]\n user.tuesday_availability = user_params[:tuesday_availability]\n user.wednesday_availability = user_params[:wednesday_availability]\n user.thursday_availability = user_params[:thursday_availability]\n user.friday_availability = user_params[:friday_availability]\n user.saturday_availability = user_params[:saturday_availability]\n user.availability_comments = user_params[:availability_comments]\n \n user.save\n \n # update complete flag\n if not user.complete\n all_fields_filled = true\n user_params.each do |k, v|\n if v.blank?\n all_fields_filled = false\n end\n end\n if all_fields_filled \n user.complete = true\n user.save\n else\n flash[:warning] = \"Some profile information is still missing. Please fill out the missing fields so that we can determine the best projects for you!\"\n end\n\n if not flash[:warning]\n flash[:notice] = \"Profile was successfully updated.\"\n end\n end\n\n redirect_to user_path(params[:id])\n end",
"def update\n if not params[:id]\n redirect_to root_path\n end\n user = User.find(params[:id])\n # update fields\n user.first_name = user_params[:first_name]\n user.last_name = user_params[:last_name]\n user.age = user_params[:age]\n user.education = user_params[:education]\n user.school = user_params[:school]\n user.expertise = user_params[:expertise]\n user.description = user_params[:description]\n user.availability = user_params[:availability]\n user.save\n \n # update complete flag\n if not user.complete\n all_fields_filled = true\n user_params.each do |k, v|\n if v.blank?\n all_fields_filled = false\n end\n end\n if all_fields_filled \n user.complete = true\n user.save\n else\n flash[:warning] = \"Some profile information is still missing. Please fill out the missing fields so that we can determine the best projects for you!\"\n end\n\n if not flash[:warning]\n flash[:notice] = \"Profile was successfully updated.\"\n end\n end\n\n redirect_to user_path(params[:id])\n end",
"def edit_staff_member_name(selected)\n\ts = StaffMember.find(selected)\n\tprint \"\\nTo edit the staff member name please enter here: \"\n\tname = gets.chomp\n\ts.update_attributes(name: name)\nend",
"def updated_profile\n \n @user = User.find_by_id(session[:user_id])\n \n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n @user.address = params[:user][:address]\n @user.city = params[:user][:city]\n @user.pincode = params[:user][:pincode]\n @user.state = params[:user][:state]\n @user.contact_no = params[:user][:contact_no]\n\n if @user.save\n flash[:notice] = \"Changes Updated Successfully\"\n redirect_to :action => \"admin_profile\"\n else\n flash[:notice] = \"Changes are not updated\"\n end # if @user.save\n\n end",
"def edit(*)\n super.tap do\n __debug_sim('USER initiates modification of existing entries.')\n end\n end",
"def edit\n @update_welcome = 'You have accessed the update page'\n @user = User.find(params[:id])\n\n end",
"def get_input\n if $logged_in\n print \"#{$logged_in.username} > \"\n gets.chomp\n else\n print \"User > \"\n gets.chomp\n end\nend"
] | [
"0.7229527",
"0.6956531",
"0.69048595",
"0.6856542",
"0.65341365",
"0.6497263",
"0.6437425",
"0.63885206",
"0.638058",
"0.63600695",
"0.6330888",
"0.6285693",
"0.6279032",
"0.6246253",
"0.6235097",
"0.6206364",
"0.6204562",
"0.6188513",
"0.6184168",
"0.61820275",
"0.61696464",
"0.615983",
"0.615224",
"0.61258435",
"0.60964733",
"0.60862494",
"0.60862494",
"0.60845983",
"0.60691833",
"0.60633177",
"0.6062177",
"0.6060291",
"0.6053111",
"0.6052309",
"0.60160786",
"0.60092604",
"0.6001434",
"0.5993611",
"0.5988708",
"0.5983251",
"0.59534854",
"0.59505737",
"0.5949204",
"0.59444577",
"0.5941416",
"0.5934049",
"0.592873",
"0.5926072",
"0.5921163",
"0.5917415",
"0.59048593",
"0.5897724",
"0.5875954",
"0.5875399",
"0.5874478",
"0.5855023",
"0.5836902",
"0.58327156",
"0.5825269",
"0.58203876",
"0.5815354",
"0.58135283",
"0.581033",
"0.5808602",
"0.58061373",
"0.58053297",
"0.5804531",
"0.5804531",
"0.5799189",
"0.5799189",
"0.5799189",
"0.5799189",
"0.5799189",
"0.5799189",
"0.5799189",
"0.57988095",
"0.57981545",
"0.57927924",
"0.57831484",
"0.57760596",
"0.57559603",
"0.57528806",
"0.5752699",
"0.5740212",
"0.5739913",
"0.57302046",
"0.5728752",
"0.57282573",
"0.572471",
"0.57216156",
"0.57152736",
"0.5715005",
"0.571472",
"0.5711682",
"0.570925",
"0.57075936",
"0.5705624",
"0.5697255",
"0.569668",
"0.5695674",
"0.568903"
] | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json deletes a user, by first deleting data (dreams, comments etc.) associated with the user | def destroy
@user = User.find(params[:id])
if [email protected]?
@user.dreams.each do |d|
d.destroy
end
end
if [email protected]?
@user.friends.each do |f|
f.destroy
end
end
if [email protected]?
@user.requests.each do |r|
r.destroy
end
end
if !Request.find_all_by_target_id(@user.id).nil?
Request.find_all_by_target_id(@user.id).each do |t|
t.destroy
end
end
@user.comments.all.each do |c|
c.destroy
end
@user.destroy
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end",
"def delete_user\n client.delete(user)\n end",
"def delete(user_id)\n self.class.delete(\"/#{@api_ver}/users/#{user_id}\", default_options_to_merge_with)\n end",
"def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n User.cascade_delete(@user)\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend",
"def destroy\n @user.destroy\n format.json { head :no_content }\n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n logger.debug(\"user destroy\")\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n HerosUsers.destroy_all(:user_id => @user.id)\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def user_management_delete_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"id\" => id,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.delete query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 404\n raise APIException.new \"Not found\", 404, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7878458",
"0.7515236",
"0.75021076",
"0.74629927",
"0.74484795",
"0.7419005",
"0.7388561",
"0.73814195",
"0.73557687",
"0.7346719",
"0.7339103",
"0.73115444",
"0.72999364",
"0.7292922",
"0.72923154",
"0.7290053",
"0.7287718",
"0.7287718",
"0.72800785",
"0.7250926",
"0.72500956",
"0.7249158",
"0.72411215",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297",
"0.7235297"
] | 0.72968185 | 13 |
adds a pic to the user's profile | def addpic
@user = User.find_by_id(session[:remember_token])
@photo = params[:user][:pic]
if @user.pic != @photo
@user.update_attributes(:pic => @photo)
render 'home/loggedin'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile\n current_user.update(user_params)\n current_user.avatar.attach(params[:user][:avatar]) if params[:user][:avatar].present?\n end",
"def update\n current_user.update(user_params_with_profile_picture)\n\n expose current_user\n end",
"def attachprofilepicture\n current_user.avatar.attach(params[:avatar])\n redirect_to profilepage_path\n end",
"def add_photo\n user = self\n user.remote_photo_url = \"http://res.cloudinary.com/dna8puisr/image/upload/v1512743339/default_avatar_qa3u1k.png\"\n user.save\n end",
"def profile_picture\n pic = params[:user_picture]\n @user = current_user\n if @user.update(user_picture: pic)\n render json: { \"message\": \"Profile Picture Updated Successfully\" }, status: :ok\n else\n render json: @user.errors.messages\n end\n end",
"def add_default_profile_pic\n self.picture = Rails.root.join(\"app/assets/images/profile-pic.jpg\").open\n end",
"def fb_profile_pic(user, options={})\n options = options.dup\n validate_fb_profile_pic_size(options)\n options.merge!(:uid => cast_to_facebook_id(user))\n tag(\"fb:profile-pic\", stringify_vals(options))\n end",
"def fb_profile_pic(user, options={})\n validate_fb_profile_pic_size(options)\n options.merge!(:uid => cast_to_facebook_id(user))\n tag(\"fb:profile-pic\", options)\n end",
"def make_userpic!\n self.cat_id = Content::CATEGORIES[:userpic][:id]\n self.relationshiptype_id = Relationshiptype.everyone\n self.save!\n if user.profile.userpic\n user.profile.userpic.update_attributes(:cat_id => Content::CATEGORIES[:image][:id])\n end\n user.profile.userpic_id = self.id\n user.profile.save!\n end",
"def add_picture(picture)\n end",
"def profile_picture_for(user)\n if user.picture?\n image_tag(user.picture.url, alt: user.name, class: \"profile_picture\")\n else\n image_tag(random_default_image, alt: user.name, class: \"profile_picture\")\n end\n end",
"def fb_profile_pic(user, options = {})\n validate_fb_profile_pic_size(options)\n options.merge!(:uid => cast_to_facebook_id(user))\n self_closing_tag(\"fb:profile-pic\", options)\n end",
"def set_main_image\n @user = User.find(params[:id])\n @user.avatar_id = params[:image_id]\n @user.save!\n redirect_to user_path(@user), notice: \"You successfully se the main profile as your avatar!\"\n end",
"def profile_image hash = {}\n image_name = hash.delete(:image_name) ||\n @controller.instance_variable_get(:@profile_user).feed.name.titlecase.\n gsub(/[\\/\\\\\\!\\@\\#\\$\\%\\^\\*\\&\\-\\.\\,\\?]+/, ' ').gsub(' ', '').underscore\n hash.update :action => 'profile_image', :id =>\n image_name, :format => (hash[:format] || 'jpeg'), :trailing_slash => false\n home(hash)\n end",
"def addpic\n @user = User.find_by_id(session[:remember_token]) \n if(@user.pics.size != 0)\n @user.pics[0].destroy\n end\n @pic = Pic.new(:user_id => @user.id, :url => params[:pic][:url])\n @pic.save!\n redirect_to(:back)\n end",
"def profile_photo\n\tend",
"def save_new_avatar\n @user.attributes = params[:user]\n \n return render(:action => :picture) unless @user.avatar && @user.avatar.valid? && @user.save\n \n flash[:notice] = \"Saved new avatar.\"\n redirect_to picture_settings_url\n end",
"def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend",
"def update_default_photo\n @user_id = Base64.decode64(params[:user_id])\n @img = params[:p_type]\n @user = MstUser.find_by(:id => @user_id)\n @user.trans_user_informations.update(\n :profile_picture => @img,\n )\n flash[:success] = t(\"you_have_successfully_update_the_profile_picture\")\n redirect_to user_dashboard_url\n end",
"def pic\r\n @profile ||= PicProfile.new(:account_id => session[:account_id])\r\n \r\n if request.post?\r\n # ! unlimited required !\r\n \r\n old_photo_id = @profile.photo_id\r\n @profile.photo_id = params[:photo_id]\r\n \r\n # validate the photo\r\n if @profile.photo_id && @profile.photo_id != old_photo_id\r\n photo = @profile.photo_id && Photo.get_photo(@profile.photo_id)\r\n if photo && photo.account_id == @profile.account_id\r\n if @profile.save\r\n Account.update_account_nick_pic_cache(session[:account_id], :pic => photo.image.url(:thumb_48))\r\n flash.now[:message] = \"已成功保存\"\r\n else\r\n flash.now[:error_msg] = \"操作失败, 再试一次吧\"\r\n end\r\n else\r\n jump_to(\"/errors/forbidden\")\r\n end\r\n end\r\n end\r\n \r\n end",
"def profile_img(uid, type=\"normal\")\n \"http://graph.facebook.com/#{uid}/picture?type=#{type}\"\n end",
"def editPicture\n user = User.find(session[:user_id])\n user.photo = params[:user][:photo]\n user.save\n redirect_to :controller => :users, :action => :home\n end",
"def user_profile_img(user)\n if user.avatar?\n return image_tag(user.avatar, alt: user.name, size: \"60x60\")\n else\n img_url = 'no_image.png'\n end\n image_tag(img_url, alt: user.name, size: \"60x60\")\n end",
"def attach_image_for_profile_and_flash_notice(image)\n # Change user's profile image.\n if @user.image == image\n flash_notice(:runtime_no_changes.t)\n else\n @user.update(image: image)\n flash_notice(:runtime_image_changed_your_image.t(id: image.id))\n end\n end",
"def display_profile_image\n if self.picture.present? && self.picture.url(:small).present?\n self.picture.url(:small)\n else\n ActionController::Base.helpers.asset_path('user.png')\n end\n end",
"def add\n @user = current_user\n unless current_user.user_info.blank? \n current_user.user_info.each do | key , value|\n m = \"#{key}=\"\n unless key.to_str == \"avatar\" \n @user.send( m, current_user.user_info[key] ) if @user.respond_to?( m )\n end\n end\n end\n respond_to do |format|\n format.html # add.html.erb\n format.json { render json: @user }\n end\n end",
"def add_picture (picture)\r\n fail \"Missing picture.\" if (picture == nil)\r\n path = absolute_path(picture.sub(\"/images\", \"../public/images\"), __FILE__)\r\n fail \"There exists no file on path #{path}\" unless (File.exists?(path))\r\n\r\n self.picture = picture\r\n end",
"def update_picture\n \n # Get the specified user, making sure that it exists\n @user = User.find_by_login(params[:user_login])\n \n # Check that the current user is the specified user, or an\n # administrator\n unless @user == current_user or admin_logged_in?\n flash[:error] = 'You cannot upload a profile picture for another user.'\n redirect_to :controller => 'sessions', :action => 'new'\n else\n \n if !params[:picture].blank?\n # Destroy any profile pictures currently associated with the \n # specified user\n destroy_user_profile_pics(@user) \n \n # Create a new profile picture and populate it with data\n @picture = ProfilePicture.new\n @picture.user = @user\n @picture.uploaded_data = params[:picture]\n @picture.content_type = 'image/jpeg'\n \n # Save new profile picture and redirect back to upload picture action\n @picture.save!\n flash.now[:just_submitted] = true\n end\n\n render :template => 'users/upload_picture', :layout => 'dialog'\n end\n end",
"def set_profile_image\n @profile_image = ProfileImage.find(params[:id])\n end",
"def update_profile_image(file)\n perform_post(\"account/update_profile_image.#{Twitter.format}\", build_multipart_bodies(:image => file))\n end",
"def update\n if params[:user][:prof_pic]\n params[:user][:prof_pic] = decode_base64\n end\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @user = current_user\n\n @user.profile = @profile\n @profile.save\n\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile, notice: 'Profile was successfully created.' }\n format.json { render :show, profile: :created, location: profile }\n @profile.create(profile_image: image)\n\n else\n format.html { render :new }\n format.json { render json: status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n if @user_profile.image.attachment \n @profile_image = @user_profile.image\n else\n @profile_image = \"https://api.adorable.io/avatars/200/#{current_user.username}\" \n end\n end",
"def uploaded_pic_file=(pic_file)\n if !pic_file.blank?\n img = Magick::Image.from_blob(pic_file.read).first\n img.change_geometry!('100x100'){ |cols, rows, im|\n im.resize!(cols, rows)\n }\n new_file = \"public/images/profile_images/#{self.username}.jpg\"\n img.write(new_file)\n end\n end",
"def create\n @profile_picture = ProfilePicture.new(params[:profile_picture])\n @profile_picture.user_id = current_user.id \n\n respond_to do |format|\n if @profile_picture.save\n format.html { redirect_to @profile_picture, notice: 'Profile picture was successfully created.' }\n format.json { render json: @profile_picture, status: :created, location: @profile_picture }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile_picture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_specific_user(first_name:, last_name:, number:, age: )\n user = User.new(\n first_name: first_name,\n last_name: last_name,\n password: 'secret',\n description: \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\",\n birthday: age.years.ago\n )\n user.email = \"#{user.first_name}@gmail.com\"\n\n url = \"app/assets/images/user_#{number}.jpg\"\n\n file = File.open(url)\n user.photo.attach(io: file, filename: \"#{user.first_name}_#{user.last_name}.jpg\", content_type: 'image/jpg')\n user.save!\nend",
"def profile_picture\n profile_picture_file_name\n end",
"def profile_image(profile)\n url = Gravatar.new(profile.display_email || '@').image_url size: 40,\n secure: true, default: :mm\n image_tag url, alt: \"gravatar for #{profile.name}\",\n style: 'width: 40px; height: 40px;'\n end",
"def profile_pic(facebook_id, opts={})\n type = opts.delete(:type) || \"square\" # <= Valid types: square, small, normal, large\n opts = {:class=>\"profile-pic\", :border=>0}.merge(opts)\n image_tag(\"//graph.facebook.com/#{facebook_id}/picture?type=#{type}\", opts)\n end",
"def get_pic_url\n\t if !self.pic_url\n\t\t twit_u = User.get_twitter_user_from_name(self.screen_name)\n\t\t\tputs twit_u\n\t\t\tself.pic_url = twit_u[\"profile_image_url\"]\n\t\t\tself.save!\n\t\tend\n\tend",
"def profile\n\t\t@user = User.where(username: params[:username])[0]\n\t\t@pics = Picture.where(user_id: @user.id).reverse\n\n\tend",
"def update\n @user = User.find(session[:user_id])\n if logged_in? && check_current_user? \n @user.image_url = params[:image]\n @user.save(:validate => false)\n redirect_to user_path(@user)\n else\n redirect_to user_path(@user)\n end\n end",
"def set_profile_photo\n @profile_photo = ProfilePhoto.find(params[:id])\n end",
"def update_default_photo\n @user_type = params[:type]\n @user_id = Base64.decode64(params[:user_id])\n @img = params[:p_type]\n @user = MstUser.find_by(:id => @user_id)\n @user.trans_user_informations.update(\n :profile_picture => @img,\n )\n flash[:success] = \"You have successfully update the profile picture.\"\n redirect_to admin_user_edit_url(:user_id => params[:user_id], :type => @user_type)\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n @user_profile.user_id = current_user.id if !current_user.is_admin?\n # update_address\n if @user_profile.save\n# resize_head_pic @user_profile.image.url\n redirect_to(\"/centers\") \n else\n render :action => \"new\" \n end\n end",
"def user_pic user\n \"<a href='#{site(user)}' title='#{user.city} #{user.jobs} #{user.maxim} #{user.memo}' target='_blank'><img width='48' height='48' src='#{user.avatar.thumb.url}' width='#{USER_THUMB_SIZE}' height='#{USER_THUMB_SIZE}'></a>\"\n end",
"def update_userpic!(should_this_be)\n if !should_this_be && user.profile.userpic == self\n self.clear_userpic!\n elsif should_this_be && user.profile.userpic != self\n self.make_userpic!\n end\n end",
"def profile_avatar\n if current_user.update(params.require(:user).permit(:avatar))\n render :profile_avatar\n else\n render(json: { errors: current_user.errors.full_messages }, status: :unprocessable_entity) && return\n end\n end",
"def create\n user = User.new(user_params_with_profile_picture)\n\n if user.save\n expose user\n else\n error! :invalid_resource, user.errors\n end\n end",
"def update\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\tpicture = params[:photo]\n\n \tif picture != nil\n \t\tfile = File.new(Rails.root.join('app', 'assets', 'images', picture.original_filename), 'wb')\n \t\tfile.write(picture.read)\n \t\tsubmission_hash = {\"email\" => params[:email],\n \"bio\" => params[:bio],\n \"photo\" => picture.original_filename}\n @current_user.update_attributes(submission_hash)\n render :action => 'crop'\n \telse\n \t\tsubmission_hash = {\"email\" => params[:email],\n \"bio\" => params[:bio]}\n @current_user.update_attributes(submission_hash)\n redirect_to :controller => :user, :action => :profile\n \tend\n\n\tend",
"def update\n file = params[:user][:image]\n @user.set_image(file)\n # raise 'hi'\n if @user.update_attributes(user_profile_params)\n redirect_to @user\n else\n render 'edit'\n end\n end",
"def set_profile_picture_url(user)\n case user.provider\n when 'facebook'\n x = open(\"http://graph.facebook.com/v2.6/#{user.uid}/picture?redirect=false\", &:read)\n user.profile_pic = eval(x)[:data][:url]\n else # 'twitter', 'google', 'linkedin'\n user.profile_pic = open(user.image_url)\n end\n user.profile_pic.url\n end",
"def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end",
"def update_image(image)\n self.avatar = image\n save!\n end",
"def set_picture\n @picture = Picture.where(id: params[:id], user: current_user)\n end",
"def avatar_photo (person)\n if person.image.attached?\n image_tag person.image\n else\n image_tag \"static/placeholder.jpg\"\n end\n end",
"def profile_photo\n photos = self.profile_photos\n photos.empty? ? 'http://ragatzi.s3.amazonaws.com/uploads/profile_default_1.png' : photos.last.photo.url\n end",
"def raster_profile_picture(user)\n if user.authentications.where(:provider == \"Facebook\").any?\n fb_picture(user)\n elsif user.authentications.where(:provider == \"Twitter\").any?\n twitter_picture(user, type: \"normal\") \n else\n image_tag user.avatar.url(:raster), class: \"img-circle small_profile_picture\"\n end\n end",
"def user_avatar(user_id)\n user = User.find!(user_id)\n if user.avatar.attached?\n image_tag user.avatar\n else\n image_tag \"../images/Littlefinger_Main.jpg\"\n end\n end",
"def edit\n \n @user.avatar.attach(params[:avatar])\n authorize @user\n end",
"def set_user_image\n @user_image = UserImage.find(params[:id])\n end",
"def set_user_image\n @user_image = UserImage.find(params[:id])\n end",
"def update_picture_avatar!\n return unless params[:user][:picture_attributes].present?\n avatar = params[:user][:picture_attributes][:avatar]\n params[:user].delete :picture_attributes if avatar.blank?\n end",
"def direct_avatar(profile_url, http)\n resp = http.head('/pavatar.png')\n profile_url + (profile_url =~ /\\/$/ ? '' : '/') + 'pavatar.png' if resp.kind_of?(Net::HTTPSuccess)\n end",
"def add_pic(options = {})\n @object = Pic.new(self, options)\n end",
"def show\n format.html { redirect_to user_path(@image.user), notice: \"Profile picture was successfully created.\" }\n end",
"def create_confirm\n @user = User.new(user_params)\n unless @user.valid?\n render new_user_path \n end\n if user_params.has_key?(:profile)\n dir = \"#{Rails.root}/app/assets/profiles\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profileName = user_params[:name] + \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') +\".\" + ActiveStorage::Filename.new(user_params[:profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profileName), 'wb') do |f|\n f.write(user_params[:profile].read)\n end\n @user.profile = profileName\n end\n end",
"def set_user_avatar\n @user_avatar = UserAvatar.find(params[:id])\n end",
"def profile_image=(file_data)\n @file_data = file_data\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n if params[:user][:profile_pic]\n uploaded_file = params[:user][:profile_pic].path\n @user.update(profile_pic: Cloudinary::Uploader.upload(uploaded_file, :folder => \"user/profile\")[\"public_id\"])\n end\n format.html {\n flash[:success] = \"Your profile has been updated.\"\n redirect_to users_url\n }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_pic_url\n result_hash['pic']\n end",
"def create\n @user = User.new(user_params)\n\n if params[:avatar_url] == \"\"\n @user.avatar_url = \"fct.gif\"\n end\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_picture\n\t\timage_tag(\"ruby.svg.png\", alt: \"Profile Picture\")\n\tend",
"def update_profile_image(image)\n body, headers = http_multipart_data({:image => image})\n post('/account/update_profile_image.json', body, headers)\n end",
"def update_profile_photo\n\t\t# checking the profile setting is present or not\n\t\tif !params[:profile_setting].present?\n\t\t\t# if present then navigate to the page\n\t\t\tredirect_to :back \n\t\telse\n\t\t# update the profile update images like cover photo and profile photo\n\t\t @profile_photos = @user.update_attributes(profile_setting_photo_params)\n\t\t # redirect to the user profile app page\n\t\t redirect_to user_profile_data_profile_path\n\t\tend\n\tend",
"def update_profile\n @profile_form = ProfileForm.new(profile_params)\n if !@profile_form.valid?\n render :edit_profile\n elsif profile_params[:new_profile].present?\n dir = \"#{Rails.root}/app/assets/profiles/\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profilename = profile_params[:name]+ \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') + \".\" + ActiveStorage::Filename.new(profile_params[:new_profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f|\n f.write(profile_params[:new_profile].read)\n end\n @profile_form.profile = profilename\n update_user_profile(@profile_form)\n else\n update_user_profile(@profile_form)\n end\n end",
"def set_avatar\n @user = current_user\n @avatar = Avatar.find(@user.avatar)\n end",
"def set_avatar(user, avatar)\n make_request(\n :put,\n \"/profile/#{user}/avatar_url\",\n content: { avatar_url: avatar }\n ).code == 200\n end",
"def picture\n\t\tid = params.has_key?(:id)?params[:id]:nil\n\t\t\n\t\tredirect_to '/assets/default_user.jpg' and return if id.nil?\n\t\t\n\t\tuser = User.find_by_id(id)\n\t\t\n\t\t#User picture\n\t\tif (!user.nil? && !user.fb_id.nil?)\n\t\t\tredirect_to 'https://graph.facebook.com/'+user.fb_id.to_s+'/picture?type=square' and return\n\t\telse\n\t\t\tredirect_to '/assets/default_user.jpg' and return\n\t\tend\n\t\n\t\trender :text=>id\n\tend",
"def save_picture(data)\n File.open('public/images/areas/'+ self.profile_picture,'w') do |f|\n f.write data\n end\n end",
"def create\n if params[:user]['image'].present?\n req = Cloudinary::Uploader.upload(params[:user][\"image\"])\n @user = User.new(user_params)\n @user.update :image => req[\"url\"]\n else\n @user = User.new(user_params)\n @user.update :image => 'https://tracker.moodle.org/secure/attachment/30912/f3.png'\n end\n\n\n if @user.save\n session[:user_id] = @user.id\n redirect_to user_path(@user.id)\n else\n render :new\n end\n\n end",
"def create_profile_photo\n randomPhotoIndex = 1 + rand(10)\n p = self.profile_photos.create\n p.remote_photo_url = 'http://ragatzi.s3.amazonaws.com/uploads/profile_default_' + randomPhotoIndex.to_s + '.png'\n p.save! \n end",
"def update\n @user = User.find(params[:id])\n @user.avatar.purge\n @user.avatar.attach(params[:avatar])\n user_params = params.require(:user).permit(:first_name, :last_name, :description, :avatar)\n if @user.update(user_params)\n flash[:success] = \"You successfuly updated your account\"\n redirect_to @user\n else\n render :action => 'edit'\n end\n end",
"def profile_picture\n if facebook_authentication && facebook_authentication.profile_picture\n return facebook_authentication.profile_picture\n end\n return '/images/unknown_user.png'\n end",
"def linked_in_avatar(user)\n image_tag(user.user_info[\"linked_in\"][\"image\"])\n end",
"def update!(**args)\n @profile_picture_option = args[:profile_picture_option] if args.key?(:profile_picture_option)\n end",
"def profile_img=(user_params)\n self.imageName = base_part_of(user_params.original_filename)\n self.imageB64 = user_params.read\n end",
"def profile_params\n params.require(:profile).permit(:user_id, :image)\n end",
"def update_avatar_from_provider!(auth)\n avatar_image_url = auth[\"info\"][\"image\"] || auth[\"extra\"][\"raw_info\"][\"profile_image_url_https\"] rescue nil\n person.update_attribute(:avatar_image_url, avatar_image_url) if avatar_image_url && person\n end",
"def edit_real_picture\n end",
"def add_profile(userinput)\n profile = Profile.create(name:userinput)\n profile.user_id = self.id\n profile.save\n profile\n end",
"def update\n user_info = User.find(params[:id])\n if !user_info.points\n @user[:points] = 100\n end\n if !user_info.image\n @user[:image] = 'https://graph.facebook.com/'+user_info.uid.to_s+'/picture?width=360&height=210'\n end\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@user = User.find(params[:id])\n\t\tif params[:avatar_photo]\n\t\t\[email protected]_id = params[:avatar_photo].to_i\n\t\telsif params[:cover_photo]\n\t\t\[email protected]_photo_id = params[:cover_photo].to_i\n\t\tend\n\n\t\tif @user.save\n\t\t\tflash[:success] = \"Photo Set!\"\n\t\t\tredirect_to request.referrer\n\t\telse\n\t\t\tflash[:error] = \"Couldn't set photo!\"\n\t\t\tredirect_to request.referrer\n\t\tend\n\tend",
"def profile_pic_params\n params.require(:profile_pic).permit(:title, :image)\n end",
"def edit_profile_picture\n picutre = ProfilePicture.new(params[:profile_picture])\n #flash[:notice] = activerecord_error_list(picutre.errors)\n if picutre.save\n pre_pic = ProfilePicture.find(:first,:conditions=>[\"user_id=#{picutre.user_id} and id!=#{picutre.id}\"])\n pre_pic.destroy if !pre_pic.nil?\n else\n flash[:notice] = picutre.errors.first[1] unless picutre.save\n end\n redirect_to \"/users/profile/#{@login_user.id}\"\n end",
"def update\n require 'rmagick'\n if params[:user].keys == [\"picture\"]\n @user.mimetype = params[:user][:picture].content_type\n @user.picture = params[:user][:picture].read\n @user.save\n @user = User.find(@user.id)\n picture = Magick::Image.from_blob(@user.picture)[0]\n picture.auto_orient!\n picture.resize_to_fit!(300, 300)\n picture.resize_to_fill!(300,300)\n @user.picture = picture.to_blob\n @user.save\n redirect_to :back and return\n end\n (params[:user].delete(\"password\") if params[:user][:password].blank?) rescue nil\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to pages_edit_profile_path, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { redirect_to pages_edit_profile_path, notice: 'Unprocessable entity' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def remove_picture\n @user = User.find_by_id(params[:id])\n \n if @user && (@user == @current_logged_in_user || @current_logged_in_user.is_a?(Admin))\n @user.picture_filename = nil\n @user.save\n \n \n render :partial => \"picture_edit\", :locals => {:user => @user}\n end\n end",
"def profile_image_tag(person, options = {})\n source = profile_image_source(person, options)\n options[:link_uri] = person_path(person) if add_image_link?(options)\n options[:alt_text] = \"Current photo of #{person}\"\n profile_or_team_image_div source, options\n end",
"def set_avatar\n @avatar = Avatar.find(params[:user_id])\n end",
"def profilepicture\n if portfolio\n portfolio.photo\n end\n end"
] | [
"0.7656146",
"0.7345806",
"0.73139536",
"0.7227781",
"0.7208167",
"0.7203044",
"0.72013706",
"0.71973735",
"0.71411794",
"0.7132607",
"0.70486164",
"0.7016035",
"0.70130724",
"0.6984113",
"0.69822097",
"0.6934895",
"0.69249046",
"0.6870301",
"0.6854374",
"0.6844526",
"0.6818469",
"0.68055815",
"0.6804141",
"0.6780701",
"0.6765894",
"0.6756528",
"0.67498195",
"0.6745845",
"0.67327404",
"0.66895616",
"0.66800463",
"0.66682",
"0.6659837",
"0.6657603",
"0.6656675",
"0.66558814",
"0.6653119",
"0.6643637",
"0.662511",
"0.6596176",
"0.6593395",
"0.65907663",
"0.6582822",
"0.656625",
"0.6564916",
"0.6560768",
"0.65586853",
"0.6547435",
"0.6494022",
"0.64876777",
"0.648348",
"0.648236",
"0.6466606",
"0.64535075",
"0.643015",
"0.642978",
"0.64075905",
"0.63872105",
"0.63849103",
"0.63491124",
"0.6348376",
"0.6348376",
"0.63473284",
"0.6333595",
"0.6333426",
"0.63238",
"0.6312207",
"0.6310357",
"0.6308588",
"0.6288644",
"0.6286875",
"0.6285879",
"0.628474",
"0.62684673",
"0.62640065",
"0.6263319",
"0.62600213",
"0.625931",
"0.6252361",
"0.624579",
"0.6245491",
"0.62352246",
"0.6233451",
"0.62278765",
"0.62259924",
"0.62257254",
"0.6221478",
"0.62207854",
"0.6217006",
"0.62130976",
"0.6211079",
"0.62013215",
"0.61992866",
"0.61973304",
"0.61904186",
"0.6189585",
"0.6175496",
"0.61719733",
"0.6163761",
"0.61588216"
] | 0.76705986 | 0 |
Optimizations can be: :mobile_number => associated to the message, so that it does not need to be read when completing missing fields | def infer_custom_attributes(optimizations = {})
address = self.kind_of?(AoMessage) ? to : from
return unless address.try(:protocol) == 'sms'
number = address.mobile_number
# Infer country from phone number
unless self.country
countries = Country.all.select{|x| number.start_with? x.phone_prefix}
if countries.length > 0
# Slipt countries with and without area codes
with_area_codes, without_area_codes = countries.partition{|x| x.area_codes.present?}
# From those with area codes, select only the ones for which the number start with them
with_area_codes = with_area_codes.select{|x| x.area_codes.split(',').any?{|y| number.start_with?(x.phone_prefix + y.strip)}}
# If we find matches with area codes, use them. Otherwise, use those without area codes
countries = with_area_codes.present? ? with_area_codes : without_area_codes
if countries.length == 1
ThreadLocalLogger << "Country #{countries[0].name} (#{countries[0].iso2}) was inferred from prefix"
self.country = countries[0].iso2
else
self.country = countries.map do |c|
ThreadLocalLogger << "Country #{c.name} (#{c.iso2}) was inferred from prefix"
c.iso2
end
end
end
end
# Infer carrier from phone number (if country is present)
if self.country and not self.carrier
countries = self.country
countries = [countries] unless countries.kind_of? Array
countries = countries.map{|x| Country.find_by_iso2_or_iso3 x}
carriers = []
countries.each do |c|
next unless c
cs = Carrier.find_by_country_id c.id
cs.each do |carrier|
next unless carrier.prefixes.present?
prefixes = carrier.prefixes.split ','
if prefixes.any?{|p| number.start_with?(c.phone_prefix + p.strip)}
ThreadLocalLogger << "Carrier #{carrier.name} was inferred from prefix"
carriers << carrier
end
end
end
self.carrier = carriers.length == 1 ? carriers[0].guid : carriers.map(&:guid) unless carriers.empty?
end
# Infer country and carrier from stored MobileNumber, if any
mob = optimizations[:mobile_number] || (MobileNumber.find_by_number number)
mob.complete_missing_fields self if mob
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sms_number_attribute(sms_number)\n # Sometimes Telerivet will return SMS numbers without a \"+\". When we figure\n # out why, remove this workaround.\n if sms_number[0] != '+'\n sms_number = \"+#{sms_number}\"\n end\n\n @sms_number_attribute_cache ||= {}\n @sms_number_attribute_cache[sms_number] ||= @@SMS_NUMBER_FIELDS.keys\n .find { |attribute| split_sms_numbers(attribute).include?(sms_number) }\n end",
"def update_mobile_phone_number\n begin\n self.mobile_phone_number = self.mobile_phone.tr('^0-9', '')\n rescue\n return nil\n end\n end",
"def phone_numbers_match_first_message\n first_message = self.messages.order(:created_at)&.first\n unless first_message.blank?\n unless self.to_phone == first_message.to\n errors.add(:to_phone, 'must match :to attribute of first Message')\n end\n unless self.from_phone == first_message.from\n errors.add(:from_phone, 'must match :from attribute of first Message')\n end\n end\n end",
"def deliver_sms(params)\n#puts \"**** Message#deliver_sms; params=#{params}\"\n sms_gateway = params[:sms_gateway]\n phone_number_array = @contact_info.map {|c| c[:phone]}.compact.uniq\n phone_numbers = phone_number_array.join(',')\n assemble_sms()\n#puts \"**** sms_gateway.deliver #{sms_gateway} w #{phone_numbers}: #{sms_only}\"\n #******* CONNECT TO GATEWAY AND DELIVER MESSAGES \n gateway_reply = \n sms_gateway.deliver(phone_numbers, sms_only)\n#puts \"**** gateway_reply=#{gateway_reply}\"\n #******* PROCESS GATEWAY REPLY (INITIAL STATUSES OF SENT MESSAGES) \n gtw_msg_id = nil\n if phone_number_array.size == 1\n # SINGLE PHONE NUMBER \n if gateway_reply =~ /ID: (\\w+)/\n gtw_msg_id = $1\n gtw_msg_id = gateway_reply[4..99] # Temporary workaround as $1 doesn't work on Heroku\n msg_status = MessagesHelper::MsgSentToGateway\n else\n gtw_msg_id = gateway_reply # Will include error message\n msg_status = MessagesHelper::MsgError\n end\n # Mark the message to this member as being sent\n self.sent_messages[0].update_attributes(:gateway_message_id => gtw_msg_id, \n :msg_status => msg_status)\n else\n # MULTIPLE PHONE NUMBERS\n # Get the Clickatell reply and parse into array of hash like {:id=>'asebi9xxke...', :phone => '2345552228372'}\n#puts \"**** gateway_reply=#{gateway_reply}\"\n msg_statuses = gateway_reply.split(\"\\n\").map do |s|\n if s =~ /ID:\\s+(\\w+)\\s+To:\\s+([0-9]+)/\n {:id => $1, :phone => $2} \n else\n {:id => nil, :phone => nil, :error => s}\n end\n end\n # Make array to associate members with their numbers\n @member_phones = self.members.map {|m| {:phone => m.primary_phone, :member => m} }\n # Update the sent_message records to indicate which have been accepted at Gateway \n msg_statuses.each do |s|\n#puts \"**** s[:id]=#{s[:id]}, s[:phone]=#{s[:phone]}\"\n if s[:id] && s[:phone]\n # Find the right member by matching phone numbers\n member = @member_phones.find{|m| m[:phone]==s[:phone]}[:member]\n # Find the right sent_message by matching member & message\n sent_message = SentMessage.where(:member_id=>member.id, :message_id=>self.id).first\n # Update the sent_message\n sent_message.update_attributes(\n :gateway_message_id => s[:id], \n :msg_status=> MessagesHelper::MsgSentToGateway\n )\n end\n end\n # Any sent_messages not now marked with gateway_message_id and msg_status must have errors\n sent_messages.each do |m| \n m.update_attributes(:msg_status=> MessagesHelper::MsgError) if m.msg_status.nil?\n end\n end\n end",
"def get_sms_number\n self.phone_numbers.where([\"type in(1, 3)\"]).first\n end",
"def mobile_phone\n self.dig_for_string(\"agentSummary\", \"mobilePhone\")\n end",
"def mobile_phone=(n)\n pull unless @details\n pn = Quickbooks::Model::TelephoneNumber.new\n pn.free_form_number = n\n @details.mobile_phone = pn\n #update our locally stored number too\n update_mobile_phone_number\n end",
"def mobile_number\n phones.mobile.try(:first).try(:number)\n end",
"def telerivet_contact_ids\n @@SMS_NUMBER_FIELDS.keys\n .map { |attribute| split_sms_numbers(attribute) }\n .flatten\n .map { |sms_number| telerivet_id_cache[sms_number] }\n .reject(&:blank?)\n .uniq\n end",
"def mobile_phone\n pull unless @details\n begin\n return @details.mobile_phone.free_form_number\n rescue\n return nil\n end\n end",
"def mobile_number\n \"#{mobile_phone_prefix}-#{short_phone_number}\"\n end",
"def handle_dialling_codes\n fields = [:direct_phone_number, :phone_number, :company_phone_number].select { |pn| self.send(pn).to_s.strip.size <= 3 }\n unless fields.empty?\n fields.each do |field|\n self.send(\"#{field}=\".to_sym, nil)\n end\n end\n end",
"def phone_mobile=(new_number)\n write_attribute :phone_mobile, new_number.try(:gsub, /[^0-9]/i, '')\n end",
"def phone_number; end",
"def phone_number; end",
"def mobile_phone=(value)\n @mobile_phone = value\n end",
"def phone_number\n\t\t\trecipient.phone_number\n\t\tend",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n recipient_phone = Phone.find_by_number(@message.number)\n \t recipient_phone ||= User.create!.phones.create!(:number => @message.number)\n @message.send_SMS(@message.raw_message, recipient_phone, \"\", @message.app.id)\n format.html { redirect_to messages_path, notice: 'Message was successfully sent.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mobile_phone\n return @mobile_phone\n end",
"def unique_mobile_user\n if self.class.where(mobile: mobile).count > 0\n errors.add(:mobile, :taken)\n end\n end",
"def build_message\n\n # Get user\n user = User.find(params[\"user_id\"])\n\n # User Info\n user_info = user[\"name\"]+\" \"+user[\"last_name\"]+\" (\"+user[\"email\"]+\"), \"+user[\"jobtitle\"]+\n \", perteneciente al centro de costos \"+user[\"deptname\"]+\", a cursado una solicitud para \"\n\n # Transfer line\n if params[\"request\"] == \"transfer line\"\n ms = user_info+params[\"transfer_line_type\"]+\" su linea de teléfono con número telefónico: +56 9 \"+\n params[\"phone_number\"]\n\n # Smartphone\n elsif params[\"item\"] == \"smartphone\"\n lost = \"\"\n motive = \"\"\n\n #if not technical service\n if params[\"request\"] != \"technical service\"\n # Get smartphone info\n if params[\"want_all\"] == '0'\n params[\"model\"] = get_smartphone(params[\"model_one\"])\n params[\"price\"] = params[\"model\"][\"price\"]\n motive = \"\"\n else\n params[\"model\"] = get_smartphone(params[\"model_all\"])\n motive = \" El modelo smartphone elegido no corresponde al cargo que tiene el trabajador.\n El motivo de la elección que ha dado el trabajador es: \"+params[\"comment\"]+\".\"\n end\n end\n\n # New\n if params[\"request\"] == \"new\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"want_new_number\"] == \"true\"\n ms+= \"debe ser nuevo.\"\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim.\"\n end\n\n # Renew, stolen/lost\n elsif params[\"request\"] == \"renew\" || params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" renovar su smartphone, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor referencial de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n lost = \" Esta solicitud fue cursada por la pérdido o robo del smartphone que el trabajador tenia asignado anteriormente.\"\n end\n\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"number_type\"] == \"new\"\n ms+= \"debe ser nuevo.\"\n params[\"want_new_number\"] = true\n elsif params[\"number_type\"] == \"same\"\n ms+= \"será el mismo que tiene asignado actualmente el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"same_number\"]+\".\"\n params[\"want_new_number\"] = false\n params[\"phone_number\"] = params[\"same_number\"]\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n params[\"want_new_number\"] = false\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim\"\n end\n\n # technical service\n elsif params[\"request\"] == \"technical service\"\n\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n end\n\n #message\n ms = user_info+\" enviar al servicio técnico su smartphone modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\", con número telefónico +56 9 \"+\n params[\"phone_number\"]+\". El desperfecto que presenta el smartphone es \"+\n params[\"comment\"]+\". \"+replace\n\n ms+= motive+lost\n end\n\n # Bam\n elsif params[\"item\"] == \"bam\"\n\n if params[\"request\"] != \"technical service\"\n # Get bam model's info\n params[\"model\"] = get_bam(params[\"model\"])\n # Get bam plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n end\n\n # New, stolen/lost\n if params[\"request\"] == \"new\" || params[\"request\"] == \"stolen/lost\"\n # Message\n ms = user_info+\" un nuevo dispositivo Bam modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \", asociado al plan \"+params[\"plan\"][\"name\"]+\", el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" Esta solicitud fue cursada por la pérdido o robo del dispositivo Bam que el trabajador tenia asignado anteriormente.\"\n end\n\n # Renew\n elsif params[\"request\"] == \"renew\"\n # Message\n ms = user_info+\" renovar su dispositivo Bam, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \". El usuario mantendrá el mismo plan, el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n # Technical service\n elsif params[\"request\"] == \"technical service\"\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n end\n #message\n ms = user_info+\" enviar al servicio técnico su dispositivo Bam modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\". El desperfecto que presenta el Bam es \"+\n params[\"comment\"]+\". \"+replace\n end\n\n # Sim\n elsif params[\"item\"] == \"sim\"\n # Message\n ms = user_info+\" una nueva Sim y el número de teléfono asociado a él\"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" debe ser el número telefónico: +56 9 \"+params[\"phone_number\"]+\n \". Esta solicitud fue cursada por la pérdida o robo de la Sim que el trabajador tenia asignado anteriormente.\"\n elsif params[\"want_new_number\"] == \"true\"\n ms+= \" debe ser nuevo.\"\n else\n # Message\n ms+= \" será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n\n # Roaming\n elsif params[\"item\"] == \"roaming\"\n # Get Roaming plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n # Modify date\n date_split = params[\"start_date\"].split(\"-\")\n params[\"start_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n\n date_split = params[\"end_date\"].split(\"-\")\n params[\"end_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n # Message\n ms = user_info+\" el servicio Roaming, con el plan: \"+params[\"plan\"][\"name\"]+\n \", el cual tiene un valor de $\"+params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". El servicio\n se solicita ya que el trabajador viaja al extranjero debido a: \"+params[\"comment\"]+\n \", entre las fechas: \"+params[\"start_date\"].strftime('%d/%m/%Y')+\" y \"+params[\"end_date\"].strftime('%d/%m/%Y')+\".\"\n end\n\n return ms\n end",
"def contact_phone\n self.contact[:contact_phone]\n end",
"def standardized_sms_phone_number\n PhoneParser.normalize(sms_phone_number)\n end",
"def add_sms_number(telerivet_link)\n tl = telerivet_link\n # cache the ID for later telerivet_contact_ids calls. But don't use \"||=\"\n # here: we need to call TelerivetBridge no matter what.\n telerivet_id_cache[tl.sms_number] = TelerivetBridge.sync_telerivet_link_and_return_contact_id(tl)\n assign_attributes(tl.attribute.to_sym => split_sms_numbers(tl.attribute.to_sym).push(tl.sms_number).uniq.join(', '))\n end",
"def with_sms_verification(phone)\n # Try to find SMS verification request\n sms_verification = SmsVerification.where({ cookie: cookie, phone: phone }).first\n\n # No SMS code sent yet.\n unless sms_verification\n generate_sms_verification_code(phone)\n false\n # SMS code was already sent\n else\n # SMS code is correct\n if sms_verification.code == params[:sms_verification_code]\n reset(sms_verification)\n true\n # SMS code is incorrect\n else\n sms_verification.attempts += 1\n sms_verification.save\n\n if sms_verification.attempts >= 3\n reset(sms_verification)\n generate_sms_verification_code(phone)\n end\n\n false\n end\n end\n end",
"def normalize_phone_number\n # stretch\n end",
"def normalize_phone_number\n # stretch\n end",
"def normalize_phone_number\n # stretch\n end",
"def normalize_phone_number\n # stretch\n end",
"def phone\n if @data.attribute_names.include?(:cmupreferredtelephone)\n @phone ||= @data[:cmupreferredtelephone].last.gsub(/[^0-9]/,'')\n else\n @phone ||= nil\n end\n end",
"def cell_phone; end",
"def index\n @short_messages = ShortMessage.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n\n cell_nos = []\n @short_messages.each do |sms|\n cell_nos << sms.target\n cell_nos << sms.source\n end\n\n @users = User.where(:mobile_no => cell_nos).index_by(&:mobile_no)\n end",
"def create_message_if_user_updated\n if !message && !id_changed? && user_id_changed? && user && user.master_consult && (!outbound? || user.phone == destination_phone_number)\n Message.create!(\n user: user,\n consult: user.master_consult,\n phone_call_id: id\n )\n end\n end",
"def treat_by_phone\n @conversation = @admin.mailbox.conversations.find(params[:id])\n @conversation.update_column :treated_by_phone, true\n @conversation.update_column :treated_at, Time.now\n @conversation.update_column :updated_at, Time.now\n @structure.delay.compute_response_rate\n respond_to do |format|\n format.html { redirect_to pro_structure_conversations_path(@structure), notice: \"La demande est considérée comme traitée\" }\n end\n end",
"def cell_phone_with_country_code; end",
"def calculate(message, phone)\n \n puts message.to\n end",
"def sms_retrieval_params\n params.require(:sms_retrieval).permit(:phone_number, :room_id)\n end",
"def mobile_phone\n return unless @user.loa3?\n\n dig_out('telephones', 'phone_type', VAProfile::Models::Telephone::MOBILE)\n end",
"def mobile_phone=(mobile_phone)\n\n if !mobile_phone.nil? && mobile_phone.to_s.length > 15\n fail ArgumentError, \"invalid value for 'mobile_phone', the character length must be smaller than or equal to 15.\"\n end\n\n @mobile_phone = mobile_phone\n end",
"def mobile_phone=(mobile_phone)\n\n if !mobile_phone.nil? && mobile_phone.to_s.length > 15\n fail ArgumentError, \"invalid value for 'mobile_phone', the character length must be smaller than or equal to 15.\"\n end\n\n @mobile_phone = mobile_phone\n end",
"def set_mobile_phone\n @mobile_phone = MobilePhone.friendly.find(params[:id])\n end",
"def find_by_sms_email_address(address, options={})\n number, carrier = reflections[:carrier].klass.carrier_from_sms_email(address)\n\n if number\n phone = find_by_number(number, options)||new(:number => number)\n phone.carrier = carrier if carrier\n phone\n else\n nil\n end\n\n end",
"def set_message_from_message_record(message_record,event_id,user)\n\n if (!message_record.nil? && ! message_record.empty? && !user.nil?)\n @event_id = (!event_id.nil?)? event_id: \"\"\n @id = (message_record.has_key?(\"message_id\"))? message_record[\"message_id\"]: \"\"\n @phone_number = (user.phone_number.nil?)? \"\": user.phone_number\n @user_id = (user.user_id.nil?)? \"\": user.user_id\n @content = (message_record.has_key?(\"content\"))? message_record[\"content\"]: \"\"\n @created_at = (message_record.has_key?(\"created_at\"))? DateTime.rfc3339(message_record[\"created_at\"]).to_f: Time.now.to_f\n @updated_at = (message_record.has_key?(\"updated_at\"))? DateTime.rfc3339(message_record[\"updated_at\"]).to_f: Time.now.to_f\n\n end\n\n end",
"def phone_number\n if self[:phone_number] == nil\n return nil\n end\n phone_number = self[:phone_number]\n return PhoneNumberHandler.format_phone_number(phone_number)\n end",
"def phone_number\n if self[:phone_number] == nil\n return nil\n end\n phone_number = self[:phone_number]\n return PhoneNumberHandler.format_phone_number(phone_number)\n end",
"def update_phone_number\n begin\n self.phone_number = self.primary_phone.tr('^0-9', '')\n rescue\n return nil\n end\n end",
"def send_sms_verification_code\n number_to_send_to = phone_number\n verification_code = phone_verification_code\n sms_message_body = I18n.t(\"devise.phone.message_body\", :verification_code => verification_code)\n\n sms = Sms.new\n sms.phone_number = number_to_send_to\n sms.message = sms_message_body\n return false unless sms.send!\n\n true\n end",
"def mobile_present?\n !mobile_number.nil?\n end",
"def mobile_enquiry(user_input_tokens)\n phone_enquiry(user_input_tokens)\n end",
"def telephone_field(object_name, method, options = T.unsafe(nil)); end",
"def customer_phone\n params['mobileNo']\n end",
"def conversation_extra_infos(conversation)\n extra_infos = Mailboxer::ExtraInfo.find(conversation.mailboxer_extra_info_ids.split(',')) if conversation.mailboxer_extra_info_ids.present?\n end",
"def calculate_partial_cost(phone_numbers, message)\n requested_url = 'https://api.txtlocal.com/send/?'\n uri = URI.parse(requested_url)\n http = Net::HTTP.start(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n res = Net::HTTP.post_form(uri, 'apikey' => ENV['LR_TXTLOCAL_TOKEN'], 'message' => message, 'sender' => 'Test', 'numbers' => phone_numbers.join(','), 'test' => '1')\n response = JSON.parse(res.body)\n response['cost']\n end",
"def mobile_phone_number\n FFaker.numerify(\"#{mobile_phone_prefix}## ### ###\")\n end",
"def set_unverified_phone_attributes\n if phone_verification_code.nil?\n self.phone_verification_code = generate_phone_verification_code\n end\n self.phone_number_verified = false\n self.phone_verification_code_sent_at = DateTime.now\n self.phone_verified_at = nil\n # removes all white spaces, hyphens, and parenthesis\n phone_number.gsub!(/[\\s\\-\\(\\)]+/, '') if phone_number\n end",
"def mobile_text_params\n params.require(:mobile_text).permit(:username, :scode, :mobile, :content, :extcode, :sendtime, :msgid, :msgtype, :signtag, :temid)\n end",
"def add_phone_number!(phone_number)\n clean_phone_number = Expect.clean_phone_number(phone_number)\n \n unless self.phone_numbers.where(clean_phone_number: clean_phone_number).any?\n self.phone_numbers.create(phone_number: phone_number)\n end\n end",
"def send_verification(phone:)\n raise StandardError, \"Phone can't be blank\" if phone.blank?\n raise StandardError, \"Please enter a valid phone\" unless PhoneValidator.valid?(phone)\n\n # check if a code was already sent to this phone number\n existing_code = redis.get(phone_key(phone))\n if existing_code\n\n # if a code was already sent, we need to check\n # that time has passed before re-sending it\n # we don't want to allow users to send too many SMS\n # because they cost money and could be abused\n too_early = redis.get(resend_key(phone)).present?\n\n raise StandardError, \"Can't resend a code this soon\" if too_early\n\n # verify that the maximum number of attempts was not yet reached\n attempts = redis.get(attempts_key(phone)).to_i\n raise StandardError, \"You reached the maximum number of attempts, please wait\" if attempts > MAX_ATTEMPTS\n\n # if time has passed, we re-send the same code\n code = existing_code\n else\n # generate N digit code\n code = SecureRandom.random_number(10 ** CODE_LENGTH).to_s.rjust(CODE_LENGTH, \"0\")\n\n # save this code in redis under the given phone number\n redis.set(phone_key(phone), code, ex: EXPIRATION, nx: true)\n # set attempts to 0\n redis.set(attempts_key(phone), \"0\", ex: EXPIRATION, nx: true)\n end\n\n # reset a timer for being able to send a code for a given phone number\n redis.set(resend_key(phone), \"true\", ex: TIME_BEFORE_RESEND, nx: true)\n\n content = \"Verification code: #{code}\"\n # actually send the SMS using twilio or some other service\n Messenger.call(phone: phone, message: content)\n end",
"def customer_mobile_params\n params.require(:customer_mobile).permit(:buyer_id, :seller_id, :invoice_id, :mobile_id)\n end",
"def phone_info(phone_number)\n if Telephony.config.pinpoint.sms_configs.empty?\n return PinpointHelper.handle_config_failure(:sms)\n end\n\n response = nil\n error = nil\n\n Telephony.config.pinpoint.sms_configs.each do |sms_config|\n error = nil\n CLIENT_POOL[sms_config].with do |client|\n response = client.phone_number_validate(\n number_validate_request: { phone_number: phone_number },\n )\n rescue Seahorse::Client::NetworkingError,\n Aws::Pinpoint::Errors::ServiceError => error\n PinpointHelper.notify_pinpoint_failover(\n error: error,\n region: sms_config.region,\n channel: :sms,\n extra: {},\n )\n end\n break if response\n end\n\n type = case response&.number_validate_response&.phone_type\n when 'MOBILE'\n :mobile\n when 'LANDLINE'\n :landline\n when 'VOIP'\n :voip\n else\n :unknown\n end\n\n error ||= unknown_failure_error if !response\n\n PhoneNumberInfo.new(\n type: type,\n carrier: response&.number_validate_response&.carrier,\n error: error,\n )\n end",
"def field_register_pharmacy(pharm_number,pharm_contact_name,staff_phone_number)\n pharm_number = standardize_number(pharm_number[0])\n\n #check to make sure this number is not already registered\n phone_number_in_db = Number.where(:id => pharm_number)\n if phone_number_in_db.count > 0\n send_try_again_sms(staff_phone_number,\"This number is already registered to pharmacy #{phone_number_in_db.first.pharmacy_id}\")\n return nil\n end\n\n\n Pharmacy.insert(:preferred_number_id => pharm_number,\n :name => pharm_contact_name)\n pid = Pharmacy.where(:preferred_number_id => pharm_number).first.id\n\n Number.insert(\n :id => pharm_number,\n :pharmacy_id => pid,\n :call_this_number => 1,\n :created_at => Time.now\n )\n\n #settings so we dont call em\n PendingCall.insert(\n :number_id => pharm_number,\n :attempts => $max_ors_attempts,\n :error_message_sent => 1\n )\n\n # Default start and end time for pharmacies\n AvailableTime.insert(\n :pharmacy_id => pid,\n :start_time => \"09:00:00\",\n :end_time => \"21:00:00\"\n )\n\n sms_message_confirmation = \"Registration successful. Pharmacy ID number is #{pid}\"\n $stderr.puts \"sending reg confirmation to to #{staff_phone_number}\"\n\n $client.account.sms.messages.create(\n :from => $sms_out_number,\n :to => staff_phone_number,\n :body => sms_message_confirmation)\n #send message to user\n $stderr.puts \"sending reg confirmation to to #{pharm_number}\"\n $client.account.sms.messages.create(\n :from => $sms_out_number,\n :to => pharm_number,\n :body => \"Welcome to bangpharma. Your pharmacy ID is #{pid}.\")\n\n return nil\nend",
"def sms_to(phone_number, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end",
"def remove_sms_number(telerivet_link)\n attribute = telerivet_link.attribute\n sms_number = telerivet_link.sms_number\n\n TelerivetBridge.unsync_telerivet_link(telerivet_link)\n assign_attributes(attribute => split_sms_numbers(attribute).reject{ |sms| sms == sms_number }.join(', '))\n end",
"def transform_numbers_row fields,row\n re = /(\\+?\\d*)?(\\/TYPE=PLMN@?)?([a-z0-9\\._-]*)@?([a-z0-9\\._-]*)?/i\n @numbers.each do |f,arr|\n i = fields[f]\n next unless i\n val = row[i]\n re.match val\n number = $1 || \"\"\n mail = \"\"\n mail += $3 if $3\n mail += \"@\"+$4 if $3 && !$3.empty? && $4 && !$4.empty?\n row << number.sub(\"+\",\"\")\n row << mail\n end\n return row\n end",
"def phone_number\n @phone.number\n end",
"def register_number(message,sms_number)\n chopped_message = message.gsub(/^\\s*reg\\s/i,'').split(\"\\s\")\n $stderr.puts chopped_message\n # check that it is length 2\n send_try_again_sms(sms_number) if chopped_message.length != 2\n register_number = chopped_message.grep(/\\d+/)\n #TODO - could make this more robust and allow for +88 too\n if register_number[0].length != 11 and register_number.grep(/^\\+1/).length != 1 #length of phone numbers in bangladesh\n send_try_again_sms(sms_number,\n \" The phone number should be 11 digits long\")\n return nil\n end\n\n register_name = chopped_message.grep(/[a-zA-Z]+/)\n\n if register_name.length == 1 and register_number.length == 1\n $stderr.puts \"meets field register reqs\"\n field_register_pharmacy(register_number,register_name,sms_number)\n else\n send_try_again_sms(sms_number)\n end\n return nil\nend",
"def create\n @message = Message.new(params[:message])\n @message.sender = \"cmu3071\" #THIS NEEDS TO BE CHANGED WHEN OAF RECEIVES THEIR OWN SHORTCODE\n @message.time = Time.now\n \n body = @message.body\n phones = Message.split_numbers(@message.recipient)\n\n phones.each do |ph|\n phone = Message.reformat_phone(ph)\n puts \"PHONE: #{phone}\"\n url = Message.text_to(phone,body)\n puts \"URL: #{url}\"\n newUrl = URI.parse(URI.encode(url.strip))\n http = Net::HTTP.new(newUrl.host,443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @data = http.get(newUrl.request_uri)\n puts \"STATUS: #{@data.code}\"\n puts \"BODY: #{@data.body}\"\n puts \"RESPONSE: #{@data}\"\n end\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def phone_number_value\n # byebug\n\n if self.phone_number.present?\n numbers_array = self.phone_number.split(\",\")\n numbers_array.each do |nn|\n nn = nn.gsub(\"-\",\"\").gsub(\"+91\",\"\").gsub(\" \",\"\") \n # byebug\n if nn.to_i.to_s.length != 10\n # byebug\n self.errors[:phone_number]<< \"must be 10 digit number\"\n end \n end\n end\n end",
"def sms_message(number,\r\n message,\r\n country_code = nil)\r\n # Prepare query url.\r\n _path_url = '/sms-message'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'output-case' => 'camel',\r\n 'number' => number,\r\n 'message' => message,\r\n 'country-code' => country_code\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: _parameters\r\n )\r\n CustomQueryAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n SMSMessageResponse.from_hash(decoded)\r\n end",
"def phone_params\n params.require(:phone).permit(:id, :code, :number, :description)\n end",
"def send!(message)\n if(self.msisdn_number.blank?)\n if(info = get_sim_info)\n self.update_attribute(:msisdn_number, response[:msisdn])\n end\n end\n\n JasperSmsGateway.send(self.msisdn_number, message)\n end",
"def cell_phone_in_e164; end",
"def user_phone_number_params\n params.require(:user_phone_number).permit(:number, :user_id)\n end",
"def contact_phone_with_default\n phone_numbers.first || phone_numbers.build\n end",
"def known_numbers\n numbers = {}\n\n numbers[:me] = Set.new(@client.account.incoming_phone_numbers.list.map(&:phone_number))\n\n @client.account.sms.messages.list({}).each do |@message|\n if @message.direction == \"inbound\"\n numbers[:victims] ||= Set.new\n numbers[:victims] << @message.from\n end\n end\n return numbers\nend",
"def phone_cell\n pid13 = message.fetch('PID').fetch('PID.13')\n\n # prefer PRN (Primary Residence Number) that contains a cell phone number\n phone_cell_record = pid13.find do |record|\n phone_cell_number?(record.fetch('PID.13.1', '') || '') &&\n record.fetch('PID.13.2', :unknown_type_of_phone_record) == 'PRN'\n end\n\n # otherwise choose the first occuring cell phone number\n phone_cell_record ||= pid13.find do |record|\n phone_cell_number?(record.fetch('PID.13.1', '') || '')\n end\n\n # any number for which phone_cell_number? returns false is ignored\n\n strip_non_phone_number_characters(phone_cell_record.fetch('PID.13.1')) if phone_cell_record.present?\n end",
"def mutate_phone_number(_)\n Faker::PhoneNumber.phone_number\n end",
"def from_for_display\n PhoneNumber.find_by_number(from).try(:name_and_number)\n end",
"def build_lookup_belongs(blank = nil)\n # TODO: Remove rescue statement\n @sms_templates = SmsTemplate.find_all_for_select_option('')\n @message_signature = \"\\n--\\n#{self.current_user.display_name.truncate(24)}\"\n @sms_recipients = AddressbookContact.find(:all, :order => 'name ASC')\n \n end",
"def get_contact_phone(page)\n page.css(WebScraper::JOB_DETAILS_SELECTOR)[WebScraper::JOB_CONTACT_PHONE_POS].content.strip\n end",
"def set_fields_from_hash(message)\n @sender = message['fromUuid'] || ''\n @payload = message['payload'] || {}\n @message_type = payload['message_type'].to_s.downcase || ''\n @time_stamp = payload['time_stamp'] || nil\n @handled = false\n end",
"def process_complaint_messages\n @messages.map! do |message|\n m = message['Message']\n details = {\n :complaint_detail => {\n :complaint_type => m['complaint'].fetch('complaintFeedbackType', 'N/A'),\n :complaint_date => m['complaint'].fetch('arrivalDate', 'N/A')\n }\n }\n Message.new(message['MessageId'], account_id, m['mail']['timestamp'], m['mail']['destination'][0], 'complaint', details)\n end\n end",
"def send_sms_token\n if(self.phone?)\n generate_sms_token! if self.sms_confirmation_token.nil?\n ::Devise.sms_sender.send_sms(self.phone, I18n.t(:\"devise.sms_activations.sms_body\", :sms_confirmation_token => self.sms_confirmation_token, :default => self.sms_confirmation_token))\n else\n self.class.sms_confirmation_keys.each do |key|\n self.errors.add(key, :no_phone_associated)\n end\n false\n end\n end",
"def sms_messages\n telerivet_contact_ids\n .map { |contact_id| TelerivetBridge.sms_messages_for_contact_id(contact_id) }\n .flatten\n .sort { |a, b| b.created_at - a.created_at }\n end",
"def edit_phone_number\n begin\n if params[:user][:phone_number].present?\n @user = api_user\n if @user && params[:user][:password].present?\n authorized_user = @user.valid_password?(params[:user][:password])\n elsif @user && params[:user][:email].present?\n authorized_user = @user.email == params[:user][:email] ? @user : nil\n else\n authorized_user=@user\n end\n if authorized_user\n if params[:user][:verification_code].present?\n if @user.verification_code == params[:user][:verification_code]\n if @user.update(phone_number: params[:user][:phone_number],verification_code: nil)\n @response = {:code => \"0\",:status => \"Success\",:message => \"Phone number updated successfully\",:user => @user.create_hash}\n else\n @response = {:code => \"1\",:status => \"Error\",:message => \"Error while updating phone number\",:user => @user.errors}\n end\n else\n @response = {:code => \"2\",:status => \"Error\",:message => \"Wrong verification code\"}\n end\n else\n verification_code = rand(1000...9999)\n to_number = \"#{params[:countries]}#{params[:user][:phone_number]}\"\n body = \"Your phone number successfully updated on miniflix and your verification code is #{verification_code}\"\n\n twillo_response = TwilioService.new(to_number, body).call()\n\n if twillo_response[:success]\n @response = {:code => \"0\",:status => \"Success\",:message => \"Successfully sent verification code on your phone number.\"}\n @user.update_attributes(:verification_code => verification_code)\n else\n @response = {:code => \"-1\",:status => \"Error\",:message => twillo_response[:message]}\n end\n end\n else\n @msg = params[:user][:email].present? ? \"Invalid email\" : \"Invalid Current Password\"\n @response = {:code => \"3\",:status => \"Error\",:message => @msg}\n end\n else\n @response = {:code => \"4\",:status => \"Error\",:message => \"Please pass user_id/phone_number/password/email\"}\n end\n rescue Exception => e\n @response = {:code => \"-1\",:status => \"Error\",:message => e.message}\n end\n render :json => @response\n end",
"def uses_mobile?(phone_number)\n PhoneNumber::MOBILE_PREFIXES.any? { |prefix| phone_number.starts_with?(prefix) }\n end",
"def set_twilio_params\n\t @incoming_phone = params[:From]\n\t @message = params[:Body]\n\t anonymous_phone_number = params[:To]\n\n\t @interview = Interview.where(phone_number: anonymous_phone_number).first\n\t end",
"def send_followup(params={})\n @contact_info = sent_messages.map do |sm| # including only sent_messages w/o response\n m = sm.member # member to whom this message was sent\n if m.msg_status < MessagesHelper::MsgDelivered\n {:member => m, :phone => m.primary_phone, :email => m.primary_email} \n else\n nil\n end\n end\n deliver_email if send_email\n deliver_sms(:sms_gateway=>params[:sms_gateway]) if send_sms\n end",
"def send_sms(message)\n api_response = \"\"\n if !self.mobile.blank?\n txtlocal = Txtlocal.find_by_sms_type(Txtlocal::GROUP_CHAT)\n if !txtlocal.nil?\n txtlocal.message_contents = message\n api_response = txtlocal.send_sms(self.mobile)\n end\n else\n api_response = \"You have not provided any mobile number. Please go to your 'Account' to set up a mobile number\"\n end\n return api_response\n end",
"def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end",
"def phone_params\n params.require(:phone).permit(:mobile)\n end",
"def all_mobile_params\n params.require(:all_mobile).permit(:mobile, :client_id)\n end",
"def copy_phone_if_user\n self.phone_number = user.phone_number if user && !phone_number\n end",
"def phone\n @json['user']['content']['phonenumber'] || ''\n end",
"def shape_phone_number\n self.phone_number = twilio_format phone_number\n end",
"def build_hl7_message(patient_info) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n msg_input = upload_qbp_template('lib/assets/qbp.hl7')\n\n # Build MSH Segment\n uid = rand(10_000_000_000).to_s\n msh = msg_input[:MSH]\n msh.time = Time.zone.now\n msh.message_control_id = uid\n\n # Build QPD segnment\n qpd = msg_input[:QPD]\n qpd.query_tag = uid\n\n if patient_info[:patient_list]\n patient_id_list = HL7::MessageParser.split_by_delimiter(qpd.patient_id_list, msg_input.item_delim)\n patient_id_list[1] = patient_info[:patient_list][:id] # ID\n patient_id_list[4] = patient_info[:patient_list][:assigning_authority] # assigning authority\n patient_id_list[5] = patient_info[:patient_list][:identifier_type_code] # identifier type code\n qpd.patient_id_list = patient_id_list.join(msg_input.item_delim)\n end\n\n if patient_info[:patient_name]\n patient_name = HL7::MessageParser.split_by_delimiter(qpd.patient_name, msg_input.item_delim)\n patient_name[0] = patient_info[:patient_name][:family_name] # family name\n patient_name[1] = patient_info[:patient_name][:given_name] # given name\n patient_name[2] = patient_info[:patient_name][:second_or_further_names] # second name\n patient_name[3] = patient_info[:patient_name][:suffix] # suffix name\n qpd.patient_name = patient_name.join(msg_input.item_delim)\n end\n\n if patient_info[:mothers_maiden_name]\n mother_maiden_name = HL7::MessageParser.split_by_delimiter(qpd.mother_maiden_name, msg_input.item_delim)\n mother_maiden_name[0] = patient_info[:mothers_maiden_name][:family_name] # family name\n mother_maiden_name[1] = patient_info[:mothers_maiden_name][:given_name] # given name\n mother_maiden_name[6] = patient_info[:mothers_maiden_name][:name_type_code] # name type code, M = Maiden Name\n qpd.mother_maiden_name = mother_maiden_name.join(msg_input.item_delim)\n end\n\n qpd.patient_dob = patient_info[:patient_dob]\n\n qpd.admin_sex = patient_info[:admin_sex]\n\n if patient_info[:address]\n address = HL7::MessageParser.split_by_delimiter(qpd.address, msg_input.item_delim)\n address[0] = patient_info[:address][:street] # street address\n address[2] = patient_info[:address][:city] # city\n address[3] = patient_info[:address][:state] # state\n address[4] = patient_info[:address][:zip] # zip\n address[6] = patient_info[:address][:address_type] # address type\n qpd.address = address.join(msg_input.item_delim)\n end\n\n if patient_info[:phone]\n phone_home = HL7::MessageParser.split_by_delimiter(qpd.phone_home, msg_input.item_delim)\n phone_home[5] = patient_info[:phone][:area_code] # area code\n phone_home[6] = patient_info[:phone][:local_number] # local number\n qpd.phone_home = phone_home.join(msg_input.item_delim)\n end\n\n msg_input\n end",
"def fill_mobile_data(user)\n puts \"Selecting moble nr country: #{mobile_country = user.mobile_country}\"\n select_item_from_list(:xpath, MOBILE_COUNTRY_SELECT, mobile_country)\n mobile_phone = user.mobile_phone\n puts \"Inputing mobile nr: '#{mobile_phone}'\"\n get_elem_and_fill(:xpath, MOBILE_NR_FILL, mobile_phone)\n end",
"def phone_number\n case rand(0..2)\n when 0 then fixed_line_number\n when 1 then mobile_number\n when 2 then mobile_or_pager_number\n end\n end",
"def compose_sms_with_order_details (c, order_index)\r\n\r\n order_id = order_index[\"order_id\"]\r\n\r\n # get order detail details with specific API endpoint \r\n order = c.sell_shop_orders_find order_id\r\n\r\n # New order with order ID as reference\r\n text = \"NEW ORDER #{order_id}\\n\"\r\n\r\n products = order[\"products_details\"]\r\n first_name = order[\"billing_address\"][\"first_name\"]\r\n last_name = order[\"billing_address\"][\"last_name\"]\r\n street = order[\"billing_address\"][\"street\"]\r\n city = order[\"billing_address\"][\"city\"]\r\n phone = order[\"contact_details\"][\"phone\"]\r\n\r\n # product list\r\n products.each do |product|\r\n text << \"#{product[\"quantity\"]} #{product[\"name\"]}\\n\"\r\n end \r\n\r\n # Total price\r\n text << \"TOT #{order[\"price\"]}#{order[\"currency_code\"]}\\n\"\r\n\r\n # Buyer address \r\n text << \"#{first_name} #{last_name}\\n\"\r\n text << \"#{street}, #{city}\\n\"\r\n\r\n # Buyer phone contact\r\n text << \"#{phone}\\n\"\r\nend",
"def send_to_phone(phone_obj, message, options={})\n\n if options[:skip_validation]\n phone_text = phone_obj.is_a?(ActiveRecord::Base) ? format_phone_number(phone_number) : phone_obj\n return send_message(phone_text, message, options)\n end\n\n phone_number = phone_obj.is_a?(ActiveRecord::Base) ? phone_obj :\n find_or_create_phone_number(phone_obj, options)\n\n assert_message_options!(phone_number, message, options)\n send_message(format_phone_number(phone_number), message, options)\n end"
] | [
"0.604683",
"0.5911435",
"0.58908224",
"0.57916653",
"0.57662237",
"0.5667378",
"0.56544393",
"0.5648933",
"0.55333394",
"0.55319816",
"0.55071",
"0.5497148",
"0.5490483",
"0.5425102",
"0.5425102",
"0.53891736",
"0.53792125",
"0.5366751",
"0.53635323",
"0.53623897",
"0.5341147",
"0.53339756",
"0.53321826",
"0.532227",
"0.5321797",
"0.5289522",
"0.5289522",
"0.5289522",
"0.5289522",
"0.5280801",
"0.52790827",
"0.5278421",
"0.5236854",
"0.5236235",
"0.523",
"0.52195346",
"0.52123713",
"0.5210959",
"0.5201878",
"0.5201878",
"0.5193144",
"0.5181349",
"0.51734596",
"0.51604474",
"0.51603705",
"0.5142958",
"0.5127647",
"0.5118275",
"0.5103293",
"0.5090582",
"0.50871456",
"0.50859594",
"0.50807935",
"0.5078506",
"0.50782865",
"0.5076751",
"0.5070239",
"0.50543684",
"0.5051295",
"0.5045275",
"0.5042919",
"0.5033252",
"0.50328314",
"0.5030321",
"0.5030009",
"0.5018146",
"0.5016899",
"0.5009863",
"0.5006015",
"0.50049245",
"0.50027996",
"0.50016695",
"0.4995304",
"0.49951267",
"0.49872112",
"0.49864608",
"0.49819446",
"0.49778637",
"0.49751103",
"0.4971794",
"0.4969827",
"0.4960243",
"0.49511784",
"0.4946167",
"0.49429435",
"0.49428272",
"0.49414685",
"0.49414414",
"0.4930135",
"0.492961",
"0.49241713",
"0.49200246",
"0.4918942",
"0.49188352",
"0.49183923",
"0.49169064",
"0.49163762",
"0.49123457",
"0.4910933",
"0.4905231"
] | 0.6365193 | 0 |
Detects whether DynamicPULSE Agent can attach | def detect
dynamicpulse_remote_xml = File.join(@app_dir, 'WEB-INF/dynamicpulse-remote.xml')
if File.exist?(dynamicpulse_remote_xml)
doc = REXML::Document.new(open(dynamicpulse_remote_xml))
@url = doc.elements['dynamicpulse-remote/centerUrl'].text
@system_id = doc.elements['dynamicpulse-remote/systemId'].text
@logger.debug("url=#{@url}")
@logger.debug("system_id=#{@system_id}")
return 'DynamicPULSE-3.+'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agent?\n true\n end",
"def agent?\n false\n end",
"def free_agent?\n type == \"free_agent\"\n end",
"def discoverable?\n fails_any = false\n\n # TODO Loop through agent requirements\n\n return !fails_any\n end",
"def attached?\n\t\tCommon.device_status(@handle);\n end",
"def agent_available?\n @free_agents.count > 0\n end",
"def status?\n # Is the VNC port open?\n unless system(\"nc -z localhost 5900 > /dev/null\")\n info(\"VNC port not open...\")\n return false\n end\n # Is at least one of the trigger files present?\n components = ['/Library/Preferences/com.apple.RemoteManagement.launchd', '/private/etc/RemoteManagement.launchd']\n components.each do |component|\n\t components.delete(component) if not File.exist?(component)\n end\n return false if components.empty?\n # Is the ARDAgent running?\n # This appears to be the only consistently active process on Leo, Snowy, and Lion.\n unless system(\"ps axc | grep ARDAgent > /dev/null\")\n info(\"ARD agent not running...\")\n return false\n end\n true\n end",
"def can_spawn?\n\t\t\n\tend",
"def probe?\n self.type == :probe\n end",
"def provision?\n true\n end",
"def attached?\n interface.status == 'in-use'\n end",
"def has_responsable?\n dreport.has_responsable?\n end",
"def provisional?\n registered? && @provisional\n end",
"def attached?\n return true if (device_type.to_s != 'device')\n !!( device && File.exists?(device) )\n end",
"def use_agent?\n @use_agent\n end",
"def control_pid?\n !!self[:daemonize]\n end",
"def control_pid?\n !!self[:daemonize]\n end",
"def check_config_and_start_agent\n return unless monitoring? && has_correct_license_key?\n return if using_forking_dispatcher?\n\n setup_and_start_agent\n end",
"def manual_enabled?\n return true\n end",
"def can_remind_patient?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end",
"def monitoring?\n if Agent.config[:monitor_mode]\n true\n else\n ::NewRelic::Agent.logger.warn('Agent configured not to send data in this environment.')\n false\n end\n end",
"def required_capabilities?(tcp)\n (ToolProxy::ENABLED_CAPABILITY - tcp['capability_offered']).blank?\n end",
"def check_command_policy\n true\n end",
"def enable_listener?\n true\n end",
"def check_attached\n check_connected\n raise NotAttached unless @app && @cube\n end",
"def is_agent?\n self.dig_for_boolean(\"agentSummary\", \"isAgent\")\n end",
"def agent_should_start?\n return false if already_started? || disabled?\n\n if defer_for_delayed_job?\n ::NewRelic::Agent.logger.debug('Deferring startup for DelayedJob')\n return false\n end\n\n if defer_for_resque?\n ::NewRelic::Agent.logger.debug('Deferring startup for Resque in case it daemonizes')\n return false\n end\n\n unless app_name_configured?\n NewRelic::Agent.logger.error('No application name configured.',\n 'The Agent cannot start without at least one. Please check your ',\n 'newrelic.yml and ensure that it is valid and has at least one ',\n \"value set for app_name in the #{NewRelic::Control.instance.env} \",\n 'environment.')\n return false\n end\n\n return true\n end",
"def ant?; @ant and @ant.alive?; end",
"def ant?; @ant and @ant.alive?; end",
"def ant?; @ant and @ant.alive?; end",
"def autostart?\n output_ptr = FFI::MemoryPointer.new(:int)\n return nil if FFI::Libvirt.virDomainGetAutostart(self, output_ptr) < 0\n output_ptr.read_int == 1\n end",
"def agent_should_start?\n !blacklisted_constants? &&\n !blacklisted_executables? &&\n !in_blacklisted_rake_task?\n end",
"def use_agent?; end",
"def can_activate?\n if custom?\n unless server.blank? || port.blank? || username.blank? || password.blank? || from_address.blank?\n true\n else\n false\n end\n elsif wundercoach_standard?\n unless replyto_address.blank?\n true\n else\n false\n end\n end\n end",
"def allow_registration method\n @register_semaphore.synchronize do\n @dynamic_capabilities.add method\n end\n end",
"def pingable?\n true\n end",
"def waiver?\n free_agent? && !waiver_bid\n end",
"def agent_eligible?(agents)\n agent = agents.find { |a|\n a['role'] == \"source\" and a['_resolved']['display_name']['software_name'] == \"Islandora\"\n }\n debug \"Islandora agent eligible: #{agent}\" if agent\n agent\n end",
"def alive?\n sub_type == 'ssdp:alive'\n end",
"def waagent_exists?\n ::File.exists?(::File.expand_path(::File.join('etc', 'waagent.conf'),'/')) &&\n `which waagent`\nend",
"def supports_required_capabilities?(tcp)\n (ToolProxy::ENABLED_CAPABILITY - tcp['capability_offered']).blank?\n end",
"def alive?(options)\n true\n end",
"def launchctl?\n launchctl.present?\n end",
"def launchctl?\n launchctl.present?\n end",
"def can_deliver?\n return false if inactive?\n return false if on_delivery?\n return false if sleepy?\n return false if waiting?\n true\n end",
"def valid?\n @hydra.queue(request('verify'))\n end",
"def is_dynamic?\n !@discovery_config.nil?\n end",
"def main_commands_enabled\n $game_party.exists\n end",
"def main_commands_enabled\n $game_party.exists\n end",
"def main_commands_enabled\n $game_party.exists\n end",
"def alive?\n !@native_manager.nil?\n end",
"def minting_service_defined?\n Rails.configuration.x.madmp.enable_dmp_id_registration && minter.present? &&\n minter.api_base_url.present?\n end",
"def provision_enabled?(env)\n env.fetch(:provision_enabled, true)\n end",
"def can?()\n d = server[:deployer]\n \n if d.has_key?(:from) and d.has_key?(:to)\n return true\n else\n return false\n end\n end",
"def sendable?\n at?(:active)\n end",
"def can_recover?\n self.lapsed? and not self.blacklisted\n end",
"def already_started?\n if started?\n ::NewRelic::Agent.logger.error('Agent Started Already!')\n true\n end\n end",
"def alive?\n [email protected]?\n end",
"def can_start?\n true\n end",
"def enable?(skill)\n return @actor.skill_can_use?(skill)\n end",
"def agent?(target, executor, inventory)\n inventory.features(target).include?('puppet-agent') ||\n executor.transport(target.transport).provided_features.include?('puppet-agent') || target.remote?\n end",
"def can_activate?\n self.sender && self.email_match?\n end",
"def can_health_check?\n return false if @service_type == 'worker'\n\n true\n end",
"def isAgent _args\n \"isAgent _args;\" \n end",
"def enabled?\n debug \"Call 'enabled?' for Pacemaker service '#{name}' on node '#{hostname}'\"\n out = get_primitive_puppet_enable name\n debug \"Return: '#{out}' (#{out.class})\"\n out\n end",
"def can_create_patient?\n has_role?(:enroller) || has_role?(:public_health_enroller)\n end",
"def ldap_auto_activate?\r\n ldap_auto_activate.to_s.to_i != 0\r\n end",
"def recording_consent_required?\n @settings.get_value(\"Require Recording Consent\") == \"true\"\n end",
"def host_agent_ready?\n # Localhost\n uri = URI.parse(\"http://#{LOCALHOST}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = LOCALHOST\n return true\n end\n\n return false unless @is_linux\n\n # We are potentially running on Docker in bridged networking mode.\n # Attempt to contact default gateway\n uri = URI.parse(\"http://#{@default_gateway}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = @default_gateway\n return true\n end\n false\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return false\n end",
"def announce_sensor\n announce_payload = {}\n announce_payload[:pid] = pid_namespace? ? get_real_pid : Process.pid\n announce_payload[:args] = @process[:arguments]\n\n uri = URI.parse(\"http://#{@host}:#{@port}/#{DISCOVERY_PATH}\")\n req = Net::HTTP::Put.new(uri)\n req.body = announce_payload.to_json\n\n # ::Instana.logger.debug \"Announce: http://#{@host}:#{@port}/#{DISCOVERY_PATH} - payload: #{req.body}\"\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n data = JSON.parse(response.body)\n @process[:report_pid] = data['pid']\n @agent_uuid = data['agentUuid']\n true\n else\n false\n end\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return false\n end",
"def allow_notification?\n true\n end",
"def votable?\n # NOTE: it was requested by NCID staff to make all registrations automatically votable\n # regardless of certification status\n return true\n# return self.certification.present?\n end",
"def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend",
"def enabled?(probe)\n Ruby.primitive :taskprobe_enabled_p\n raise PrimitiveFailure, \"TaskProbe#enabled? primitive failed\"\n end",
"def attached?\n not identifier.blank?\n end",
"def has_custom_attack?\n custom_attack_skill_features.any?\n end",
"def ability?\n self.__ability.present?\n end",
"def passive?\n false\n end",
"def instruments_running?\n instruments_pids.count > 0\n end",
"def instrumentalists?\n true\n end",
"def control_availability\n dpms_availability\n end",
"def can_emulate\n {\n method: \"Emulation.canEmulate\"\n }\n end",
"def disabled?\n if @view_context.params[\"id\"]\n current_ems = ExtManagementSystem.where(:id => @view_context.params[\"id\"]).first\n !current_ems.class_by_ems(\"HostInitiator\")&.supports?(:create)\n else\n ExtManagementSystem.none? do |ems|\n ems.class_by_ems(\"HostInitiator\")&.supports?(:create)\n end\n end\n end",
"def healthy?\n %w(run sleep).include?(@transmitter.status)\n end",
"def isAgentReady(agent)\n if agent.kind_of?(String)\n\treturn @agents_ready.include?(agent)\n else\n\treturn @agents_ready.include?(agent.name)\n end\n end",
"def disabled?\n !Agent.config[:agent_enabled]\n end",
"def can_create_patient_assessments?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end",
"def create?\n Agent.belongs_to_current_user(@user).exists?(@record.agent_id)\n end",
"def supports_injection?\n\n\tinj_works = false\n\t\n\tif !system(\"aireplay-ng -9 mon0 > inj_test.txt\")\n\t\tsystem(\"clear\")\n\t\tputs \"Sorry, either your wireless is disabled or\"\n\t\tputs \"your wireless card does not support injection.\"\n\t\tputs \"This makes cracking impossible.\"\n\t\tputs\n\tend\n\t\n\tfile = File.foreach(\"inj_test.txt\") do |line| \n\t\n\t\tif line =~ /Injection is working!/\n\t\t\tinj_works = true\n\t\tend\n\t\t\n\tend\n\t\n\treturn inj_works\nend",
"def verify_details_submitted_from_agent_following_lead\n if user_valid_for_viewing?(['Vendor'], params[:udprn].to_i)\n verified = params[:verified] == 'true' ? true : false\n vendor_id = @current_user.id\n agent_id = params[:agent_id].to_i\n if verified\n PropertyService.new(params[:udprn].to_i).attach_assigned_agent(agent_id)\n render json: { message: 'The agent has been chosen as your assigned agent' }, status: 200\n else\n ### TODO: Report to the admin\n render json: { message: 'The incident will reported to admin' }, status: 400\n end\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def promiscuous?\n\t\t\treturn false\n\t\tend",
"def check_snmp\n\t\tprint_status(\"Checking if SNMP is Installed\")\n\t\tkey = \"HKLM\\\\System\\\\CurrentControlSet\\\\Services\"\n\t\tif registry_enumkeys(key).include?(\"SNMP\")\n\t\t\tprint_status(\"\\tSNMP is installed!\")\n\t\t\treturn true\n\t\telse\n\t\t\tprint_error(\"\\tSNMP is not installed on the target host\")\n\t\t\treturn false\n\t\tend\n\tend",
"def enabled?\n !host.nil?\n end",
"def verify_mode\n @agent.verify_mode\n end",
"def can_post_install?\n return false unless has_os?\n\n ![\"vmware_esxi\", \"hyperv\", \"suse11\", \"suse12\"].include?(os_image_type.downcase)\n end",
"def allowed?\n return self.connected_to_padma?\n end",
"def pid_needed?\n pid.blank?\n end",
"def connected_to_padma?\n return !self.padma.nil?\n end",
"def peripheralManagerDidStartAdvertising(peripheralManager, error:error)\n if(error)\n NSLog(\"#{error}\")\n @advertisingSwitch.setOn(false, animated: true)\n return\n end\n\n if (peripheralManager.isAdvertising)\n NSLog(\"Turned advertising\")\n @advertisingSwitch.setOn(true, animated: true)\n end\n end",
"def requires_manual_payment?\n Paykido::Application.config.always_pay_manually or\n !self.payer.registered?\n end",
"def target_guestshell?(agent)\n agent['target'] == 'guestshell' ? true : false\nend"
] | [
"0.6566977",
"0.6432048",
"0.6125815",
"0.6015897",
"0.5879132",
"0.5862358",
"0.58021617",
"0.5801306",
"0.57894063",
"0.5718899",
"0.56837744",
"0.5639697",
"0.5635936",
"0.55782056",
"0.5576682",
"0.55494636",
"0.55494636",
"0.5440355",
"0.54350835",
"0.54216427",
"0.5409606",
"0.53964734",
"0.53889155",
"0.5373888",
"0.53685474",
"0.5367305",
"0.5364229",
"0.53629655",
"0.53629655",
"0.53629655",
"0.5360937",
"0.53608614",
"0.53492373",
"0.5337403",
"0.53358793",
"0.5331049",
"0.53254426",
"0.53146464",
"0.5314023",
"0.53022814",
"0.527962",
"0.5271123",
"0.5250173",
"0.5250173",
"0.5245279",
"0.5235904",
"0.52302694",
"0.5230022",
"0.5230022",
"0.5230022",
"0.5222711",
"0.5218153",
"0.521595",
"0.5212076",
"0.5206854",
"0.52057695",
"0.51999635",
"0.51963764",
"0.519156",
"0.5188452",
"0.5188061",
"0.5186876",
"0.51752573",
"0.51739246",
"0.5171187",
"0.516246",
"0.515827",
"0.515718",
"0.5146102",
"0.5146042",
"0.513848",
"0.5134222",
"0.5132236",
"0.5129226",
"0.51292086",
"0.51190066",
"0.5116759",
"0.5115767",
"0.5115168",
"0.51045096",
"0.51034003",
"0.5101702",
"0.51003957",
"0.5095893",
"0.5077108",
"0.50706",
"0.50693244",
"0.50686103",
"0.5062505",
"0.50624824",
"0.5062079",
"0.50605065",
"0.5053757",
"0.50507396",
"0.5048545",
"0.5045419",
"0.5043089",
"0.50373465",
"0.5036774",
"0.5026153",
"0.502596"
] | 0.0 | -1 |
Downloads and places the DynamicPULSE JARs | def compile
if @url.nil? || @system_id.nil?
raise "url #{@url}, or systemId #{@system_id} is not available, detect needs to be invoked"
end
dp_home = File.join(@app_dir, '.dynamic_pulse_agent')
FileUtils.mkdir_p(dp_home)
download_and_unzip(@url, @system_id, 'dynamicpulse-agent.zip', dp_home)
FileUtils.mv(File.join(dp_home, 'dynamicpulse.jar'), @lib_directory)
FrameworkUtils.link_libs([@app_dir], @lib_directory)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n #python executable files\n end",
"def tailor_package_to_platform\n @package.app('Dropbox')\n @package.volumes_dir('Dropbox Installer')\n @package.source(URI.encode(\"file://#{download_dest}\"))\n end",
"def install\n libexec.install \"phyutility.jar\"\n bin.write_jar_script libexec/\"phyutility.jar\", \"phyutility\"\n pkgshare.install \"examples\", \"manual.pdf\"\n end",
"def bundle\n raise \"Paths not given! Call setup first.\" if @install_dir.nil? || @jar_dir.nil?\n gems_jar = File.join(jar_dir, 'gems.jar')\n default_options = { :generate_rdoc => false, \n :generate_ri => false,\n :install_dir => install_dir }\n FileUtils.rm_rf install_dir if File.exists? install_dir\n FileUtils.mkdir_p install_dir\n installer = Gem::DependencyInstaller.new(default_options)\n @gems.each do |name, version|\n puts \"Installing #{name} (#{version})\"\n installer.install(name, version || Gem::Requirement.default) \n end\n Dir.glob(\"#{install_dir}/**/*.jar\").each do |jar|\n FileUtils.mv jar, File.join(jar_dir, jar.split(\"/\").last)\n end\n FileUtils.rm gems_jar if File.exists? gems_jar\n `jar cf #{gems_jar} -C #{install_dir} .`\n end",
"def download_and_install_agent(dt_home)\n LibertyBuildpack::Util.download_zip(@version, @uri, 'Dynatrace Appmon Agent', dt_home)\n rescue => e\n raise \"Unable to download the Dynatrace Appmon Agent jar. Ensure that the agent jar at #{@uri} is available and accessible. #{e.message}\"\n end",
"def copy_libs\n path_to_original_lib = File.dirname(__FILE__) # File.dirname(__FILE__) is the location of this file, that give the path of the main lib folder\n libs_to_copy = ['log.rb', 'files_manager.rb', 'command.rb'] # List of Libraries copied in the project folder for standalone run\n libs_dest_dir = \"#{@project_path}/#{@libdir}\" # Dir used to store libraries, to run the rakefile\n lib_dir = File.expand_path(libs_dest_dir) # get the absolute path\n FileUtils.mkdir_p libs_dest_dir # Create the output_dir if it doesn't exist\n for lib in libs_to_copy\n lib_file = \"#{path_to_original_lib}/#{lib}\"\n (@log.fatal { \"Workflow Finalisation : cannot copy the library #{lib_file} \" }; exit ) if not File.file? lib_file\n @log.info \"Workflow Finalisation : Copy libraries for a standalone usage of the rakefiles : #{lib_file}\"\n FileUtils.cp \"#{lib_file}\", libs_dest_dir\n end\n end",
"def download_plugins\n return nil unless download_plugins?\n plugin_downloader = Puppet::Configurer::Downloader.new(\n \"plugin\",\n Puppet[:plugindest],\n Puppet[:pluginsource],\n Puppet[:pluginsignore]\n )\n\n plugin_downloader.evaluate.each { |file| load_plugin(file) }\n end",
"def install\n # ENV.java_cache\n # system \"mvn\", \"clean\", \"package\", \"-Dmaven.test.skip=true\"\n libexec.install \"swagger-codegen-cli.jar\"\n bin.write_jar_script libexec/\"swagger-codegen-cli.jar\", \"swagger-codegen-moya\"\n end",
"def loadScripts\n load \"su2dslib/preferences.rb\"\n load \"su2dslib/exportbase.rb\"\n load \"su2dslib/interface.rb\"\n load \"su2dslib/numeric.rb\"\n load \"su2dslib/material.rb\"\n load \"su2dslib/radiance_entities.rb\"\n load \"su2dslib/radiancescene.rb\"\n load \"su2dslib/location.rb\"\n load \"su2dslib/resultsgrid.rb\"\nend",
"def install\n safe_system \"pax --insecure -rz -f Payload.gz -s ',./bin,#{bin},' -s ',./man,#{man},' -s ',./lib,#{lib},' -s ',./license_gpl_pdftk,#{prefix}/LICENSE,' -s ',./,#{prefix}/README/,'\"\n end",
"def copy_libs\n `mkdir -p #{ @path }/assets/wwww`\n `cp framework/phonegap.jar #{ @path }/libs`\n `cp framework/res/values/strings.xml #{ @path }/res/values/strings.xml`\n `cp framework/res/layout/main.xml #{ @path }/res/layout/main.xml`\n `cp framework/res/layout/preview.xml #{ @path }/res/layout/preview.xml`\n %w(drawable-hdpi drawable-ldpi drawable-mdpi).each do |e|\n `cp framework/res/drawable/icon.png #{ @path }/res/#{ e }/icon.png`\n end \n `cp -R example #{ @path }/assets`\n `mv #{ @path }/assets/example #{ @path }/assets/www`\n end",
"def download_assets\n return if @app.assets.blank?\n\n cmds = []\n\n @app.assets.sort_by { |asset| @app.ordered_assets.find_index(asset.dxid) }.each do |asset|\n url = download_asset(asset)\n tar_opts = asset.gzipped? ? \"xzf -\" : \"xf -\"\n cmds << \"RUN curl #{url} | tar #{tar_opts} -C / --no-same-owner --no-same-permissions\"\n end\n\n <<~ASSETS\n # Download app assets\"\n #{cmds.join(\"\\n\")}\n ASSETS\n end",
"def all_in_one_jar(options)\n name = options[:id] || fail(\"Missing :id\")\n libs = options[:libs] || fail(\"Missing :id\")\n package(:jar, :id => fakesdb(name)).tap do |pkg|\n pkg.enhance [task(:retrieve)]\n # double-enhance so merge happens after base jar is created\n pkg.enhance do\n pkg.enhance do\n libs.each do |prefix|\n Dir[_(\"lib\") + \"/#{prefix}-*.jar\"].each do |dep|\n fast_merge_jar pkg, dep if dep !~ /-sources/\n end\n end\n end\n end\n end\n end",
"def install_plugins\n download_plugins\n generate_goodies_includes\nend",
"def install!\n refresh_file_accessors\n prepare_pod_groups\n add_source_files_references\n add_frameworks_bundles\n add_vendored_libraries\n add_resources\n add_developer_files unless sandbox.development_pods.empty?\n link_headers\n end",
"def download_package\n path = download_path\n remote_file path do\n source URL\n action :create\n only_if { !::File.exist?(PATH) }\n end\n end",
"def load_libs; end",
"def execute_installation\n #start logging\n set_log_file @options[:log]\n \n download_and_decompress(@options[:prefix], [REDIS_URL, SQLITE3_URL, NGINX_URL])\n \n install_redis if @options[:redis]\n install_sqlite\n configure_nginx @options\n\n install_all_gems\n install_rhoconnect\n \n #remove downloaded tarballs\n cleanup options[:prefix]\n end",
"def load_library\n\t\t#wget some url\n\tend",
"def download\n if File.exist?\"#{Rails.root}/public/MEAN_Angular_#{current_user.email}.sh\"\n @mean_angular_script = \"MEAN_Angular_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/MEAN_AngularJS_#{current_user.email}.sh\"\n @mean_angularjs_script = \"MEAN_AngularJS_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/Python_Django_#{current_user.email}.sh\"\n @python_django_script = \"Python_Django_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/Ruby_on_Rails_#{current_user.email}.sh\"\n @ruby_on_rails_script = \"Ruby_on_Rails_#{current_user.email}.sh\"\n end\n end",
"def download_and_unzip(base_url, system_id, filename, save_to_dir)\n download_url = File.join(base_url, system_id, filename)\n LibertyBuildpack::Util.download_zip('3.+', download_url, 'DynamicPULSE Agent', save_to_dir)\n rescue => e\n raise \"[DynamicPULSE] Can't download #{filename} from #{download_url}. Please check dynamicpulse-remote.xml. #{e.message}\"\n end",
"def compile\n JavaBuildpack::Util.download(@version, @uri, 'Auto Reconfiguration', jar_name(@version), @lib_directory)\n end",
"def libs; end",
"def install_packages(app)\n\n `installer -pkg \"#{app}\" -target /`\n\nend",
"def post_install; end",
"def install\n\t install_dir(plugin_dirs) do |file|\n\t\tnext if file =~ /ROBOT/\n\t\tfile\n\t end\n\tend",
"def setup\n install_latest_ruby\n\n install_global_gems\n end",
"def package_dependency(dep, bundle_info)\n info \"Starting packaging #{dep}\"\n\n instance = if dep.is_a? String\n dependency_object_by_name dep\n else\n dep\n end\n\n onError \"Invalid dependency name: #{dep}\" unless instance\n\n files = instance.getInstalledFiles\n\n if !files || files.empty?\n error \"Dependency '#{dep}' has no files to package\"\n return nil\n end\n\n # Add symbolic link targets\n links_found = true\n total_links = 0\n handled = []\n\n while links_found\n\n links_found = false\n\n files.each do |f|\n full = File.join(DependencyInstallFolder, f)\n\n next if handled.include? full\n\n next unless File.exist?(full) && File.symlink?(full)\n\n link_target = File.join(File.dirname(f), File.readlink(full))\n\n unless child_path?(DependencyInstallFolder,\n File.join(DependencyInstallFolder, link_target))\n onError 'symbolic link to be installed points outside the dependency folder: ' +\n link_target.to_s\n end\n\n links_found = true\n total_links += 1\n handled.append full\n files.append link_target\n end\n end\n\n handled = nil\n\n info \"Resolved #{total_links} symbolic links in packaged file list\" if total_links > 0\n\n precompiled_name = instance.getNameForPrecompiled + '_' + CurrentPlatform\n zip_name = precompiled_name + '.tar.xz'\n info_file = precompiled_name + '_info.txt'\n hash_file = precompiled_name + '_hash.txt'\n\n # Check that all exist\n Dir.chdir(DependencyInstallFolder) do\n files.each do |f|\n unless File.exist? f\n onError \"Dependency file that should be packaged doesn't exist: \" + f.to_s\n end\n end\n\n files_to_restore = strip_files_if_needed files\n\n File.open(info_file, 'w') do |f|\n f.puts \"RubySetupSystem precompiled library for #{CurrentPlatform}\"\n f.puts instance.Name + ' retrieved from ' + instance.RepoURL\n f.puts instance.Version.to_s + ' Packaged at ' + Time.now.to_s\n f.puts ''\n f.puts \"You can probably find license from the repo url if it isn't included here\"\n f.puts 'This info file is included in ' + zip_name\n end\n\n # When bundling everything needs to be made clean\n File.unlink zip_name if File.exist?(zip_name) && $options[:bundle]\n\n info \"Compressing files into #{zip_name}\"\n\n # Write a tar file with lzma compression\n runSystemSafe('tar', '-cJf', zip_name, info_file, *files)\n\n restore_stripped_files files_to_restore\n\n onError 'Failed to create zip file' unless File.exist? zip_name\n\n hash = SHA3::Digest::SHA256.file(zip_name).hexdigest\n\n # Write hash to file\n File.open(hash_file, 'w') do |f|\n f.puts hash\n end\n\n success \"Done with #{dep}, created: #{zip_name}\"\n info \"#{zip_name} SHA3: \" + hash\n # info \"#{zip_name} PLATFORM: \" + CurrentPlatform\n bundle_info[:dep_files].append zip_name\n return { name: precompiled_name, hash: hash }\n end\nend",
"def install_package\n path = download_path\n windows_package 'Divvy' do\n source path\n installer_type :nsis\n action :install\n end\n end",
"def copy_solr_marc \n copy_file \"SolrMarc.jar\", \"lib/SolrMarc.jar\"\n end",
"def compile\n download_start_time = Time.now\n print \"-----> Downloading Spring Boot CLI #{@version} from #{@uri} \"\n\n JavaBuildpack::Util::ApplicationCache.new.get(@uri) do |file| # TODO: Use global cache #50175265\n puts \"(#{(Time.now - download_start_time).duration})\"\n expand(file, @configuration)\n end\n link_classpath_jars\n end",
"def install\n \n end",
"def pkg_binary; \"pacaur\" end",
"def download_mut_deps( mut_dir )\n FileUtils.chdir mut_dir, :verbose => verbose?\n cmd = \"puppet module build --render-as=json\"\n puts cmd if verbose?\n tgz = `#{cmd}`.split(\"\\n\").last.gsub('\"','')\n puts \"built module archive: #{tgz}\" if verbose?\n cmd = \"puppet module install #{tgz} \" +\n \"--module_repository=#{@upstream_puppet_forge} \" +\n \"--modulepath=#{@mods_dir} --target-dir=#{@mods_dir}\"\n v1 cmd\n out = `#{cmd}`\n v1 out\n\n # add the\n FileUtils.cp tgz, @tars_dir, :verbose => verbose?\n end",
"def extract\n return config.instance_dir if extracted?\n\n jar_file = download\n\n FileUtils.mkdir_p config.instance_dir\n FileUtils.cp jar_file, config.binary_path\n self.extracted_version = config.version\n\n config.instance_dir\n end",
"def install_management\n # Needed to play with the configuration database.\n package 'debconf'\n package 'debconf-utils'\n\n # Keys for Debian packages.\n package 'debian-archive-keyring'\n\n # Fetch files via HTTP.\n package 'curl'\n package 'wget'\n\n package 'dpkg-dev' # Builds packages from source.\n package 'openssh-server' # SSH into the box.\n\n # For gems with native extensions.\n package 'build-essential'\n package 'g++'\n\n # Pull code from version control.\n package 'subversion'\n package 'git-core'\n\n package 'avahi-daemon' # mDNS, a.k.a. Bonjour\n package 'ddclient' # dynamic DNS\n end",
"def reshuffle_jars()\n FileUtils.mkdir_p(\"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/\")\n FileUtils.cp(Dir[\"#{UcbDeployer::RESOURCES_DIR}/soulwing-casclient-*\"],\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/\")\n # These have been placed in $CATALINA_HOME/lib\n [\"mail\", \"activation\", \"javamail\", \"commons-logging\", \"log4j\"].each do |jar|\n FileUtils.rm_rf(Dir[\"#{self.build_dir()}/src/webapp/WEB-INF/lib/#{jar}-*\"])\n end\n end",
"def install_sdk(sdk_url)\n require 'zip'\n sdk_zip_path=File.join(Dir.tmpdir,'sdk.zip')\n if sdk_url.start_with?('file:')\n # require specific file scheme: the path part is \"relative\", or absolute if there are 4 slash\n raise 'use format: file:///<path>' unless sdk_url.start_with?('file:///')\n sdk_zip_path=sdk_url.gsub(%r{^file:///},'')\n else\n redirect_remain=2\n begin\n Aspera::Rest.new(base_url: sdk_url).call(operation: 'GET',save_to_file: sdk_zip_path)\n rescue Aspera::RestCallError => e\n if e.response.is_a?(Net::HTTPRedirection)\n if redirect_remain > 0\n redirect_remain-=1\n sdk_url=e.response['location']\n retry\n else\n raise \"too meny redirect\"\n end\n else\n raise e\n end\n end\n end\n # SDK is organized by architecture\n filter=\"/#{Environment.architecture}/\"\n ascp_path=nil\n # first ensure license file is here so that ascp invokation for version works\n self.path(:aspera_license)\n self.path(:aspera_conf)\n Zip::File.open(sdk_zip_path) do |zip_file|\n zip_file.each do |entry|\n # get only specified arch, but not folder, only files\n if entry.name.include?(filter) and !entry.name.end_with?('/')\n archive_file=File.join(folder_path,File.basename(entry.name))\n File.open(archive_file, 'wb') do |output_stream|\n IO.copy_stream(entry.get_input_stream, output_stream)\n end\n if entry.name.include?('ascp')\n FileUtils.chmod(0755,archive_file)\n ascp_path=archive_file\n end\n end\n end\n end\n File.unlink(sdk_zip_path) rescue nil # Windows may give error\n ascp_version='n/a'\n raise \"error in sdk: no ascp included\" if ascp_path.nil?\n cmd_out=%x{#{ascp_path} -A}\n raise \"An error occured when testing ascp: #{cmd_out}\" unless $? == 0\n # get version from ascp, only after full extract, as windows requires DLLs (SSL/TLS/etc...)\n m=cmd_out.match(/ascp version (.*)/)\n ascp_version=m[1] unless m.nil?\n File.write(File.join(folder_path,PRODUCT_INFO),\"<product><name>IBM Aspera SDK</name><version>#{ascp_version}</version></product>\")\n return ascp_version\n end",
"def lib_path; end",
"def lib_path; end",
"def lib_path; end",
"def install\n invoke \"totem:lodestar:install:javascripts\"\n invoke \"totem:lodestar:install:stylesheets\"\n invoke \"totem:lodestar:install:images\"\n invoke \"totem:lodestar:install:configs\", [file_name]\n invoke \"totem:lodestar:install:databases\", [file_name]\n invoke \"totem:lodestar:install:routes\"\n invoke \"totem:lodestar:install:documents\"\n invoke \"totem:lodestar:install:travis_ci\", [file_name]\n invoke \"totem:lodestar:install:views\", [file_name]\n end",
"def _load_automatic(&block)\n dir = URI.join(@uri, \"dists/#{@suite}/\")\n\n file = signed_download(URI.join(dir, 'Release'), URI.join(dir, 'Release.gpg'))\n\n release = DebParseRelease.new(@app, dir, file)\n c = Collector.new\n c.run_each(@all_archs.product(@components)) do |ac|\n pinfo = release.download(\"#{ac[1]}/binary-#{ac[0]}/Packages\")\n\n parser = DebPackagesParser.new(@app, @uri, pinfo)\n block.call(parser)\n end\n c.wait_throw\n end",
"def bootstrap(project, ref)\n package_url = \"http://builds.delivery.puppetlabs.net/#{project}/#{ref}/artifacts\"\n\n # First fetch the params file\n params_file = \"#{package_url}/#{ref}.yaml\"\n puts \"Fetching params file from '#{params_file}'...\"\n system(\"wget #{params_file}\")\n unless $?.success?\n fail \"Could not download params file '#{params_file}'. Perhaps project or ref were incorrect?\"\n end\n\n data = YAML.load_file(File.basename(params_file))\n\n # Next fetch the signing bundle\n signing_bundle = \"#{data[:project]}-#{data[:version]}-signing_bundle.tar.gz\"\n puts \"Fetching signing bundle from '#{package_url}/#{signing_bundle}'...\"\n system(\"wget #{package_url}/#{signing_bundle}\")\n\n unless $?.success?\n fail \"Could not download signing bundle '#{signing_bundle}'. Perhaps project or ref were incorrect?\"\n end\n\n # Unpack and clone the bundle\n puts \"Unpacking signing bundle...\"\n system(\"tar xf #{signing_bundle}\")\n\n puts \"Cloning signing bundle...\"\n system(\"git clone --recursive #{signing_bundle.gsub('.tar.gz', '')} #{data[:project]}-#{data[:version]}\")\n return [data[:project], data[:version]]\nend",
"def install\n end",
"def install\n end",
"def install_plugin_pods\n current_dir = Pathname.new __dir__\n project_dir= Pathname.new Dir.pwd\n relative = current_dir.relative_path_from project_dir\n pluginDir = File.join(relative.to_s, 'Plugins')\n if File.directory?(pluginDir) then\n plugins = Dir.children(pluginDir).each{}\n plugins.map do |r|\n if r != '.DS_Store' then\n podDir = File.join(pluginDir, r)\n pod r, :path => podDir, :nhibit_warnings => true\n puts(r)\n end\n end\n end\nend",
"def load_lab_app_lib_files\n libFiles = File.dirname(__FILE__) + \"/../lib/*.rb\"\n Dir[libFiles].each do |file|\n fullpath = File.expand_path(file)\n puts \"Loading your file #{fullpath}\"\n require fullpath\n end\n end",
"def shared_boot_jar_directory\n FilePath.new(@build_dir, \"boot-jars\")\n end",
"def patch_jars(jars)\n jars.each do |jar|\n tmp = File.new(\"MANIFEST.MF\", \"w\")\n Zip::ZipFile.open(jar) do |zip|\n cont = zip.read(\"META-INF/MANIFEST.MF\").rstrip\n tmp.puts(cont)\n if cont.match('DynamicImport-Package').nil? then\n tmp.puts(\"DynamicImport-Package: com.vladium.*\\n\")\n end\n\n tmp.close\n zip.replace(\"META-INF/MANIFEST.MF\", \"MANIFEST.MF\")\n end\n end\nend",
"def build_jar\n `rm framework/local.properties` if File.exists? 'framework/local.properties'\n `rm framework/phonegap.jar` if File.exists? 'framework/phonegap.jar'\n `rm framework/phonegap.js` if File.exists? 'framework/phonegap.js'\n `ECHO 'sdk-location=#{ @android_sdk_path }' > framework/local.properties`\n `cd framework; ant jar`\n end",
"def package_plugin(name)\n `cd #{@repository_path}; rake feather:package path=#{name} target=#{@build_path}`\n end",
"def install_in_ubuntu\n install_ppa(node['SignalFx_ppa']['collectd']['name'],\n node['SignalFx_ppa']['collectd']['uri'])\n install_ppa(node['SignalFx_ppa']['collectd_plugin']['name'],\n node['SignalFx_ppa']['collectd_plugin']['uri'])\n ubuntu_update\n install_package 'collectd'\nend",
"def setup(install_dir, jar_dir)\n @install_dir = install_dir\n @jar_dir = jar_dir\n end",
"def pack_clouds_dot_rb_and_expected_directories\n %w(lib plugins).each do |dir|\n if File.directory?(d = cloud.clouds_dot_rb_dir/dir)\n dputs(\"Adding local path: #{d}\")\n FileUtils.cp_r d, cloud.tmp_path/cloud.base_config_directory, :verbose => true, :remove_destination => true # req'd for symlinks\n end\n end\n FileUtils.cp cloud.clouds_dot_rb_file, cloud.tmp_path/\"/etc/poolparty/clouds.rb\"\n end",
"def load_dependencies(options = {})\n load_config(options)\n Merb::BootLoader::BuildFramework.run\n Merb::BootLoader::Dependencies.run\n Merb::BootLoader::BeforeAppRuns.run\n end",
"def install\n end",
"def run\n build_jar\n create_android\n generate_manifest\n copy_libs\n add_name_to_strings\n write_java\n end",
"def install\n system \"curl\", \"-L\", \"-o\", \"nuget.exe\", \"https://nuget.org/nuget.exe\"\n system \"/usr/local/bin/mono\", \"nuget.exe\", \"restore\", \"./Source/Boogie.sln\"\n system \"/usr/local/bin/xbuild\", \"Source/Boogie.sln\"\n system \"mkdir\", \"#{prefix}/Binaries\"\n prefix.install Dir[\"Binaries/*\"]\n system \"echo '#!/bin/sh'$'\\\\n''mono\\ #{prefix}/Boogie.exe\\ \\\"$@\\\"'$'\\\\n' > boogie\"\n system \"chmod\", \"+x\", \"boogie\"\n bin.install \"boogie\"\n end",
"def install\n bin.install \"bing-wallpaper.sh\" => \"bing-wallpaper\"\n prefix.install_metafiles\n end",
"def install\n FileUtils.cp_r File.join(builddir, '.'), destdir\n # Remove build cookies\n %w(build extract).each do |cookie|\n Dir.glob(\"#{destdir}/.#{cookie}-cookie-*\").each do |f|\n Log.info \"Deleting FPM Cookie #{f}\"\n File.delete(f)\n end\n end\n end",
"def postscript(ant, build_environment, product_directory, *args)\n return unless config_source[MAVEN_REPO_CONFIG_KEY]\n\n args.each do |arg|\n FilePath.new(arg['dest']).ensure_directory\n ant.jar(:jarfile => \"#{arg['dest']}/#{arg['artifact']}.jar\") do\n ant.fileset(:dir => @basedir.to_s, :includes => arg['includes'], :excludes => arg['excludes'])\n end\n end\n\n\n # package terracotaa\n end",
"def getPackages\n `wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.4.tar.gz`\n `wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz`\n `wget http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz`\n `tar zxf nagios-4.0.4.tar.gz`\n `tar zxf nagios-plugins-2.0.tar.gz`\n `tar zxf nrpe-2.15.tar.gz`\n end",
"def initial_setup\n # Copy across the application_record_loader.rb unless it already exists\n copy_file '../static_files/application_record_loader.rb',\n 'lib/record_loader/application_record_loader.rb',\n skip: true\n # Copy across the record_loader.rake unless it already exists\n copy_file '../static_files/record_loader.rake',\n 'lib/tasks/record_loader.rake',\n skip: true\n end",
"def download_and_install_agent(dynatrace_home)\n LibertyBuildpack::Util.download_zip(@version, @uri, 'Dynatrace OneAgent', dynatrace_home)\n rescue => e\n raise \"Unable to download the Dynatrace OneAgent. Ensure that the agent at #{@uri} is available and accessible. #{e.message}\"\n end",
"def maven_get(dependencies = DEPENDENCIES)\n #First, make sure the TMPMAVENDIR exists and create it if not.\n FileUtils.mkdir_p(TMPMAVENDIR)\n\n #Now make sure all the dependencies exist.\n dependencies.each do |dependency|\n jar_filename = dependency_to_jar(dependency)\n\n #Check if we already have the jar. Get it if not.\n if !File.exists?(maven_filename(jar_filename))\n url = dependency_to_url(dependency)\n uri = URI(dependency_to_url(dependency))\n $stderr.puts(\"downloading #{jar_filename} from #{uri}...\")\n\n File.open(maven_filename(jar_filename), \"wb\") do |f|\n begin\n f.print open(url, 'User-Agent' => 'ruby').read\n $stderr.puts \"Successfully downloaded #{jar_filename}!\"\n rescue SocketError => e\n $stderr.puts \"SocketError in downloading #{jar_filename}: #{e}\"\n rescue SystemCallError => e\n $stderr.puts \"SystemCallError in downloading #{jar_filename}: #{e}\"\n end\n end\n end\n end\nend",
"def post_install\n end",
"def package\n unless @package\n @package = package_resource_class.new(download_dest, run_context)\n tailor_package_to_platform\n end\n @package\n end",
"def install_conf_files\n generate(\"bindery:solr_conf\", \"#{File.join(save_location, 'solr')} --force\")\n end",
"def installDeps(copy)\n deps = Buildr.artifacts(project('infra').compile.dependencies).map(&:to_s)\n deps << project('infra').package.to_s\n\t\t EXTRA_JARS.each do |jar|\n\t\t\t\t\tdeps << jar\n\t\t\t\tend\n deps = skipDeps(deps)\n\n classpathFile = File.new(GT4LIB + '/gndms-dependencies.xml', 'w')\n classpathFile.syswrite('<?xml version=\"1.0\"?>' + \"\\n\" + '<project><target id=\"setGNDMSDeps\"><path id=\"service.build.extended.classpath\">' + \"\\n\")\n depsFile = File.new(GT4LIB + '/gndms-dependencies', 'w')\n deps.select { |jar| jar[0, GT4LIB.length] != GT4LIB }.each { |file| \n basename = File.basename( file )\n newname = GT4LIB+'/'+basename\n if (copy)\n puts 'cp: \\'' + file + '\\' to: \\'' + newname + '\\''\n cp(file, newname)\n puts 'yay'\n chmod 0644, newname\n else\n puts 'ln_sf: \\'' + file + '\\' to: \\'' + newname + '\\''\n chmod 0644, file\n ln_sf(file, newname)\n end\n depsFile.syswrite(basename + \"\\n\") \n classpathFile.syswrite('<pathelement location=\"' + basename + '\" />' + \"\\n\")\n }\n depsFile.close\n classpathFile.syswrite('</path></target></project>' + \"\\n\\n\")\n classpathFile.close\n end",
"def load_libs\n loadQueue = []\n Pathname.glob './lib/*.rb' do |script|\n require script.to_s\n scriptfolder = Pathname.new(script.to_s.gsub('.rb', ''))\n next if not scriptfolder.directory?\n\n loadQueue += scriptfolder.children(true).find_all {|file| file.to_s[-3..-1] == '.rb'}\n end\n \n # load the children\n loadQueue.each {|file| require file.to_s }\n end",
"def after_install(path, cli_path, options = {})\n logger = Bridgetown.logger\n git_init path\n\n unless options[\"skip-bundle\"]\n begin\n require \"bundler\"\n bundle_install path\n rescue LoadError\n logger.info \"Could not load Bundler. Bundle install skipped.\"\n end\n end\n\n yarn_install path unless options[\"skip-yarn\"]\n\n yarn_start = \"yarn start\"\n\n logger.info \"Success!\".green, \"🎉 Your new Bridgetown site was\" \\\n \" generated in #{cli_path.cyan}.\"\n if options[\"skip-yarn\"]\n logger.info \"You can now #{\"cd\".cyan} #{cli_path.cyan} to get started.\"\n logger.info \"You'll probably also want to #{\"yarn install\".cyan}\" \\\n \" to load in your frontend assets.\"\n else\n logger.info \"You can now #{\"cd\".cyan} and run #{yarn_start.cyan} to get started.\"\n end\n logger.info \"Then check out our online documentation for\" \\\n \" next steps: #{DOCSURL.cyan}\"\n logger.info \"Bundle install skipped.\" if options[\"skip-bundle\"]\n end",
"def generate()\n\t\tjdc='jekyll_date_chart.js'\n\t\tcopy_file \"lib/#{jdc}\", \"_assets/javascripts/#{jdc}\"\n\n\t\tdirectory 'vendor/assets/javascripts/', '_assets/javascripts/'\n\t\tdirectory 'vendor/assets/stylesheets/', '_assets/stylesheets/'\n\tend",
"def load!\n plug_path = \"#{path}/plugins\"\n unless File.directory?(plug_path)\n FileUtils.mkdir_p(plug_path)\n end\n for folder in [\"base\", load_path]\n FileUtils.copy_entry(\"/data/servers/#{folder}\", \"#{path}\")\n end\n remote_files.each do |file|\n FileUtils.copy_entry(file[:source], \"#{path}/#{file[:destination]}\")\n end\n plugins.each do |plugin|\n Plugin.new(plugin[:name]).load_and_save!(\n \"/data/plugins/#{plugins_path}\",\n plugin[:jar_path],\n \"#{path}/plugins\"\n )\n end\n unless components.empty?\n comp_path = \"#{path}/plugins/GameManager/components/\"\n unless File.directory?(comp_path)\n FileUtils.mkdir_p(comp_path)\n end\n components.each do |component|\n FileUtils.copy_entry(component[:path], \"#{path}/plugins/GameManager/components/#{component[:name]}.jar\")\n end\n end\n env.each{|k,v| Env.set(k, v.to_s, true)}\n for file in [\"yml\", \"yaml\", \"json\", \"properties\"].flat_map{|ext| Dir.glob(\"#{path}/**/*.#{ext}\")}\n data = Env.substitute(File.read(file))\n File.open(file, \"w\") do |f|\n f.write(data)\n end\n end\n end",
"def update_load_path\n require 'bundler'\n Bundler.setup\n end",
"def bundle_dependencies\r\n if options[:run_bundle]\r\n say \"Bundling application dependencies using bundler...\"\r\n in_root { run 'bundle install' }\r\n end\r\n end",
"def inject_jar(jar_path)\n jar_dir = tmp_app_path.join('Contents/Java')\n jar_dir.rmtree\n jar_dir.mkdir\n cp Pathname.new(jar_path), jar_dir\n end",
"def build_appdynamics\n old_filepath = \"source/appdynamics-php-agent-linux_x64-#{@source_input.version}.tar.bz2\"\n filename_prefix = \"#{@filename_prefix}_linux_noarch_any-stack\"\n\n if File.exist?(old_filepath)\n merge_out_data(old_filepath, filename_prefix)\n else\n HTTPHelper.download(@source_input, old_filepath)\n @out_data[:sha256] = Sha.get_digest(old_filepath, \"sha256\")\n @out_data[:url] = @source_input.url\n end\n end",
"def install!\n STDERR.puts \"Slimerjs does not appear to be installed in #{slimerjs_path}, installing!\"\n FileUtils.mkdir_p Slimerjs.base_dir\n\n # Purge temporary directory if it is still hanging around from previous installs,\n # then re-create it.\n temp_dir = File.join(temp_path, 'slimerjs_install')\n FileUtils.rm_rf temp_dir\n FileUtils.mkdir_p temp_dir\n\n Dir.chdir temp_dir do\n unless system \"curl -O #{package_url}\" or system \"wget #{package_url}\"\n raise \"\\n\\nFailed to load slimerjs! :(\\nYou need to have cURL or wget installed on your system.\\nIf you have, the source of slimerjs might be unavailable: #{package_url}\\n\\n\"\n end\n\n case package_url.split('.').last\n when 'bz2'\n system \"bunzip2 #{File.basename(package_url)}\"\n system \"tar xf #{File.basename(package_url).sub(/\\.bz2$/, '')}\"\n when 'zip'\n system \"unzip #{File.basename(package_url)}\"\n else\n raise \"Unknown compression format for #{File.basename(package_url)}\"\n end\n\n # Find the slimerjs build we just extracted\n extracted_dir = Dir['slimerjs*'].find { |path| File.directory?(path) }\n\n # Move the extracted slimerjs build to $HOME/.slimerjs/version/platform\n if FileUtils.mv extracted_dir, File.join(Slimerjs.base_dir, platform)\n STDOUT.puts \"\\nSuccessfully installed slimerjs. Yay!\"\n end\n\n # Clean up remaining files in tmp\n if FileUtils.rm_rf temp_dir\n STDOUT.puts \"Removed temporarily downloaded files.\"\n end\n end\n\n raise \"Failed to install slimerjs. Sorry :(\" unless File.exist?(slimerjs_path)\n end",
"def initialize\n\n unless ENV['PBMANAGER_ROOT'].nil?\n @base_dir = Pathname.new(ENV['PBMANAGER_ROOT'])\n if !@base_dir.directory?\n abort(\"PBMANAGER_ROOT is not directory\")\n end\n @base_dir = @base_dir.realpath.to_s\n else\n abort(\"Could not find PBMANAGER_ROOT\")\n return\n end\n\n\n # our \"build_root\" sits off our home directory,\n # TODO make this home or tmp or \"where told\"\n @sites_dir = ENV['HOME'] + \"/Sites\"\n\n\n @build_dir = \"#{@sites_dir}/build\"\n @cache_dir = \"#{@sites_dir}/cache\"\n\n # TODO Evaluate moving these to where they need to be realized.\n @ksiso_dir = \"#{@build_dir}/isos\"\n @vagrant_dir = \"#{@build_dir}/vagrant\"\n @ovf_dir = \"#{@build_dir}/ovf\"\n @vmware_dir = \"#{@build_dir}/vmware\"\n @vbox_dir = \"#{@build_dir}/vbox\"\n\n\n # TODO when ready to gemize the location this will be \"~/.pbs/config\"\n\n # if the directory exists then use it, otherwise create it, then\n # stop and alert the user.\n\n # TEMPORARY\n @config_dir = \"#{@base_dir}/config\"\n unless File.directory?(@config_dir)\n abort(\"Could not find PBMANAGER_ROOT/config?\")\n return\n end\n\n # TODO when ready to gemize location this will be \"~/.pbs/log\"\n the_log_dir = \"#{@base_dir}/log\"\n unless File.directory?(the_log_dir)\n # puts \"Making #{the_log_dir} for logging\"\n FileUtils.mkdir_p(the_log_dir)\n end\n\n the_log_file = \"#{the_log_dir}/log.txt\"\n begin\n @log = Logger.new(the_log_file)\n @log.level = Logger::DEBUG\n rescue => e\n raise PBManager::FatalError.new(\"Could not find #{the_log_file}\", e)\n return\n end\n\n @settings = YAML.load_file(\"#{@config_dir}/application.yml\")\n\n # TODO temp hardcode, this will be in \"~/.pbs/config\" directory\n @vmos = @settings[:vmos]\n @vmtype = @settings[:vmtype]\n\n\n @log.unknown(\"PBManager was initialized\")\n @log.debug \"@settings = \\n#{@settings.to_yaml}\"\n @log.info \"@vmos = #{@vmos}\"\n @log.info \"@vmtype = #{@vmtype}\"\n end",
"def package_ruby(pkg, options) \n # update dependencies in any case, i.e. independant if package exists or not\n deps = dependencies(pkg)\n Dir.chdir(pkg.srcdir) do\n begin\n logname = \"obs-#{pkg.name.sub(\"/\",\"-\")}\" + \"-\" + Time.now.strftime(\"%Y%m%d-%H%M%S\").to_s + \".log\"\n gem = FileList[\"pkg/*.gem\"].first\n if not gem \n Packager.info \"Debian: creating gem from package #{pkg.name}\"\n if !system(\"rake gem 2> #{File.join(OBS_LOG_DIR, logname)}\")\n raise \"Debian: failed to create gem from RubyPackage #{pkg.name}\"\n Packager.warn \" check: #{File.expand_path(logname)}\"\n end\n end\n\n gem = FileList[\"pkg/*.gem\"].first\n\n # Make the naming of the gem consistent with the naming schema of\n # rock packages\n #\n # Make sure the gem has the fullname, e.g.\n # tools-metaruby instead of just metaruby\n gem_rename = gem.sub(basename(pkg.name), canonize(pkg.name))\n if gem != gem_rename\n Packager.info \"Debian: renaming #{gem} to #{gem_rename}\"\n FileUtils.mv gem, gem_rename\n gem = gem_rename\n end\n\n Packager.debug \"Debian: copy #{gem} to #{packaging_dir(pkg)}\"\n FileUtils.cp gem, packaging_dir(pkg)\n gem_final_path = File.join(packaging_dir(pkg), File.basename(gem))\n\n # Prepare injection of dependencies\n options[:deps] = deps\n convert_gem(gem_final_path, options)\n # register gem with the correct naming schema\n # to make sure dependency naming and gem naming are consistent\n @ruby_rock_gems << debian_name(pkg)\n rescue Exception => e\n raise \"Debian: failed to create gem from RubyPackage #{pkg.name} -- #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end",
"def download_driver_http\n File.write(\n @target_path,\n open(@params[:jdbc_driver_jar]).read\n )\n end",
"def add_ri2_site_ruby\n src = File.join(D_RI2, 'lib').gsub('/', '\\\\') # + \"\\\\\"\n site_ruby = SITE_RUBY.gsub('/', '\\\\')\n puts \"#{'installing RI2 runtime files:'.ljust(COL_WID)}From #{src}\"\n puts \"#{COL_SPACE}To #{site_ruby}\"\n # copy everything over to pkg dir\n `xcopy /s /q /y #{src} #{site_ruby}`\n # now, loop thru build dir, and move to runtime\n Dir.chdir( File.join(SITE_RUBY, 'ruby_installer') ) { |d|\n Dir.glob('build/*.rb').each { |fn|\n f_str = File.binread(fn)\n if f_str.sub!(REWRITE_MARK, '\\1module Runtime # Rewrite')\n puts \"#{COL_SPACE}rewrite #{fn[6..-1]}\"\n File.open( File.join( 'runtime', fn[6..-1]), 'wb') { |f| f << f_str }\n end\n }\n `rd /s /q build`\n puts \"#{COL_SPACE}deleting build dir\"\n }\n end",
"def update_libraries uri\n src = sources.find(uri)\n libraries.each do |lib|\n lib.merge src if lib.contain?(src.filename)\n end\n diagnoser.schedule uri\n end",
"def install_in_debian\n package 'apt-transport-https'\n package 'dirmngr' if get_debian_os_name == 'stretch'\n collectd_ppa_source = node['SignalFx_debian_ppa'][get_debian_os_name]['collectd']['uri']\n signalfx_collectd_plugin_ppa_source = node['SignalFx_debian_ppa'][get_debian_os_name]['collectd_plugin']['uri']\n signalfx_keyid = node['SignalFx_debian_ppa']['keyid']\n execute 'add SignalFx PPA' do\n command \"apt-key adv --keyserver keyserver.ubuntu.com --recv-keys #{signalfx_keyid} && \n echo #{collectd_ppa_source} > /etc/apt/sources.list.d/signalfx_collectd.list && \n echo #{signalfx_collectd_plugin_ppa_source} > /etc/apt/sources.list.d/signalfx_collectd_plugin.list\"\n action :run\n end\n ubuntu_update\n install_package 'collectd'\nend",
"def load_dependencies(options = {})\n load_config(options)\n Merb::BootLoader::BuildFramework.run\n Merb::BootLoader::Dependencies.run\n Merb::BootLoader::BeforeAppLoads.run\n end",
"def qpid_tools_tarball\n \"#{qpid_prebuild_repo}/qpid-python-tools-#{qpid_version}.tar.gz\"\n end",
"def fetch_obs_packages\n log.info \"Fetching all required packages\"\n yast_url.each_with_index do |url, index|\n system \"zypper --root #{cache_dir} ar --no-gpgcheck -p #{index + 1} #{url} \" \\\n \"download-packages-#{index}\"\n end\n system \"xargs -a #{obs_pkg_list_path} zypper --root #{cache_dir} \" \\\n \"--pkg-cache-dir=#{cache_dir} download\"\n\n yast_url.size.times { |i| system \"zypper --root #{cache_dir} rr download-packages-#{i}\" }\n\n log.info \"Fetching packages from extra repositories\"\n @extra_repos.each do |repo|\n system \"zypper --root #{cache_dir} ar --no-gpgcheck #{repo[:server]} \" \\\n \"download-extra-packages\"\n system \"zypper --root #{cache_dir} --pkg-cache-dir=#{cache_dir} \" \\\n \"download #{repo[:packages].join(\" \")}\"\n system \"zypper --root #{cache_dir} rr download-extra-packages\"\n end\n end",
"def download_jar(jar_name, target_directory = @lib_directory, description = @component_name)\n download(description) { |file| FileUtils.cp file.path, File.join(target_directory, jar_name) }\n end",
"def install\n system \"make\"\n pkgshare.install Dir[\"bin/*.R\"]\n pkgshare.install Dir[\"bin/*.r\"]\n rm Dir[\"bin/*.R\"]\n rm Dir[\"bin/*.r\"]\n bin.install Dir[\"bin/*\"]\n bin.install \"fastahack/fastahack\"\n pkgshare.install \"samples\"\n end",
"def build_package\n # Force timestamp to be initialized before anything else. This gives us a\n # stable timestamp for the process.\n timestamp\n # Prepare the work area: copy files from root_path to work_path based on\n # the resolved Manifest.txt.\n prepare_work_area\n # Anything that has been modified locally needs to be reset.\n restore_modified_files\n # Save both the final release metadata and the in-package release metadata.\n save_release_metadata\n # Vendor the dependencies for the package.\n vendor_dependencies\n # Request that supporting plug-ins build the package.\n request_build_package\n end",
"def install_flutter_business_pods\n install_business_pods\n install_plugin_pods\nend",
"def install_business_pods\n current_dir = Pathname.new __dir__\n project_dir= Pathname.new Dir.pwd\n relative = current_dir.relative_path_from project_dir\n pod 'FlutterBusiness', :path => relative\nend",
"def install_databases\n package 'sqlite3'\n package 'libsqlite3-dev'\n\n package 'mysql-client'\n package 'mysql-server'\n package 'libmysql-dev', 'libmysqlclient-dev', /^libmysqlclient\\d*-dev$/\n\n package 'postgresql-client'\n package 'libpq-dev'\n\n # TODO: NoSQL stores.\n end",
"def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end",
"def generate_packaging_artifacts(workdir, name, binding, project)\n [\"pkginfo\", \"depend\", \"preinstall\", \"preremove\", \"postinstall\", \"proto\"].each do |template|\n target_dir = File.join(workdir, 'packaging')\n FileUtils.mkdir_p(target_dir)\n erb_file(File.join(VANAGON_ROOT, \"resources/solaris/10/#{template}.erb\"), File.join(target_dir, template), false, { :binding => binding })\n end\n end",
"def package_artifact\n # keep track of current working dir\n current_dir = Dir.pwd\n Dir.chdir @configuration.package_destination_path\n\n # zip final package\n cmd = []\n cmd << \"zip\"\n cmd << \"-r\"\n cmd << \"\\\"#{@configuration.zipped_package_name}\\\"\"\n cmd << \"\\\"#{@configuration.dsym_name}\\\"\" unless @configuration.skip_dsym\n cmd << \"\\\"#{@configuration.ipa_name}\\\"\" unless [email protected]? \"iphoneos\"\n cmd << \"\\\"#{@configuration.app_name}.#{@configuration.app_extension}\\\"\" unless [email protected]? \"macosx\"\n cmd << \"2>&1 %s ../build.output\" % (@configuration.verbose ? '| tee' : '>')\n\n system cmd.join \" \"\n\n # delete all the artifacts but the .app. which will be needed by the automation builds\n FileUtils.rm_rf @configuration.dsym_name unless !File.exists? @configuration.dsym_name\n FileUtils.rm_rf @configuration.ipa_name unless !File.exists? @configuration.ipa_name\n\n # back to working directory\n Dir.chdir current_dir\n\n puts \"Done\"\n puts \"ZIP package: #{@configuration.zipped_package_name}\"\n end",
"def package_tarballs( mods_dirs )\n pwd = Dir.pwd\n mods_dirs.each do |module_dir|\n next unless File.directory? module_dir\n FileUtils.chdir module_dir, :verbose => (verbose?)\n\n cmd = \"puppet module build --render-as=json\"\n puts cmd if verbose?\n tgz = `#{cmd}`.split(\"\\n\").last.gsub('\"','')\n puts \"--[tgz] built module archive: #{tgz}\" if verbose?\n FileUtils.cp tgz, @tars_dir, :verbose => verbose?\n end\n FileUtils.chdir pwd, :verbose => verbose?\n end",
"def add_gem_paths; end",
"def release\n # dynatrace paths within the droplet\n pwd = ENV['PWD']\n dynatrace_home_dir = \"#{pwd}/app/#{DYNATRACE_HOME_DIR}\"\n dynatrace_one_agent = File.join(dynatrace_home_dir, 'agent', lib_name, 'liboneagentloader.so')\n dynatrace_one_agent = File.join(dynatrace_home_dir, 'agent', lib_name, 'libruxitagentloader.so') unless File.file?(File.join(@app_dir, DYNATRACE_HOME_DIR, 'agent', lib_name, 'liboneagentloader.so'))\n\n @logger.debug(\"dynatrace_one_agent: #{dynatrace_one_agent}\")\n\n # create the dynatrace agent command as java_opts\n @java_opts << \"-agentpath:#{dynatrace_one_agent}\"\n end"
] | [
"0.5832175",
"0.57193285",
"0.5714784",
"0.5633345",
"0.5625683",
"0.5536673",
"0.5443501",
"0.5388589",
"0.5387417",
"0.5326837",
"0.5325343",
"0.5315711",
"0.5313322",
"0.5282778",
"0.52585924",
"0.5248945",
"0.5240402",
"0.52303493",
"0.52268946",
"0.5222545",
"0.52156854",
"0.52105284",
"0.5209294",
"0.519594",
"0.51894957",
"0.5174843",
"0.51732343",
"0.5169766",
"0.5168905",
"0.51503056",
"0.5147079",
"0.51418304",
"0.5140529",
"0.5133009",
"0.51322085",
"0.51302457",
"0.5129405",
"0.51231366",
"0.5117321",
"0.5117321",
"0.5117321",
"0.5112767",
"0.5107749",
"0.510607",
"0.5086253",
"0.5086253",
"0.5086145",
"0.50788283",
"0.5067855",
"0.50658274",
"0.50642854",
"0.50533664",
"0.5052345",
"0.5050461",
"0.504707",
"0.5042312",
"0.5040946",
"0.5039002",
"0.5036366",
"0.50297964",
"0.50238335",
"0.5021355",
"0.5018711",
"0.5015955",
"0.5015493",
"0.50107855",
"0.5008957",
"0.4995293",
"0.49916542",
"0.4989533",
"0.49890262",
"0.4987465",
"0.49812996",
"0.49690267",
"0.49689054",
"0.49649447",
"0.49588257",
"0.49588084",
"0.49524465",
"0.49517807",
"0.49406236",
"0.49403372",
"0.4928604",
"0.49281344",
"0.49197307",
"0.4915457",
"0.4894251",
"0.48934546",
"0.4891015",
"0.48902062",
"0.48874974",
"0.48869827",
"0.4885725",
"0.48824334",
"0.48820975",
"0.48792723",
"0.48747426",
"0.4873278",
"0.48726517",
"0.48708013"
] | 0.6323254 | 0 |
Append VM options to java_opts | def release
@java_opts << '-javaagent:/home/vcap/app/.dynamic_pulse_agent/aspectjweaver.jar'
@java_opts << '-Dorg.aspectj.tracing.factory=default'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decorate_java_opts(java_opts)\n java_opts\n end",
"def java_args=(args)\n Buildr.application.deprecated \"Use ENV['JAVA_OPTS'] instead\"\n ENV['JAVA_OPTS'] = Array(args).join(' ')\n end",
"def jvm_options(arg = nil)\n set_or_return(:jvm_options, arg, kind_of: String)\n end",
"def add_jvm_args\n\n # Load the app bundled configurations and re-configure as needed the JVM parameters for the Server VM\n log(\"JVM config passed via droplet java_opts : #{@droplet.java_opts}\")\n\n JavaBuildpack::Container::Wls::JvmArgHelper.update(@droplet.java_opts)\n JavaBuildpack::Container::Wls::JvmArgHelper.add_wlx_server_mode(@droplet.java_opts, @start_in_wlx_mode)\n log(\"Consolidated Java Options for Server: #{@droplet.java_opts.join(' ')}\")\n\n wls_pre_classpath = \"export PRE_CLASSPATH='#{@domain_home}/#{WLS_PRE_JARS_CACHE_DIR}/*'\"\n wls_post_classpath = \"export POST_CLASSPATH='#{@domain_home}/#{WLS_POST_JARS_CACHE_DIR}/*'\"\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'a') do |f|\n\n f.puts '# 3. Add JVM Arguments by editing the startWebLogic.sh script '\n f.puts '# Export User defined memory, jvm settings, pre/post classpaths inside the startWebLogic.sh '\n f.puts '# Need to use \\\\\" with sed to expand the environment variables '\n f.puts \"sed -i.bak \\\"s#^DOMAIN_HOME#\\\\n#{wls_pre_classpath}\\\\n#{wls_post_classpath}\\\\n\\\" #{@domain_home}/startWebLogic.sh\"\n f.puts \"sed -i.bak \\\"s#^DOMAIN_HOME#export USER_MEM_ARGS='${APP_ID_ARGS} #{@droplet.java_opts.join(' ')} '\\\\n\\\" #{@domain_home}/startWebLogic.sh \"\n f.puts ' '\n end\n end",
"def add_options(opts)\n opts\n end",
"def release\n @java_opts << \"-javaagent:#{File.join NEW_RELIC_HOME, jar_name(@version)}\"\n @java_opts << \"-Dnewrelic.home=#{NEW_RELIC_HOME}\"\n @java_opts << \"-Dnewrelic.config.license_key=#{NewRelic.license_key @vcap_services}\"\n @java_opts << \"-Dnewrelic.config.app_name='#{@vcap_application[NAME_KEY]}'\"\n @java_opts << \"-Dnewrelic.config.log_file_path=#{File.join NEW_RELIC_HOME, 'logs'}\"\n end",
"def parse_additional_options(opts)\n end",
"def parse_additional_options(opts)\n end",
"def add_pem_values_to_options_store(opts); end",
"def set_opts(options)\n @opt ||= options\n end",
"def set_opts(args)\n @jar_args = \" #{args}\"\n end",
"def release\n unless use_jvm_trust_store?\n # Hardcoded truststore location since @app_dir changes from staging to runtime and the java opts are set on staging.\n @java_opts << \"-Djavax.net.ssl.trustStore=/home/vcap/app/#{NEW_TRUST_STORE_DIRECTORY}#{NEW_TRUST_STORE_FILE}\"\n @java_opts << \"-Djavax.net.ssl.trustStorePassword=#{password}\"\n end\n end",
"def add_opts!(type=:gen, *opts)\n opt_type = OpenBabel::OBConversion.const_get(type.to_s.upcase.<<(\"OPTIONS\"))\n hash = \n if opts.first.is_a?(Hash)\n opts.first\n else\n opts.inject({}) do |hsh,v| \n if v.is_a?(Array)\n hsh[v[0]] = v[1]\n else\n hsh[v] = true\n end\n hsh\n end\n end\n hash.each do |k,v|\n next if v == false\n args = [ (OUT_OPTS_SHORT[k] || k).to_s, opt_type ]\n if v && (v != true)\n args << v\n end\n self.add_option(*args)\n end\n self\n end",
"def parse_options(opts)\n super(opts)\n\n opts.separator \"\"\n opts.separator \"Android options:\"\n\n opts.on('--with-ndk=DIRECTORY', \"Path to the Android NDK\") do |arg|\n @ndk_path = arg\n end\n opts.on('--with-sdk=DIRECTORY', \"Path to the Android SDK\") do |arg|\n @sdk_path = arg\n end\n\n end",
"def configure_js_parallels_vm(options)\n options['os-type'] = \"solaris-10\"\n configure_parallels_vm(options)\n return\nend",
"def add_options(opts, options, path='')\n options.each_pair { |k,v|\n next unless v.is_a?(Hash)\n key_path = path.empty? ? k.to_s : \"#{path}.#{k}\"\n if v.has_key?(:val)\n default = v[:val]\n switch = \"--#{key_path} #{v[:arg]}\"\n doc_with_default = \"#{v[:doc]} Default: #{default}\"\n if default.is_a?(Array)\n if v.has_key?(:short)\n opts.on(v[:short], switch, String, v[:doc]) { |val| arg_append(key_path, val, v[:parse]) }\n else\n opts.on(switch, String, v[:doc]) { |val| arg_append(key_path, val, v[:parse]) }\n end\n elsif v.has_key?(:short)\n # If val is nil then the option was a flag so set to true\n opts.on(v[:short], switch, v[:type], doc_with_default) { |val| set(key_path, val || true) }\n else \n # If val is nil then the option was a flag so set to true\n opts.on(switch, v[:type], doc_with_default) { |val| set(key_path, val || true) }\n end\n else\n add_options(opts, v, key_path)\n end\n }\n end",
"def common_options(opts); end",
"def define_options(opt)\n # override this; no additional options by default\n end",
"def options(opts)\n @options = @options.merge(opts)\n end",
"def engine_options(additional_options = {})\n opts = options.dup.merge(additional_options)\n opts[:load_paths] = load_paths(opts)\n opts\n end",
"def set_options(opts)\n common_options(opts)\n end",
"def options=(opts)\n @@options = opts\n end",
"def discover_java_args(sketch)\n arg_file = \"#{File.dirname(sketch)}/data/java_args.txt\"\n args = []\n if FileTest.exist?(arg_file)\n args += File.read(arg_file).split(/\\s+/)\n elsif Processing::RP_CONFIG['java_args']\n args += Processing::RP_CONFIG['java_args'].split(/\\s+/)\n end\n args.map! { |arg| \"-J#{arg}\" } unless @options.nojruby\n args\n end",
"def configure_ps_parallels_vm(options)\n options['os-type'] = \"ubuntu\"\n configure_parallels_vm(options)\n return\nend",
"def options!(**opts)\n options.merge!(opts)\n end",
"def default_jvmargs\n [ ]\n end",
"def configure_vs_parallels_vm(options)\n options['os-type'] = \"other\"\n configure_parallels_vm(options)\n return\nend",
"def default_options=(opts); end",
"def options=(opts)\n @parsed_options = opts\n write_attribute :options, @parsed_options.to_json\n end",
"def set_json_opts(options)\n @json_opts.merge!(options)\n end",
"def release\n java_opts = @java_opts.nil? || @java_opts.empty? ? nil : @java_opts\n [\n \"JAVA_HOME=#{check_jre_path}\",\n 'SERVER_PORT=$PORT',\n as_env_var(java_opts),\n qualify_path(start_script(root), @app_dir)\n ].flatten.compact.join(' ')\n end",
"def compiler_options\n options = {}\n options['tmp_dir'] = @tmp_dir if @tmp_dir\n options['lib_dir'] = @lib_dir if @lib_dir\n options['config_script'] = @config_script if @config_script\n options['config_options'] = @config_options if @config_options\n #options['cross_config_options'] = @cross_config_options\n options\n end",
"def user_options(options)\n merged_options = options.dup\n merged_options[:cpu_cores] = get_option(:cores_per_socket)\n merged_options[:memory] = get_option(:vm_memory)\n merged_options.compact\n end",
"def options(opts)\n opts.each { |k,v| merge_options(k, v) }\n end",
"def command_compiler_options\n command_options.merge(use: command_plugins.keys, plugins_options: command_plugins)\n end",
"def options; @opts end",
"def merge_opts_with_env opts = {}\n merge_env (opts = opts.dup)\n merge_opts opts\n end",
"def jvm_opt_test(jvmfile1, jvmfile2 = nil)\n # basic context that test cases can customize\n context = { configuration: {}, environment: {} }\n\n Dir.mktmpdir do |root|\n # each app directory requires a .liberty\n liberty_home = File.join(root, '.liberty')\n FileUtils.mkdir_p liberty_home\n\n # create the common context keys that each test can use\n context[:app_dir] = root\n library_directory = File.join(root, '.lib')\n FileUtils.mkdir_p(library_directory)\n context[:lib_directory] = library_directory\n context[:license_ids] = { 'IBM_LIBERTY_LICENSE' => '1234-ABCD' }\n\n # create repository stubs\n LibertyBuildpack::Repository::ConfiguredItem.stub(:find_item) { |&block| block.call(LIBERTY_VERSION) if block }\n .and_return(LIBERTY_DETAILS)\n\n LibertyBuildpack::Util::Cache::ApplicationCache.stub(:new).and_return(application_cache)\n application_cache.stub(:get).with(LIBERTY_SINGLE_DOWNLOAD_URI).and_yield(File.open('spec/fixtures/wlp-stub.jar'))\n\n # provide the unit tests with the application root directory and basic context to customize\n yield root, context, liberty_home\n\n # Invoke the Liberty release stage\n Liberty.new(context).release\n\n # read the resulting jvm.options file(s) and return its contents for test validation\n file_contents1 = jvm_opts(File.join(root, jvmfile1)) if jvmfile1\n file_contents2 = jvm_opts(File.join(root, jvmfile2)) if jvmfile2\n\n jvmfile2.nil? ? file_contents1 : [file_contents1, file_contents2]\n end\n end",
"def command\n java_opts = []\n if ENV['JAVA_OPTS'].nil?\n java_opts = []\n else\n java_opts = ENV['JAVA_OPTS'].split(\" \")\n end\n @command = ([@binary] + java_opts).flatten\n end",
"def command\n java_opts = []\n if ENV['JAVA_OPTS'].nil?\n java_opts = []\n else\n java_opts = ENV['JAVA_OPTS'].split(\" \")\n end\n @command = ([@binary] + java_opts).flatten\n end",
"def engine_opts\n @setup[:engine_opts] ||= engine_args.inject({}) { |opts, a| a.is_a?(Hash) ? opts.update(a) : opts.update(a => true) }\n end",
"def add_cxxflags(flags)\n @flags << flags\n end",
"def add_cxxflags(flags)\n @flags << flags\n end",
"def options \n self.merge!(@config.opts)\n end",
"def configure_other_parallels_vm(options)\n options['os-type']=\"other\"\n configure_parallels_vm(options)\n return\nend",
"def script_options(opts = {})\n opts = opts.to_h.compact.deep_symbolize_keys\n\n opts = {\n job_name: adapter.sanitize_job_name(job_name),\n workdir: staged_root,\n output_path: output_file,\n shell_path: shell_path\n }.merge opts\n end",
"def init_options(options = { verbose: false })\n options[:cache_directory] ||= File.join(Dir.home, '.elm-install')\n @options = options\n end",
"def add_options; end",
"def configure_ay_parallels_vm(options)\n options['os-type'] = \"opensuse\"\n configure_parallels_vm(options)\n return\nend",
"def hadoop_jobconf_options\n if reads_from_elasticsearch? || writes_to_elasticsearch?\n settings[:map_speculative] = 'false' if settings[:map_speculative].nil?\n settings[:reduce_speculative] = 'false' if settings[:reduce_speculative].nil?\n end\n \n super() + [].tap do |o|\n if (reads_from_elasticsearch? || writes_to_elasticsearch?)\n o << java_opt('es.config', settings[:es_config])\n o << java_opt('elasticsearch.transport', settings[:es_transport])\n o << java_opt('elasticsearch.transport.host', settings[:es_transport_host]) if settings[:es_transport] && settings[:es_transport_host]\n o << java_opt('elasticsearch.transport.port', settings[:es_transport_port]) if settings[:es_transport] && settings[:es_transport_port]\n end\n \n if reads_from_elasticsearch?\n o << java_opt('elasticsearch.input.index', input_index.index)\n o << java_opt('elasticsearch.input.mapping', input_index.mapping)\n o << java_opt('elasticsearch.input.splits', settings[:es_input_splits])\n o << java_opt('elasticsearch.input.query', settings[:es_query])\n o << java_opt('elasticsearch.input.request_size', settings[:es_request_size])\n o << java_opt('elasticsearch.input.scroll_timeout', settings[:es_scroll_timeout])\n end\n\n if writes_to_elasticsearch?\n o << java_opt('elasticsearch.output.index', output_index.index)\n o << java_opt('elasticsearch.output.mapping', output_index.mapping)\n o << java_opt('elasticsearch.output.index.field', settings[:es_index_field])\n o << java_opt('elasticsearch.output.mapping.field', settings[:es_mapping_field])\n o << java_opt('elasticsearch.output.id.field', settings[:es_id_field])\n o << java_opt('elasticsearch.output.bulk_size', settings[:es_bulk_size])\n end\n end.flatten.compact\n end",
"def thor_options_to_optparse\n flags = []\n %i[color progress debug interactive].each do |option|\n if options[option] then flags << \"--#{option}\"\n else flags << \"--no-#{option}\"\n end\n end\n flags\n end",
"def merge_vm_parameters(host, global, vb)\n # These are arrays of hashes\n if global['vm_options'] or host['vm_options']\n merge_hash = merge_2_array_of_hashes(global['vm_options'], host['vm_options'])\n merge_hash.each do |key, value|\n vb.customize [\"modifyvm\", :id, \"--#{key}\", value]\n end\n end\nend",
"def init_options( opts )\n options = default_options.merge( opts ) \n @environment = options[:environment]\n @perf_threshold = options[:perf_threshold]\n @moleable = options[:moleable]\n @app_name = options[:app_name]\n @user_key = options[:user_key]\n @store = options[:store]\n @excluded_paths = options[:excluded_paths]\n end",
"def options=(opts)\n myopts = {}\n opts.each do |key, val|\n debug \"looping on key #{key}, val #{val}\"\n debug \"class of key is #{key.class}\"\n tftpassert(\"options keys must be symbols\") { key.class == Symbol }\n myopts[key.to_s] = val.to_s\n end\n @options = myopts\n end",
"def options_build\n @prod_options = \"--port #{@prod_port} --log #{@prod_log} --pid #{@prod_pid} -e production -d\"\n @dev_options = \"--port #{@dev_port} --log #{@dev_log} --pid #{@dev_pid} -e development -d\"\nend",
"def taskOpts\nend",
"def build_options(options)\n options.inject([]) do |result, (opt, val)|\n if val\n result << \"--#{shellify_opt(opt)}\"\n result << shellify_opt(val) if val != true\n end\n result\n end\n end",
"def useradd_options\n opts = []\n opts << \"-m\" if new_resource.manage_home\n opts\n end",
"def setup_options(options = T.unsafe(nil)); end",
"def program_options\n [\n ['--format', '-f FORMAT', 'Format as html or text(default)',\n lambda { |value| options.format = value }\n ],\n ['--coffee', '-c', 'Show code as coffeescript',\n lambda { |value| options.coffee = true }\n ]\n ]\nend",
"def flag_options\n return @flag_options unless @flag_options.nil?\n @flag_options = ''\n @flag_options << ' --auto-attach' if new_resource.auto_attach\n @flag_options << ' --force' if new_resource.force\n @flag_options << ' --insecure' if new_resource.insecure\n @flag_options\n end",
"def runtime_options\n DEFAULT_OPTIONS.merge(symbolize_keys(options))\n end",
"def additional_config(options, config)\n options[:hostname] = parse_property(config, \"hostname\", String)\n options[:runtime_path] = parse_property(config, \"runtime_path\", String)\n options[:port_range] = parse_property(config, \"port_range\", Range)\n options[:ssl_port_range] = parse_property(config, \"ssl_port_range\", Range)\n options[:jmx_port_range] = parse_property(config, \"jmx_port_range\", Range)\n options[:rpc_port_range] = parse_property(config, \"rpc_port_range\", Range)\n options[:transport_port_range] = parse_property(config, \"transport_port_range\", Range)\n options[:supported_versions] = parse_property(config, \"supported_versions\", Array)\n options[:default_version] = parse_property(config, \"default_version\", String)\n options[:instance_limit] = parse_property(config, \"instance_limit\", Integer)\n options[:seeds] = parse_property(config, \"seeds\", String)\n options[:clustername] = parse_property(config, \"clustername\", String)\n options[:max_heap_size] = parse_property(config, \"max_heap_size\", String)\n options[:heap_newsize] = parse_property(config, \"heap_newsize\", String)\n options\n end",
"def customize_virtualbox(name,options)\n custom_config = \"\"\n options.each_pair do |key,value|\n next if VALID_VM_OPTIONS.include?(key)\n case key\n when 'cpus','memory'\n custom_config << \" vbox.customize ['modifyvm', :id, '--#{key}','#{value}']\\n\"\n when 'mac'\n custom_config << \" vbox.customize ['modifyvm', :id, '--macaddress1','#{value}']\\n\"\n else\n log.warn(\"Skipped invalid custom option for node #{name}: #{key}=#{value}\")\n end\n end\n custom_config\n end",
"def options(opts = {})\n OPTIONS.merge(opts)\n end",
"def configure_ai_parallels_vm(options)\n options['os-type']=\"solaris-11\"\n configure_parallels_vm(options)\n return\nend",
"def set_options(opts)\n if not opts.nil?\n @options[\"min_tokens\"] = opts[\"min_tokens\"] if not opts[\"min_tokens\"].nil?\n @options[\"max_tokens\"] = opts[\"max_tokens\"] if not opts[\"max_tokens\"].nil?\n @options[\"matching_method\"] = opts[\"matching_method\"] if not opts[\"matching_method\"].nil?\n @options[\"threshold\"] = opts[\"threshold\"] if not opts[\"threshold\"].nil?\n @options[\"top_n\"] = opts[\"top_n\"] if not opts[\"top_n\"].nil?\n end\n end",
"def command_options=(opts)\n # Ensure these options are removed, these are either incompatible with the LSF,\n # or will already have been added elsewhere\n {\n ['-h', '--help'] => false,\n ['-w', '--wait'] => false,\n ['-d', '--debug'] => false,\n ['-c', '--continue'] => false,\n '--exec_remote' => false,\n ['-t', '--target'] => '*',\n ['-e', '--environment'] => '*',\n '--id' => '*',\n ['-l', '--lsf'] => %w(add clear)\n }.each do |names, values|\n [names].flatten.each do |name|\n ix = opts.index(name)\n if ix\n opts.delete_at(ix)\n [values].flatten.each do |value|\n if value && (value == '*' || opts[ix] == value)\n opts.delete_at(ix)\n end\n end\n end\n end\n end\n @command_options ||= []\n @command_options += opts\n end",
"def set_default_options(options)\n opts = options.dup\n\n extra_options = opts.delete(:extra_options)\n extra_options = DEFAULT_EXTRA_OPTIONS.merge(extra_options)\n\n has_timeout_string_arg = extra_options[:mongocryptd_spawn_args].any? do |elem|\n elem.is_a?(String) && elem.match(/\\A--idleShutdownTimeoutSecs=\\d+\\z/)\n end\n\n timeout_int_arg_idx = extra_options[:mongocryptd_spawn_args].index('--idleShutdownTimeoutSecs')\n has_timeout_int_arg = timeout_int_arg_idx && extra_options[:mongocryptd_spawn_args][timeout_int_arg_idx + 1].is_a?(Integer)\n\n unless has_timeout_string_arg || has_timeout_int_arg\n extra_options[:mongocryptd_spawn_args] << '--idleShutdownTimeoutSecs=60'\n end\n\n opts[:bypass_auto_encryption] ||= false\n\n opts.merge(extra_options)\n end",
"def convert_options(opts); end",
"def pig_options\n opts = {}\n opts['fs.s3n.awsAccessKeyId'] = ENV['AWS_ACCESS_KEY']\n opts['fs.s3n.awsSecretAccessKey'] = ENV['AWS_SECRET_KEY']\n opts['fs.s3.awsAccessKeyId'] = ENV['AWS_ACCESS_KEY']\n opts['fs.s3.awsSecretAccessKey'] = ENV['AWS_SECRET_KEY']\n opts['pig.events.logformat'] = PIG_LOG_FORMAT\n opts['pig.logfile'] = local_log_dir + \"/local-pig.log\"\n opts['pig.udf.scripting.log.dir'] = local_udf_log_dir\n opts['python.verbose'] = 'error'\n opts['jython.output'] = true\n opts['python.home'] = jython_directory\n opts['python.path'] = \"#{local_install_directory}/../controlscripts/lib:#{local_install_directory}/../vendor/controlscripts/lib\"\n opts['python.cachedir'] = jython_cache_directory\n opts['java.security.krb5.realm'] = ''\n opts['java.security.krb5.kdc'] = ''\n return opts\n end",
"def modify_job_options(service)\n # Example how to programmatically modify job options:\n job_options = service.job_options\n #job_options[:limit] = 'someHost'\n #job_options[:extra_vars]['flavor'] = 'm1.small'\n @hosts,@modify = Getting_Hosts()\n \n #@the_list = $evm.root['dialog_mylist']\n job_options[:extra_vars]['mylist'] = @hosts\n job_options[:extra_vars]['list'] = @modify\n # Important: set stack_options\n #@reqopts = @handle.root['dialog*']\n #@handle.log(\"info\", \"the inputs are: #{@reqopts} \")\n #vm_name = $evm.root['dialog_param_vm_name']\n #@handle.log(\"info\", \"the vm name is: #{vm_name} \")\n #job_options[:extra_vars]['name_host'] = vm_name\n #@handle.log(\"info\", \"Starting Ansible Tower Pre-Provisioning\")\n service.job_options = job_options\n @options = service.job_options[:extra_vars]\n @handle.log(\"info\", \"the options are: #{@options} \")\n end",
"def build_opts_string(*additional_opts)\n options = build_opts + additional_opts\n options = options << \"2>&1 | ocunit2junit\" if test_output == :junit\n return options.compact.join(\" \")\n end",
"def compile_opts(o={}, extra={})\n case o\n when Symbol, String\n extra.merge(:name => o.to_s)\n when NilClass\n extra\n else\n extra.merge(o)\n end\n end",
"def customize_provider(name,options)\n custom_config = \"\"\n options.each_pair do |key,value|\n next if global_vagrant_options.include?(key)\n case key\n when 'cpus'\n custom_config << \" prov.vmx['numvcpus'] = '#{value}'\\n\"\n when 'memory'\n custom_config << \" prov.vmx['memsize'] = '#{value}'\\n\"\n when 'mac'\n custom_config << \" prov.vmx['ethernet0.generatedAddress'] = '#{value}'\\n\"\n else\n log.warn(\"Skipped invalid custom option for node #{name}: #{key}=#{value}\")\n end\n end\n custom_config\n end",
"def launcher_env_options(opts)\n if getenv(\"AUTH_TYPE\") == \"RANDOM\"\n ## each day we want to use different auth type ignoring weekends\n time = Time.now\n day_of_year = time.yday\n passed_weeks_of_year = time.strftime('%W').to_i - 1\n opts[:auth_type] = ALTERNATING_AUTH[\n (day_of_year - 2 * passed_weeks_of_year) % ALTERNATING_AUTH.size\n ]\n elsif getenv(\"AUTH_TYPE\")\n opts[:auth_type] = getenv(\"AUTH_TYPE\")\n end\n\n # workaround https://issues.jenkins-ci.org/browse/JENKINS-30719\n # that means to remove extra `\\` chars\n ENV['IMAGE_PRE'] = ENV['IMAGE_PRE'].gsub(/\\\\\\${/,'${') if ENV['IMAGE_PRE']\n\n keys = [:crt_path, :deployment_type,\n :hosts_spec, :auth_type,\n :ssh_key, :ssh_user,\n :app_domain, :host_domain,\n :rhel_base_repo,\n :dns, :set_hostnames,\n :use_rpm_playbook,\n :use_nfs_storage,\n :image_pre,\n :puddle_repo,\n :etcd_num,\n :pre_ansible,\n :ansible_url,\n :customized_ansible_conf,\n :kerberos_docker_base_image,\n :kerberos_kdc, :kerberos_keytab_url,\n :kerberos_docker_base_image,\n :kerberos_admin_server]\n\n keys.each do |key|\n val = getenv(key.to_s.upcase)\n opts[key] = val if val\n end\n\n opts[:use_rpm_playbook] = false unless to_bool(opts[:use_rpm_playbook])\n opts[:use_nfs_storage] = false unless to_bool(opts[:use_nfs_storage])\n end",
"def set_options(opts)\n opts.version, opts.banner = options.version, options.banner\n opts.set_program_name 'LinkShrink'\n\n options.api.map do |k, v|\n arg = k.to_s.downcase\n\n opts.on_head(\"-#{arg[0]}\", \"--#{arg}\", argument_text_for(k)) do\n options.api[k] = true\n end\n end\n\n opts.on_tail('-v', '--version',\n 'display the version of LinkShrink and exit') do\n puts opts.ver\n exit\n end\n\n opts.on_tail('-h', '--help', 'print this help') do\n puts opts.help\n exit\n end\n end",
"def options\n [\n [\"--without-applications\", \"Don't build the ALPS applications.\"],\n [\"--without-examples\", \"Don't build ALPS examples.\"],\n [\"--without-python\", \"Don't build ALPS python extensions.\"],\n [\"--without-tests\", \"Don't build ALPS tests.\"],\n [\"--with-fortran\", \"Build ALPS Fortran Binaries (currently TEBD).\"],\n [\"--without-mpi\", \"Disable MPI parallelization in ALPS.\"],\n [\"--with-omp\", \"Enable OpenMP parallelization in ALPS.\"],\n [\"--without-shared\", \"Don't build the ALPS shared libraries.\"],\n ]\n end",
"def options\n result = options_pre_mizuno\n result[:reuse_address] = true\n result\n end",
"def opts\n load_defaults unless @opts\n @opts\n end",
"def opt(name, extras = {})\n class_exec do\n attr_reader name\n register_job_argument(name, :opt, extras)\n end\n end",
"def update_kafka_heap_opts\n sudo(\"sed -i -e '/export KAFKA_HEAP_OPTS/d' /etc/profile.d/kafka.sh > /dev/null 2>&1 || true\")\n sudo(\"echo \\\"export KAFKA_HEAP_OPTS='#{KafkaHelpers.kafka_heap_opts}'\\\" | sudo tee -a /etc/profile.d/kafka.sh\")\n end",
"def option(short, long, desc = nil, options = {})\n @__options ||= []\n option = Shebang::Option.new(short, long, desc, options)\n\n @__options.push(option)\n end",
"def merge_options(opts)\n @options = {\n :format => :base_64,\n :cipher => \"AES-256-CBC\",\n :iv => nil,\n :padding => true, # use cipher padding by default\n }.merge! opts\n _handle_iv\n _handle_padding\n end",
"def hadoop_jobconf_options\n jobconf_options = []\n settings[:reuse_jvms] = '-1' if (settings[:reuse_jvms] == true)\n settings[:respect_exit_status] = 'false' if (settings[:ignore_exit_status] == true)\n # If no reducer and no reduce_command, then skip the reduce phase\n settings[:reduce_tasks] ||= 0 unless reduce?\n jobconf_options += [\n :io_sort_mb, :io_sort_record_percent,\n :map_speculative, :map_tasks,\n :max_maps_per_cluster, :max_maps_per_node,\n :max_node_map_tasks, :max_node_reduce_tasks,\n :max_reduces_per_cluster, :max_reduces_per_node,\n :max_record_length, :min_split_size,\n :output_field_separator, :key_field_separator,\n :partition_fields, :sort_fields,\n :reduce_tasks, :respect_exit_status,\n :reuse_jvms, :timeout,\n :max_tracker_failures, :max_map_attempts,\n :max_reduce_attempts, :reduce_speculative\n ].map do |opt|\n defn = settings.definition_of(opt, :description)\n val = settings[opt]\n java_opt(defn, val)\n end\n jobconf_options.flatten.compact\n end",
"def update_config_options\n options = Util::OptsParser.options(ARGV)\n Util::Configuration.tag_time_to_live_in_seconds = options[:ttl]\n Util::Configuration.case_sensitive_matching = options[:case]\n Util::Configuration.hashtag_storage_class = options[:storage]\n Util::Configuration.log_capture_device = options[:log_device]\n Util::Configuration.automatic_restart = options[:automatic_restart]\n current_config = Util::Configuration.to_a\n current_config << \"Port: #{options[:port]}\"\n logger.info(current_config.join(', '))\n options\n end",
"def opts\n @opts\n end",
"def with_options( opts={} )\n @options.update opts\n self\n end",
"def puppet_cli_options\n Puppet::Settings::REQUIRED_APP_SETTINGS.map do |setting|\n \"--%s %s\" % [setting, @tmpdir]\n end\n end",
"def options(opt); end",
"def options(opt); end",
"def options_defaults(options)\n options[:parallel_run] = 0\n end",
"def expand_options(options)\n # its deprecated but still work to do to deprecate it fully\n # Chef.deprecated(:package_misc, \"expand_options is deprecated, use shell_out instead\")\n if options\n \" #{options.is_a?(Array) ? Shellwords.join(options) : options}\"\n else\n \"\"\n end\n end",
"def build_opts(hash, *args)\n opts = args\n hash.each do |key, value|\n case key\n when :secure, :soft\n value == :yes && opts << '--%s' % key\n when :appname, :appversion\n when :name\n else\n opts << '--%s' % key << value\n end\n end\n opts << hash[:appname]\n opts << hash[:appversion]\n opts.compact\n end",
"def set_preferences( opts={} )\n options.merge!( opts )\n end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end"
] | [
"0.75858617",
"0.69976497",
"0.69608134",
"0.67900294",
"0.6231088",
"0.59903437",
"0.57705724",
"0.57705724",
"0.56569254",
"0.56348896",
"0.5618846",
"0.55961907",
"0.55826974",
"0.5519571",
"0.5482722",
"0.5439303",
"0.5412641",
"0.53961307",
"0.5395842",
"0.536357",
"0.5360977",
"0.53515947",
"0.53431535",
"0.53329986",
"0.53267026",
"0.53185695",
"0.53115994",
"0.5286556",
"0.528623",
"0.52804416",
"0.5260468",
"0.5252398",
"0.52502835",
"0.5249013",
"0.52423877",
"0.52411926",
"0.52378356",
"0.52255744",
"0.52112293",
"0.52112293",
"0.51904696",
"0.51772946",
"0.51772946",
"0.5175485",
"0.5147781",
"0.5147727",
"0.5132983",
"0.5132339",
"0.5127166",
"0.51232755",
"0.51193",
"0.5108255",
"0.5105004",
"0.5094184",
"0.50778365",
"0.50744283",
"0.5071511",
"0.5049849",
"0.50469935",
"0.5036765",
"0.50324214",
"0.5029199",
"0.50276166",
"0.50218874",
"0.50165206",
"0.49929664",
"0.49916318",
"0.49913338",
"0.4978988",
"0.49776393",
"0.497763",
"0.49657482",
"0.49646515",
"0.49611548",
"0.49520814",
"0.4951854",
"0.494924",
"0.49419692",
"0.49417543",
"0.4932443",
"0.493176",
"0.4922285",
"0.49016145",
"0.48988512",
"0.4895344",
"0.48944077",
"0.48923677",
"0.48826945",
"0.4874535",
"0.48689914",
"0.4868513",
"0.4863023",
"0.4858755",
"0.4857725",
"0.48568693",
"0.48547783",
"0.48547783",
"0.48547783",
"0.48547783",
"0.48547783"
] | 0.5743371 | 8 |
Downloads ZIP file from specified url | def download_and_unzip(base_url, system_id, filename, save_to_dir)
download_url = File.join(base_url, system_id, filename)
LibertyBuildpack::Util.download_zip('3.+', download_url, 'DynamicPULSE Agent', save_to_dir)
rescue => e
raise "[DynamicPULSE] Can't download #{filename} from #{download_url}. Please check dynamicpulse-remote.xml. #{e.message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(url)\n base.get(url, @file_path)\n end",
"def download\n open(download_url, \"rb\")\n end",
"def download(url)\n Net::HTTP.get_response(url)\n end",
"def download!(source_url, destination_file); end",
"def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t\t\tf.write(resp.body)\n\t\t\t}\n\t\t\tf.close\n\t\t\treturn path\n\t\tend",
"def fetch_artifact_zip(download_path, url)\n # rubocop:disable Security/Open\n open(download_path, 'wb') do |file|\n file.print URI.open(url, 'Authorization' => \"token #{ENV['PERSONAL_TOKEN']}\").read\n end\n # rubocop:enable Security/Open\nend",
"def download_archive(url, archive, opts)\n archive.binmode\n remote = open(\n url,\n http_basic_authentication: [opts['user'] || '', opts['password'] || ''],\n )\n\n # download content\n archive.write(remote.read)\n archive.rewind\n archive.close\n\n [archive, remote.meta['content-type']]\n end",
"def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents: ethon.response_body,\n link_url: last_location_header(ethon)\n }\n end",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def download_ror_file(url)\n return nil unless url.present?\n\n puts 'Downloading ROR data file...'\n\n headers = {\n host: 'zenodo.org',\n Accept: 'application/zip'\n }\n resp = HTTParty.get(url, headers: headers)\n unless resp.present? && resp.code == 200\n puts(\"Unable to fetch ROR file from Zenodo -- #{url} -- #{resp}\")\n return nil\n end\n resp.parsed_response\n end",
"def download_file(url, dest)\n if File.exist?(dest)\n say \"File already downloaded #{dest}\"\n return dest\n end\n\n say \"Downloading...\"\n FileUtils.mkdir_p(File.dirname(dest)) # ensure parent folder exists\n\n File.open(dest, 'wb') do |saved_file|\n URI.open(url, 'rb') do |read_file|\n saved_file.write(read_file.read)\n end\n end\n dest\n end",
"def download(url)\n STDERR.print \"loading #{url}\"\n response = Faraday.get(url)\n STDERR.puts ' (done)'\n response.body\n end",
"def download(url, filename)\n require 'open-uri'\n if File.exists?(\"lib/\" + filename)\n puts \"'#{filename}' is already downloaded... skipped\"\n else\n puts \"'#{filename}' downloading...\"\n File.open(\"lib/\" + filename, \"wb\") do |saved_file|\n open(url + filename, \"rb\") { |read_file| saved_file.write(read_file.read) }\n end\n end\nend",
"def download_data_file(url, directory, destination_filename)\n filepath = \"#{directory}/#{destination_filename}\"\n puts \">> Downloading #{filepath}...\"\n IO.copy_stream(open(url), filepath)\n\n Zip::File.open(filepath) do |zip_file|\n data_file = zip_file.glob('*.csv').first\n filepath = \"#{directory}/#{data_file.name}\"\n puts \">> Extracting #{filepath}...\"\n data_file.extract(filepath)\n end\nend",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def fetch_file(url)\n url =~ %r{/([^/]*)\\.(tar\\.gz|tar\\.bz2|tgz|zip|tbz)$}\n name = $1\n ext = $2\n filename = \"#{name}.#{ext}\"\n archive = File.join(env.path, \"archives\", filename)\n\n rbvm_md5 = config_md5[filename]\n\n if File.exists?(archive)\n archive_md5 = Digest::MD5.file(archive)\n if rbvm_md5\n if archive_md5.to_s == rbvm_md5\n log(\"Using existing archive for #{filename}.\", \"info\")\n fetch = false\n else\n log(\"Existing archive has bad MD5, backup and download again.\", \"error\")\n FileUtils.mv(archive, File.join(env.path, \"archives\", \"#{filename}-#{Time.now.strftime(\"%Y%m%d%H%M%S\")}.orig\"))\n archive_md5 = nil\n fetch = true\n end\n else\n log(\"Unknown archive: #{archive}\", \"warn\")\n fetch = false\n end\n else\n fetch = true\n end\n\n if fetch\n catch_error(\"Failed to fetch: #{url}\") do\n log(\"#{name} - #fetching\", 'info')\n exec_cmd(\"curl\", \"-s\", \"-S\", \"-L\", \"--create-dirs\", \"-C\", \"-\", \"-o\", archive, url)\n end\n end\n\n return archive\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download_zip_from_s3(file_path, filename, connection)\n\ts3_key = \"zipped_packages/\" + filename\n\tsuccess = connection.download(s3_key, file_path + filename)\n\treturn success\nend",
"def save_to_tempfile(url)\n verbose(\"Downloading #{url}\")\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n http.start do |http|\n resp = http.get(uri.path)\n file = Tempfile.new('master.zip')\n file.binmode\n file.write(resp.body)\n file.flush\n file.close\n\n verbose(\"Saved to #{file.path}\")\n\n file\n end\n end",
"def download(args = {})\n\t # \n\t # parse arguments\n\t # \n\t if args.keys.size == 1 and args.values.size == 1\n\t url = args.keys.first\n\t output_path = args.values.first\n\t else\n\t raise \"download() currently only accepts one {URL => location} pair\"\n\t end\n\t \n\t # \n\t # perform the download\n\t # \n\t \n\t # https://stackoverflow.com/questions/2263540/how-do-i-download-a-binary-file-over-http\n\t # instead of http.get\n\t require 'open-uri'\n\t \n\t File.open(output_path, \"wb\") do |saved_file|\n\t # the following \"open\" is provided by open-uri\n\t open(url, \"rb\") do |read_file|\n\t saved_file.write(read_file.read)\n\t end\n\t end\n\t \n\t return output_path\n\tend",
"def download_zip()\n url = URI(\"#{FONTELLO_URL}/#{session_key}/get\")\n response = Net::HTTP.get_response(url)\n\n if response.code != '200'\n raise 'can\\'t connect to Fontello' if @download_tries == 3\n\n # Remove the session key so a new one is requested\n File.delete(SESSION_FILE)\n\n # And retry download\n @download_tries += 1\n download_zip()\n else\n File.write(ZIP_FILE, response.read_body, universal_newline: true)\n end\n end",
"def download!(url, path)\n raise CommandFailed unless download(url, path)\n end",
"def download_package\n path = download_path\n remote_file path do\n source URL\n action :create\n only_if { !::File.exist?(PATH) }\n end\n end",
"def download_file(url, show_progress = false)\n if show_progress\n pbar = nil\n begin\n require 'progressbar'\n rescue LoadError => e\n Fog::Logger.warning \"progressbar rubygem not found. Install it for fancier progress.\"\n pbar = :noop\n end\n open(\n url,\n :content_length_proc => lambda { |total|\n if pbar != :noop\n if total && 0 < total\n pbar = ProgressBar.new(\"Downloading\", total)\n pbar.file_transfer_mode\n end\n end\n },\n :progress_proc => lambda { |read_size|\n if pbar != :noop\n pbar.set read_size if pbar\n else\n print \"\\rDownloading... #{\"%.2f\" % (read_size/1024.0**2)} MB\"\n end\n }\n )\n else\n open(url)\n end\n end",
"def get_file(url); end",
"def download_url(url, output_filename, dir_name = \"media/tmp\")\n command = \"wget --quiet '#{url}' -O '#{dir_name}/#{output_filename}'\"\n system(command)\n end",
"def download(url, file)\n # First, open the remote file. (FD == 'File Descriptor', a C term)\n #\n # If we first open the remote file, if there are any exceptions in\n # attempting to open it, we won't lose the contents of the local file.\n open(url) do |remoteFD|\n # Open the local file, purging the contents.\n File.open(file, \"w\") do |genericFD|\n remoteFD.each_line do |line|\n # Take each line, stick it in the file.\n genericFD.puts line\n end\n end\n end\n @repo.add(file) # add the file to the list to be committed\nend",
"def download_file(url, dest_dir)\n @log.info(\"== Ensuring file is cached: #{url} to #{dest_dir}\")\n require 'down'\n filename = File.basename(url)\n downloaded_file = File.join(dest_dir,filename)\n remote_file = Down.open(url)\n unless File.exist?(downloaded_file) && File.size(downloaded_file) == remote_file.size\n @log.verbose(\"Downloading #{url} to #{downloaded_file}\")\n Down.download(url, destination: downloaded_file)\n else\n @log.verbose(\"Skipping download, already in cache: #{downloaded_file}\")\n end\n remote_file.close\n downloaded_file\n end",
"def download(url, path: nil, overwrite: false, sha1_hash: nil)\n if path.nil?\n fname = url.split('/')[-1]\n else\n path = File.expand_path(path)\n if File.directory?(path)\n fname = File.join(path, url.split('/')[-1])\n else\n fname = path\n end\n end\n\n if overwrite || !File.exist?(fname) || (sha1_hash && !check_sha1(fname, sha1_hash))\n dirname = File.dirname(fname)\n FileUtils.mkdir_p(dirname)\n\n puts \"Downloading #{fname} from #{url}...\"\n open(url, 'rb') {|src| ::IO.copy_stream(src, fname) }\n if sha1_hash && !check_sha1(fname, sha1_hash)\n raise \"File #{fname} is downloaded but the content hash does not match. \" +\n \"The repo may be outdated or download may be incomplete. \" +\n \"If the `repo_url` is overridden, consider switching to \" +\n \"the default repo.\"\n end\n end\n\n return fname\n end",
"def download(url)\n file = File.basename(url)\n # Resume an interrupted download or fetch the file for the first time. If\n # the file on the server is newer, then it is downloaded from start.\n sh \"wget -Nc --no-verbose #{url}\"\n # If the local copy is already fully retrieved, then the previous command\n # ignores the timestamp. So we check with the server again if the file on\n # the server is newer and if so download the new copy.\n sh \"wget -N --no-verbose #{url}\"\n\n # Download Md5\n sh \"wget --no-verbose #{url}.md5\"\n\n # Verify the tarball using md5sum or md5\n if system(\"which md5sum > /dev/null\")\n matched = system(\"md5sum -c #{file}.md5\")\n elsif system(\"which md5 > /dev/null\")\n md5_out = %x[md5 -q #{file}].chomp\n md5_actual = File.read(\"#{file}.md5\").split[0]\n matched = md5_out == md5_actual\n else\n puts \"Cannot find md5sum or md5. Please install md5sum or md5 and try again\"\n exit 1\n end\n\n # Re-download tarball if corrupt; extract otherwise.\n if !matched\n sh \"rm #{file} #{file}.md5\"; download(url)\n else\n sh \"tar xf #{file}\"\n end\nend",
"def write_file_from_url(file, url)\n Net::HTTP.start(@download.base_url) do |http|\n begin\n http.request_get(url) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n ensure\n file.close\n end\n end\n end",
"def download(url, cache_dir, filename)\n run_script \"curl -L --create-dirs -o #{cache_dir[:guest_path]}/#{filename} #{url}\" unless File.exist?(\"#{cache_dir[:host_path]}/#{filename}\")\n end",
"def get_file(uri, dest_dir)\n response = get_client(uri, Net::HTTP::Get, :get)[URI.escape(uri)].get :accept => \"application/zip\"\n filename = response.headers[:content_disposition] == nil ? \"tmp_#{rand}.zip\" : response.headers[:content_disposition].split(\"filename=\")[1]\n filename = File.join(dest_dir, filename)\n File.open(filename, 'w') { |f| f.write(response.body) }\n filename\n end",
"def save_file(url, file)\n puts \"Downloading http://...#{url[-8..-1]} -> #{file}\"\n File.open(file, \"wb\") do |saved_file|\n # the following \"open\" is provided by open-uri\n open(url) do |read_file|\n saved_file.write(read_file.read)\n end\n end\nend",
"def get_file_via_http url, file_name, try\n\n @config.logger.trace(\"Downloading \" + url + \" to \" + file_name )\n p = URI::Parser.new\n uri = URI.parse( p.escape( url ) )\n req = Net::HTTP::Get.new(uri.request_uri)\n req[\"User-Agent\"] = NicInfo::VERSION_LABEL\n req[\"Accept\"] = NicInfo::JSON_CONTENT_TYPE\n req[\"Connection\"] = \"close\"\n http = Net::HTTP.new( uri.host, uri.port )\n if uri.scheme == \"https\"\n http.use_ssl=true\n http.verify_mode=OpenSSL::SSL::VERIFY_NONE\n end\n res = http.start do |http_req|\n http_req.request(req)\n end\n\n case res\n when Net::HTTPSuccess\n File.write(file_name, res.body)\n else\n if res.code == \"301\" or res.code == \"302\" or res.code == \"303\" or res.code == \"307\" or res.code == \"308\"\n res.error! if try >= 5\n location = res[\"location\"]\n return get_file_via_http( location, file_name, try + 1)\n end\n res.error!\n end\n end",
"def download_to_file(url, path)\n result = false\n\n uri = URI(url)\n if uri.scheme == 'file'\n result = FileUtils.mv uri.path, path\n Rails.logger.info \"Moved to #{path}\" if result == 0\n else\n result = download_url_to_file uri, path\n end\n result\n end",
"def download_file!(download_url = image_url)\n raise DownloadError, \"Download failed: couldn't find download url for #{url}\" if download_url.blank?\n response, file = http_downloader.download_media(download_url)\n raise DownloadError, \"Download failed: #{download_url} returned error #{response.status}\" if response.status != 200\n file\n end",
"def download_file_to_filename(filename, url)\n puts \"Downloading #{url}...\"\n uri = URI(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: uri.scheme == 'https'\n ) do |http|\n request = Net::HTTP::Get.new uri.request_uri\n\n http.request request do |response|\n if response.is_a?(Net::HTTPRedirection) || response.is_a?(Net::HTTPFound)\n return download_file_to_filename(filename, response['location'])\n end\n\n open filename, 'wb' do |io|\n response.read_body do |chunk|\n io.write(chunk)\n end\n end\n end\n end\nend",
"def download_and_save_file(url, path)\n options = {}\n\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n if proxy\n uri = URI.parse(proxy)\n proxy_host = uri.scheme + \"://\" + uri.host + \":\" + uri.port.to_s\n proxy_user, proxy_pass = uri.userinfo.split(/:/) if uri.userinfo\n options[:proxy_http_basic_authentication] = [proxy_host,proxy_user,proxy_pass]\n end\n\n open_and_save_file(path, open(url, options).read)\nend",
"def download_file(uri, dest_dir)\n begin\n u = URI.parse(uri)\n fname, ext = File.basename(u.path).scan(/(.+)\\.(.+)/).flatten\n dest_file = File.join(dest_dir, \"#{fname}_#{Time.now.to_i}.#{ext}\")\n res = send_http_get_request(uri)\n rescue Net::ReadTimeout, IOError, EOFError, Errno::ECONNRESET,\n Errno::ECONNABORTED, Errno::EPIPE, Net::OpenTimeout,\n Errno::ETIMEDOUT => e\n print_error(\"#{e.message}: #{uri}\")\n return\n end\n\n save_file(res.body, dest_file)\n print_status(\"Download completed for #{uri}\")\n end",
"def download(url, cookie = '')\n escaped_url = URI.escape(url)\n\n begin\n open(escaped_url, 'Cookie' => cookie, :read_timeout => 5)\n rescue OpenURI::HTTPError => error\n puts \"The network request for:\\n #{url}\\nreturned an error:\\n #{error.message}\"\n puts \"Please try again later or update Pandata. Sorry about that!\\n\\nFull error:\"\n raise PandataError\n end\n end",
"def cl_zip_download_url(tag, options = {})\r\n Cloudinary::Utils.zip_download_url(tag, options)\r\n end",
"def download_and_unpack_archive(uri, root)\n # all file types filtered here should be handled inside block.\n if uri.end_with?('.tgz', '.tar.gz', '.zip', 'jar')\n if uri.include? '://'\n print \"-----> Downloading from #{uri} ... \"\n else\n filename = File.basename(uri)\n print \"-----> Retrieving #{filename} ... \"\n end\n download_start_time = Time.now\n LibertyBuildpack::Util::Cache::ApplicationCache.new.get(uri) do |file|\n puts \"(#{(Time.now - download_start_time).duration})\"\n install_archive(file, uri, root)\n end\n else\n # shouldn't happen, expect index.yml or component_index.yml to always\n # name files that can be handled here.\n puts \"Unknown file type, not downloaded, at #{uri}\"\n end\n end",
"def download_resource(url, path)\n FileUtils.mkdir_p File.dirname(path)\n the_uri = URI.parse(URI.escape(url))\n if the_uri\n data = html_get the_uri\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end",
"def download_file(agent, url)\n SouvlakiRS.logger.info \" starting download for #{url}\"\n\n data = agent.get(url)\n unless data\n SouvlakiRS.logger.error ' download failed'\n return nil\n end\n\n filename = get_response_filename(data) || filename_from_url(url)\n [data, filename]\n end",
"def download(url)\n filedl = url.split(\"/\").last\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n open(filedl, \"w\") do |file|\n file.write(response.body)\n end\n return filedl\nend",
"def download_file!\n retries = 3\n\n begin\n options = {\n :read_timeout => 300,\n }\n\n open(from_url, options) do |f|\n save_to_cache(f)\n end\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n Timeout::Error,\n OpenURI::HTTPError => e\n if retries != 0\n retries -= 1\n retry\n else\n raise Exceptions::NetworkError.new(from_url, e)\n end\n end\n end",
"def download(url)\n resp = http.get(url, :follow_redirect => true)\n\n unless resp.ok?\n raise(\n HTTPClient::BadResponseError,\n \"Got HTTP #{resp.status}: #{resp.body}\"\n )\n end\n\n return resp.body.force_encoding('UTF-8')\n end",
"def zip_download\n download_zip_file if request.post?\n end",
"def download\n log.warn(log_key) { source[:warning] } if source.key?(:warning)\n\n options = {}\n\n if source[:unsafe]\n log.warn(log_key) { \"Permitting unsafe redirects!\" }\n options[:allow_unsafe_redirects] = true\n end\n\n # Set the cookie if one was given\n options[\"Cookie\"] = source[:cookie] if source[:cookie]\n options[\"Authorization\"] = source[:authorization] if source[:authorization]\n\n download_file!(download_url, downloaded_file, options)\n end",
"def download(file, todir = '.')\r\n begin\r\n puts \"Downloading file #{file} from #{@address}\"\r\n c = open(\"http://#{@address}/#{file}\").read\r\n Dir.mkdir(todir) if not File.directory?(todir)\r\n f = open(\"#{todir}/#{file}\", 'wb')\r\n f.puts c\r\n f.close\r\n rescue => e\r\n if not File.exists?(fullfile)\r\n $stderr.puts \"Could not download file #{file} form #{@address}.\"\r\n $stderr.puts e.to_s\r\n end\r\n end\r\nend",
"def zip_url; end",
"def download_file(url, destination)\n raw_file = server_api.get_rest(url, true)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def archive_download_url\n raise \"Not implemented yet!\"\n end",
"def download_file(target_dir_pathname, url_info)\n url = url_info['url']\n\n filename = target_dir_pathname\n if url_info.key?('filename')\n filename += url_info['filename']\n else\n # Use the initial URL's basename, rather than following redirects\n # first, since one of them redirects to a URL with a long unreadable\n # basename.\n filename += Pathname.new(url).basename\n end\n\n puts \"Checking #{filename}...\"\n if filename.exist? && url_info.include?('sha256')\n $sha256.reset\n $sha256.file(filename)\n if $sha256.hexdigest === url_info['sha256']\n puts \"File '#{filename}' up to date.\"\n return\n else\n puts \"File '#{filename}' exists, but the hash did not match. Re-downloading.\"\n end\n end\n\n target_dir_pathname.mkpath\n download_file_to_filename(filename, url)\nend",
"def download( url )\n image = open( \"#{url}.jpg\" ).read\n File.write @path, image\n end",
"def archive_extension(_url)\n '.zip'\n end",
"def archive_extension(_url)\n '.zip'\n end",
"def archive_extension(_url)\n '.zip'\n end",
"def url(path)\n uri, details = @api.cmd_to_url(:file_download, path: remote_file(path))\n @api.full_uri(uri, details[:params])\n end",
"def download(uri)\n target = File.join(@cache_dir, filename(uri))\n @logger.debug \"Downloading file to #{target}\"\n rich_uri = URI(uri)\n Net::HTTP.start(rich_uri.host, rich_uri.port, use_ssl: rich_uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(rich_uri.request_uri)\n http.request request do |response|\n File.open(target, File::CREAT | File::WRONLY) do |file|\n response.read_body do |chunk|\n file.write(chunk)\n end\n end\n end\n end\n rescue => e\n @logger.error \"Unable to download from #{uri}\"\n puts e.backtrace\n end",
"def download!(uri)\n processed_uri = process_uri(uri)\n file = RemoteFile.new(processed_uri)\n raise CarrierWave::DownloadError, \"trying to download a file which is not served over HTTP\" unless file.http?\n cache!(file)\n end",
"def download\n path.dirname.mkpath\n\n case io = open(url)\n when StringIO\n begin\n exact_path.open('w', 0o755) { |fd| fd.write(io) }\n rescue StandardError\n exact_path.unlink if exact_path.exist?\n raise\n end\n when Tempfile\n io.close\n iopath = Pathname.new(io.path)\n iopath.chmod(0o755)\n iopath.rename exact_path\n end\n\n path.delete if path.symlink?\n path.make_symlink exact_path\n end",
"def download(path)\n downloader.get do |req|\n req.url path\n end.body\n end",
"def http_download_uri(uri, filename)\n puts \"Starting HTTP download for: #{uri.to_s}\"\n http_object = Net::HTTP.new(uri.host, uri.port)\n http_object.use_ssl = true if uri.scheme == 'https'\n begin\n http_object.start do |http|\n request = Net::HTTP::Get.new uri.request_uri\n http.read_timeout = 500\n http.request request do |response|\n open filename, 'w' do |io|\n response.read_body do |chunk|\n io.write chunk\n end\n end\n end\n end\n rescue Exception => e\n puts \"=> Exception: '#{e}'. Skipping download.\"\n return\n end\n puts \"Stored download as #{filename}.\"\n end",
"def archive\n @archive ||= RestClient.get info['link'] + '/zip'\n end",
"def download\n # noinspection RubyCaseWithoutElseBlockInspection\n case type\n when 'direct'\n dir = File.dirname(path)\n FileUtils.mkdir_p(dir)\n Attachment.download_from_url(source, dir)\n when 'git'\n FileUtils.mkdir_p(File.dirname(path))\n ::Open3.capture3('git submodule update --init --recursive')\n end\n end",
"def download_url(hash)\n _get(\"/files/#{hash}/download_url\") { |json| json }\n end",
"def download(path)\n if File.exists?(path)\n puts \"#{path} already exists\"\n\n return\n end\n\n File.open(path, \"w\") do |file|\n file.binmode\n HTTParty.get(self['href'], stream_body: true) do |fragment|\n file.write(fragment)\n end\n end\n end",
"def download_file(url, destination)\n raw_file = server_api.streaming_request(url)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def download(url='http://download.openvz.org/template/precreated/')\n\t\ttemplate = ostemplate\n\t\tfile = @@vzcache + template + '.tar.gz'\n if !File.file? file or File.zero? file\n\t\t\trequire 'open-uri'\n\t\t\tdebug \"Downloading template '\" + template + \"' to directory: '\" + @@vzcache + \"'\"\n\t\t\twriteOut = open(file, \"wb\")\n\t\t\twriteOut.write(open(url + '/' + template + '.tar.gz').read)\n\t\t\twriteOut.close\n\t\tend\n\tend",
"def http_get(uri, download_path)\n\n # We'll save to a tempfile in case something goes wrong in the download\n # process. This avoids accidentally overwriting an old version, or\n # leaving a partially downloaded file in place\n begin\n tempfile = Tempfile.new('remote_file')\n tempfile.binmode\n response = http(uri) do |resp|\n resp.read_body do |chunk|\n tempfile.write(chunk)\n end\n end\n\n # If download was successful, copy the tempfile over to the resource path.\n if response.kind_of?(Net::HTTPSuccess)\n tempfile.flush\n\n # Try to move the file from the temp location to the final destination.\n # If the move operation fails due to permission denied, try a copy\n # before giving up. On some platforms (Windows) file locking or weird\n # permissions may cause the mv operation to fail but will still allow\n # the copy operation to succeed.\n begin\n FileUtils.mv(tempfile.path, download_path)\n rescue Errno::EACCES\n FileUtils.cp(tempfile.path, download_path)\n end\n\n # If the fileserver supports the last-modified header, make sure the\n # file saved has a matching timestamp. This may be used later to do a\n # very rough ensure=latest kind of check.\n if response.header['last-modified']\n time = Time.parse(response.header['last-modified'])\n File.utime(time, time, download_path)\n end\n end\n ensure\n tempfile.close\n tempfile.unlink\n response\n end\n end",
"def fetch(base_url, file_name, dst_dir)\n FileUtils.makedirs(dst_dir)\n src = \"#{base_url}/#{file_name}\"\n dst = File.join(dst_dir, file_name)\n if File.exists?(dst)\n logger.notify \"Already fetched #{dst}\"\n else\n logger.notify \"Fetching: #{src}\"\n logger.notify \" and saving to #{dst}\"\n open(src) do |remote|\n File.open(dst, \"w\") do |file|\n FileUtils.copy_stream(remote, file)\n end\n end\n end\n return dst\n end",
"def getlist(url)\n @url = url\n doc = Nokogiri::HTML(open(@url))\n # @fileset = doc.css(\"td a\")[1..-1]\n @fileset = doc.css(\"td a\")[1,1] #revert to above after testing\n @fileset.each do |item|\n @docname = item.text\n puts \"Downloading #{@docname}\"\n # download the zip files\n download(@url, @docname, \"/vagrant/src/ruby/JobSearch/nuvi/download/\")\n # unzip(@docname, @downloadpath)\n @zipcount += 1\n end\n @zipcount == @fileset.length ? (puts \"Retrieved #{@zipcount} zip files.\") : (puts \"missed a few\")\nend",
"def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end",
"def handle_remote_file(url, pid)\n local_path = download_remote_file(url, pid)\n return local_path unless zip_file?(local_path)\n\n extracted_local_zip = extract_local_zip(local_path, pid)\n FileUtils.rm_rf(local_path)\n extracted_local_zip\n end",
"def download(url)\n response = client.send(:get, url, {}, 'Content-Type': 'text/html')\n raise ::Errors::BadRequest unless response.success?\n\n response.body\n end",
"def download(file_name)\n remote_file_path = File.join(remote_path, file_name)\n local_file_path = File.join(backup_folder, file_name)\n\n file_from_storage = remote_directory.files.get(remote_file_path)\n\n prepare_local_folder(local_file_path)\n create_local_file(local_file_path, file_from_storage)\n\n local_file_path\n end",
"def download_from_file(filename)\n\t\t\tif !File.exist? filename\n\t\t\t\tputs \"Error: #{filename} not found\" \n\t\t\t\texit 1\n\t\t\tend\n\t\t\tfilename = File.realpath(filename)\n\t\t\tt = Torrent.new(@config[:grabber])\n\t\t\tFile.readlines(filename).each { |show| download(get_link(t, show)) }\n\t\tend",
"def download(url, filename, outputFolder)\r\n loadStatus = true\r\n begin\r\n Net::HTTP.start(url) { |http|\r\n t= Time.now\r\n filedate = t.strftime(\"%m%d%Y\")\r\n\t\tif url == \"downloads.cms.gov\"\r\n\t\t\tresp = http.get(\"/medicare/#{filename}\")\r\n\t\telse\r\n\t\t\tresp = http.get(\"/download/#{filename}\")\r\n\t\tend\r\n\r\n open(\"#{outputFolder}#{filedate}#{filename}\", \"wb\") { |file|\r\n file.write(resp.body)\r\n }\r\n }\r\n\r\n puts \"download of #{filename} complete\"\r\n rescue Exception=>e\r\n loadStatus = false\r\n end\r\n return loadStatus\r\nend",
"def download_file(path, url, size: nil)\n File.open(path, 'wb') do |f|\n uri = URI(url)\n current = 0\n last_print_update = 0\n print_progress = UI.interactive? || U3dCore::Globals.verbose?\n Net::HTTP.start(uri.host, uri.port, http_opts(use_ssl: uri.scheme == 'https')) do |http|\n request = Net::HTTP::Get.new uri\n http.request request do |response|\n begin\n # override with actual results, this should help with\n # innacurrate declared sizes, especially on Windows platform\n size = Integer(response['Content-Length'])\n rescue ArgumentError\n UI.verbose 'Unable to get length of file in download'\n end\n started_at = Time.now.to_i - 1\n response.read_body do |segment|\n f.write(segment)\n current += segment.length\n # wait for Net::HTTP buffer on slow networks\n # FIXME revisits, this slows down download on fast network\n # sleep 0.08 # adjust to reduce CPU\n next unless print_progress\n\n print_progress_now = Time.now.to_f - last_print_update > 0.5\n # force printing when done downloading\n print_progress_now = true if !print_progress_now && size && current >= size\n next unless print_progress_now\n\n last_print_update = Time.now.to_f\n Utils.print_progress(current, size, started_at)\n print \"\\n\" unless UI.interactive?\n end\n end\n end\n print \"\\n\" if print_progress\n end\n end",
"def download_file(file_type)\n temp_file = File.new(public_url.split('/').last, \"wb\")\n remote_data = open(URI.parse(public_url))\n temp_file.write(remote_data.read)\n update_attributes(file_type => temp_file)\n File.delete temp_file\n end",
"def download_and_store(url, filename=\"#{SecureRandom.uuid}\")\n\n # https://ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html\n file = Tempfile.new(filename) # use an array to enforce a format\n\n # set to write in binary mode (kinda weird api, but hey)\n file.binmode\n\n @task_result.logger.log_good \"Attempting to download #{url} and store in #{file.path}\" if @task_result\n\n begin\n\n uri = URI.parse(url)\n\n opts = {}\n if uri.instance_of? URI::HTTPS\n opts[:use_ssl] = true\n opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n # TODO enable proxy\n http = Net::HTTP.start(uri.host, uri.port, nil, nil, opts) do |http|\n http.read_timeout = 15\n http.open_timeout = 15\n http.request_get(uri.path) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n end\n\n rescue URI::InvalidURIError => e\n @task_result.logger.log_error \"Invalid URI? #{e}\" if @task_result\n return nil\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n @task_result.logger.log_error \"Unable to request URI: #{uri} #{e}\" if @task_result\n return nil\n rescue OpenSSL::SSL::SSLError => e\n @task_result.logger.log_error \"SSL connect error : #{e}\" if @task_result\n return nil\n rescue Errno::ECONNREFUSED => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ECONNRESET => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ETIMEDOUT => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Net::HTTPBadResponse => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::BufError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue SocketError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Encoding::InvalidByteSequenceError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue Encoding::UndefinedConversionError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unexpected end of file, consider looking at this file manually: #{url}\" if @task_result\n return nil\n ensure\n file.flush\n file.close\n end\n\n file.path\n end",
"def download_file_from_url(url: nil, shipment: nil)\n response = Faraday.get(url)\n redirect_url = response.headers['location']\n\n # The use of `URI::DEFAULT_PARSER` is due to the redirect_url otherwise being invalid according to RFC3986.\n # The default parser follows the RFC2396 standard.\n # Basically the issue is that there are unescaped square brackets in the URL.\n # Bring has been notified about this issue and if they fix it, then we can remove this fix.\n response = Faraday.get(URI::DEFAULT_PARSER.parse(redirect_url))\n data = response.body\n path = \"#{Rails.root}/tmp/#{shipment.unique_shipment_id}-awb_document.pdf\"\n\n pdf_file = File.open(path, 'wb') do |f|\n f.write(data)\n end\n\n return path\n end",
"def download(url, download_to=File.expand_path(\".\")+File::SEPARATOR)\n $LOG.info \" Starting download of fillings from SEC url [\"+url+\"]\"\n files=[]\n content = open(url).read\n @links = Set.new\n uri=URI(url)\n @base_path=\"\"\n @base_path=(uri.scheme+\"://\"+uri.host+((uri.port==80 && \"\") || \":\"+uri.port.to_s)) unless uri.host.nil?\n parse(content)\n download_to += File::SEPARATOR unless download_to.end_with?(File::SEPARATOR)\n mkdir(download_to)\n @links.each do |link|\n file=download_to + link.split(\"/\")[-1]\n dump_to_file(file, open(link).read)\n files << file\n end unless uri.host.nil?\n files\n end",
"def download_url(filename)\n url(response_content_disposition: %Q{attachment; filename=\"#{filename}\"})\n end",
"def download_files(url, path)\n client = RightSupport::Net::HTTPClient.new\n response = client.get(url, :timeout => 10)\n File.open(path, \"wb\") { |file| file.write(response) } unless response.empty?\n File.exists?(path)\n rescue Exception => e\n Log.error(\"#{e.class.name}: #{e.message} - #{e.backtrace.first}\")\n false\n end",
"def create_zip(name,url)\n @outputFile = (Rails.root.to_s+\"/tmp/cache/downloads/\"+name+\".zip\")\n if File.exist?(@outputFile)\n FileUtils.rm_rf (@outputFile)\n end\n @inputDir = url\n entries = Dir.entries(@inputDir)\n entries.delete(\".\")\n entries.delete(\"..\")\n io = Zip::ZipFile.open(@outputFile, Zip::ZipFile::CREATE)\n writeEntries(entries, \"\", io) #calling recursive write entries method\n io.close();\n return @outputFile\n end",
"def download_link\n download_params = { :sub => 'download', :fileid => @fileid, :filename => @remote_filename, :cookie => @api.cookie }\n DOWNLOAD_URL % [ @server_id, @short_host, download_params.to_query ]\n end",
"def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end",
"def download_file_to_tempdir(url)\n tmpdir = Pathname(Dir.mktmpdir(\"razor-repo-#{filesystem_safe_name}-download\"))\n filename = tmpdir + Pathname(url.path).basename\n\n result = url.open\n unless result.is_a?(File)\n # Create Tempfile to converge code flow.\n tmpfile = Tempfile.new filename.to_s\n tmpfile.binmode\n tmpfile << result.read\n result = tmpfile\n end\n begin\n # Try and get our data out to disk safely before we consider the\n # write completed. That way a crash won't leak partial state, given\n # our database does try and be this conservative too.\n begin\n result.flush\n result.respond_to?('fdatasync') ? result.fdatasync : result.fsync\n rescue NotImplementedError\n # This signals that neither fdatasync nor fsync could be used on\n # this IO, which we can politely ignore, because what the heck can\n # we do anyhow?\n end\n FileUtils.mv(result, filename)\n ensure\n result.close\n end\n\n # Downloading was successful, so save our temporary directory for later\n # cleanup, and return the path of the file.\n self.tmpdir = tmpdir\n self.save\n\n return filename.to_s\n\n rescue Exception => e\n # Try our best to remove the directory, but don't let that stop the rest\n # of the recovery process from proceeding. This might leak files on\n # disk, but in that case there is little else that we could do to\n # resolve the situation -- we already tried to delete the file/dir...\n FileUtils.remove_entry_secure(tmpdir, true)\n raise e\n end",
"def fetch type, version, extension=\"tar.gz\"\n core_url = \"#{@base}/#{type}-#{version}.#{extension}\"\n tmp = Galaxy::Temp.mk_auto_file \"galaxy-download\"\n @log.info \"Fetching #{core_url} into #{tmp}\"\n if @base =~ /^http:/\n begin\n output = Galaxy::HostUtils.system(\"curl -D - #{core_url} -o #{tmp} -s\")\n rescue Galaxy::HostUtils::CommandFailedError => e\n raise \"Failed to download archive #{core_url}: #{e}\"\n end\n status = output.first\n (protocol, response_code, response_message) = status.split\n unless response_code == '200'\n raise \"Failed to download archive #{core_url}: #{status}\"\n end\n else\n open(core_url) do |io|\n File.open(tmp, \"w\") { |f| f.write(io.read) }\n end\n end\n return tmp\n end",
"def get_file(url)\n get(url).body\n end",
"def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end",
"def get_file(url, filename, headers = {})\n request(:get, url, headers, :file => filename)\n end",
"def get_file(url, filename, headers = {})\n request(:get, url, headers, :file => filename)\n end",
"def download!(uri)\n unless uri.blank?\n processed_uri = process_uri(uri)\n file = RemoteFile.new(processed_uri)\n raise CarrierWave::DownloadError, \"trying to download a file which is not served over HTTP\" unless file.http?\n cache!(file)\n end\n end",
"def download( uri, to )\n to_dir = File.dirname( to )\n FileUtils.mkdir_p( to_dir ) unless File.directory?( to_dir )\n\n begin\n case uri\n when URI::FTP : download_via_ftp( uri, to )\n when URI::HTTP : download_via_http( uri, to )\n else\n raise ::Crate::Error, \"Downloading is only supported via FTP or HTTP at this time\"\n end\n rescue => e\n puts\n STDERR.puts \"Error downloading #{uri.to_s} : #{e}\"\n exit 1\n end\n end",
"def download(params, save_as)\n info = self.class.get('/files.info', query: params.merge({token: @token})).tap do |response|\n raise \"error retrieving information for for file #{params[:file]}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch('file')\n\n if download = info['url']\n uri = URI(download)\n name = uri.path.split('/').last\n\n if save_as\n if File.directory?(save_as)\n name = \"#{save_as}/#{name}\"\n else\n name = save_as\n end\n end\n\n File.open(name, 'wb') { |f| f.write HTTParty.get(download).parsed_response }\n return name\n else\n raise \"error determining private download URL for file #{params[:file]}\"\n end\n end",
"def download(save_path=\"\")\n url = prefix + \"download\"\n r = response(url) \n if r.class == String #success\n open(File.join(save_path,@filename), \"wb\").write(open(r).read)\n return r\n else #failed\n return r\n end\n end"
] | [
"0.7571589",
"0.74389625",
"0.731503",
"0.7263454",
"0.71225715",
"0.7115583",
"0.7067918",
"0.7065795",
"0.70417625",
"0.70291936",
"0.7015135",
"0.69531184",
"0.69345987",
"0.69157714",
"0.6902937",
"0.68869",
"0.68745154",
"0.6872318",
"0.68510014",
"0.6792038",
"0.6758725",
"0.6750209",
"0.6738935",
"0.6703942",
"0.6665269",
"0.66617715",
"0.6646458",
"0.66268075",
"0.6600598",
"0.65874803",
"0.6574228",
"0.6559421",
"0.6530949",
"0.6512263",
"0.6473247",
"0.6460526",
"0.64586586",
"0.64583296",
"0.64400274",
"0.64349806",
"0.6426577",
"0.642528",
"0.6403217",
"0.6400814",
"0.64008135",
"0.639679",
"0.63814276",
"0.63498634",
"0.63498247",
"0.63476646",
"0.6341799",
"0.63205814",
"0.63126266",
"0.6303771",
"0.6303138",
"0.629924",
"0.6296763",
"0.6296763",
"0.6296763",
"0.6296052",
"0.6290811",
"0.62742317",
"0.62595826",
"0.62415886",
"0.6214538",
"0.6196263",
"0.6194599",
"0.61927795",
"0.61922264",
"0.618977",
"0.6185843",
"0.61858195",
"0.6180022",
"0.6176729",
"0.6167345",
"0.61495507",
"0.61394453",
"0.61272115",
"0.61063826",
"0.6106361",
"0.6099106",
"0.6085838",
"0.6074343",
"0.6071737",
"0.60665673",
"0.60648525",
"0.60643935",
"0.6060146",
"0.6059358",
"0.60483176",
"0.6029138",
"0.6027635",
"0.6013836",
"0.60018134",
"0.60000944",
"0.60000944",
"0.59983605",
"0.5995583",
"0.5994818",
"0.5992939"
] | 0.6893747 | 15 |
view_file :: symbol > string | def view_file(type)
if (type == :html)
"#{DirMap.html_views}/fields/image.html.erb"
else
"#{DirMap.html_views}/fields/image.html.erb"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_string_from_view(view_file)\n end",
"def render_string_from_view(view_file)\n end",
"def current_file\n @view[@cursor]\nend",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/entries/cv.html.erb\"\n else\n \"#{DirMap.html_views}/entries/cv.html.erb\"\n end\n end",
"def get_view(filename)\n full_file = File.join(options.views, filename)\n if File.exists?(full_file)\n view_file = full_file \n else\n view_directory = File.join(File.dirname(__FILE__),'views')\n view_file = File.join(view_directory,filename)\n end\n open(view_file,'r') { |file| file.read }\n end",
"def get_view(filename)\n full_file = File.join(options.views, filename)\n if File.exists?(full_file)\n view_file = full_file \n else\n view_directory = File.join(File.dirname(__FILE__),'views')\n view_file = File.join(view_directory,filename)\n end\n open(view_file,'r') { |file| file.read }\n end",
"def _render filename\n\t\t\tFile.read(\"./views/_/#{filename}.html\")\n\t\tend",
"def access_file_name\n end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/fields/image-and-text.html.erb\"\n else\n \"#{DirMap.html_views}/fields/image-and-text.html.erb\"\n end\n end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/fields/_compound.html.erb\"\n else\n \"#{DirMap.html_views}/fields/_compound.html.erb\"\n end\n end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/fields/info-blocks.html.erb\"\n else\n \"#{DirMap.html_views}/fields/info-blocks.html.erb\"\n end\n end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/entries/nav.html.erb\"\n else\n \"#{DirMap.html_views}/entries/nav.html.erb\"\n end\n end",
"def view_path(file_name)\n File.join(\"app\", \"views\", \"#{self.class.name.gsub(\"Controller\",\"\").downcase}\", file_name)\n end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/fields/date.html.erb\"\n else\n \"#{DirMap.html_views}/fields/date.html.erb\"\n end\n end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/fields/_collection.html.erb\"\n else\n \"#{DirMap.html_views}/fields/_collection.html.erb\"\n end\n end",
"def file_to_render\n file\n end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/fields/password.html.erb\"\n else\n \"#{DirMap.html_views}/fields/password.html.erb\"\n end\n end",
"def file\n @file\n end",
"def inspect\n \"File: #{@name} #{@ext}\"\n end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/entries/post-news.html.erb\"\n else\n \"#{DirMap.html_views}/entries/post-news.html.erb\"\n end\n end",
"def format(view_path = T.unsafe(nil)); end",
"def file\n end",
"def file\n end",
"def file\n @pathname.to_s\n end",
"def filename\n get \"filename\"\n end",
"def template_file(file)\n File.join(\n MiGA::MiGA.root_path,\n 'lib', 'miga', 'cli', 'action', 'browse', file\n )\n end",
"def file_path; end",
"def filename \n end",
"def view_name\n @view.virtual_path.split('/').last\n end",
"def file=(_arg0); end",
"def file=(_arg0); end",
"def file=(_arg0); end",
"def file\n FILE\n end",
"def view_source\n File.read(@script)\n end",
"def filename\n @file\n end",
"def file_name\n @file_name\n end",
"def input_view_file\n \"#{self.form_files_dir}/date.html.erb\"\n end",
"def filename=(_); end",
"def file_path\n end",
"def filename=(_arg0); end",
"def filename=(_arg0); end",
"def filename=(_arg0); end",
"def name() @filename end",
"def filename()\n #This is a stub, used for indexing\n end",
"def path\n @filename\n end",
"def html(view)\n File.read(File.join('public', \"#{view.to_s}.html\"))\nend",
"def show\n @file_name = @quickchecker.file\n end",
"def file_path=(_arg0); end",
"def path\n @file\n end",
"def unique_filename(name)\n File.join(VIEW_PATH, \"#{name}.erb\")\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def render_from_view(what, type, engines=[:sass])\n out = show :\"#{type}/#{what}\", :engine => engines\n\n content_type type\n out\n rescue Errno::ENOENT => e\n nil\n end",
"def eval_file\n @file || '(__TEMPLATE__)'\n end",
"def show(filename)\n File.read File.join(@base_path, filename)\n end",
"def file name\n \n end",
"def file_name(usage)\n if usage.to_s == 'ehtml'\n \"l#{page_layout_root_id}.html.erb\"\n else\n \"l#{page_layout_root_id}.#{usage}\"\n end \n end",
"def source_file\n @source_location[0]\n end",
"def view_dir(view)\n\treturn \"#{$ccase_root}/#{view}\"\nend",
"def info_header_fname\n \"_#{name.downcase}_info.html.erb\"\n end",
"def full_filename (for_file = model.document.file)\n for_file\n end",
"def file\n file_names[x]\n end",
"def view_string(template, params={})\n params[:controller] = self\n template = \"#{template}.rhtml\" if template.is_a? Symbol\n @@erb_template.new(template, params, plugin_name()).string\n end",
"def mobile_file(file)\n File.exists?(\"#{settings.views}/#{file}#{@device}.html\") ? view = \"#{file}#{@device}\" : view = file\n end",
"def filename\n @basename + PAGE_FILE_EXT\n end",
"def code\n path\n end",
"def file_name\n self.file_file_name\n end",
"def view_paths; end",
"def view_paths; end",
"def view_paths; end",
"def show\n respond_to do |format|\n format.gltf do\n send_file EziiOsPath.new(@gltf_model.global_path).file_system_path\n end\n end\n end",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def show\n\t\tsend_file(params[:path])\n end"
] | [
"0.7521457",
"0.7521457",
"0.6807137",
"0.67920536",
"0.67034245",
"0.67034245",
"0.66717064",
"0.6573521",
"0.65572613",
"0.65494925",
"0.64311475",
"0.6403776",
"0.64000905",
"0.6382687",
"0.63780075",
"0.636775",
"0.6365856",
"0.63655585",
"0.63294274",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6324249",
"0.6321205",
"0.6321205",
"0.6321205",
"0.6321205",
"0.6321205",
"0.6321205",
"0.6321205",
"0.6321205",
"0.6321205",
"0.6321205",
"0.6321205",
"0.63187283",
"0.6308983",
"0.6282565",
"0.6282565",
"0.62697214",
"0.62396055",
"0.6195483",
"0.6195323",
"0.6190179",
"0.6162826",
"0.61555403",
"0.61555403",
"0.61555403",
"0.6151703",
"0.61399835",
"0.6131254",
"0.6118769",
"0.6088266",
"0.6078593",
"0.6074937",
"0.60736835",
"0.60736835",
"0.60736835",
"0.606837",
"0.6067038",
"0.604994",
"0.6039693",
"0.6035812",
"0.6006187",
"0.60015064",
"0.59986645",
"0.5996174",
"0.5996174",
"0.5996174",
"0.5996174",
"0.5994634",
"0.5992072",
"0.59811497",
"0.59601384",
"0.5949402",
"0.59144026",
"0.5898112",
"0.58966327",
"0.5896165",
"0.5882724",
"0.58824563",
"0.5873973",
"0.5868521",
"0.5866735",
"0.5859439",
"0.58549035",
"0.58549035",
"0.58549035",
"0.5848871",
"0.5843106",
"0.58357644"
] | 0.6374109 | 15 |
Create a replication request | def create_replication(request, &block)
post "/replicate/", request, &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_replication_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def update_replication(request, &block)\n put \"/replicate/#{request[:replication_id]}/\", request, &block\n end",
"def post_init\n # Build a JSON representation\n r = {:source => \"#{@conn_obj.remote_db}\",\n :target => \"#{@conn_obj.our_db}\"}\n #, :continuous => true }\n r_json = r.to_json\n\n # Create the HTTP request\n req = \"POST /_replicate HTTP/1.1\\r\\n\"\n req += \"Content-Length: #{r_json.length}\\r\\n\\r\\n\"\n req += \"#{r_json}\"\n\n # Push it to the network\n send_data req\n end",
"def replicate(request)\n UNIXSocket.new(REPLICA_SOCKET_PATH).puts(request)\n end",
"def get_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_replication_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::NetApp::V1::Replication.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def start_replication_with_http_info(execution, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReplicationApi.start_replication ...'\n end\n # verify the required parameter 'execution' is set\n if @api_client.config.client_side_validation && execution.nil?\n fail ArgumentError, \"Missing the required parameter 'execution' when calling ReplicationApi.start_replication\"\n end\n # resource path\n local_var_path = '/replication/executions'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(execution)\n auth_names = ['basic']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReplicationApi#start_replication\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_replication_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def start_replication(execution, opts = {})\n start_replication_with_http_info(execution, opts)\n nil\n end",
"def request!\n PoolNode.create_or_get(@id, node)\n end",
"def create_requestor(request_address, reply_address=nil, reply_queue=nil)\n HornetQ::Client::RequestorPattern.new(self, request_address, reply_address, reply_queue)\n end",
"def create\n name, type = resource[:name].split('/')\n rdata = resource[:rdata]\n ttl = resource[:ttl]\n case type\n when 'MX'\n Array(rdata).each_with_index do |exchange, index|\n preference = Array(resource[:preference])[index]\n nsupdate(\"server #{server}\n update add #{name} #{ttl} MX #{preference} #{exchange}\n send\")\n end\n when 'SRV'\n Array(rdata).each_with_index do |target, index|\n port = Array(resource[:port])[index]\n weight = Array(resource[:weight])[index]\n priority = Array(resource[:priority])[index]\n nsupdate(\"server #{server}\n update add #{name} #{ttl} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n nsupdate(\"server #{server}\n update add #{name} #{ttl} #{type} #{Array(rdata).first}\n send\")\n end\n end",
"def delete_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_replication_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create!\n Recliner.put(uri)\n end",
"def create params\n raise_start_server unless Server::node\n new params\n end",
"def create\n make_create_request\n end",
"def id\n replication_id\n end",
"def create\n\n info(\"Initializing %s MongoDB replica set\" % resource[:host])\n\n command = \"echo 'rs.initiate()' | mongo #{resource[:host]} --quiet\"\n result = `#{command}`\n\n info(\"Sleeping 90 seconds for the replica set to become active\")\n sleep(90)\n\n end",
"def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil, service_mode = '1')\n send_req({\n a: :rec_new,\n z: zone,\n type: type,\n name: name,\n content: content,\n ttl: ttl,\n prio: prio,\n service: service,\n srvname: srvname,\n protocol: protocol,\n weight: weight,\n port: port,\n target: target,\n service_mode: service_mode\n })\n end",
"def create_request\r\n request = @svc.createRequest(\"ReferenceDataRequest\")\r\n\r\n @identifiers.each {|identifier| request.append(\"securities\", identifier) }\r\n \r\n @options.each do |key, value|\r\n next if key == :fields or key == :overrides\r\n request.set(key.to_s, convert_value_to_bberg(value))\r\n end\r\n \r\n @options[:fields].each {|f| request.append(\"fields\", f) }\r\n \r\n overrides = request.getElement(\"overrides\")\r\n @options[:overrides].each do |field_id, value|\r\n new_override = overrides.appendElement()\r\n new_override.setElement(\"fieldId\", field_id.to_s)\r\n new_override.setElement(\"value\", convert_value_to_bberg(value))\r\n end\r\n @request = request\r\n end",
"def to_create_request\n 'create_%s' % api_name\n end",
"def create(args) \n help_form = {:tNote => args[:note],\n :xCategory => args[:category],\n :sFirstName => args[:first_name],\n :sLastName => args[:last_name],\n :sUserId => args[:user_id],\n :sEmail => args[:email],\n :sPhone => args[:phone],\n :fUrgent => args[:urgent]}.reject!{|k,v| v == nil}\n \n JSON.parse(api_request('request.create', 'POST', help_form))['xRequest'] rescue []\n end",
"def create\n @session_replica = SessionReplica.new(session_replica_params)\n\n respond_to do |format|\n if @session_replica.save\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :created, location: @session_replica }\n else\n format.html { render :new }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_request\n Effective::QbRequest.new_requests_for_unsynced_items.first\n end",
"def create\n\n #Can params be fulfilled through the headers as well?\n #Checks the receiver and group id parameter to see if they exist\n #Then create a new Request with parameters through the body, including group id and receiver id\n\n if (User.where(id: v1_requests_params[:reciever_id]).first != nil) && (Group.where(id: v1_requests_params[:group_id]).first != nil)\n @v1_request = Request.new(sender_id: current_user.id,reciever_id: v1_requests_params[:reciever_id],\n group_id: v1_requests_params[:group_id],request_type: v1_requests_params[:request_type],\n chore_id: v1_requests_params[:chore_id], group_name: v1_requests_params[:group_name])\n\n if @v1_request.save\n render json: @v1_request, status: :created\n else\n head(:unprocessable_entity)\n end\n end\n end",
"def create_conn\n EM::HttpRequest.new(MIRROR_SOURCE)\nend",
"def replication_agent(run_mode, name)\n RubyAem::Resources::ReplicationAgent.new(@client, run_mode, name)\n end",
"def create_request(res, user, res_notes)\n errors = res.validate\n notes = \"### Requested on #{Time.zone.now.to_s(:long)} by \"\\\n \"#{user.md_link}\\n\\n#### Notes:\\n#{res_notes}\"\n res.flag(:request)\n res.status = 'requested'\n res.notes = notes\n res.save!\n\n AdminMailer.request_filed(res).deliver_now # send request notification\n \"Request for #{res.equipment_model.md_link} filed successfully. \"\\\n \"#{errors.to_sentence}\\n\"\n end",
"def resume_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_resume_replication_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def session_replica_params\n params.require(:session_replica).permit(:origin_id, :start_date)\n end",
"def build_request path, opts = {}\n connection.build_request path, opts\n end",
"def create_request publisher, method, params\n CnsBase::RequestResponse::RequestSignal.new(publisher, method, params)\n end",
"def generate_request\r\n end",
"def create\n prepare_params\n\n @request = Request.new(request_params.merge(user: current_user))\n @request.assign_sudo_users(request_params[:sudo_user_ids])\n respond_to do |format|\n if enough_resources && @request.save\n successful_save(format)\n else\n unsuccessful_action(format, :new)\n end\n end\n end",
"def create_server\n\n end",
"def setup_replication_destination_obj(replication)\n # if this is a standard object AND we're copying to a mission AND there exists a copy of this obj in the given mission,\n # then we don't need to create a new object, so return the existing copy\n if is_standard? && replication.has_to_mission? && (copy = copy_for_mission(replication.to_mission))\n obj = copy\n else\n # otherwise, we init and return the new object\n obj = self.class.new\n end\n\n # set flag so that standardizable callback doesn't call replicate again unnecessarily\n obj.changing_in_replication = true\n\n obj\n end",
"def build_request\n client.request request_name\n end",
"def build_request(*args); end",
"def create\n @request = Request.new(params[:request])\n @request.user_id = current_user.id\n @request.owner_id = User.find(Place.find(params[:request][:place_id]).user_id).id\n @request.status = 1\n @request.save\n #respond_with(@request)\n redirect_to pending_tenant_requests_path and return\n end",
"def create\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('create',:node => node_id)\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def create_new_http_request\n # Create a new HTTP request instance\n request_spec = @data[:request][:instance]\n http_class = \"Net::HTTP::#{request_spec.verb._camelize}\"\n http_request = http_class._constantize::new(request_spec.path)\n # Set the request body\n if request_spec.is_io?\n http_request.body_stream = request_spec.body\n else\n http_request.body = request_spec.body\n end\n # Copy headers\n request_spec.headers.each { |header, value| http_request[header] = value }\n # Save the new request\n request_spec.raw = http_request\n # Set user-agent\n if @data[:options].has_key?(:connection_user_agent)\n http_request['user-agent'] ||= @data[:options][:connection_user_agent]\n end\n http_request\n end",
"def mt_tsk_create_request\n task = MtCompanyTask.find( params[:id] );\n req = MaintenanceRequest.new();\n \n req.title = task.title;\n req.remarks = task.description; \n unless ( task.building.nil? )\n req.building = task.building;\n end\n req.reporter = @worker;\n \n req.mt_company_task = task;\n req.mt_company = @mt_company\n task.maintenance_request = req;\n \n begin\n req.save!\n task.save!\n add_confirmation \"MT_REQ CREATED\"\n redirect_to :action=>:mt_req_show, :id=>req.id, :back=>:mt_tsk_list;\n rescue Exception=>e\n add_error e.message\n redirect_to :action=>:mt_tsk_show, :id=>params[:id];\n end\n end",
"def create_membership_request\n member = Member.new(squad: @squad, user: current_user, membership: 'request')\n member.save(validate: false)\n end",
"def post_create_clone\n response = self.class.post(\"/service/#{$service_id}/version/#{$new_dev_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end",
"def create\n pending_request = PendingTutorRequest.create(tutor_request_params)\n tutee = User.find(params[:student_id])\n course = Course.find(TutorSubject.find(params[:tutor_subject_id]).course_id)\n\n course_code = course.course_prefix + course.course_code\n\n data = {\n course: course_code,\n tutee: tutee.first_name\n }\n\n notifcation_params = { 'user_id' => params[:tutor_id],\n 'title' => 'Request',\n 'body' => 'You have a new pending request for ' + course_code,\n 'icon' => 'request_new',\n 'color' => 'lightgrey',\n 'type' => 'request',\n 'associated_data' => data.to_json }\n\n if pending_request.valid?\n Notifications.send_notification(notifcation_params)\n json_response(pending_request, :created)\n else\n json_response(pending_request.errors, :unprocessable_entity)\n end\n end",
"def create(args = nil)\n # Connects to the xmpp-client that is used for sending xmpp-messages\n @send_client = connect(@@send_client_info)\n \n # Connect to xmpp-client that is used for receiving messages that are then turn into http-requests\n @receive_client = connect(@@receive_client_info)\n runMessageReceiver\n \n # Ensures that xmpp-server has node: home/host/<host>/<node_account>/contexts\n XmppHelper::createContextGeneralNode\n\n end",
"def replication_type\n settings[:replication_type]\n end",
"def create\n request = params[:request]\n requestor = request.delete :requestor_attributes\n @request = Request.new(request)\n \n if requestor[:id].nil?\n @request.requestor = Requestor.new(requestor)\n else\n @request.requestor = Requestor.find(requestor[:id])\n end\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to @request, :notice => 'Request was successfully created.' }\n format.json { render :json => @request, :status => :created, :location => @request }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@request = Request.new( update_request_params )\n\n\t\trespond_to do |format|\n\t\t\tif @request.save\n\t\t\t\tformat.json { render json: @request, status: :created }\t\t\t\t\n\t\t\telse\n\t\t\t\tformat.json { render json: @request.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def replicate(to_mission_or_replication = nil)\n\n # if mission or nil was passed in, we don't have a replication object, so we need to create one\n # a replication is an object to track replication parameters\n if to_mission_or_replication.is_a?(Replication)\n replication = to_mission_or_replication\n else\n replication = Replication.new(:src_obj => self, :to_mission => to_mission_or_replication)\n end\n\n # wrap in transaction if this is the first call\n return replication.redo_in_transaction unless replication.in_transaction?\n\n # do logging after redo_in_transaction so we don't get duplication\n Rails.logger.debug(replication.to_s) if self.class.log_replication?\n\n # if we're on a recursive step AND we're doing a shallow copy AND this is not a join class,\n # we don't need to do any recursive copying, so just return self\n if replication.recursed? && replication.shallow_copy? && !JOIN_CLASSES.include?(self.class.name)\n add_replication_dest_obj_to_parents_assocation(replication, self)\n return self\n end\n\n # if we get this far we DO need to do recursive copying\n # get the obj to copy stuff to, and also tell the replication object about it\n replication.dest_obj = dest_obj = setup_replication_destination_obj(replication)\n\n # set the proper mission ID if applicable\n dest_obj.mission_id = replication.to_mission.try(:id)\n\n # copy attributes from src to parent\n replicate_attributes(replication)\n\n # ensure uniqueness params are respected\n ensure_uniqueness_when_replicating(replication)\n\n # call a callback if requested\n self.send(replicable_opts(:after_copy_attribs), replication) if replicable_opts(:after_copy_attribs)\n\n # add dest_obj to its parent's assoc before recursive step so that children can access it\n add_replication_dest_obj_to_parents_assocation(replication)\n\n # if this is a standard obj, add the newly replicated dest obj to the list of copies\n # unless it is there already\n add_copy(dest_obj) if is_standard?\n\n replicate_child_associations(replication)\n\n dest_obj.save!\n\n return dest_obj\n end",
"def create(params={})\n self.request(__method__, params)\n end",
"def make_tn_request( opts={} )\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( headers )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\treturn \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\tend",
"def create_req(conn, info_detail)\n event_raised(:ev_create_another, {:conn => conn, :info_detail => info_detail})\n end",
"def distribute(request)\n promote_replica_to_primary if primary_not_available?\n return \"Uh Oh, no primary\" if primary.nil?\n\n if write?(request)\n send(primary, request)\n else\n send(random_server, request)\n end\n end",
"def create_sr(package,from,to)\n puts \"Creating submit request for package #{package} from #{from} to #{to}\"\n if Options.instance.debug_project\n to = Options.instance.debug_project\n puts \"Creating submit request for package #{package} from #{from} to #{to}\"\n end\n log.info \"Creating submit request for package #{package} from #{from} to #{to}\"\n if system(\"#{osc_cmd} sr #{from} #{package} #{to}\")\n request = `#{osc_cmd} request list #{to} #{package} |grep State:new |head -n 1 |cut -d\\\\ -f2`\n log.info \"Created request id #{request}\"\n end\nend",
"def create_request(host,port,ssl,meth,path,headers,query,body,respcode,resphead,response)\n\t\treq = WmapRequest.create(\n\t\t\t\t:host => host,\n\t\t\t\t:address => host,\n\t\t\t\t:port => port,\n\t\t\t\t:ssl => ssl,\n\t\t\t\t:meth => meth,\n\t\t\t\t:path => path,\n\t\t\t\t:headers => headers,\n\t\t\t\t:query => query,\n\t\t\t\t:body => body,\n\t\t\t\t:respcode => respcode,\n\t\t\t\t:resphead => resphead,\n\t\t\t\t:response => response\n\t\t\t)\n\t\t#framework.events.on_db_request(rec)\n\tend",
"def add_requests\n @request = Requests.new(@txn_name, self.config, self.name, self.probability, self.type)\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def request(*a)\n request = Request.new(*a)\n request.node = self\n request\n end",
"def lsepoch_create_replica_record(params, record)\n _replica = Vob.new(params[:vob])\n _replica[:tag] = record[:tag]\n _replica[:host_id] = record[:host_id]\n _replica[:replica_name] = record[:row_replica] # \"fresh\" value from parsing\n _replica[:replica_uuid] = record[:oid]\n _replica[:description] = \"Orphaned from the epoch table...\"\n _replica.save\n record[:row_replica] = _replica[:id]\n end",
"def create\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::POST_SUBSCRIPTION\n\n args.req_body = ZAPIArgs.new\n args.req_body.accountKey = SAMPLE_ACCOUNT_KEY\n args.req_body.contractEffectiveDate = '2013-02-1'\n args.req_body.termType = 'TERMED'\n args.req_body.initialTerm = '12'\n args.req_body.autoRenew = true\n args.req_body.renewalTerm = \"3\"\n args.req_body.notes = 'Test POST subscription from z-ruby-sdk'\n args.req_body.subscribeToRatePlans = []\n args.req_body.subscribeToRatePlans[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].productRatePlanId = 'ff8080811ca15d19011cdda9b0ad3b51'\n args.req_body.subscribeToRatePlans[0].chargeOverrides = []\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].productRatePlanChargeId =\n 'ff8080811ca15d19011cddad8c953b53'\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].quantity = 10\n args.req_body.invoiceTargetDate = '2013-12-31'\n args.req_body.invoiceCollect = false\n\n puts \"========== CREATE A SUBSCRIPTION ============\"\n\n begin\n @z_client.post(args) do |resp|\n ap resp\n return resp.subscriptionNumber if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end",
"def create(opts)\n opts = check_params(opts,[:servers])\n super(opts)\n end",
"def create(opts)\n operation = {create: { _index: opts[:index], _type: opts[:type] }}\n operation[:create][:_id] = opts[:id] if opts[:id]\n @buffer.puts operation.to_json\n @buffer.puts opts[:body].to_json\n end",
"def create\n from_interface = Interface.find(patchcord_params['from_node'])\n to_interface = Interface.find(patchcord_params['to_node'])\n @patchcord = Patchcord.new(from_node: from_interface,\n to_node: to_interface,\n length: patchcord_params['length'])\n\n respond_to do |format|\n if @patchcord.save\n format.html { redirect_to @patchcord, notice: 'Patchcord was successfully created.' }\n format.json { render :show, status: :created, location: @patchcord }\n else\n format.html { redirect_to new_patchcord_url, alert: @patchcord.errors }\n format.json { render json: @patchcord.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_network(request)\n # --- Create the new Instance ---\n network = VirtualNetworkOCCI.new(\n VirtualNetwork.build_xml,\n @client,\n request.body,\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = network.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n network.info\n return to_occi_xml(network, :code=>201)\n end",
"def initialize(args={})\n @source = args[:source] || nil\n @replica = args[:replica] || nil\n @sbm_limit = args[:sbm_limit] || 600\n @repl_status = {}\n end",
"def batch_create(request = nil, manifest: nil, items: nil, **opt)\n self.request = request ||= pre_flight(manifest, items, **opt)\n self.start_time = request[:start_time] ||= timestamp\n opt[:manifest_id] = request[:manifest_id] ||= manifest\n result_data = submit_batch(**opt)\n self.end_time = timestamp\n self.result = post_flight(result_data, **opt)\n end",
"def log_request\n ServerRequestLog.create! default_log_hash\n end",
"def build_create_subscription_request(xml, options)\n # Subscription\n add_subscription(xml, options)\n\n xml.target!\n end",
"def create\n @request = ::Request.new(admin_request_params)\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to [:admin, @request], notice: 'Request was successfully created.' }\n format.json { render json: @request, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clone_item_request = CloneItemRequest.new(params[:clone_item_request])\n\n respond_to do |format|\n if @clone_item_request.save\n format.html { redirect_to(@clone_item_request, :notice => 'Clone item request was successfully created.') }\n format.xml { render :xml => @clone_item_request, :status => :created, :location => @clone_item_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @clone_item_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n #@request = Request.new\n end",
"def create_request\n super(@credentials)\n end",
"def create\n GpsJob.perform_later(request_params)\n head(:ok)\n end",
"def make_tn_request( opts={} )\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( headers )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def make_tn_request( opts={} )\n\t\topts = TEST_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts )\n\n\t\theaderstring = TNetstring.dump( headers )\n\t\tbodystring = TNetstring.dump( opts[:body] || '' )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def new_reply(req)\n SsaReply.new(req, self)\n end",
"def new\n @request = Request.new\n end",
"def add_replication conn\n if @schedule.has_key? conn.name\n return\n else\n @schedule[conn.name] = conn\n\n if !@active\n @active = true\n EM::add_timer(@interval) { run_replications }\n end\n end\n end",
"def createXRegionReadRep(instId, sourceDbInstId, subnetGrp)\n puts \"Creating cross region replica #{instId} from source DB #{sourceDbInstId} with subnet group #{subnetGrp}\"\n\n begin\n opts = Hash.new\n opts[:db_instance_identifier] = instId\n opts[:source_db_instance_identifier] = sourceDbInstId\n opts[:db_subnet_group_name] = subnetGrp\n @rds.create_db_instance_read_replica(opts)\n rescue Exception => e\n puts \"KSRdsUtil>>createXRegionReadRep: error \" + e.message\n end\n\n end",
"def create\n @termination_request = TerminationRequest.new(termination_request_params)\n @termination_request.lease_no = get_active_lease.lease_no\n @termination_request.app_status = 0 #set pending flag\n\n respond_to do |format|\n if @termination_request.save\n format.html { redirect_to @termination_request, notice: 'Termination request was successfully created.' }\n format.json { render :show, status: :created, location: @termination_request }\n else\n format.html { render :new }\n format.json { render json: @termination_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_request(verb, uri, opts = T.unsafe(nil)); end",
"def create_request(request_in, opts = {})\n data, _status_code, _headers = create_request_with_http_info(request_in, opts)\n data\n end",
"def request\n @request ||= ActionDispatch::TestRequest.create.tap do |request|\n request.request_id = SecureRandom.uuid\n end\n end",
"def add_repeating_request(url, interval, content)\n @nodes << RepeatingRequest.new(page_config, url, interval, content)\n end",
"def make_request(new_request) \n puts \"[Controller:make_request] request '#{new_request.id}' will be submitted to arduino\"\n return error_msg(:arduino_address) unless address_valid?(new_request.address)\n \t\treturn Interface::ArduinoClient.register_request(new_request)\n rescue Exception => error; return error_msg(:timeout, error)\n end",
"def create\n @request = Request.new(request_params)\n\n respond_to do |format|\n if @request.save\n notify_users(@request)\n session[:request_id] = @request.id\n format.html { redirect_to createdrequest_requests_path, notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n else\n format.html { render :action => \"new\" , alert: \"Something went wrong, try again\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @request = Request.new(request_params)\n @request.user = current_user\n @request.auto = current_user.autos.last\n if @request.save\n flash[:notice] = 'Request was successfully created.'\n redirect_to requests_path\n else\n render :new\n end\n end",
"def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end",
"def replicate_child(child, assoc_name, replication)\n # build new replication param obj for child\n new_replication = replication.clone_for_recursion(child, assoc_name)\n\n # call replicate for the child object\n child.replicate(new_replication)\n end",
"def initialize\n create_new_rep\n end",
"def request_node(*args)\n RequestNode.new(self, *args)\n end",
"def request_node(*args)\n RequestNode.new(self, *args)\n end",
"def zenodo_replication_url\n raise 'Override zenodo_replication_url in the model'\n end",
"def build_request(name, args)\n build_args(args) if args\n # build the request & http object\n build_http_request(name)\n # set the content type & request body\n update_content_type(name)\n make_request(@http, @request)\n end",
"def subscription_service_create_with_http_info(space_id, create_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionService.subscription_service_create ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling SubscriptionService.subscription_service_create\" if space_id.nil?\n # verify the required parameter 'create_request' is set\n fail ArgumentError, \"Missing the required parameter 'create_request' when calling SubscriptionService.subscription_service_create\" if create_request.nil?\n # resource path\n local_var_path = \"/subscription/create\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(create_request)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SubscriptionVersion')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionService#subscription_service_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_record(http)\n json = %|{\n \"kind\": \"Article\",\n \"title\": \"Sample\",\n \"text\": \"Just some random text.\"\n}|\n resp = http.send_request('PUT', '/v1/Article', json, { 'Content-Type' => 'application/json' })\n # Response should be an OK with a JSON body.\n assert_equal(Net::HTTPOK, resp.class, 'response not an OK')\n reply = Oj.strict_load(resp.body, symbol_keys: true)\n\n # Make sure the message has the correct fields and values.\n assert_equal(0, reply[:code], 'create reply.code should be 0 meaning no error')\n ref = reply[:ref]\n refute_equal(nil, ref, 'create reply record reference can not be nil')\n refute_equal(0, ref, 'create reply record reference can not be 0')\n ref\n end",
"def create(params = {})\n http_helper.send_post_request(\"#{@url_prefix}/\", params)\n end",
"def create(opts)\n opts = check_params(opts,[:description,:local_policy,:remote_policy,:requested_hosts])\n super(opts)\n end",
"def create(data) # rubocop:disable Rails/Delegate\n client.create(data)\n end",
"def construct_request(method, url, requestor, opts={})\n user_headers = opts[:headers] || {}\n version = opts[:server_api_version]\n payload_raw = opts[:payload] || \"\"\n\n payload = if payload_raw.class == Hash\n to_json(payload_raw)\n else\n payload_raw\n end\n\n # Provide a means to explicitly delete version header for test purposes\n version_headers = if opts.has_key?(:api_version)\n version = opts[:api_version]\n if version.nil?\n {}\n else\n {\"X-Ops-Server-API-Version\" => version}\n end\n else\n {\"X-Ops-Server-API-Version\" => server_api_version}\n end\n\n auth_headers = opts[:auth_headers] || requestor.signing_headers(method, url, payload)\n\n uri = URI.parse(url)\n\n # for further details, see: get_host_port in oc-chef-pedant/lib/pedant/utility.rb\n host = \"#{uri.host}:#{uri.port}\"\n\n final_headers = standard_headers.\n merge(auth_headers).\n merge(user_headers).\n merge(version_headers).\n merge({'Host' => host, 'X-REMOTE-REQUEST-ID' => UUIDTools::UUID.random_create.to_s})\n\n [final_headers, payload]\n end"
] | [
"0.77556616",
"0.6345245",
"0.61897504",
"0.6185618",
"0.6121208",
"0.59140223",
"0.5831481",
"0.5817684",
"0.5785764",
"0.5746391",
"0.5610842",
"0.56090087",
"0.56039417",
"0.5579938",
"0.5559646",
"0.55029815",
"0.55015385",
"0.5482988",
"0.5482678",
"0.5471468",
"0.5429423",
"0.5415274",
"0.54056615",
"0.538734",
"0.538624",
"0.53757256",
"0.5355439",
"0.534745",
"0.5323615",
"0.5299448",
"0.5294552",
"0.5279868",
"0.5279407",
"0.5275871",
"0.5275564",
"0.5264032",
"0.5236251",
"0.5211843",
"0.52072877",
"0.52044576",
"0.51977545",
"0.51895434",
"0.5187183",
"0.5154234",
"0.5139594",
"0.51379305",
"0.5128905",
"0.5127308",
"0.5116164",
"0.5115222",
"0.50946313",
"0.50747705",
"0.50720257",
"0.5070637",
"0.50619173",
"0.5050173",
"0.5043849",
"0.50381565",
"0.50107586",
"0.5010307",
"0.5009908",
"0.500148",
"0.49997222",
"0.4989936",
"0.49844375",
"0.49830037",
"0.4980297",
"0.49797836",
"0.49642843",
"0.49620646",
"0.49582282",
"0.49535245",
"0.49495164",
"0.49417385",
"0.49417385",
"0.49389613",
"0.49322453",
"0.49250883",
"0.4919791",
"0.49196702",
"0.49190864",
"0.49156633",
"0.49152267",
"0.49128532",
"0.49117064",
"0.48998147",
"0.48975116",
"0.4897344",
"0.48971054",
"0.48968714",
"0.48915827",
"0.48915827",
"0.48851743",
"0.4884398",
"0.48831102",
"0.48827705",
"0.48751307",
"0.48725963",
"0.4871845",
"0.48705932"
] | 0.8101763 | 0 |
Update a replication request | def update_replication(request, &block)
put "/replicate/#{request[:replication_id]}/", request, &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_replication_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def update!(**args)\n @replication_state = args[:replication_state] if args.key?(:replication_state)\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update_replication\n replication.stored = true\n replication.update_admin\n replication.update_local\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update(request)\n end",
"def update(request)\n end",
"def update!(**args)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end",
"def update!(**args)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @min_replica_count = args[:min_replica_count] if args.key?(:min_replica_count)\n end",
"def update!(**args)\n @replica_hours = args[:replica_hours] if args.key?(:replica_hours)\n end",
"def update!(**args)\n @max_replicas = args[:max_replicas] if args.key?(:max_replicas)\n @min_replicas = args[:min_replicas] if args.key?(:min_replicas)\n end",
"def update!(**args)\n @experiment_id_list = args[:experiment_id_list] if args.key?(:experiment_id_list)\n @mode = args[:mode] if args.key?(:mode)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @experiment_id_list = args[:experiment_id_list] if args.key?(:experiment_id_list)\n @mode = args[:mode] if args.key?(:mode)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @source_address_group = args[:source_address_group] if args.key?(:source_address_group)\n end",
"def update!(**args)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @max_replica_count = args[:max_replica_count] if args.key?(:max_replica_count)\n @starting_replica_count = args[:starting_replica_count] if args.key?(:starting_replica_count)\n end",
"def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update!(**args)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def create_replication(request, &block)\n post \"/replicate/\", request, &block\n end",
"def update!(**args)\n @memberships = args[:memberships] if args.key?(:memberships)\n @request_id = args[:request_id] if args.key?(:request_id)\n @space = args[:space] if args.key?(:space)\n end",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end",
"def update!(**args)\n @write_run_data_requests = args[:write_run_data_requests] if args.key?(:write_run_data_requests)\n end",
"def update!(**args)\n @retry = args[:retry] if args.key?(:retry)\n end",
"def update!(**args)\n @retry = args[:retry] if args.key?(:retry)\n end",
"def update\n respond_to do |format|\n if @session_replica.update(session_replica_params)\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :ok, location: @session_replica }\n else\n format.html { render :edit }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @extension = args[:extension] if args.key?(:extension)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @initiator = args[:initiator] if args.key?(:initiator)\n @retention_settings = args[:retention_settings] if args.key?(:retention_settings)\n end",
"def update!(**args)\n @cluster = args[:cluster] if args.key?(:cluster)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n end",
"def update!(**args)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n end",
"def update!(**args)\n @node_ip = args[:node_ip] if args.key?(:node_ip)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n end",
"def update!(**args)\n @host = args[:host] if args.key?(:host)\n @node_id = args[:node_id] if args.key?(:node_id)\n @parameters = args[:parameters] if args.key?(:parameters)\n @port = args[:port] if args.key?(:port)\n @state = args[:state] if args.key?(:state)\n @zone = args[:zone] if args.key?(:zone)\n end",
"def update!(**args)\n @form = args[:form] if args.key?(:form)\n @replies = args[:replies] if args.key?(:replies)\n @write_control = args[:write_control] if args.key?(:write_control)\n end",
"def update\n @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @resource_info = args[:resource_info] if args.key?(:resource_info)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end",
"def update!(**args)\n @request = args[:request] if args.key?(:request)\n @target = args[:target] if args.key?(:target)\n @type = args[:type] if args.key?(:type)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_id = args[:version_id] if args.key?(:version_id)\n end",
"def update!(**args)\n @request = args[:request] if args.key?(:request)\n @target = args[:target] if args.key?(:target)\n @type = args[:type] if args.key?(:type)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_id = args[:version_id] if args.key?(:version_id)\n end",
"def update!(**args)\n @request = args[:request] if args.key?(:request)\n @target = args[:target] if args.key?(:target)\n @type = args[:type] if args.key?(:type)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_id = args[:version_id] if args.key?(:version_id)\n end",
"def update!(**args)\n @request = args[:request] if args.key?(:request)\n @target = args[:target] if args.key?(:target)\n @type = args[:type] if args.key?(:type)\n @update_time = args[:update_time] if args.key?(:update_time)\n @version_id = args[:version_id] if args.key?(:version_id)\n end",
"def update!(**args)\n @request_logging = args[:request_logging] if args.key?(:request_logging)\n end",
"def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @recurrence = args[:recurrence] if args.key?(:recurrence)\n @recurrence_id = args[:recurrence_id] if args.key?(:recurrence_id)\n @server_id = args[:server_id] if args.key?(:server_id)\n end",
"def update!(**args)\n @allow_transactional_writes = args[:allow_transactional_writes] if args.key?(:allow_transactional_writes)\n @cluster_id = args[:cluster_id] if args.key?(:cluster_id)\n end",
"def update!(**args)\n @cluster_id = args[:cluster_id] if args.key?(:cluster_id)\n @throttled = args[:throttled] if args.key?(:throttled)\n end",
"def update!(**args)\n @initiator_id = args[:initiator_id] if args.key?(:initiator_id)\n @mutations = args[:mutations] if args.key?(:mutations)\n end",
"def update!(**args)\n @operation = args[:operation] if args.key?(:operation)\n @protocol = args[:protocol] if args.key?(:protocol)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @cluster_id = args[:cluster_id] if args.key?(:cluster_id)\n @index_for_debugging = args[:index_for_debugging] if args.key?(:index_for_debugging)\n @reason = args[:reason] if args.key?(:reason)\n end",
"def update!(**args)\n @exclude_objects = args[:exclude_objects] if args.key?(:exclude_objects)\n @include_objects = args[:include_objects] if args.key?(:include_objects)\n @max_concurrent_backfill_tasks = args[:max_concurrent_backfill_tasks] if args.key?(:max_concurrent_backfill_tasks)\n @publication = args[:publication] if args.key?(:publication)\n @replication_slot = args[:replication_slot] if args.key?(:replication_slot)\n end",
"def update!(**args)\n @migrate_resource_requests = args[:migrate_resource_requests] if args.key?(:migrate_resource_requests)\n end",
"def update!(**args)\n @cpus = args[:cpus] if args.key?(:cpus)\n @memory = args[:memory] if args.key?(:memory)\n @replicas = args[:replicas] if args.key?(:replicas)\n end",
"def update!(**args)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"def update!(**args)\n @ip = args[:ip] if args.key?(:ip)\n @labels = args[:labels] if args.key?(:labels)\n @port = args[:port] if args.key?(:port)\n @principal = args[:principal] if args.key?(:principal)\n @region_code = args[:region_code] if args.key?(:region_code)\n end",
"def update!(**args)\n @replies = args[:replies] if args.key?(:replies)\n @root_comment = args[:root_comment] if args.key?(:root_comment)\n end",
"def update!(**args)\n @finish_time = args[:finish_time] if args.key?(:finish_time)\n @original_request = args[:original_request] if args.key?(:original_request)\n @request_time = args[:request_time] if args.key?(:request_time)\n end",
"def update!(**args)\n @finish_time = args[:finish_time] if args.key?(:finish_time)\n @original_request = args[:original_request] if args.key?(:original_request)\n @request_time = args[:request_time] if args.key?(:request_time)\n end",
"def update!(**args)\n @finish_time = args[:finish_time] if args.key?(:finish_time)\n @original_request = args[:original_request] if args.key?(:original_request)\n @request_time = args[:request_time] if args.key?(:request_time)\n end",
"def update!(**args)\n @finish_time = args[:finish_time] if args.key?(:finish_time)\n @original_request = args[:original_request] if args.key?(:original_request)\n @request_time = args[:request_time] if args.key?(:request_time)\n end",
"def update!(**args)\n @finish_time = args[:finish_time] if args.key?(:finish_time)\n @original_request = args[:original_request] if args.key?(:original_request)\n @request_time = args[:request_time] if args.key?(:request_time)\n end",
"def update!(**args)\n @finish_time = args[:finish_time] if args.key?(:finish_time)\n @original_request = args[:original_request] if args.key?(:original_request)\n @request_time = args[:request_time] if args.key?(:request_time)\n end",
"def update!(**args)\n @finish_time = args[:finish_time] if args.key?(:finish_time)\n @original_request = args[:original_request] if args.key?(:original_request)\n @request_time = args[:request_time] if args.key?(:request_time)\n @tables = args[:tables] if args.key?(:tables)\n end",
"def update!(**args)\n @finish_time = args[:finish_time] if args.key?(:finish_time)\n @original_request = args[:original_request] if args.key?(:original_request)\n @request_time = args[:request_time] if args.key?(:request_time)\n @tables = args[:tables] if args.key?(:tables)\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update!(**args)\n @address = args[:address] if args.key?(:address)\n @partition = args[:partition] if args.key?(:partition)\n @snat_pool = args[:snat_pool] if args.key?(:snat_pool)\n end",
"def update!(**args)\n @address = args[:address] if args.key?(:address)\n @partition = args[:partition] if args.key?(:partition)\n @snat_pool = args[:snat_pool] if args.key?(:snat_pool)\n end",
"def update!(**args)\n @backoff_retry_count = args[:backoff_retry_count] if args.key?(:backoff_retry_count)\n @id = args[:id] if args.key?(:id)\n @latest_err = args[:latest_err] if args.key?(:latest_err)\n @latest_retry_time = args[:latest_retry_time] if args.key?(:latest_retry_time)\n @total_retry_count = args[:total_retry_count] if args.key?(:total_retry_count)\n end",
"def update(params={})\n self.request(__method__, params)\n end",
"def update!(**args)\n @counter = args[:counter] if args.key?(:counter)\n @host = args[:host] if args.key?(:host)\n @num = args[:num] if args.key?(:num)\n end",
"def update(params)\n self.class.new reinit_endpoint(params).do_put\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @ns = args[:ns] if args.key?(:ns)\n end",
"def update!(value, request_id=nil, current_retry=nil)\n request_id = SecureRandom.uuid unless request_id\n\n # Failure case, not able to successfully complete the operation, retry a.s.a.p.\n if current_retry && current_retry <= 0\n return request_id\n end\n\n # Get the current merged state of this counter\n vclock = self.refresh()\n\n if self.has_request_id?(request_id)\n # If the request_id already exists in the counter, return success\n return true\n else\n # If the request_id doesn't exist, attempt to add it and save\n if value < 0\n self.counter.decrement(request_id, value * -1)\n else\n self.counter.increment(request_id, value)\n end\n\n unless self.save(vclock)\n # If the save wasn't successful, retry\n current_retry = self.retry_count unless current_retry\n self.update!(value, request_id, current_retry - 1)\n else\n # If the save succeeded, no problem\n return true\n end\n end\n end",
"def update!(**args)\n @label_selector_path = args[:label_selector_path] if args.key?(:label_selector_path)\n @spec_replicas_path = args[:spec_replicas_path] if args.key?(:spec_replicas_path)\n @status_replicas_path = args[:status_replicas_path] if args.key?(:status_replicas_path)\n end",
"def update!(**args)\n @target = args[:target] if args.key?(:target)\n @request = args[:request] if args.key?(:request)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @count = args[:count] if args.key?(:count)\n @payload = args[:payload] if args.key?(:payload)\n @uuid = args[:uuid] if args.key?(:uuid)\n end",
"def update!(**args)\n @cluster_network_uri = args[:cluster_network_uri] if args.key?(:cluster_network_uri)\n @cluster_uri = args[:cluster_uri] if args.key?(:cluster_uri)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @reply = args[:reply] if args.key?(:reply)\n @user_input = args[:user_input] if args.key?(:user_input)\n end",
"def increment_replica_count\n self.original['spec']['replicas'] += 1\n end",
"def replicate(request)\n UNIXSocket.new(REPLICA_SOCKET_PATH).puts(request)\n end",
"def update!(**args)\n @fixed_node_count = args[:fixed_node_count] if args.key?(:fixed_node_count)\n @scaling = args[:scaling] if args.key?(:scaling)\n end",
"def update\n url = single_url\n payload = attributes_to_payload\n payload[:reset_data] = true\n to_server url, payload\n end",
"def update!(**args)\n @cluster_size = args[:cluster_size] if args.key?(:cluster_size)\n @work_id = args[:work_id] if args.key?(:work_id)\n end",
"def update!(**args)\n @requisition_id = args[:requisition_id] if args.key?(:requisition_id)\n end",
"def update!(**args)\n @requisition_id = args[:requisition_id] if args.key?(:requisition_id)\n end",
"def update!(**args)\n @process_id = args[:process_id] if args.key?(:process_id)\n @server_ip = args[:server_ip] if args.key?(:server_ip)\n @time_usec = args[:time_usec] if args.key?(:time_usec)\n end",
"def update!(**args)\n @autoscaling_spec = args[:autoscaling_spec] if args.key?(:autoscaling_spec)\n @disk_spec = args[:disk_spec] if args.key?(:disk_spec)\n @id = args[:id] if args.key?(:id)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @replica_count = args[:replica_count] if args.key?(:replica_count)\n @used_replica_count = args[:used_replica_count] if args.key?(:used_replica_count)\n end",
"def update!(**args)\n @metric_requests = args[:metric_requests] if args.key?(:metric_requests)\n @time_range = args[:time_range] if args.key?(:time_range)\n end",
"def update!(**args)\n @metric_requests = args[:metric_requests] if args.key?(:metric_requests)\n @time_range = args[:time_range] if args.key?(:time_range)\n end",
"def patch!\n request! :patch\n end",
"def update!(**args)\n @parameters = args[:parameters] if args.key?(:parameters)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end",
"def patch(request)\n request.method = :patch\n request.call\n end",
"def update\n\n end",
"def update\n authorize! :update, @db_repl_freq\n respond_to do |format|\n if @db_repl_freq.update(db_repl_freq_params)\n format.html { redirect_to @db_repl_freq, notice: 'Database replication frequency was successfully updated.' }\n format.json { render :show, status: :ok, location: @db_repl_freq }\n else\n format.html { render :edit }\n format.json { render json: @db_repl_freq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @info = args[:info] if args.key?(:info)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end",
"def update!(**args)\n @http_request = args[:http_request] if args.key?(:http_request)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @operation = args[:operation] if args.key?(:operation)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @severity = args[:severity] if args.key?(:severity)\n @source_location = args[:source_location] if args.key?(:source_location)\n @struct_payload = args[:struct_payload] if args.key?(:struct_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @trace = args[:trace] if args.key?(:trace)\n end"
] | [
"0.7440423",
"0.7303998",
"0.66813946",
"0.66813946",
"0.66813946",
"0.66813946",
"0.66558594",
"0.65778977",
"0.65778977",
"0.65778977",
"0.65778977",
"0.6329283",
"0.6260008",
"0.6260008",
"0.6166248",
"0.6166248",
"0.6092129",
"0.6085541",
"0.6068225",
"0.6068225",
"0.6033065",
"0.5998585",
"0.59890854",
"0.59890854",
"0.59890854",
"0.59890854",
"0.5971154",
"0.59533393",
"0.59429055",
"0.5906319",
"0.58903635",
"0.58903635",
"0.58527935",
"0.5810309",
"0.5809538",
"0.57741785",
"0.57722723",
"0.57722723",
"0.57641923",
"0.57637966",
"0.57502395",
"0.57476443",
"0.5735747",
"0.5735747",
"0.5735747",
"0.5735747",
"0.5716013",
"0.571302",
"0.56987095",
"0.56887484",
"0.567872",
"0.5675228",
"0.567031",
"0.56649184",
"0.5663484",
"0.56618106",
"0.5642175",
"0.5639816",
"0.5635349",
"0.56235844",
"0.56218714",
"0.56218714",
"0.56218714",
"0.56218714",
"0.56218714",
"0.56218714",
"0.56186",
"0.56186",
"0.5616871",
"0.56127197",
"0.56127197",
"0.5582043",
"0.55778515",
"0.55735946",
"0.5558079",
"0.5547975",
"0.5544743",
"0.55363977",
"0.5532422",
"0.5531724",
"0.5529043",
"0.5525607",
"0.552128",
"0.55171293",
"0.5510916",
"0.55066764",
"0.5506541",
"0.5503698",
"0.5503698",
"0.55031085",
"0.5490559",
"0.5490472",
"0.5490472",
"0.5488526",
"0.5480066",
"0.54758054",
"0.5473616",
"0.54671",
"0.5466335",
"0.54655766"
] | 0.825009 | 0 |
This method is being called on 'NameOwnerChanged', which helps us stop the app when Skype stops (a reconnect is needed after Skype restarts). | def name_owner_changed(msg)
raise "Skype has stopped running." if msg.params.first == "com.Skype.API" and msg.params[1].to_s.match(/^:\d\.\d+$/)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_disconnect\n # Let others know that the user left\n broadcast :_send_message, {event: :chat, from: '', at: Time.now, message: \"#{params[:name]} left the chatroom.\"}.to_json if params[:name]\n end",
"def disconnect!\n app.speakers.ID(@id).disconnect_from\n connected?\n end",
"def stop_typing\n PubSub::Publisher.new.publish_for(conversation.user_participants.online.where.not(id: sender.id), 'stop_typing', {source: {id: conversation_id}, user: {id: sender.id}}, {foreground: true})\n end",
"def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end",
"def on_disconnected\n end",
"def unbind()\n Babylon.logger.debug(\"DISCONNECTED\") # Very low level Logging\n EventMachine::stop_event_loop\n end",
"def stop\n if params[:name]\n streaming_user = User.where('stream_key = ?', params[:name]).first\n if streaming_user\n async_confirm_and_set_stream_state(streaming_user)\n render status: :ok\n else\n render status: :not_found\n end\n else\n render status: :not_found\n end\n end",
"def unbind\n puts \"connection #{@connection.id.to_s} unbound\"\n begin\n unless !@registered\n self.unregister(@user.uuid)\n $ws_notifier.call(\"#{@user.uuid} just left the server\",\"disconnection\")\n else\n puts \"Never registered. So don't try to kill connection data\"\n end\n rescue\n puts \"Error (unbind). Couldn't delete from hash\"\n end\n puts \"Person is no longer connected\"\n end",
"def remove!\n package('skype') { action :remove }\n end",
"def stop_xmpp_for_app(app)\n Djinn.log_info(\"Shutting down xmpp receiver for app: #{app}\")\n MonitInterface.remove(\"xmpp-#{app}\")\n Djinn.log_info(\"Done shutting down xmpp receiver for app: #{app}\")\n end",
"def unbind\n $dsock_list.delete self\n\n log :info, \"-- #{@player}:#{@addr}:#{@port} disconnected from CoralMUD!\"\n\n if @player\n @player.socket = nil if @player.socket == self\n\n if @player.in_room\n @player.in_room.display([:visual, \"other.can_see?(actor)\"], @player, [@player], \"<%=other.peek(actor)%> has lost their link.\")\n end\n end\n\n end",
"def stop_on_unknown\n @stop_on_unknown = true\n end",
"def turn_off_speaker\n puts \"SPEAKER OFF\"\n # The daemons gem will handle the stopping of the \n # # audio file playing process\n #if File.exist?( ALARM_FILE )\n if Applications.alarm_on?\n `#{SOUND_CONTROL_FILE} stop`\n # Delete file to show that the alarm is on\n #File.delete( ALARM_FILE )\n Applications.alarm_off\n end\n end",
"def stop; self.app.stop end",
"def load_application_object_failed(err)\n if @mode == :update\n unsubscribe\n end\n super\n end",
"def on_twitter_engine_unregister_user(e, who)\n pre = '<Twitter::Engine>'\n @log.info(\"#{pre} Unregistering user: #{who} (xmpp).\")\n end",
"def delete_listen(l)\n\t\treturn unless listen?\n\t\t\n\t\tbegin\n\t\t\tcase provider\n\t\t\twhen \"facebook\"\n\t\t\t\tdelete_listen_on_facebook(l)\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tlogger.debug \"error deleting listen from service: #{provider}\"\n\t\t\tlogger.debug e.inspect\n\t\tend\n\tend",
"def remove_self\n self.alive = false\n fire :remove_me\n @input_manager.unsubscribe_all self\n end",
"def unbind\n @player.logout if @player\n @player = nil\n @connector = nil\n end",
"def unbind\n @player.logout if @player\n @player = nil\n @connector = nil\n end",
"def client_disconnected\n puts \"client #{current_user.email} disconnected\"\n current_player = current_user.player\n broadcast_message :player_exit, {\n id: current_player.id\n }\n current_player.is_online = false\n current_player.save\n end",
"def stop_typing(_user)\n PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'stop_typing', {source: {id: id}, user: {id: _user.id}}, {foreground: true})\n end",
"def end_listen(l)\n\t\treturn unless listen?\n\t\t\n\t\tbegin\n\t\t\tcase provider\n\t\t\twhen \"lastfm\"\n\t\t\t\tend_listen_on_lastfm(l)\n\t\t\twhen \"facebook\"\n\t\t\t\tend_listen_on_facebook(l)\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tlogger.debug \"error ending listen on service: #{provider}\"\n\t\t\tcatch_error(l, e)\n\t\tend\n\tend",
"def irc_part_event(stem, sender, arguments) # :nodoc:\n @chan_mutex.synchronize do\n if sender[:nick] == @nick then\n drop_channel arguments[:channel]\n else\n @channel_members[arguments[:channel]].delete sender[:nick]\n end\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end",
"def change_name(user_instance)\n puts `clear`\n\n `afplay sounds/beeping.mp3.mp3`\n\n\n changename_banner\n name = $prompt.ask(\"Please enter new password\")\n # puts \"Please enter new username\"\n # name = gets.chomp.to_s\n user_instance.name = name\n puts \"Your new username is #{name}\"\n spinner = TTY::Spinner.new(\"Returning home :spinner :spinner :spinner \", format: :spin_2)\n spinner.auto_spin\n sleep(2)\n spinner.stop('Done!')\n homepage(user_instance)\nend",
"def on_MainWindow_destroy\n @wfsock.close\n Gtk.main_quit\n end",
"def irc_kick_event(stem, sender, arguments) # :nodoc:\n if arguments[:recipient] == @nick then\n old_pass = @channel_passwords[arguments[:channel]]\n @chan_mutex.synchronize do\n drop_channel arguments[:channel]\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n join_channel arguments[:channel], old_pass if options[:rejoin]\n else\n @chan_mutex.synchronize do\n @channel_members[arguments[:channel]].delete arguments[:recipient]\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end\n end",
"def linger caller_window=nil\n begin\n if caller_window\n ch = @win.getchar\n caller_window.ungetch(ch) # will this be available to underlying window XXX i think not !!\n else\n sleep 1\n end\n ensure\n destroy\n end\n end",
"def unfriend(actor)\n unfollow(actor)\n actor.unfollow(self) if ActsAsActivityStream.sns_type == :custom\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/Skype')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def start_cast_desktop_mirroring(name); end",
"def release_nickname!\n self.nickname = \"shelby_#{self.nickname}\"\n self.save\n end",
"def skypeout_friends\n Skype.find_users_of_type \"SKYPEOUT_FRIENDS\"\n end",
"def irc_quit_event(stem, sender, arguments) # :nodoc:\n @chan_mutex.synchronize do\n @channel_members.each { |chan, members| members.delete sender[:nick] }\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end",
"def skype_status_offline\n ret = @skype_obj.Invoke(\"SET USERSTATUS OFFLINE\").first\n raise \"Couldnt go offline: '#{ret}'.\" if ret != \"USERSTATUS OFFLINE\"\n nil\n end",
"def on_nick_already_in_use(connection, nick_name)\n end",
"def spoof()\n\t\tlisten()\n\n\t\tlisten()\n\tend",
"def unsubscribed\n super\n # TODO: abort any pending lookup requests\n end",
"def ignore_disconnect; end",
"def cancel_self\n\t\tparty_list.each_key { |user_id| User.find(user_id).delete_event(self.id) }\n\tend",
"def unsubscribed # :doc:\n # Override in subclasses\n end",
"def stop\n Prompt.restore\n Hook.unregister\n end",
"def unsubscribed\n @room.remove_user(current_user)\n\n # Inform the other players that this player has left.\n broadcast_users_changed\n end",
"def stop_polling!; end",
"def unbind\n EM.cancel_timer @timer\n\n @registered = false\n\n return if @disconnecting or @reconnecting\n\n reconnect true\n end",
"def remove_callback(callback_name)\n connection.remove_callback(callback_name)\n end",
"def unsubscribed; end",
"def unbind() end",
"def classroom_app_force_unprompted_screen_observation\n return @classroom_app_force_unprompted_screen_observation\n end",
"def stop_listening\n @continue_listening = false\n end",
"def disconnect!; end",
"def someone_did_quit(stem, person, msg)\n end",
"def disconnect\n if @current_user.fitbit_user\n @current_user.fitbit_user.unsubscribe_from_notifications rescue nil\n #@current_user.fitbit_user.destroy (MySQL error when deleting from view... have to do it manually)\n ActiveRecord::Base.connection.execute \"delete from fbskeleton.fitbit_users where id = #{@current_user.fitbit_user.id}\"\n end\n\n # set it to nil if it is FITBIT\n @current_user.update_column(:active_device,nil) if @current_user.active_device == 'FITBIT'\n \n head :ok \n end",
"def withSpeakerName(speech)\n return speech.speaker_name.to_s.length != 0\n end",
"def disconnect!\n super\n ensure\n if (restart = @restart)\n @restart = nil\n restart.signal\n end\n end",
"def unbind\n @connected = false\n @network.disconnected!\n\n super\n end",
"def cmd_notify_stop\n\t\t\t\tprint_status(\"Stopping the monitoring of sessions to Slack\")\n\t\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tend",
"def disconnect; end",
"def disconnect; end",
"def on_quitting\n end",
"def unbind; end",
"def on_hangup_signal( signo )\n\t\tself.log.warn \"Hangup (%p)\" % [ signo ]\n\t\tself.restart\n\tend",
"def disconnect!\n end",
"def intent_listen_stop\n\tbegin\n\t\tdata = { 'myData' => 'This is broadcast data 5!' }\n\t\tif @params['par']\n\t\t\tcase @params['par']\n\t\t\twhen '411'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.rhomobile.BROADCAST\",[\"com.rhomobile.compliancetestruby\"],\"\",\"\",\"\",\"\",data)\n\t\t\twhen '412'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"compliancetestruby\",\"\",\"\",\"\",data)\t\t\t\t\t\n\t\t\twhen '413'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"rhomobile compliancetest_ruby/compliancetestruby.exe\",\"\",\"\",\"\",data)\n\t\t\telse\n\t\t\tend\n\t\tend\n\t\tRho::Intent.startListening(url_for(:action => :listen_callback))\n\t\tRho::Intent.stopListening()\n Rho::Intent.send(@result)\n\trescue => ex\n\t\tjsmethod = 'Ruby.sendValueToJS(\"' + ex.message + '\")'\n\t\tRho::WebView.executeJavascript(jsmethod)\n\tend\nend",
"def initialize(application_name)\n @application_name = application_name\n\n # Get the message id's for the Skype Control messages\n @api_discover_message_id =\n Win32::RegisterWindowMessage('SkypeControlAPIDiscover')\n @api_attach_message_id =\n Win32::RegisterWindowMessage('SkypeControlAPIAttach')\n\n instance = Win32::GetModuleHandle(nil)\n\n @window_class = Win32::WNDCLASSEX.new\n @window_class[:style] = Win32::CS_HREDRAW | Win32::CS_VREDRAW\n @window_class[:lpfnWndProc] = method(:message_pump)\n @window_class[:hInstance] = instance\n @window_class[:hbrBackground] = Win32::COLOR_WINDOW\n @window_class[:lpszClassName] =\n FFI::MemoryPointer.from_string 'ruby-skype'\n\n @window = Win32::CreateWindowEx(Win32::WS_EX_LEFT,\n FFI::Pointer.new(@window_class.handle),\n 'ruby-skype',\n Win32::WS_OVERLAPPEDWINDOW,\n 0, 0, 0, 0, Win32::NULL, Win32::NULL,\n instance, nil)\n end",
"def onPause\n super\n end",
"def tick\n while Win32::PeekMessage(@msg, Win32::NULL, 0, 0, Win32::PM_REMOVE) > 0\n Win32::TranslateMessage(@msg)\n Win32::DispatchMessage(@msg)\n end\n\n # Don't simplify this as we rely on false != nil for tribool values\n #noinspection RubySimplifyBooleanInspection\n if @authorized == false\n Skype::Errors::ExceptionFactory.generate_exception(\"ERROR 68\")\n end\n end",
"def devoice(nick)\n change_permissions(:devoice, nick)\n end",
"def stop\n @listen_thread.kill if listening?\n end",
"def stop(called_by = nil)\n if called_by\n logger.debug(\"Stopping appsignal (#{called_by})\")\n else\n logger.debug(\"Stopping appsignal\")\n end\n Appsignal::Extension.stop\n end",
"def stop(called_by = nil)\n if called_by\n logger.debug(\"Stopping appsignal (#{called_by})\")\n else\n logger.debug(\"Stopping appsignal\")\n end\n Appsignal::Extension.stop\n end",
"def stop\n\n super\n\n stop_observing\n end",
"def omni\n @channel = nil\n true\n end",
"def cleanup\n super\n disconnect\n end",
"def name_unless_default\n name == Rack::OAuth.default_instance_name ? nil : name\n end",
"def allow_name_change?\n true\n end",
"def unbind\n self.close\n @master.unbind(@name)\n end",
"def disconnect\n # Implement in subclass\n end",
"def on_shutdown\n logger.debug \"Disconnecting user: #{@user} from channel: #{@channel}.\"\n @@connections[@channel].delete(@user)\n end",
"def kill(nickname, comment = \"Connection killed\")\n send_data(\"KILL #{nickname} :#{comment}\".strip)\n end",
"def disconnect!; true; end",
"def join_on_connect(bot)\n @config[:channels].each{|chan|\n join_channel( bot, chan )\n }\n \n # If we are not required to do anything else, unhook\n if @config[:connect_only] then\n unregister_all(0.5) # Give my hooks half a second to disconnect\n # or unregister_hooks(0.5, :chanman_connect)\n end\n end",
"def remote_name(sender, body)\n params = body.split\n return nil unless params.length == 2 and params.first =~ /[0-9a-f]+:[0-9a-f]+/\n local_rekey('')\n key_hash = MD5::digest(params.first)[0,8]\n fingerprint = _fingerprint(key_hash)\n if key_hash == @connection.comm.our_keyhash\n if @var[:logged_in]\n _notice \"Your account has connected from another location.\", 'chat'\n @var[:logged_in] += 1\n local_grant(_user_name(key_hash))\n else\n _notice \"Connected to #{@var[:last_connection].join(':')}.\", :global\n @var[:logged_in] = 1\n end\n else\n # Try to log in the user by their key first\n name = _user_name(key_hash)\n if name != 'unknown_user'\n unless @var[:presence][key_hash]\n @var[:presence][key_hash] = [ 'online', '' ]\n if @var[:revoked].include?(name)\n _notice \"Revoked user #{name} has connected.\", 'chat'\n else\n _notice \"Trusted user #{name} has connected.\", 'chat'\n local_grant(name)\n end\n end\n return nil\n end\n\n # Detect someone signing on with a new key and an old name (spoofing)\n if @connection.comm.rsa_keys[params.last] and\n @connection.comm.rsa_keys[params.last] != params.first\n\n # User spoofing has been detected. Give the user a temporary name.\n tmp_name = \"fake_#{params.last}\"\n tmp_name += (\"_%02x\" % rand(256)) if @connection.comm.rsa_keys[tmp_name]\n add_error(\"User spoofing detected! #{params.last} tried to sign on \" +\n \"with an invalid key (#{fingerprint}). Renaming to #{tmp_name}\")\n params << tmp_name\n end\n\n # Whether spoofing has been detected or not, let's give the person a\n # name and a key entry.\n name = params.last\n @connection.comm.rsa_keys[name] = params.first\n @connection.comm.names[key_hash] = name\n if params.length == 2\n _notice \"Someone claiming to be #{name} has connected (#{fingerprint})\",\n 'chat'\n end\n\n # Should we auto-grant them?\n unless @var[:revoked].include?(name)\n local_grant(name) if @var[:auto_grant]\n end\n end\nend",
"def disableConversation _obj, _args\n \"_obj disableConversation _args;\" \n end",
"def dispose\n $game_system.name_timer = @timer\n super\n end",
"def unbind\n puts \"client a connection has terminated\"\n EventMachine::stop_event_loop() \n end",
"def on_open\n\n # Must pass a nickname\n if params[:name].nil?\n response << {event: :error, from: :system, at: Time.now, message: \"Error: cannot connect without a nickname!\"}.to_json\n response.close\n return false\n end\n\n # Can't use admin nicknames\n message = {from: '', at: Time.now}\n name = params[:name]\n if (name.downcase.match(/admin|admn|system|sys|administrator/i))\n message[:event] = :error\n message[:message] = \"The nickname '#{name}' is already taken.\"\n response << message.to_json\n params[:name] = false\n response.close\n return\n end\n\n # Welcome user to chat\n message = {from: '', at: Time.now}\n message[:event] = :chat\n response << message.to_json\n message[:message] = \"#{params[:name]} joined the chatroom.\"\n broadcast :_send_message, message.to_json\n # Explain who is here or if your the first one here\n #message[:message] = list.empty? ? \"You're the first one here.\" : \"#{list[0..-2].join(', ')} #{list[1] ? 'and' : ''} #{list.last} #{list[1] ? 'are' : 'is'} already in the chatroom\"\n end",
"def someone_did_lose_usermode(stem, nick, mode, argument, bestower)\n end",
"def unsubscribed\n # This will broadcast that user unsubscribed but the frontend will not receive the final broadcast\n p '**** ChatChannel unsubscribed'\n notification = {notification: 'User X has dropped off'}\n # ActionCable.server.broadcast(params[:room], notification)\n send_broadcast(params[:room], notification)\n end",
"def unbind()\n @connected = false\n Skates.logger.debug {\n \"DISCONNECTED\"\n } # Very low level Logging\n begin\n @handler.on_disconnected() if @handler and @handler.respond_to?(\"on_disconnected\")\n rescue\n Skates.logger.error {\n \"on_disconnected failed : #{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n end",
"def off(callback_name)\n raise(ArgumentError, \"Argument 'callback_name' must be a String.\") unless callback_name.is_a?(String)\n @procs_callback.delete(callback_name)\n return self\nend",
"def voice_dialing_blocked\n return @voice_dialing_blocked\n end",
"def voice_dialing_blocked\n return @voice_dialing_blocked\n end",
"def reset_voice\n @voice = \"Boing\"\n end",
"def disconnect\n platform.disconnect\n end",
"def disown client_handler\n name = client_handler.name\n \n # No need to disown if they're not present.\n # ⎛I realize this is not strictly threadsafe. ⎞\n # ⎝At this point, I also don't particularly care.⎠\n connectedHandler = @circle.get name\n return unless client_handler.equal? connectedHandler\n \n @circle.remove name\n \n \n # Broadcast their departure:\n # (Name may be THE EMPTY STRING if the user never successfully logged in.)\n if name.length > 0\n self.send_public(\n TiscapTransmission.new(:']disconnected', name, nil),\n nil)\n end\n end",
"def disconnect\n super\n end",
"def disconnect\n super\n end",
"def disconnect\n super\n end",
"def unsubscribed\n stop_all_streams\n end"
] | [
"0.5930037",
"0.5813527",
"0.52246225",
"0.51997715",
"0.5192085",
"0.51686966",
"0.5165151",
"0.51442504",
"0.51423913",
"0.5141903",
"0.51403093",
"0.5075189",
"0.4965968",
"0.49373475",
"0.49194047",
"0.49001288",
"0.4898153",
"0.48843244",
"0.48813084",
"0.48813084",
"0.48631957",
"0.48591062",
"0.4848131",
"0.48406416",
"0.48311716",
"0.4805929",
"0.47965518",
"0.4793961",
"0.47898608",
"0.47857466",
"0.47856238",
"0.476536",
"0.4754285",
"0.47436893",
"0.47409537",
"0.47409406",
"0.47181925",
"0.47160536",
"0.4712289",
"0.47122192",
"0.47120914",
"0.47093976",
"0.47023752",
"0.46908247",
"0.46822232",
"0.4681442",
"0.4678346",
"0.4678088",
"0.46760815",
"0.46719268",
"0.46716318",
"0.4646597",
"0.46447793",
"0.46447405",
"0.4641306",
"0.4636824",
"0.4633654",
"0.46255395",
"0.46255395",
"0.4625305",
"0.46146396",
"0.46135923",
"0.46111134",
"0.461062",
"0.46011513",
"0.45964965",
"0.4596155",
"0.459578",
"0.4595629",
"0.45954284",
"0.45954284",
"0.45904276",
"0.45824757",
"0.45795706",
"0.45740047",
"0.45660257",
"0.4565085",
"0.4559125",
"0.45469335",
"0.45444208",
"0.45435542",
"0.45422992",
"0.45396122",
"0.4535315",
"0.45351937",
"0.4531577",
"0.45234886",
"0.4520107",
"0.45149007",
"0.45092303",
"0.45043623",
"0.44932386",
"0.44932386",
"0.44902575",
"0.44902018",
"0.44892362",
"0.44873247",
"0.44873247",
"0.44873247",
"0.44849205"
] | 0.72943395 | 0 |
This method is called, when the GnomeScreensaver locks or unlocks. | def gnome_screensaver_status(msg)
val = msg.params.first
if val == true
puts "Detected screenlock by Gnome Screensaver - logging out of Skype."
self.skype_status_offline
else
puts "Detected screenlock unlock by Gnome Screensaver - going online on Skype."
self.skype_status_online
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onScreenLocked\n Util.log.debug 'Screen locked'\n Info.locked = true\n Info.start_time = NSDate.date unless Info.start_time\n Util.send_pushover('Locked')\n end",
"def onScreenUnlocked\n Util.log.debug 'Screen unlocked'\n Info.locked = false\n self.displayDiff\n end",
"def lock_screen\n print_status(\"Locking the desktop...\")\n lock_info = session.railgun.user32.LockWorkStation()\n if lock_info[\"GetLastError\"] == 0\n print_status(\"Screen has been locked\")\n else\n print_error(\"Screen lock failed\")\n end\n end",
"def lock_screen\n\tprint_status(\"Locking Screen...\")\n\tclient.core.use(\"railgun\")\n\tlock_info = client.railgun.user32.LockWorkStation()\n\tif lock_info[\"GetLastError\"] == 0\n\t\tprint_status(\"Screen has been locked\")\n\telse\n\t\tprint_error(\"Screen lock Failed\")\n\tend\nend",
"def unlock\n end",
"def handle_fell_off_screen\n end",
"def onsig(sig)\n close_screen\n @exit = true\n end",
"def update_screen\n @screen.update()\n end",
"def handle_offscreen_right() end",
"def handle_offscreen_right() end",
"def unlock; end",
"def sync_real\n sw = Knj::Gtk2::StatusWindow.new\n self.timelog_stop_tracking if @timelog_active\n \n Knj::Thread.new do\n begin\n sw.label = _(\"Pushing time-updates.\")\n self.push_time_updates\n sw.percent = 0.3\n \n sw.label = _(\"Update task-cache.\")\n self.update_task_cache\n sw.percent = 0.66\n \n sw.label = _(\"Updating worktime-cache.\")\n self.update_worktime_cache\n sw.percent = 1\n \n sw.label = _(\"Done\")\n \n sleep 1\n rescue => e\n Knj::Gtk2.msgbox(\"msg\" => Knj::Errors.error_str(e), \"type\" => \"warning\", \"title\" => _(\"Error\"), \"run\" => false)\n ensure\n sw.destroy if sw\n end\n end\n end",
"def context_update_displays!()\n $gimp_iface.gimp_displays_flush()\nend",
"def mohamed() \r\n xt_login()\r\n xt_goToMonitor()\r\n xt_monitors_dragMonitorToGroup()\r\n\r\n\r\n\r\n #xt_logout()\r\n #xt_TearDown()\r\nend",
"def after_win\n\n end",
"def monitor; end",
"def resend_unlock_instructions; end",
"def pause_and_clear_screen\n pause\n clear_screen\n end",
"def window_changed(state)\n $marathon.sleepForSlowPlay\n $marathon.windowChanged(state)\nend",
"def unlock\n locksmith.unlock # Only signal to release the lock\n end",
"def call(guard_class, event, *args)\n status = if event == :start_begin\n 'idle'\n else\n 'running'\n end\n self.class.set_rbg status\n end",
"def suspend_proc_gevents(str=\"\")\r\n @suspend_queue_proc = true\r\n @num_of_suspend += 1\r\n @log.debug(\"suspend_proc_gevents (#{str}) add lock #{@num_of_suspend}\")\r\n end",
"def curses_menu_finalize\n @screenshot = capture_screenshot\n super\n end",
"def update\n @space.step(TICK)\n @boxes.each { |box| box.check_off_screen }\n end",
"def lock\n @unlocked = false\n \"Diary is now locked\"\n end",
"def lock\n end",
"def send_unlock_instructions; end",
"def process_events\n while Gtk.events_pending?\n Gtk.main_iteration\n end\nend",
"def locked\n end",
"def message_soft_lock_prevent\n if $game_temp.message_window_showing\n log_error('Message were still showing!')\n $game_temp.message_window_showing = false\n end\n end",
"def draw(screen)\n @clock.tick\n # Do we need to redraw the screen?\n do_redraw = Plugin.loader.background.changed?\n screen.drawlist.each { |widget| \n if widget.changed?\n do_redraw = true\n break\n end\n } if not do_redraw\n # Ok, redraw it\n if do_redraw\n glClear(GL_COLOR_BUFFER_BIT)\n screen.drawlist.each { |widget| \n widget.draw\n }\n self.redraw\n end\n end",
"def clear_screen\n sleep(3)\n system \"clear\"\nend",
"def suspend\n end",
"def lock_list\n super\n end",
"def unlock_access!; end",
"def boot_interrupted?()\n Evdev.keys_held(KEYS)\n end",
"def unlock\n #@locked = false\n `caffeinate -u -t 2`\n `osascript -e 'delay 1' -e 'tell application \"System Events\"' -e 'keystroke return' -e 'keystroke \"#{ENV[\"MYPASS\"]}\"' -e 'delay 1' -e 'keystroke return' -e 'end tell'`\nend",
"def main_end\r\n # Refresh map\r\n $game_map.refresh\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n # If switching from battle test to any screen other than game over screen\r\n if $BTEST and not $scene.is_a?(Scene_Gameover)\r\n $scene = nil\r\n end\r\n end",
"def lock_windows(menu_item)\n Configuration.windows_locked ? menu_item.title = :lock_windows._ : menu_item.title = :unlock_windows._\n\n Configuration.windows_locked = !Configuration.windows_locked\n end",
"def onPause\n super\n end",
"def draw(screen)\n @clock.tick\n # Do we need to redraw the screen?\n do_redraw = Plugin.loader.background.changed?\n screen.drawlist.each { |widget| \n if widget.changed?\n do_redraw = true\n break\n end\n } if not do_redraw\n # Ok, redraw it\n if do_redraw\n screen.drawlist.each { |widget| widget.draw }\n @screen.flip\n end\n end",
"def ss_stop\n\tpid = `pidof xscreensaver`.chomp.to_i rescue 0\n\treturn if pid == 0\n\n\t@ss = `ps -e j | awk '{ print $7\" \"$2 }' | grep ^#{pid}`.chomp rescue false\n\t@ss = false if @ss[0,1] == 'T' rescue false\n\treturn unless @ss\n\n\t`xset dpms force on`\n\t`xscreensaver-command -deactivate`\n\t`killall -STOP #{pid}`\nend",
"def classroom_app_force_unprompted_screen_observation\n return @classroom_app_force_unprompted_screen_observation\n end",
"def create_wait_for_play_screen\r\n @log.error \"create_wait_for_play_screen: not implemented\\n\"\r\n end",
"def locked; end",
"def update\n\t\tif self.button_down?(Gosu::KbLeft)\n \t\tclose\n \tend\n end",
"def lock_expired?; end",
"def main_end\r\n super\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end",
"def update\n super\n update_bitmap # Update HP Graphic\n update_screen # Update the position the graphic should be displayed\n end",
"def suspend_proc_gevents(str=\"\")\n @log.debug(\"Suspend handling events #{str}\")\n @net_controller.suspend_srv_msg_handler\n @num_of_suspend += 1\n @log.debug(\"suspend_proc_gevents add lock #{@num_of_suspend}\")\n end",
"def unlock\n self.is_locked = false\n self\n end",
"def update_screen(output)\n if output != $last_update\n clear_screen\n puts(output)\n end\nend",
"def update\n super\n # Process mouse operations if mouse is on screen and custom method implemented\n #if $mouse.on_screen? and @active_mod_on\n # if mouse_on_window?\n # Mouse.window_add(self)\n # end\n #end\n end",
"def lock_screen_block_passbook\n return @lock_screen_block_passbook\n end",
"def lock_status?\n return @unlocked == true\n end",
"def _suspend\n\t\t# Ask the user if they would like to background the session\n\t\tif (prompt_yesno(\"Background session #{name}?\") == true)\n\t\t\tself.interacting = false\n\t\tend\n\tend",
"def lock\n @privkey = nil\n @locked = true\n end",
"def window_update()\n if $game_party != nil\n @ucLocation.cValue.text = $game_map.name\n \n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n \n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n @ucGold.cLabel.text = $game_party.gold\n end\n refresh()\n end",
"def window_update()\n if $game_party != nil\n @ucLocation.cValue.text = $game_map.name\n \n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n \n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n @ucGold.cLabel.text = $game_party.gold\n end\n refresh()\n end",
"def window_update(save_data)\n if save_data != nil\n @save_data = save_data\n if save_data.used\n # DRAW SCREENSHOT\n if Wora_NSS::SCREENSHOT_IMAGE \n if [email protected]_bitmap.nil?\n @ucScreenshot.cImage.img_bitmap.dispose\n end\n @ucScreenshot.cImage.img_bitmap = Bitmap.read_png(save_data.screenshot_stream)\n @ucScreenshot.cImage.src_rect = Rect.new((@ucScreenshot.cImage.img_bitmap.width-@ucScreenshot.cImage.rect.width)/2,\n (@ucScreenshot.cImage.img_bitmap.height-@ucScreenshot.cImage.rect.height)/2,\n @ucScreenshot.cImage.rect.width, @ucScreenshot.cImage.rect.height)\n end\n #else \n # if SWAP_TILE and $game_switches[SWAP_TILE_SWITCH]\n # create_swaptilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,\n # save_data['gamemap'].display_y)\n # else\n # create_tilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,\n # save_data['gamemap'].display_y)\n # end\n #end\n \n # DRAW GOLD\n if Wora_NSS::DRAW_GOLD\n @ucGold.cLabel.text = save_data.game_par.gold\n end\n \n # DRAW PLAYTIME\n if Wora_NSS::DRAW_PLAYTIME\n @total_sec = save_data.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n end\n \n # DRAW LOCATION\n if Wora_NSS::DRAW_LOCATION\n @ucLocation.cValue.text = save_data.game_map.name\n end\n \n # DRAW FACE & Level & Name\n @ucCharFacesList.clear()\n save_data.game_par.members.each_index do |i|\n actor = save_data.game_act[save_data.game_par.members[i].id]\n x_base = (i*100) + (i*16)\n @ucCharFacesList.push(UCSaveCharStatus.new(self, actor, Rect.new(x_base, 208, 100, 182)))\n end\n end\n end\n refresh()\n end",
"def window_update(save_data)\n if save_data != nil\n @save_data = save_data\n if save_data.used\n # DRAW SCREENSHOT\n if Wora_NSS::SCREENSHOT_IMAGE \n if [email protected]_bitmap.nil?\n @ucScreenshot.cImage.img_bitmap.dispose\n end\n @ucScreenshot.cImage.img_bitmap = Bitmap.read_png(save_data.screenshot_stream)\n @ucScreenshot.cImage.src_rect = Rect.new((@ucScreenshot.cImage.img_bitmap.width-@ucScreenshot.cImage.rect.width)/2,\n (@ucScreenshot.cImage.img_bitmap.height-@ucScreenshot.cImage.rect.height)/2,\n @ucScreenshot.cImage.rect.width, @ucScreenshot.cImage.rect.height)\n end\n #else \n # if SWAP_TILE and $game_switches[SWAP_TILE_SWITCH]\n # create_swaptilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,\n # save_data['gamemap'].display_y)\n # else\n # create_tilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,\n # save_data['gamemap'].display_y)\n # end\n #end\n \n # DRAW GOLD\n if Wora_NSS::DRAW_GOLD\n @ucGold.cLabel.text = save_data.game_par.gold\n end\n \n # DRAW PLAYTIME\n if Wora_NSS::DRAW_PLAYTIME\n @total_sec = save_data.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n @ucTime.cLabel.text = sprintf(MENU_CONFIG::TIME_PATTERN, hour, min, sec)\n end\n \n # DRAW LOCATION\n if Wora_NSS::DRAW_LOCATION\n @ucLocation.cValue.text = save_data.game_map.name\n end\n \n # DRAW FACE & Level & Name\n @ucCharFacesList.clear()\n save_data.game_par.members.each_index do |i|\n actor = save_data.game_act[save_data.game_par.members[i].id]\n x_base = (i*100) + (i*16)\n @ucCharFacesList.push(UCSaveCharStatus.new(self, actor, Rect.new(x_base, 208, 100, 182)))\n end\n end\n end\n refresh()\n end",
"def on_leave\n @_entered = false\n super\n end",
"def clear_events() \n while (Gtk.events_pending?)\n Gtk.main_iteration\n end\nend",
"def reset_screen\n clear_screen\n move_to_home\nend",
"def reset_screen\n clear_screen\n move_to_home\nend",
"def update\n super\n # update_bitmap # Not needed for now\n update_screen # Update the position the graphic should be displayed\n # update_frame # Update the frame count (if wanted later)\n end",
"def update\n case @game_settings.current_screen\n when \"start\"\n start_screen_inputs\n when \"levels\"\n levels_screen_inputs\n when \"game\"\n if @deck.deck_count == 0 || valid_table(@playing_cards).length == 0\n @game_settings.current_screen = \"gameover\"\n end\n\n if @game_settings.is_cpu_player_enabled\n @mes = computer_move @p1 if @computer_signal.update?\n @true_mes = (@mes == 1) && @computer_signal.display_message?\n @false_mes = (@mes == 0) && @computer_signal.display_message?\n @trying_mes = (@mes == 2) && @computer_signal.display_message?\n end\n\n if @game_settings.p1_init\n game_screen_inputs @p1\n @p2.clean_slate if @game_settings.p2_init && @p1.set_found\n @p1.set_found = false #reset\n end\n\n if @game_settings.p2_init\n game_screen_inputs @p2\n @p1.clean_slate if @game_settings.p1_init && @p2.set_found\n @p2.set_found = false\n end\n\n when \"gameover\"\n game_over_screen_inputs\n end\n end",
"def update\n super\n update_menu_background\n @command_window.update\n @gold_window.update\n @status_window.update\n if @submenu_window\n @submenu_window.update\n @submenu_window.dispose if @submenu_window.openness == 0\n @submenu_window = nil if @submenu_window.disposed?\n end\n if @command_window.active\n update_command_selection\n elsif @status_window.active\n update_actor_selection\n elsif @submenu_window.active\n update_submenu_selection\n end\n end",
"def init_screen screen\n\n screen.set_editable false\n screen.set_xalign 1\n screen.set_can_focus false\n\n end",
"def setDefaultScreen(screen)\n if screen.respond_to?(:click)\n $DEFAULT_SCREEN = screen\n Debug.log(\"Screen switched\")\n end\n end",
"def setDefaultScreen(screen)\n if screen.respond_to?(:click)\n $DEFAULT_SCREEN = screen\n Debug.log(\"Screen switched\")\n end\n end",
"def suspend()\n #This is a stub, used for indexing\n end",
"def start\n\t\treturn self.unlock()\n\tend",
"def lock!\n @locked = true\n end",
"def endscreen\n @user = nil\n login\nend",
"def idle?; end",
"def lock!; end",
"def clean_screen\n sleep 1\n system 'clear'\n end",
"def update_screen\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end",
"def update_screen\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end",
"def hold_screen(player_num)\n print \"----------------\\n\"\n print \"PLAYER #{player_num}'s TURN. Press any key to continue...\\n\"\n print \"----------------\\n\"\n pause\n end",
"def lock\n shaz_nolock_lock if !@nolock\n end",
"def broadcast\n @monitor.instance_eval {mon_check_owner()}\n Thread.critical = true\n for t in @waiters\n\tt.wakeup\n end\n @waiters.clear\n Thread.critical = false\n Thread.pass\n end",
"def start\n display = Swt::Widgets::Display.get_current\n while [email protected]\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end",
"def endLoadingScreen \n \"endLoadingScreen\" \n end",
"def awake\n\t\tend",
"def event_sighup()\n _load_registrations\n load_command_methods\n dispatch :log, \"SIG-HUP, controls.rb reloaded\"\nend",
"def wake_event_loop!\n super\n end",
"def wake_event_loop!\n super\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end",
"def lock\n if locked?\n message = \"It seems another backup is still running, or previous backup did not complete. If you are sure that there are no backups currently running then try deleting the lockfile at `#{@lock_file}'.\"\n\n alert message\n send_alerts\n exit 1\n end\n FileUtils.touch @lock_file\nend",
"def unlock\n @locking = false\n end",
"def window_update(enemy, scan_mode)\n if enemy != nil\n @scan_mode = scan_mode\n @ucEnemyGraphic.enemy = enemy\n end\n refresh()\n end",
"def process_events\n while (Gtk.events_pending?)\n Gtk.main_iteration\n end\n end",
"def idle\n gateway_check\n update_status((Time.now.to_f * 1000), @game, nil)\n end",
"def initialize(param = {})\n super(param) ;\n\n @drawMutex = Mutex::new() ;\n @drawMutex.synchronize(){\n setupWindow(param) ;\n @exitWhenQuit = true ;\n }\n\n end",
"def on_invalidate(&block); end",
"def initialize_screen\n try_set_screen\n\t Klass.initialize(@handle)\n\t true\n end",
"def smart_screen_enable_in_shell\n return @smart_screen_enable_in_shell\n end"
] | [
"0.7572191",
"0.7189657",
"0.670182",
"0.6492404",
"0.58944213",
"0.55779976",
"0.5543611",
"0.5527484",
"0.5501582",
"0.5501582",
"0.5486032",
"0.54489285",
"0.5406625",
"0.53914165",
"0.53221726",
"0.5274225",
"0.52736765",
"0.52697337",
"0.5268061",
"0.5245089",
"0.52063894",
"0.52046204",
"0.51858455",
"0.51759636",
"0.51700956",
"0.51595557",
"0.51578707",
"0.50987864",
"0.50948334",
"0.509364",
"0.5075912",
"0.5075707",
"0.5065313",
"0.5052787",
"0.50465477",
"0.5040826",
"0.5032127",
"0.5028334",
"0.5017237",
"0.5015751",
"0.5012497",
"0.5003472",
"0.4996453",
"0.49956614",
"0.49914092",
"0.498294",
"0.49796212",
"0.49728683",
"0.49702027",
"0.49685282",
"0.49682075",
"0.49578464",
"0.49523067",
"0.49499837",
"0.4949956",
"0.49469647",
"0.49288988",
"0.49283",
"0.49283",
"0.49252355",
"0.49252355",
"0.49167472",
"0.49102664",
"0.49063602",
"0.49063602",
"0.4900655",
"0.48974803",
"0.48953682",
"0.4890087",
"0.48878244",
"0.48878244",
"0.48739472",
"0.48686734",
"0.48624092",
"0.4860629",
"0.48603427",
"0.48601377",
"0.4855317",
"0.48514956",
"0.48514956",
"0.4845811",
"0.48439375",
"0.4843265",
"0.48414263",
"0.48388836",
"0.48358634",
"0.48351774",
"0.48322287",
"0.48322287",
"0.4831203",
"0.48304847",
"0.48251534",
"0.48242125",
"0.4823868",
"0.48231634",
"0.4820947",
"0.48164213",
"0.48140058",
"0.48055872",
"0.48013446"
] | 0.642254 | 4 |
This listens for the connected events and blocks the thread calling it. | def listen
main = DBus::Main.new
main << @bus
main.run
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_connected(&block)\n @on_connected_procs << block\n end",
"def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end",
"def listen\n loop do\n self.listen_loop\n \n #Break out if something is wrong.\n break if !@out_mutex or (@in and @in.closed?) or (@out and @out.closed?)\n end\n end",
"def process_events\n while (Gtk.events_pending?)\n Gtk.main_iteration\n end\n end",
"def monitor_events\n event_monitor_running\n event_monitor_handle.start do |event|\n @queue.enq(event)\n end\n ensure\n stop_event_monitor\n end",
"def listen(&block)\n loop do\n block.call receive\n end\n end",
"def monitor_events\n event_monitor_handle.start\n event_monitor_handle.each_batch do |events|\n event_monitor_running\n if events && !events.empty?\n @queue.enq events\n end\n sleep_poll_normal\n end\n ensure\n reset_event_monitor_handle\n end",
"def go\n while(true)\n process_event(wait_for_event)\n end\n end",
"def on_connected\n end",
"def listen\n connect do\n routes.each do |queue|\n @client.subscribe(queue) do |args|\n run(queue, args)\n end\n end\n end\n while (!Thread.current[:shutdown]) do\n sleep(self.class.sleep_time)\n end\n end",
"def on_connection_listener_fetch_loop(event)\n listener = event[:caller]\n debug \"[#{listener.id}] Polling messages...\"\n end",
"def wait_end()\n begin\n loop do\n sleep(TICK/1000.0) while (self.connected?() rescue nil)\n break\n end\n rescue Exception => e\n end\n end",
"def dispatch event\n raise Exception.new(\"workers cannot dispatch while blocked\") if blocked?\n @event = event\n @is_running = true\n \n self.resume event\n end",
"def process_events\n while Gtk.events_pending?\n Gtk.main_iteration\n end\nend",
"def listen_wait\n\t\t\tif block_given?\n\t\t\t\[email protected] { yield }\n\t\t\telse\n\t\t\t\[email protected]\n\t\t\tend\n\t\tend",
"def communication_loop\n while connected? && line = readline\n ui.log :printer, :received, line\n\n line.downcase!\n if line.starts_with?(*greetings)\n @can_send = 1\n elsif line.starts_with?(\"ok\")\n # TODO: Implement Q: parameter from \n # http://reprap.org/wiki/GCODE_buffer_multiline_proposal\n @can_send = 1\n # eg: Error:Line Number is not Last Line Number+1, Last Line:15\n # Resend:16\n elsif line.starts_with?(\"rs\", \"resend\")\n # TODO: extract line number from response.\n line = @lines.length - 1 # Last command. \n\n @send_queue.unshift(@lines[line])\n @can_send = 1\n end\n\n send_commands_from_queue\n end\n rescue => e\n puts \"Got exception in event communication thread!\"\n puts \"#{e.class}: #{e}\\n #{e.backtrace.join(\"\\n \")}\"\n disconnect\n raise(e)\n end",
"def each_event\n\t\t\twhile event = SDC.window.poll_event do\n\t\t\t\tyield event\n\t\t\tend\n\t\tend",
"def listen\r\n end",
"def setup_dispatch_thread!\n EM.schedule do\n if running? and not closed?\n begin\n logger.debug { \"adding EM.watch(#{selectable_io.inspect})\" }\n @em_connection = EM.watch(selectable_io, ZKConnection, self) { |cnx| cnx.notify_readable = true }\n rescue Exception => e\n $stderr.puts \"caught exception from EM.watch(): #{e.inspect}\"\n end\n end\n end\n end",
"def dispatch_events!\n loop do\n event = @event_queue.pop\n\n callbacks.each do |callback|\n Thread.new do\n callback.call event\n end\n end\n end\n end",
"def join\n @listen_thread.join if @listen_thread\n sleep 0.5\n raise @thread_error if @thread_error\n end",
"def listen\n em_run do\n end\n end",
"def broadcast\n signal_next until @waiting_threads.empty?\n self\n end",
"def each_data &block\n @listener.start\n @run = true\n\n Signal.trap(\"INT\") {@run = false}\n\n runner = Thread.new do\n loop do\n @listener.get.each {|data| yield data}\n end\n end\n\n sleep 1 while(@run)\n runner.exit\n @listener.stop\n end",
"def process\n read_events.each {|event| event.callback!}\n end",
"def wait_for_event\n q = @vm.eventQueue()\n while(true)\n event_set = q.remove()\n it = event_set.iterator()\n while(it.hasNext)\n event = it.next\n $DEBUG and puts(\"Received an event: #{event.java_class}\")\n @frame = AndroidDebug::Jpda::Frame.new(event.thread.frame(0), event.location)\n @this = @frame.this\n return(AndroidDebug::Jpda::Event.new(event))\n end \n end\n end",
"def wait_readable\n if evented?\n Celluloid.current_actor.wait_readable(@socket)\n else\n Kernel.select([@socket])\n end\n end",
"def listen(debug=false)\n connect unless connected?\n\n @listen_thread = Thread.new {\n @client.add_message_callback do |message|\n next if message.body.nil?\n next unless allowed_roster_includes?(message.from)\n\n Thread.new do\n begin\n dispatch(message)\n rescue => e\n log e\n raise if debug\n end\n end\n end\n @roster ||= Jabber::Roster::Helper.new(@client)\n @roster.add_subscription_request_callback do |item,presence|\n next unless allowed_roster_includes?(presence.from)\n @roster.accept_subscription(presence.from) \n end\n sleep\n }\n end",
"def wake_event_loop!\n super\n end",
"def wake_event_loop!\n super\n end",
"def start\n while listen\n # Loop for-ev-er\n end\n end",
"def run\n trap_signals\n loop do\n break if signals_want_shutdown\n begin\n # IO.select returns either a triplet of lists with IO objects that\n # need attention or nil on timeout of 2 seconds.\n if needy = IO.select([server.socket, lifeline], nil, [server.socket, lifeline], 2)\n server.log.debug(\"Detected activity on: #{needy.inspect}\")\n # If the lifeline is active the server went down and we need to go\n # down as well.\n break if needy.flatten.any? { |io| !io.respond_to?(:accept_nonblock) }\n # Otherwise we handle incoming requests\n needy.flatten.each do |io|\n if io.respond_to?(:accept_nonblock)\n begin\n process_incoming_socket(*io.accept_nonblock)\n rescue Errno::EAGAIN, Errno::ECONNABORTED\n end\n end\n end\n end\n rescue EOFError, Errno::EAGAIN, Errno::EINTR, Errno::EBADF, IOError\n end\n end\n cleanup\n end",
"def listen\n Thread.new { EventMachine.run } unless EventMachine.reactor_running?\n jack.each_job(2) do |job|\n job = Job.new(job.conn, job.jobid, job.body)\n EventMachine.defer proc { process(job) }, proc {|res| raise(res) if res.kind_of?(Exception) }\n end\n end",
"def start\n Thread.new do\n loop do\n @connection.wait_for_notify do |channel|\n @actions[channel].call\n end\n end\n end\n end",
"def initialize_listener\r\n @listener = Thread.new do\r\n begin\r\n loop do\r\n while (messages = API.read_input(@device)).empty?\r\n sleep(1.0/1000)\r\n end\r\n add_to_buffer(messages) unless messages.empty?\r\n end\r\n rescue Exception => exception\r\n Thread.main.raise(exception)\r\n end\r\n end\r\n @listener.abort_on_exception = true\r\n @listener\r\n end",
"def listen_to(io, &callback); end",
"def listen_to_channel(connection, channel, &block)\n connection.execute(\"LISTEN #{channel}\")\n\n loop do\n connection.raw_connection.wait_for_notify(10) do |event, pid, payload|\n return if yield payload\n end\n end\n ensure\n connection.execute(\"UNLISTEN *\")\n end",
"def handle_all_events\r\n @connection.set_generic_handler do |event|\r\n begin\r\n handle_event(event)\r\n rescue => exception\r\n $stderr.puts exception.inspect\r\n $stderr.puts exception.backtrace\r\n end\r\n end\r\n true\r\n end",
"def listening?; end",
"def on_open_channel(type, &block); end",
"def start_async\n while c = @serv.accept\n Thread.start do\n begin\n @threads << Thread.current\n l = Mutex.new\n loop do\n begin\n x = Dr2.read(c, [Dr2::Types::Message,\n Dr2::Types::Error])\n Thread.start {\n begin\n @threads << Thread.current\n receive x, c, l\n ensure\n l.unlock rescue nil if l.locked?\n @threads.delete Thread.current\n end\n }\n rescue Dr2::Types::EOFException\n break\n rescue Dr2::Types::QuitException\n break\n rescue Exception\n l.synchronize { Dr2.write(c, $!) }\n end\n end\n ensure\n c.close rescue nil\n @threads.delete Thread.current\n end\n end\n end\n end",
"def listen\n connect do\n routes.each do |route|\n @client.subscribe(route) do |args|\n run(route, args)\n end\n end\n \n loop do\n sleep 1\n end\n end\n end",
"def on_connect(obj=nil, &block)\n @on_connect_obj = obj\n @on_connect = Proc.new { |handle, obj_ptr|\n # On connect, we'll need to re-add all of our change handlers\n @listeners.each_pair do |pattern, (listener, proc)|\n begin\n next if status != :connected\n Klass.set_OnKeyChange_Handler(@handle, listener, pattern, proc, pointer_for(obj)) \n sleep @handler_sleep\n rescue\n Phidgets::Log.error(\"#{self.class}::on_connect\", $!.to_s)\n end\n end\n yield self, object_for(obj_ptr)\n }\n Klass.set_OnServerConnect_Handler(@handle, @on_connect, pointer_for(obj))\n sleep @handler_sleep\n end",
"def start\n catch(:stop) do\n @poll_waiter.poll do\n read_events\n end\n end\n end",
"def listen\n # TODO\n self\n end",
"def wait\n self.listener.wait if self.listener\n end",
"def monitor_socket\n\t\tself.waiters = []\n\n\t\t# Spawn a new thread that monitors the socket\n\t\tself.dispatcher_thread = ::Thread.new {\n\t\t\twhile (true)\n\t\t\t\tbegin\n\t\t\t\t\trv = Rex::ThreadSafe.select([ self.sock.fd ], nil, nil, 2)\n\t\t\t\trescue\n\t\t\t\t\tdlog(\"Exception caught in monitor_socket: #{$!}\", 'meterpreter', LEV_1)\n\t\t\t\tend\n\n\t\t\t\tbegin\n\t\t\t\t\tpacket = receive_packet\n\t\t\t\trescue EOFError\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\t\t\t\tif (packet)\n\t\t\t\t\tdispatch_inbound_packet(packet)\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend",
"def listen\n EM.run do\n connect do\n routes.each do |route|\n @client.subscribe(route) do |args|\n begin\n run(route, args)\n rescue\n logger.error(\"EventmachineSubscriber listen error on #{route}: #{$!}\")\n end\n end\n end\n end\n end\n end",
"def send_events; end",
"def process_events\n until @dead\n event = next_event\n notify_listeners(event)\n event.dispatch\n end\n rescue Exception => ex\n Logger.error \"Error while running event: #{Logger.format_error(ex)}\"\n end",
"def on(channel, &block)\n @actions[channel] = block\n @connection.exec(\"LISTEN #{channel}\")\n @logger.info \"Listener listening on #{channel}\"\n end",
"def observe_events(client)\n return unless enable_listener?\n queue = create_queue(client)\n client.subscribe(queue) do |message|\n event = Event.parse(message)\n handle_event(event)\n end\n end",
"def sit\n\t\twhile connected?\n\t\t\tif block_given?\n\t\t\t\tyield\n\t\t\telse\n\t\t\t\tsleep(0.1)\n\t\t\tend\n\t\tend\n\tend",
"def ev_do_handle_events(readers, writers); end",
"def start\n _signals_trap\n _init_actors\n unpause\n Celluloid::Actor[:listen_adapter].async.start\n @thread = Thread.new { _wait_for_changes }\n end",
"def key_listen\n Thread.new do\n loop do \n block = @key_bindings[get_character]\n puts block.call if block\n end\n end\n end",
"def listenForeverBlocking\r\n unless EventMachine::reactor_running?\r\n debug \"running SINGLE THREAD!\"\r\n EM::run {\r\n EM::PeriodicTimer.new(300, proc { debug 'listener 300s ping'}) # this is actually never cancelled (yet)\r\n listenForeverLoopingOnErrorNonBlocking\r\n }\r\n debug \"listener EM done--EM.run ended\"\r\n else\r\n debug \"aww still multiple threaded [but still EM]...!\"\r\n listenForeverLoopingOnErrorNonBlocking\r\n sleep\r\n end\r\n end",
"def handle_poll_event( socket, event )\n\t\t$stderr.puts \"Got #{event.inspect} event for #{socket.inspect}\"\n\n\t\tcase event\n\t\twhen :error\n\t\t\t$stderr.puts \"Socket error on the listener socket.\"\n\t\t\tself.shutdown\n\n\t\twhen :read\n\t\t\tclient_sock = socket.accept\n\t\t\tuser = Example::User.new( client_sock, self )\n\n\t\t\t$stderr.puts \"Accepted connection from #{user}\"\n\t\t\[email protected]( client_sock, :read, &user.method(:handle_io_event) )\n\t\t\tuser.add_output( BANNER )\n\t\t\tuser.prompt\n\n\t\t\tself.broadcast_msg( \"[New connection: #{user}]\" )\n\t\t\t@users << user\n\n\t\tend\n\tend",
"def notify(context)\n \n context.connection_listeners.each do |connection_listener|\n yield connection_listener\n end\n \n end",
"def connect\n start_listener!\n end",
"def listen(&block)\n block ||= self.class.for_client\n Supernova.logger.info { \"Server started.\" }\n while run\n next unless IO.select [server], nil, nil, 1\n thread_list << Thread.start(server.accept) do |client|\n Supernova.logger.info { \"Client accepted.\" }\n begin\n protocol = Protocol.new(\n @protocol_options.merge(:type => :server))\n\n @protocols << protocol\n\n protocol.socket = client\n protocol.handshake\n\n block.call(protocol)\n rescue ExitError => e\n Supernova.logger.error { \"Closing while client is connected. Notifying...\" }\n if protocol\n protocol.close(:shutdown)\n else\n client.close unless client.closed?\n end\n rescue RemoteCloseError\n rescue ProtocolError => e\n Supernova.logger.error { \"Client failed: #{e.message} #{e.backtrace.join(\"\\n\")}\" }\n client.close unless client.closed?\n end\n\n thread_list.delete(Thread.current)\n Supernova.logger.info { \"Client disconnected.\" }\n protocol.close(false)\n end\n end\n end",
"def on(event, &block) # open, message, close, ping, pong\n @events[event] = block\n end",
"def start\n \n register_signal_handlers\n log.info(\"Registered event handlers...\")\n \n EM.synchrony do\n do_work\n end\n \n end",
"def on_connection_listener_fetch_loop_received(event)\n listener = event[:caller]\n time = event[:time]\n messages_count = event[:messages_buffer].size\n\n message = \"[#{listener.id}] Polled #{messages_count} messages in #{time}ms\"\n\n # We don't want the \"polled 0\" in dev as it would spam the log\n # Instead we publish only info when there was anything we could poll and fail over to the\n # zero notifications when in debug mode\n messages_count.zero? ? debug(message) : info(message)\n end",
"def listen(p0) end",
"def listen(p0) end",
"def listen(p0) end",
"def listenLoop()\n x = Thread.new{\n i = 0\n while true\n i = i + 1\n puts \" \"\n print @name, \" Listen Loop Round: \", i\n puts \" \"\n jsonIN = @s.recv(65536)\n puts \" \"\n print @name, \" \", Time.now, \" has receaved a Message: \", jsonIN\n puts \" \"\n parsed = JSON.parse(jsonIN)\n if @netWorkMember\n self.respond( parsed )\n else\n puts \"Not a member of a Network hence I will not respond\"\n end\n end\n }\n end",
"def on(event, &block)\n listeners.add(BlockListener.new(event, &block))\n end",
"def verify_channel\n while ! self.channel\n raise EOFError if ! self.thread.alive?\n ::IO.select(nil, nil, nil, 0.10)\n end\n end",
"def run\n input_listener_thread = Thread.new{input_listener();}\n main_thread = Thread.new{main();}\n input_listener_thread.join\n main_thread.join\n end",
"def blocking_thread\n poller_thread\n end",
"def connected(client)\n\t\tclient.listen('WHEREAMI?', self)\n\t\tclient.listen('NEARBY?', self)\n\t\tclient.listen('DISTANT?', self)\n\t\tclient.listen('IMOVED', self)\n\t\tclient.listen('NEARBYENT?', self)\n\tend",
"def listen\n @@em.schedule do\n EventMachine::WebSocket.run(:host => @host, :port => @port) do |ws|\n ws.onopen { }\n ws.onclose { @connection_event_handlers[:closed].each { |h| h.call self } }\n ws.onerror { |e| @connection_event_handlers[:error].each { |h| h.call self } }\n ws.onmessage { |msg| handle_message(msg, ws) }\n end\n end\n self\n end",
"def each(&block)\n # If the buffer is closed, there's no reason to block the listening\n # thread, yield all the buffered chunks and return.\n queue = Queue.new\n @mutex.synchronize do\n return @previous.each(&block) if closed?\n @listeners << queue\n end\n\n # race condition: possibly duplicate messages when message comes in between adding listener and this\n @previous.each(&block)\n\n while chunk = queue.pop\n yield chunk\n end\n ensure\n @mutex.synchronize { @listeners.delete(queue) }\n end",
"def connected\n\t\tdo_send('CN1')\t# Connection command - initiate comms\n\t\n\t\t@polling_timer = schedule.every('60s') do\n\t\t\tlogger.debug \"Polling JVC\"\n\t\t\tdo_send('CN1')\t# Connection command\n\t\tend\n\tend",
"def on_trap &block\n @socket.callbacks << block\n end",
"def listen\n if @listener.nil? then\n @listener = Thread.new do\n loop do\n \t\t\t#sleep(0.001) # Why windows needs this, i don't know.\n @buffer = getd\n\t\t\t Thread.pass\n end\n end\n @listener.run\n\t\t $log.debug(\"Created new thread for \" + @params[\"make\"] + \" \" + @params[\"model\"])\n end\n end",
"def read\n\t\tCONNECTION_LOGGER.debug(\"In Accept\")\n\n\t\tbegin\n\t\t\tclient_socket, client_addrinfo = @server_socket.accept_nonblock\n\n\t\t\tCONNECTION_LOGGER.info(\"Accepting connection: #{client_socket}, #{client_addrinfo}\")\n\n\t\t\tchanged\n\t\t\tnotify_observers(Client.new(client_socket))\n\n\t\trescue IO::WaitReadable\n\t\t\tCONNECTION_LOGGER.warn(\"Read failed\")\n\t\trescue EOFError\n\t\t\tCONNECTION_LOGGER.warn(\"Server socket has died\")\n\t\tend\n\tend",
"def busy( &block )\n self.connection.status( :dnd, \"Working...\" )\n yield\n self.connection.status( :chat, \"JabberListener waiting for instructions\" )\n end",
"def start\n return if @thread\n @thread = Thread.start do\n @fd = Inotify.init\n \n @watchers.each do |watch|\n watch.add_watch(@fd)\n end\n\n @filePtr = FFI::IO.for_fd(@fd)\n while true\n debug \" [+] @watch_thread listening for inotify events\"\n \n buffer = FFI::Buffer.alloc_out(Inotify::Event.size + 4096, 1, false)\n event = Inotify::Event.new buffer\n ready = IO.select([@filePtr], nil, nil, nil)\n n = Inotify.read(@fd, buffer, buffer.total)\n\n event_wd = event[:wd]\n event_mask = event[:mask]\n event_len = event[:len]\n\n debug \" [+] meta event message ignored.\" and next if event_len == 0\n \n # the filename is set after the event datastructure(16 bytes fixed)\n event_file = buffer.get_string(16) # 16 bytes offset\n\n debug \" [+] raw event notification wd(#{event_wd.inspect}) \" + \n \"len(#{event[:len]}) mask(#{event_mask}) \" +\n \"subject(#{event_file.inspect})\"\n\n @watchers.each do |watch|\n # process only if watch descriptor matches\n if event_wd == watch.wd\n watch.process(event_mask, event_file, @notify_targets)\n end\n end\n end\n debug \" [+] the watch thread is terminated.\"\n end # end thread\n end",
"def socket_connected\n post_init\n end",
"def listen &block\n register_accept_listener &block if block_given?\n \n @accept_thread ||= Thread.new do\n loop do\n # Package in an Ionian::Socket\n begin\n client = Ionian::Socket.new @server.accept\n @accept_listeners.each { |listener| listener.call client }\n rescue Errno::EBADF\n # This ignores the connection if the client closed it before it\n # could be accepted.\n rescue IOError\n # This ignores the connection if the client closed it before it\n # could be accepted.\n end\n end\n end\n end",
"def signal_received; end",
"def connected(socket, remote_state)\n Distributed.debug { \"#{self}: connected\" }\n register_link(socket)\n local_server.state_update remote_state\n @send_queue = Queue.new\n\t @send_thread = Thread.new(&method(:communication_loop))\n end",
"def send_event( data )\n\t\tuntil data.empty?\n\t\t\tbytes = self.socket.sendmsg_nonblock( data, 0, exception: false )\n\n\t\t\tif bytes == :wait_writable\n\t\t\t\tIO.select( nil, [self.socket], nil )\n\t\t\telse\n\t\t\t\tself.log.debug \"Sent: %p\" % [ data[0, bytes] ]\n\t\t\t\tdata[ 0, bytes ] = ''\n\t\t\tend\n\t\tend\n\tend",
"def run\n @connection.queue do |queue|\n puts(\"Client started. Listening on queue “#{queue.name}”.\")\n begin\n queue.listen do |message|\n puts(message)\n end\n rescue Interrupt\n return\n end\n end\n end",
"def event_loop\n Qwirk.logger.debug \"#{self}: Starting receive loop\"\n @start_worker_time = Time.now\n until @stopped || (config.stopped? && @impl.ready_to_stop?)\n Qwirk.logger.debug \"#{self}: Waiting for read\"\n @start_read_time = Time.now\n msg = @impl.receive_message\n if msg\n @start_processing_time = Time.now\n Qwirk.logger.debug {\"#{self}: Done waiting for read in #{@start_processing_time - @start_read_time} seconds\"}\n delta = config.timer.measure do\n @processing_mutex.synchronize do\n on_message(msg)\n @impl.acknowledge_message(msg)\n end\n end\n Qwirk.logger.info {\"#{self}::on_message (#{'%.1f' % delta}ms)\"} if self.config.log_times\n Qwirk.logger.flush if Qwirk.logger.respond_to?(:flush)\n end\n end\n Qwirk.logger.info \"#{self}: Exiting\"\n rescue Exception => e\n @status = \"Terminated: #{e.message}\"\n Qwirk.logger.error \"#{self}: Exception, thread terminating: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n ensure\n @status = 'Stopped'\n Qwirk.logger.flush if Qwirk.logger.respond_to?(:flush)\n config.worker_stopped(self)\n end",
"def listen_for_client\n puts \"Listening...\"\n @client = @server.accept\n puts \"A client connected.\"\n @client.puts \"Connected to server!\"\n end",
"def run\n while true; async.handle_message @socket.read; end\n end",
"def on_subscribed(&block)\n return unless block\n\n call_now = false\n @lock.synchronize do\n if @subscribed\n call_now = true\n else\n @on_subscribed_handlers << block\n end\n end\n if call_now\n after(0, &block)\n end\n end",
"def start_thread\n @thread = @options[:sync] || Thread.new do\n begin\n loop do\n @status = :waiting_for_event\n process_event\n @event_queue.wait_for_new_event\n end\n rescue => e\n CFSM.logger.fatal \"#{e.class}: #{$!}\"\n Thread.main.raise e\n end\n end\n end",
"def connection_ended\n end",
"def connection_ended\n end",
"def handlePollEvent( socket, event )\n\t\t$stderr.puts \"Got #{event.inspect} event for #{socket.inspect}\"\n\n\t\tcase event\n\t\twhen :error\n\t\t\t$stderr.puts \"Socket error on the listener socket.\"\n\t\t\tshutdown()\n\n\t\twhen :read\n\t\t\tclSock = socket.accept\n\t\t\tuser = User::new( clSock, self )\n\t\t\t$stderr.puts \"Accepted connection from #{user}\"\n\t\t\[email protected] clSock, :read, &user.method(:handleIOEvent)\n\t\t\tuser.addOutput( BANNER )\n\t\t\tuser.prompt\n\t\t\tbroadcastMsg( \"[New connection: #{user}]\" )\n\t\t\t@users << user\n\n\t\tend\n\tend",
"def start_event_thread\n return false if @event_thread\n @event_thread = Thread.new(&method(:event_thread_body))\n end",
"def listenLoop()\n x = Thread.new {\n i = 0\n while true\n i = i + 1\n puts \" \"\n print @name, \" Listen Loop Round: \", i\n puts \" \"\n jsonIN = @socket.recv(65536)\n puts \" \"\n print @name, \" \", Time.now, \" has received a Message: \", jsonIN\n puts \" \"\n parsed = JSON.parse(jsonIN)\n if @netWorkMember\n self.respond(parsed)\n else\n puts \"Not a member of a Network, No Response\"\n end\n end\n }\n end",
"def inputs_thread_start\n EventMachine.run do\n @inputs.each do |plugin|\n # Tell EventMachine to watch the plugin source\n EventMachine::FileGlobWatchTail.new(plugin.source) do |emtail, entry| \n begin\n plugin.receive_data(entry) \n rescue Exception => e\n puts \"Exception: #{e}\"\n end\n end\n end\n end\n puts \"EventMachine exiting\"\n end",
"def listener; end",
"def loop_forever\n running = true\n\n while wait_for_connection\n @logger.info(\"New client connected\")\n command, *arguments = next_message.split\n @logger.debug \"#{command} received\"\n response = case command\n when /^track$/i then track(arguments.first)\n when /^list$/i then list\n when /^release$/i then release(arguments.first)\n end\n\n write(response) unless response.nil?\n end\n rescue => e\n @logger.error(\"An error occurred when waiting for new connections!\\n\\t#{e.inspect}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\")\n end",
"def run\n EventMachine::run do\n @tcp = EventMachine::connect(config.server.host, config.server.port, TCPConnection)\n @tcp.client = self\n spectator_join\n end\n end"
] | [
"0.63488406",
"0.63252324",
"0.6272153",
"0.61944103",
"0.6144928",
"0.60300845",
"0.60275453",
"0.60125875",
"0.5902169",
"0.5889862",
"0.5889367",
"0.5886719",
"0.58764803",
"0.5833371",
"0.58282495",
"0.58163905",
"0.5800977",
"0.5771189",
"0.5754785",
"0.5752643",
"0.57421416",
"0.57175815",
"0.5707339",
"0.5679487",
"0.5679192",
"0.5665701",
"0.56561416",
"0.5654248",
"0.56494844",
"0.56494844",
"0.5639995",
"0.563484",
"0.5634173",
"0.5628506",
"0.5582234",
"0.55816376",
"0.5564578",
"0.5554492",
"0.5554167",
"0.55511916",
"0.55377257",
"0.552787",
"0.5518364",
"0.5516464",
"0.5508214",
"0.5490456",
"0.54897183",
"0.54880565",
"0.548127",
"0.54657805",
"0.54479337",
"0.5443436",
"0.5434474",
"0.54271054",
"0.5423707",
"0.5412479",
"0.53881884",
"0.53879696",
"0.53813875",
"0.5379276",
"0.53783554",
"0.53778523",
"0.53750503",
"0.5374616",
"0.5371804",
"0.5371804",
"0.5371804",
"0.53599775",
"0.5359142",
"0.53542787",
"0.53522223",
"0.5348137",
"0.5348057",
"0.53362584",
"0.53223115",
"0.5320625",
"0.531903",
"0.53071123",
"0.5304527",
"0.5302107",
"0.5294629",
"0.5293772",
"0.5284093",
"0.52817893",
"0.52779955",
"0.52779585",
"0.5275339",
"0.5272282",
"0.5266029",
"0.5258284",
"0.52571845",
"0.52538264",
"0.52518106",
"0.52518106",
"0.5241673",
"0.5241496",
"0.52392834",
"0.52389425",
"0.52349645",
"0.5226039",
"0.52237916"
] | 0.0 | -1 |
Tells Skype to go offline. | def skype_status_offline
ret = @skype_obj.Invoke("SET USERSTATUS OFFLINE").first
raise "Couldnt go offline: '#{ret}'." if ret != "USERSTATUS OFFLINE"
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offline()\n set_status(\"OFFLINE\")\n end",
"def skype_status_online\n ret = @skype_obj.Invoke(\"SET USERSTATUS ONLINE\").first\n raise \"Couldnt go online: '#{ret}'.\" if ret != \"USERSTATUS ONLINE\"\n nil\n end",
"def offline\n end",
"def offline?\n status == :offline\n end",
"def online_friends\n Skype.find_users_of_type \"ONLINE_FRIENDS\"\n end",
"def offline?(id)\n !online?(id)\n end",
"def set_online_status\n self.online_status = \"offline\"\n end",
"def offline?\n !online?\n end",
"def nexus_offline(chatnet_name)\n puts \"Informing NexusNet that I have exited!!!\"\n Net::HTTP.get_print(\"nexusnet.herokuapp.com\", \"/offline_by_name?name=#{chatnet_name}\")\n end",
"def is_offline\n return if check_online_object(@privacypolicy)\n end",
"def offline?\n @is_offline = OFFLINE if @is_offline === nil\n @is_offline\n end",
"def offline_mode\n @config[\"offline_mode\"]\n end",
"def offline_question\n return if check_online_object(@question)\n end",
"def set_offline\n @_config_service.set_offline if @_config_service\n end",
"def disconnect\n request_user.offline! if request_valid?\n render :nothing => true\n end",
"def offline?\n @mode == :offline || @state == :created\n end",
"def is_online\n return if check_offline_object(@privacypolicy)\n end",
"def unaway\n @socket << \"AWAY\"\n end",
"def offline_reason(arg = nil)\n set_or_return(:offline_reason, arg, kind_of: String)\n end",
"def on_online(m, user)\n user.send \"Hello #{m.user.nick}\"\n end",
"def skypeout_friends\n Skype.find_users_of_type \"SKYPEOUT_FRIENDS\"\n end",
"def offline?\n (@options[:offline_queueing] && @offline_handler.offline?) || @broker.connected.size == 0\n end",
"def online?\n status != :offline\n end",
"def disable_offline_mode\n @offline_handler.disable if @options[:offline_queueing]\n end",
"def offline?\n return (Time.now - self.time_of_last_connection) > threshold_for_offline\n end",
"def away(m=nil)\n @socket << \"AWAY :#{m}\"\n end",
"def should_be_online?\n !should_be_offline?\n end",
"def mnu_start_offline_game(sender, sel, ptr)\r\n initialize_current_gfx(@last_selected_gametype)\r\n create_new_singlegame_window(:offline)\r\n end",
"def online?\n get_int(:offline).zero?\n end",
"def enable_offline_mode\n @offline_handler.enable if @options[:offline_queueing]\n end",
"def currently_online\n false\n end",
"def away(message = nil)\n send_data(\"AWAY \" + (message ? \":#{message}\" : \"\"))\n end",
"def action_offline\n if current_resource.online?\n converge_by(\"Offline #{new_resource}\") do\n command_pieces = [escape(new_resource.slave_name)]\n if new_resource.offline_reason\n command_pieces << \"-m '#{escape(new_resource.offline_reason)}'\"\n end\n executor.execute!('offline-node', command_pieces)\n end\n else\n Chef::Log.debug(\"#{new_resource} already offline - skipping\")\n end\n end",
"def unsubscribed\n User.find(current_user.id).update(online: false)\n ActionCable.server.broadcast(\n 'appearance_channel',\n user_id: current_user.id,\n is_online: false\n )\n end",
"def away?\n online? and (presence.show == :away or presence.show == :xa)\n end",
"def send_away(reason=nil)\n return back if reason.nil?\n send_raw(AWAY, reason)\n end",
"def online?\n @presence && @presence.type == nil\n end",
"def available?\n online? and (presence.show == nil or presence.show == :chat)\n end",
"def name_owner_changed(msg)\n raise \"Skype has stopped running.\" if msg.params.first == \"com.Skype.API\" and msg.params[1].to_s.match(/^:\\d\\.\\d+$/)\n end",
"def notify_private_reply(m, message_type = 'your interaction')\r\n if m.channel?\r\n m.reply(message_type + ' continues via PM', true)\r\n end\r\n end",
"def offline?\n return @_config_service ? @_config_service.offline? : true\n end",
"def disconnect\n\t\t@state = STATE_OFFLINE\n\t\treturn 0\n\tend",
"def local_away(body)\n if body.length > 0\n _remote_control(nil, 'pong', \"away #{body}\", true)\n @var[:presence][@connection.comm.our_keyhash] = [ 'away', body ]\n else\n local_back('')\n end\nend",
"def should_be_offline?\n time_ago = (update_frequency.seconds * 4.8).ago\n # Provides leeway for new stations\n if created_at > time_ago\n return false\n end\n observations.since(time_ago).order(created_at: :desc).count < 3\n end",
"def online?\n l_seen = last_seen.presence || 1.day.ago\n !chat_invisibility && l_seen >= 25.minutes.ago && (!last_sign_out_at || l_seen > last_sign_out_at)\n end",
"def event_outgoing_broadcast(msg)\n if @var[:room] == 'chat' and\n @var[:presence][@connection.comm.our_keyhash].first == 'away'\n local_back('')\n end\n\n # Private message?\n if @var[:room][0,1] == '@'\n peer = @var[:room].sub('@', '')\n local_msg(\"#{peer} #{msg}\")\n msg.replace('')\n end\nend",
"def online\n gateway_check\n update_status(:online, @activity, @streamurl)\n end",
"def run_offline\n offline_header\n end",
"def close\n @status = DISCONNECTED\n send(Jabber::Presence.new.set_type(:unavailable))\n end",
"def unanswered\n request('unanswered')\n end",
"def mark_as_unread\n post(\"/api/unread_message\", id: fullname)\n end",
"def online?\n !!@online\n end",
"def wake_up(bot)\r\n bot.servers.each do |key, server|\r\n server.channels.each do |channel|\r\n if channel.name == @botChannelName and @awakenStrings.size > 0\r\n bot.send_message(channel, @awakenStrings.sample)\r\n end\r\n end\r\n end\r\n end",
"def push_to_online\n transition_to :online\n end",
"def online!\n unless self.admin\n self.online =true\n self.save\n end\n end",
"def gnome_screensaver_status(msg)\n val = msg.params.first\n \n if val == true\n puts \"Detected screenlock by Gnome Screensaver - logging out of Skype.\"\n self.skype_status_offline\n else\n puts \"Detected screenlock unlock by Gnome Screensaver - going online on Skype.\"\n self.skype_status_online\n end\n end",
"def send_unavailable(from, to)\n available = router.available_resources(from, to)\n stanzas = available.map {|stream| unavailable(stream.user.jid) }\n broadcast_to_available_resources(stanzas, to)\n end",
"def set_online_status(status)\n case status\n when :available, :online\n @notification_server.chg \"NLN\", 0\n when :busy\n @notification_server.chg \"BSY\", 0\n when :idle\n @notification_server.chg \"IDL\", 0\n when :brb, :be_right_back\n @notification_server.chg \"BRB\", 0\n when :away\n @notification_server.chg \"AWY\", 0\n when :phone, :on_the_phone\n @notification_server.chg \"PHN\", 0\n when :lunch, :out_to_lunch\n @notification_server.chg \"LUN\", 0\n else\n raise \"Wrong online status: #{status}\"\n end\n end",
"def offline_map\n open OfflineAmapScreen.new(nav_bar: true)\n end",
"def disable\n if offline? && @state != :created\n Log.info(\"[offline] Connection to broker re-established\")\n @offline_stats.finish\n cancel_timer\n @state = :flushing\n # Wait a bit to avoid flooding the mapper\n EM.add_timer(rand(MAX_QUEUE_FLUSH_DELAY)) { flush }\n end\n true\n end",
"def local_back(body)\n return nil if @var[:presence][@connection.comm.our_keyhash].first != 'away'\n _remote_control(nil, 'pong', \"online #{body}\", true)\n @var[:presence][@connection.comm.our_keyhash] = [ 'online', body ]\nend",
"def online\n gateway_check\n update_status(nil, @game, @streamurl)\n end",
"def online_friends\n self.friends_by_me.online + self.friends_for_me.online\n end",
"def broadcast_state(nick, state)\n #TODO: write function\n #get users clist, get the contacts clists and check their authorization to get the state\n #if its fine -> send the message to their queues\n\n return true\nend",
"def mark_as_unread(options = {})\n default_options = {:conditions => [\"mail_items.mailbox != ?\",@user.mailbox_types[:sent].to_s]}\n add_mailbox_condition!(default_options, @type)\n return update_mail(\"mail_items.read = false\", default_options, options)\n end",
"def omni\n @channel = nil\n true\n end",
"def online\n @technician = Technician.find(params[:lawyer_id])\n @technician.is_online = true\n @technician.save\n render \"update_online\"\n end",
"def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end",
"def status\n Skype.send_ :command => \"get call #{@call_id} status\"\n end",
"def slack(msg)\n @slack.ping(msg)\n end",
"def is_offline(fqdn)\n cmd = \"/usr/sbin/cibadmin --query --xpath \\\"//node_state[@uname='#{fqdn}']\\\" | grep -q 'crmd=\\\"online\\\"'\"\n exec(cmd,random(5,10)) > 0\n end",
"def online?\n status == :online\n end",
"def tell_all(m, message)\r\n if_admin(m) do\r\n @bot.channels.each {|c| c.send(message) }\r\n end\r\n end",
"def mark_as_unread\n @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)])\n end",
"def unfollowed\n FollowMailer.unfollowed\n end",
"def modulect_is_online\n if app_settings.is_offline && controller_name != \"errors\" && (request.path =~ /.*\\/admin(\\/.*)?/) == nil && (request.path =~ /.*\\/login(\\/.*)?/) == nil\n if !logged_in? || (logged_in? && current_user.user_level == \"user_access\")\n redirect_to offline_path\n end\n end\n end",
"def send(m)\n\t\t#nick = m.message[/^[[A-z0-9]|[-_]]+/]\n\t\tnick = m.message[/^.[^ :]+/]\n\t\tbot.logger.debug \"Nick: #{nick}\"\n\t\tuser = @users[nick]\n\t\tif Mailbox.exists? nick\n\t\t if user.is_afk?\n\t\t\t\t#user.mailbox.temp_mailbox.each { |msg| user.mailbox.send_to_inbox msg }\n\t\t\t\t#user.mailbox.empty_temp_mailbox\n\t\t\t\tuser.mailbox.send_to_inbox m\n\t\t\t\tm.reply \"-.-\"\n\t\t else\n\t\t\t # User hasn't be inactive long enough, so put this msg into the temp queue\n\t\t\t\tuser.mailbox.send_to_temp m\n\t\t end\n\t end\n end",
"def on_disconnect\n # Let others know that the user left\n broadcast :_send_message, {event: :chat, from: '', at: Time.now, message: \"#{params[:name]} left the chatroom.\"}.to_json if params[:name]\n end",
"def busy?\n online? and presence.show == :dnd\n end",
"def enable\n if offline?\n if @state == :flushing\n # If we were in offline mode then switched back to online but are still in the\n # process of flushing the in-memory queue and are now switching to offline mode\n # again then stop the flushing\n @state = :running\n end\n else\n Log.info(\"[offline] Disconnect from broker detected, entering offline mode\")\n Log.info(\"[offline] Messages will be queued in memory until connection to broker is re-established\")\n @offline_stats.update\n @queue ||= [] # Ensure queue is valid without losing any messages when going offline\n @mode = :offline\n start_timer\n end\n true\n end",
"def online_friends\n \t friends_by_me.online + friends_for_me.online\n \t end",
"def online\n current_user.online!\n render :juggernaut do |page|\n page.go_online User.current\n end\n render :nothing => true \n end",
"def update_status!\n status = :online\n\n if !is_port_open?(@address, @port)\n status = :offline\n end\n\n if status != @status\n time = Time.now\n if status == :offline\n puts \"Server is currently offline\"\n else\n puts \"Server is currently online\"\n end\n\n @status = status\n if @status == :online\n @last_status_change = @last_launch\n else\n @last_status_change = time\n end\n end\n end",
"def apply_privacy(msg)\n if !msg[:privacy] || msg[:privacy].to_s == \"none\"\n return msg\n else\n if msg.privacys.include?(\"user\")\n if msg.class == Request \n if msg.method == \"REFER\"\n msg.referred_by ='sip:[email protected]'\n end\n msg.from.uri = \"sip:[email protected]\"\n msg.from.display_name ='\"Anonymous\"' \n elsif msg[:warning]\n warn_code,warn_agent,warn_text = msg.warning.to_s.split(' ',3)\n msg.warning = warn_code + \" \" + warn_text\n end \n end \n msg.privacy = nil\n return msg\n end \n end",
"def put_online\n @privacypolicy.online = true\n @privacypolicy.publication_time = DateTime.now\n @privacypolicy.save\n User.all.each do |u|\n u.last_policy_read = false\n u.save\n end\n redirect_to @privacypolicy\n end",
"def tick\n while Win32::PeekMessage(@msg, Win32::NULL, 0, 0, Win32::PM_REMOVE) > 0\n Win32::TranslateMessage(@msg)\n Win32::DispatchMessage(@msg)\n end\n\n # Don't simplify this as we rely on false != nil for tribool values\n #noinspection RubySimplifyBooleanInspection\n if @authorized == false\n Skype::Errors::ExceptionFactory.generate_exception(\"ERROR 68\")\n end\n end",
"def online\n current_user.online!\n render :juggernaut do |page|\n page.go_online current_user\n end\n render :nothing => true \n end",
"def following_broadcast_feed\n request('/followingBroadcastFeed', {body: {}})\n end",
"def offline_contest\n if [email protected]_construction?\n render 'errors/access_refused' and return\n end\n end",
"def offline_contest\n if [email protected]_construction?\n render 'errors/access_refused' and return\n end\n end",
"def stop_ticker(m)\n quiet_stop_ticker(m)\n m.reply \"Google RSS: Off\"\n end",
"def client_disconnected\n puts \"client #{current_user.email} disconnected\"\n current_player = current_user.player\n broadcast_message :player_exit, {\n id: current_player.id\n }\n current_player.is_online = false\n current_player.save\n end",
"def online?\n\t\tstatus == \"online\"\n\tend",
"def on_online(msg, user)\n return unless @private_memos.keys.include?(user.nick)\n\n Thread.new do\n loop do\n # Wait for the user to (auto-)authenticate\n sleep 10\n next unless user.authed?\n\n # Deliver all the memos\n @private_mutex.synchronize do\n while memo = @private_memos[user.nick].pop # Single = intended\n bot.loggers.info(\"Delivering a private memo from #{memo.sender.nick} to #{user.nick}\")\n user.send(\"Memo from #{memo.sender.nick}: #{memo.message}\")\n end\n end\n\n # We now don’t need to know about him anymore, so\n # don’t put unnecessary strain on the IRC server.\n user.unmonitor\n break\n end\n end\n end",
"def sms_password_reset_link\n api_response = \"\"\n link=\"http://#{ApplicationController::SITE_URL}/new_password/#{self.password_reset_code}\"\n txtlocal = Txtlocal.find_by_sms_type(Txtlocal::RESET_PASSWORD)\n if !self.mobile.blank?\n if !txtlocal.nil?\n txtlocal.message_contents += link\n api_response = txtlocal.send_sms(self.mobile)\n else\n api_response = \"SMS type does not exist\"\n end\n else\n api_response = \"You have not provided any mobile number. Please go to your 'Account' to set up a mobile number\"\n end\n \n api_response\n end",
"def toggle_nick(bot, channel)\n @use_nicks[channel] = (not @use_nicks[channel] == true)\n \n if use_nicks?(channel)\n bot.say(\"Nicks will be sent with messages.\")\n else\n bot.say(\"Nicks will not be sent (omegle users will just see anonymous text)\")\n end\n end",
"def unread!\n self.update_attribute(:status, UNREAD)\n end",
"def o_ucount_notify\n User.bot.lobby_speak(\"#{linked_name}さんが本日#{today_total_o_ucount}問解きました\")\n end",
"def fetch(m)\n\t\tnick \t\t= m.user.nick\n\t\tuser = @users[nick]\n\t\tbot.logger.debug \"Inbox empty? #{user.mailbox.empty?}\"\n\t\tbot.logger.debug \"Temp empty? #{user.mailbox.temp_mailbox_empty?}\"\n\n if user.mailbox.empty? && user.mailbox.temp_mailbox_empty?\n m.reply \"No new mail\"\n else\n m.reply \"Unread mail (#{user.mailbox.size + user.mailbox.temp_mailbox_size}):\"\n\t\t\tuser.mailbox.temp_mailbox.each { |msg| m.reply \"From #{msg.user}: #{msg.message}\" }\n\t\t\tuser.mailbox.mailbox.each { |msg| m.reply \"From #{msg.user}: #{msg.message}\" }\n\t\t\tuser.mailbox.empty_mailboxes\n end\n end",
"def perform(data)\n User.find(data[\"user_id\"]).update(status: false, online: false)\n ActionCable.server.broadcast 'chat_channel', content: \"qwertyuiop\"\n end"
] | [
"0.66431695",
"0.64580077",
"0.6376998",
"0.61214316",
"0.5895095",
"0.5845045",
"0.58369833",
"0.5835884",
"0.5806407",
"0.57812124",
"0.57335633",
"0.5690763",
"0.56801784",
"0.5656047",
"0.56333905",
"0.556071",
"0.55389917",
"0.5513177",
"0.5504552",
"0.54677373",
"0.5443998",
"0.5438867",
"0.5410484",
"0.5387806",
"0.5387227",
"0.535489",
"0.5344411",
"0.5290878",
"0.5278656",
"0.5260348",
"0.5234686",
"0.5209097",
"0.5190782",
"0.5145543",
"0.513264",
"0.5122199",
"0.5079676",
"0.5063482",
"0.50530285",
"0.5035085",
"0.5017778",
"0.50166166",
"0.5008314",
"0.49971655",
"0.49507618",
"0.4936637",
"0.49216864",
"0.4921274",
"0.49137804",
"0.49021724",
"0.487871",
"0.4870703",
"0.48673144",
"0.48623326",
"0.48584902",
"0.4836869",
"0.47983292",
"0.47886232",
"0.47843844",
"0.4776258",
"0.47631946",
"0.47612992",
"0.4755115",
"0.47411135",
"0.47228357",
"0.47148183",
"0.47140694",
"0.4712826",
"0.47075585",
"0.47013283",
"0.46802118",
"0.46770355",
"0.4676911",
"0.46766502",
"0.46684638",
"0.4668347",
"0.46629056",
"0.4662473",
"0.4652168",
"0.46367073",
"0.46315008",
"0.46230757",
"0.46229732",
"0.46122563",
"0.46017963",
"0.45926324",
"0.45909256",
"0.45853287",
"0.45812666",
"0.45812666",
"0.45687515",
"0.45665458",
"0.45583257",
"0.45453367",
"0.45404515",
"0.45329678",
"0.45321018",
"0.45256943",
"0.45224044",
"0.45051867"
] | 0.75717777 | 0 |
Tells skype to go online. | def skype_status_online
ret = @skype_obj.Invoke("SET USERSTATUS ONLINE").first
raise "Couldnt go online: '#{ret}'." if ret != "USERSTATUS ONLINE"
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skype_status_offline\n ret = @skype_obj.Invoke(\"SET USERSTATUS OFFLINE\").first\n raise \"Couldnt go offline: '#{ret}'.\" if ret != \"USERSTATUS OFFLINE\"\n nil\n end",
"def online_friends\n Skype.find_users_of_type \"ONLINE_FRIENDS\"\n end",
"def on_online(m, user)\n user.send \"Hello #{m.user.nick}\"\n end",
"def skypeout_friends\n Skype.find_users_of_type \"SKYPEOUT_FRIENDS\"\n end",
"def status\n Skype.send_ :command => \"get call #{@call_id} status\"\n end",
"def online\n gateway_check\n update_status(:online, @activity, @streamurl)\n end",
"def connect!\n app.speakers.ID(@id).connect_to\n connected?\n end",
"def slack(msg)\n @slack.ping(msg)\n end",
"def send(message)\n puts \"-> #{message}\" if Skype.DEBUG\n\n counter = next_message_counter\n message = \"##{counter} #{message}\"\n\n data = Win32::COPYDATASTRUCT.new\n data[:dwData] = 0\n data[:cbData] = message.length + 1\n data[:lpData] = FFI::MemoryPointer.from_string(message + \"\\0\")\n\n Win32::SendMessage(@skype_window, Win32::WM_COPYDATA, @window,\n pointer_to_long(data.to_ptr))\n\n while @replies[counter].nil?\n tick\n sleep(0.1)\n end\n\n ret = @replies[counter]\n @replies.delete(counter)\n ret\n end",
"def name_owner_changed(msg)\n raise \"Skype has stopped running.\" if msg.params.first == \"com.Skype.API\" and msg.params[1].to_s.match(/^:\\d\\.\\d+$/)\n end",
"def online\n gateway_check\n update_status(nil, @game, @streamurl)\n end",
"def on_open(client)\n client.subscribe \"chat\"\n # let everyone know we arrived\n client.publish \"chat\", \"#{@name} entered the chat.\"\n end",
"def available?\n online? and (presence.show == nil or presence.show == :chat)\n end",
"def verifySpeakers(url)\n clickPeopleLink()\n clickOnSpeakers()\n verifySpeakersDisplayed()\n refreshPage(url)\n end",
"def on_open\n\n # Must pass a nickname\n if params[:name].nil?\n response << {event: :error, from: :system, at: Time.now, message: \"Error: cannot connect without a nickname!\"}.to_json\n response.close\n return false\n end\n\n # Can't use admin nicknames\n message = {from: '', at: Time.now}\n name = params[:name]\n if (name.downcase.match(/admin|admn|system|sys|administrator/i))\n message[:event] = :error\n message[:message] = \"The nickname '#{name}' is already taken.\"\n response << message.to_json\n params[:name] = false\n response.close\n return\n end\n\n # Welcome user to chat\n message = {from: '', at: Time.now}\n message[:event] = :chat\n response << message.to_json\n message[:message] = \"#{params[:name]} joined the chatroom.\"\n broadcast :_send_message, message.to_json\n # Explain who is here or if your the first one here\n #message[:message] = list.empty? ? \"You're the first one here.\" : \"#{list[0..-2].join(', ')} #{list[1] ? 'and' : ''} #{list.last} #{list[1] ? 'are' : 'is'} already in the chatroom\"\n end",
"def online\n current_user.online!\n render :juggernaut do |page|\n page.go_online current_user\n end\n render :nothing => true \n end",
"def light_the_way\n HisMastersVoice.instance.tell_me(self)\n end",
"def online\n current_user.online!\n render :juggernaut do |page|\n page.go_online User.current\n end\n render :nothing => true \n end",
"def invite_facebook_friends\n end",
"def show\n whatsapp = WhatsApp.new\n whatsapp.line = @message.sender\n whatsapp.url = @message.url\n whatsapp.appname = @message.appname\n whatsapp.token = @message.token\n whatsapp.messageSearch(@message.id, @message.protocol)\n #whatsapp.questionSearch(@message.id, @message.protocol)\n end",
"def argue_with_slackbot(client)\n client.on :message do |data|\n if data.user == \"USLACKBOT\"\n client.web_client.chat_postMessage(\n channel: data.channel, \n text: \"slackbot... what a dweeb.\", \n as_user: true,\n unfurl_links: false,\n unfurl_media: false\n )\n end\n end\n end",
"def calling_speak\n speak\n end",
"def o_ucount_notify\n User.bot.lobby_speak(\"#{linked_name}さんが本日#{today_total_o_ucount}問解きました\")\n end",
"def play socket\n end",
"def start_typing\n API::Channel.start_typing(@bot.token, @id)\n end",
"def gnome_screensaver_status(msg)\n val = msg.params.first\n \n if val == true\n puts \"Detected screenlock by Gnome Screensaver - logging out of Skype.\"\n self.skype_status_offline\n else\n puts \"Detected screenlock unlock by Gnome Screensaver - going online on Skype.\"\n self.skype_status_online\n end\n end",
"def ontopic(topic, msg)\n\n typing = false\n \n a = topic.split('/')\n sender = a.pop\n (sender = a.pop; typing = true) if sender == 'typing'\n\n return if sender == @userid\n \n typing ? onincoming(sender, msg, true) : onincoming(sender, msg)\n\n end",
"def talk(text, name)\n if @os == 'osx'\n `say \"#{ text }\" -v \"#{ name.strip }\"`\n else\n `echo \"#{ text }\" | espeak`\n end\n end",
"def new_bot email, password, room\n counter = Thread.new do\n TT.run do\n client = TT::Client.new(email, password, room: room)\n my_bot = Bot.new(client)\n client.on :user_spoke do |message|\n puts \"**** in :user_spoke message: #{message.content}\"\n my_bot.tell(message.content, message.sender) if message.content.split[0] == client.user.name\n end\n client.on :user_entered do |user|\n my_bot.say_hello user\n end\n client.on :song_started do |song|\n my_bot.bop song\n end\n end\n end\nend",
"def speak_into(msg)\n require 'net/http'\n channel = \"/0001\"\n\n message = {:channel => channel, :data => msg}\n uri = URI.parse(\"http://localhost:#{FAYE_PORT}/faye\")\n begin\n Net::HTTP.post_form(uri, :message => message.to_json)\n rescue Exception => e\n $stderr.puts \"failed to send message to faye server and thus webclient\"\n $stderr.puts e.message\n return false\n end\n true\n end",
"def connect\n say \"NICK #{@botname}\"\n say \"USER #{@botname} 0 * #{@botname}\"\n say \"JOIN #{@channel}\"\n end",
"def play_voicemail_greeting\n user = locate_user(rdnis)\n if user\n play_greeting(user)\n record_voicemail_message(user)\n else\n play \"invalid\"\n end\n end",
"def Speak\r\n\t\tputs \"Ho, ho, ho! Haaappy holidays!\"\r\n\tend",
"def start\n find_or_create_active_call\n response = Twilio::TwiML::Response.new do |r|\n r.Pause\n ready_for_connection?(r)\n r.Say('Please try again later.')\n play_audio(r, 'goodbye')\n end\n\n render_twiml response\n end",
"def perform(data)\n User.find(data[\"user_id\"]).update(status: false, online: false)\n ActionCable.server.broadcast 'chat_channel', content: \"qwertyuiop\"\n end",
"def partner\n @chat_win = ChatWindow.find\n lclick_at(@partner_tab)\n sleep 1\n loop do\n cmd = wait_for_cmd\n if cmd\n response = eval cmd\n @chat_win.say \"#{ACK}#{response}\" \n end\n sleep 1\n end\n end",
"def pbTrainerSpeak(msg, bgm = nil, index = 0)\n # in case the dialogue is a hash for bgm change as well as text display\n file = (msg.is_a?(Hash) && msg.has_key?(:file)) ? msg[:file] : nil\n bgm = msg[:bgm] if msg.is_a?(Hash) && msg.has_key?(:bgm)\n msg = msg[:text] if msg.is_a?(Hash) && msg.has_key?(:text)\n # play specified BGM\n pbBGMPlay(bgm) if !bgm.nil?\n self.custom_bgm = bgm if !bgm.nil?\n # safety check\n if msg.is_a?(Proc)\n wrapper = CallbackWrapper.new\n wrapper.set({\n :battle => @battle, :scene => self, :sprites => @sprites,\n :battlers => @battle.battlers, :opponent => @battle.opponent,\n :viewport => @viewport, :vector => self.vector\n })\n return wrapper.execute(msg)\n end\n return pbBattleCommonEvent(msg) if msg.is_a?(Integer)\n return if !msg.is_a?(String) && !msg.is_a?(Array)\n msg = [msg] if !msg.is_a?(Array)\n # show opponent Trainer on screen\n clearMessageWindow\n pbShowOpponent(index, true, file) if (@battle.opponent && @battle.opponent[index]) || !file.nil?\n # display message\n for m in msg\n @battle.pbDisplayPaused(m)\n end\n clearMessageWindow\n # hide opponent Trainer off screen\n pbHideOpponent(true, true) if (@battle.opponent && @battle.opponent[index]) || !file.nil?\n end",
"def play_user_voicemails\n user = locate_user(callerid)\n if user\n play_voicemails(user)\n else\n play \"invalid\"\n end\n end",
"def send_twitch(event)\n Twitch::update_twitch_streams\n streams = Twitch::active_streams\n\n event << \"Currently active N related Twitch streams #{format_time}:\"\n if streams.map{ |k, v| v.size }.sum == 0\n event << \"None :shrug:\"\n else\n str = \"\"\n streams.each{ |game, list|\n if list.size > 0\n str += \"**#{game}**: #{list.size}\\n\"\n ss = list.take(20).map{ |stream| Twitch::format_stream(stream) }.join(\"\\n\")\n str += format_block(Twitch::table_header + \"\\n\" + ss)\n end\n }\n event << str if !str.empty?\n end\nrescue => e\n lex(e, \"Error getting current Twitch N++ streams.\", event: event)\nend",
"def say_to_existing_session(chan, nick, message)\n omegle = @channels[chan]\n return if not omegle\n\n omegle.typing\n # format message\n output = message\n output = \"<%s> %s\" % [nick, message] if(use_nicks?(chan))\n omegle.send(output)\n rescue Exception => e\n $log.debug(\"Error in omeg_send_#{chan}: #{e}\")\n $log.debug(\"#{e.backtrace.join(\"\\n\")}\")\n end",
"def push_to_online\n transition_to :online\n end",
"def set_online_status\n self.online_status = \"offline\"\n end",
"def twitter\n callback_from :twitter\n end",
"def invite\n if current_user.active_oauth_account.blank?\n session[:inviting_friend] = true\n redirect_to zh? ? \"/auth/weibo\" : \"/auth/facebook\"\n else\n redirect_to current_user.fb_invite_link\n end\n end",
"def online?\n l_seen = last_seen.presence || 1.day.ago\n !chat_invisibility && l_seen >= 25.minutes.ago && (!last_sign_out_at || l_seen > last_sign_out_at)\n end",
"def greetings(user)\n\n @user = user\n @url = 'http://cherry-timely.herokuapp.com'\n mail(to: @user.email, subject: 'Welcome to Timely!')\n end",
"def on_hello(content, client)\n OutputLogger.logger.info \"Bot is online!!!\"\n end",
"def bot_can_respond?(bot, event)\r\n botProfile = bot.profile.on(event.server)\r\n canSpeak = botProfile.permission?(:send_messages, event.channel)\r\n return canSpeak\r\n end",
"def congrats\n\t\tp \"Congrats on Guessing the Word\"\n\tend",
"def checkIfAlreadyOnline\n # check the presence chat channel to see if the current users is subscribed to the channel\n # if the user is then render return true, else return false\n allUsers = Pusher.get('/channels/presence-chat/users')\n allUsers[:users].each do |userHash|\n return true if userHash.first.last == current_user.id.to_s\n end\n return false\n end",
"def setup_bot\n Facebook::Messenger::Profile.set({\n greeting: {\n locale: 'default',\n text: 'Welcome to your friendly Ads Bot! :)' \n },\n get_started: {\n payload: 'GET_STARTED' # make sure to handle this postback\n }\n # @TODO: Add persistent menu\n }, access_token: access_token)\n end",
"def online?\n status == :online\n end",
"def send_status_notification\n message = case @state\n when :hungry then \"I'm hungry!!!\"\n when :sick then \"I'm not feeling so well... :(\"\n when :playful then 'Come play with me!'\n end\n\n DesktopNotifications.notify(message) unless message.nil?\n end",
"def join\n if request_valid?\n request_user.online!\n \n msg = message(\"joined\")\n msg = javascript_chat_message(msg)\n \n # Inform all joined channels that the user has joined\n Juggernaut.send_to_channels(msg, params[:channels])\n \n render :nothing => true\n else\n # Prevent the user from joining the channel if the request is not\n # from a valid session/user combination\n render :text => \"403\", :status => 403\n end\n end",
"def on_connect(*)\n @mplayer_cmd = \"#{config[:mplayer]} -nosound #{config[:url]}\"\n @twitter_client = Twitter::REST::Client.new do |twitter_config|\n twitter_config.consumer_key = config[:twitter_consumer_key]\n twitter_config.consumer_secret = config[:twitter_consumer_secret]\n twitter_config.access_token = config[:twitter_access_token]\n twitter_config.access_token_secret = config[:twitter_access_token_secret]\n end\n end",
"def connected?\n app.speakers.ID(@id).connected.get\n end",
"def play_prog(room_name,msg)\n begin\n @client\n @muc\n\n server = \"jabber.example.com\"\n zid = rand(9999)\n\n @client = Client.new(\"#{server}/#{zid}\")\n# Jabber::debug = true\n @client.connect\n puts @client.supports_anonymous?\n @client.auth_anonymous_sasl\n\n\n @muc = MUC::SimpleMUCClient.new(@client)\n puts \"#{room_name}@conference.#{server}/#{zid}\"\n @muc.join(Jabber::JID.new(\"#{room_name}@conference.#{server}/#{zid}\"))\n\n## tell the tv about the thing\n\n @muc.send(Jabber::Message.new(\"#{room_name}@conference.#{server}/#{zid}\",msg))\n @client.close()\n rescue Exception=>e\n puts e\n puts e.backtrace\n end\n end",
"def online?\n !!@online\n end",
"def set_SkypeID(value)\n set_input(\"SkypeID\", value)\n end",
"def message_on_slack\n\n if !HackumassWeb::Application::SLACK_ENABLED\n flash[:alert] = \"Slack integration disabled. Please enable Slack integration to use this feature.\"\n return\n end\n\n request = MentorshipRequest.find(params[:mentorship_request])\n usr = User.find(request.user_id)\n slack_id = usr.get_slack_id\n if slack_id\n request.status = \"Contacted\"\n request.save\n if HackumassWeb::Application::SLACK_MESSAGE_URL_PREFIX\n redirect_to HackumassWeb::Application::SLACK_MESSAGE_URL_PREFIX + \"/\" + slack_id\n else\n redirect_to usr.get_slack_message_link\n end\n else\n redirect_to request, alert: 'This user is not signed up on slack.'\n end\n end",
"def answer(call)\n cmd = \"ALTER CALL #{call.call_id} ANSWER\"\n r = Skype.send_ :command => cmd\n raise RuntimeError(\"Failed to answer call. Skype returned '#{r}'\") unless r == cmd\n @@calls << call\n end",
"def subscribed?\n self.friendship_status > 0\n end",
"def whatsapp_click_to_chat_url(phone)\n \"https://api.whatsapp.com/send?phone=#{whatsapp_format(phone)}&text&source&data&&lang=#{current_user.language}\"\n end",
"def speak\n \"#{name} says Assalaam alaykum\"\n end",
"def can_listen?\n\t\tprovider.in? [\"facebook\", \"lastfm\"]\n\tend",
"def speak\n puts \"WOOF WOOF\"\n end",
"def online?\n\n require 'open-uri'\n\n begin\n open('http://www.openwfe.org')\n true\n rescue SocketError => se\n false\n end\n end",
"def tender_won(offer)\n @greeting = \"Χαίρετε\"\n @offer = offer\n @user = offer.user\n @procurement = offer.procurement\n\n mail to: @user.email, subject: \"[E-Proc] Your Offer Won.\"\n end",
"def online\n @technician = Technician.find(params[:lawyer_id])\n @technician.is_online = true\n @technician.save\n render \"update_online\"\n end",
"def start_typing(_user)\n PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'start_typing', {source: {id: id}, user: _user.as_basic_json(:now)}, {foreground: true})\n end",
"def check_attendee_slack\n if current_user and HackumassWeb::Application::SLACK_ENABLED and current_user.is_attendee? and !current_user.has_slack?\n redirect_to join_slack_path, alert: 'You will need to join slack before you access our hardware page.'\n end\n end",
"def speak(text)\n @conn.post 'speak.json', :message => {:body => text}\n end",
"def url_desktop_talk\n\t\t\t@data[\"content_urls\"][\"desktop\"][\"talk\"]\n\t\tend",
"def ping()\n # Use the activity client 'client' to invoke the say_hello activity\n pong=client.ping()\n \"Got #{pong}\"\n end",
"def command_online\n SceneManager.call(Scene_OnlinePlayer)\n end",
"def broadcast_state(nick, state)\n #TODO: write function\n #get users clist, get the contacts clists and check their authorization to get the state\n #if its fine -> send the message to their queues\n\n return true\nend",
"def join_on_connect(bot)\n @config[:channels].each{|chan|\n join_channel( bot, chan )\n }\n \n # If we are not required to do anything else, unhook\n if @config[:connect_only] then\n unregister_all(0.5) # Give my hooks half a second to disconnect\n # or unregister_hooks(0.5, :chanman_connect)\n end\n end",
"def diva_service_online!\n unless DivaServicesApi.is_online?\n flash[:error] = \"DIVAServices is currently not reachable. Please stand by until we are able to reconnect.\"\n redirect_to algorithms_path\n end\n end",
"def online_friends\n self.friends_by_me.online + self.friends_for_me.online\n end",
"def msg_send(type)\n\n input_message = {\n \"type\" => \"record-alarm\", # Sensor reading\n \"alarm\" => \"smoke\", # Current time (reading time)\n }.to_json\n\n if type == \"co\"\n input_message = {\n \"type\" => \"record-alarm\", # Sensor reading\n \"alarm\" => \"co\", # Current time (reading time)\n }.to_json\n end\n\n @pubnub.publish(\n :channel => @channel_name,\n :message => input_message,\n :callback => lambda {|message| puts \"Sent Message: message\" +input_message.inspect + \"\\nResponse:\" + message.inspect}\n )\n end",
"def personalChat\n puts \"This is a Personal Chat\"\n # puts message\n end",
"def start_cast_desktop_mirroring(name); end",
"def speak(message, options = {})\n send_message(message)\n end",
"def connect()\n puts \"[#{getTime}]: Ship Bot started\"\n puts \"[#{getTime}]: What twitch channel do you want to connect to?\"\n @channelname = gets.chomp.downcase\n\n puts \"[#{getTime}]: Preparing to connect...\"\n @socket = TCPSocket.new(\"irc.chat.twitch.tv\", 6667)\n puts \"[#{getTime}]: Connected successfully\"\n\n puts \"[#{getTime}]: Authenticating...\"\n @socket.puts(\"PASS #{@oauth}\")\n @socket.puts(\"NICK #{@nickname}\")\n puts \"[#{getTime}]: Successfully authenticated\"\n\n puts \"[#{getTime}]: Joining #{@channelname}...\"\n @socket.puts(\"JOIN #\" + @channelname)\n puts \"[#{getTime}]: Joined #{@channelname}\"\n\n puts \"[#{getTime}]: Requesting permissions...\"\n @socket.puts(\"CAP REQ :twitch.tv/membership\")\n puts \"[#{getTime}]: Permissions granted\"\n puts \"\" #newline\n end",
"def call\n greet\n pick_whiskies\n end",
"def is_online\n return if check_offline_object(@privacypolicy)\n end",
"def play_voicemails(user)\n begin\n latest_status = user.latest_status\n if latest_status\n replies = latest_status.replies\n if replies\n user.latest_status.replies.each_with_index do |tr, index|\n play generate_tts_file('Next Message') if index != 0\n play generate_tts_file(tr.text)\n sleep 2\n end\n else\n play 'vm-no'\n end\n else\n play 'vm-no'\n end\n\n user.voicemails.each_with_index do |voicemail, index|\n unless voicemail.deleted?\n play generate_tts_file('Next Message') if index != 0\n execute 'controlplayback', COMPONENTS.voicemail[\"voicemail_directory\"] + voicemail.file_name\n voicemail.user_read! if voicemail.unread?\n sleep 2\n end\n end\n play 'vm-nomore'\n hangup\n rescue => err\n ahn_log.error err\n end\n end",
"def online?\n\t\tstatus == \"online\"\n\tend",
"def send_chest_fame\n Chest_Service.send_feedback(Chest_Service::FAME, online_chest)\n end",
"def in_a_channel \n unless joined_channel?\n flash[:danger] = \"Please join a channel\"\n redirect_to join_channel_url\n end\n end",
"def shout\n 'Yay!'\n end",
"def ping() \n \"Pong from #{Socket.gethostname}\"\n end",
"def request_to_connect(record, token, opts={subject: 'someone wants to connect with you!'})\n send_mail(record, token, opts, :request_to_connect)\n end",
"def online_friends\n \t friends_by_me.online + friends_for_me.online\n \t end",
"def tick\n while Win32::PeekMessage(@msg, Win32::NULL, 0, 0, Win32::PM_REMOVE) > 0\n Win32::TranslateMessage(@msg)\n Win32::DispatchMessage(@msg)\n end\n\n # Don't simplify this as we rely on false != nil for tribool values\n #noinspection RubySimplifyBooleanInspection\n if @authorized == false\n Skype::Errors::ExceptionFactory.generate_exception(\"ERROR 68\")\n end\n end",
"def online?\n @presence && @presence.type == nil\n end",
"def speak(msg, channel=@channel)\n if @s and not @stfu\n @s.puts \"PRIVMSG #{channel} :\"+2.chr+\"#{msg}\" # 2.chr = bold char in irc\n end\n end",
"def currently_online\n false\n end",
"def send_to_teams_channel\n response = self.class.post(ENV['TEAMS_WEBHOOK'],\n :body => {\"text\" => \"Pincode:- #{@pincode} has some vaccine for 18-45 age group. Try booking now!\"}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n puts response.code\n end",
"def broadcastNP type, data\n\t\t\n\t\[email protected] do |client|\n\t\t\tclient.send type, data\n\t\tend\n\tend"
] | [
"0.6325465",
"0.63063765",
"0.61073524",
"0.5774053",
"0.5738971",
"0.5688078",
"0.5627564",
"0.5548597",
"0.55452466",
"0.5535574",
"0.5525581",
"0.5522469",
"0.5512164",
"0.5508814",
"0.55005",
"0.54268765",
"0.54020166",
"0.53914374",
"0.5383166",
"0.53728586",
"0.5348382",
"0.53335947",
"0.5320056",
"0.53147024",
"0.53133494",
"0.52784705",
"0.5276636",
"0.5264654",
"0.5246396",
"0.52328116",
"0.5227641",
"0.5220972",
"0.5213356",
"0.5172551",
"0.51696265",
"0.5163408",
"0.5152076",
"0.5132057",
"0.5116075",
"0.51127595",
"0.5103075",
"0.5087375",
"0.5083337",
"0.5082963",
"0.5061752",
"0.5057781",
"0.50545037",
"0.50539076",
"0.5049797",
"0.50496775",
"0.50476265",
"0.504665",
"0.5034487",
"0.5032749",
"0.50302124",
"0.5029762",
"0.5027342",
"0.5022866",
"0.5006627",
"0.50002235",
"0.49979052",
"0.4995354",
"0.49914446",
"0.49889877",
"0.49826345",
"0.497451",
"0.49612778",
"0.49535736",
"0.4953508",
"0.49528039",
"0.49505547",
"0.49487033",
"0.49463058",
"0.4944849",
"0.4944295",
"0.4943136",
"0.49428666",
"0.4939891",
"0.49351284",
"0.49275294",
"0.49226806",
"0.49185494",
"0.49070412",
"0.49066302",
"0.49055478",
"0.49035317",
"0.49004576",
"0.49000344",
"0.4892528",
"0.48924014",
"0.48893583",
"0.4888028",
"0.4883001",
"0.48783207",
"0.48734784",
"0.48684838",
"0.48636073",
"0.48606718",
"0.48543987",
"0.48508772"
] | 0.719727 | 0 |
allows addition of new planets via user input | def initialize
@planets = [gallifrey, xander] # initialize hard coded planets
#@planets.push(@new_planet) # adds new planets via user input to planets array
@number_planets = @planets.length #counts planets by counting array elements
@formation_year = rand(-3000000..2015)
@age_of_system = 2015 - @formation_year
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_planet\n\t\tputs \"Would you like to add a planet? Enter Y/N\".colorize(:blue)\n\t\tanswer = gets.chomp.downcase\n\t\tif answer == \"y\"\n\t\t\tputs \"Great! Please enter the name of planet.\"\n\t\t\tname = gets.chomp\n\t\t\tputs \"Now enter the diameter of your planet.\"\n\t\t\tdiameter = gets.chomp\n\t\t\tputs \"What is the mass of your new planet?\"\n\t\t\tmass = gets.chomp\n\t\t\tputs \"How many moons?\"\n\t\t\tmoons = gets.chomp\n\t\t\tputs \"Is there life on your planet? Please enter \\\"Y\\\" or \\\"N\\\".\"\n\t\t\tlife = gets.chomp.downcase\n\t\t\t\tif life == \"y\"\n\t\t\t\t\tlife = true\n\t\t\t\telse \n\t\t\t\t\tlife = false\n\t\t\t\tend\n\t\t\tputs \"Finally, what is the solar rotation of your planet?\"\n\t\t\trotation = gets.chomp\n\t\t\t@new_planet = Planet.new(name: name, diameter: diameter, mass: mass, moons: moons, life: life, rotation: rotation)\n\t\t\[email protected](new_planet)\n\t\t\tputs \"Great! #{name} is born!\".colorize(:blue)\n\t\telse\n\t\t\tputs \"Fine. I didn't want your planets anyway.\".colorize(:blue)\n\t\tend\n\tend",
"def user_add_planet(solar_system)\n print \"What planet do you want to add?\"\n name = gets.chomp\n print \"what is the color of the planet?\"\n color = gets.chomp\n print \"what is the mass in kg of the planet? \"\n mass_kg = gets.chomp.to_i\n print \"what is the distance from the sun for the planet?\"\n distance_sun = gets.chomp.to_i\n print \"what is a fun fact about the planet?\"\n fun_fact= gets.chomp\n\n user_planet = Planet.new(name,color,mass_kg,distance_sun,fun_fact)\n solar_system.add_planets(user_planet)\n\nend",
"def add_planet(solar_system)\n# Ask the user for details about the planet\n print \"Enter the name of the planet: \"\n name = gets.chomp\n name = check_String(name)\n print \"Enter the color of the planet: \"\n color = gets.chomp\n color = check_String(color)\n print \"Enter the mass in kg: \"\n mass_kg = gets.chomp.to_i\n mass_kg = check_number(mass_kg)\n\n print \"Enter the distance from sun in km: \"\n distance_from_sun_km = gets.chomp.to_i\n distance_from_sun_km = check_number(distance_from_sun_km)\n print \"Enter a fun fact: \"\n fun_fact = gets.chomp\n fun_fact = check_String(fun_fact)\n# Create a new instance of Planet with that info\n # binding.pry\n planet_added = Planet.new(name, color, mass_kg, distance_from_sun_km,fun_fact)\n# Add it to the SolarSystem\n solar_system.add_planet(planet_added)\n return solar_system\nend",
"def add_planet (solar_system)\n print\"Enter a planet name: \"\n planet_name = gets.chomp # ask them for the name of the planet they wish to learn about\n planet = solar_system.find_planet_by_name(planet_name)\n if planet.nil?\n # Ask the user for details about the planet (W3.3)\n puts\"What is the planet color? \"\n planet_color = gets.chomp #\n\n puts\"What is the planet mass kg?: \"\n planet_mass = gets.chomp.to_i #\n\n puts\"What is the planet distance from sun? \"\n planet_distance = gets.chomp.to_i #\n\n puts\" What is a fun fact about the planet?\"\n planet_fun_fact = gets.chomp #\n # Create a new instance of Planet with that info, and add to solar_system(W3.3)\n new_planet = Planet.new(planet_name, planet_color, planet_mass, planet_distance, planet_fun_fact)\n solar_system.add_planet(new_planet)\n puts \"Planet added with success!\"\n puts new_planet.summary\n else\n puts \"That planet already exists!\"\n puts planet.summary\n end\nend",
"def add_new_planet our_solar_system\n puts \"Please enter the planet name\"\n planet_name = gets.chomp.capitalize\n print \"Please enter the length of time the planet takes to go around its star in earth days. ➤ \"\n year_length = gets.chomp.to_f.round(2)\n print \"Please enter how far is the planet from the sun in kilometers. ➤ \"\n distance_from_the_sun = gets.chomp.to_f.round(2)\n print \"Please enter the mass of a planet in kilograms. ➤ \"\n mass = gets.chomp\n print \"Please enter a diameter of the planet in kilometers. ➤ \"\n diameter = gets.chomp.to_f.round(2)\n print \"Please enter what is the composition of the atmosphere. ➤ \"\n atmospheric_components = gets.chomp\n\n new_planet = Planet.new(planet_name, year_length, distance_from_the_sun, mass, diameter, atmospheric_components)\n our_solar_system.add_planet(new_planet)\n puts \"New planet #{planet_name} is added.\".red\nend",
"def add_planet(solar_system)\n print \"\\nPlease enter the following details about your planet.\\nPlanet name: \"\n name = gets.chomp\n print \"Planet color: \"\n color = gets.chomp\n print \"Planet mass (kg): \"\n mass = gets.chomp.to_i\n while mass <= 0\n print \"Please enter an integer greater than 0. Planet mass (kg): \"\n mass = gets.chomp.to_i\n end\n print \"Distance from star (km): \"\n distance = gets.chomp.to_i\n while distance <= 0\n print \"Please enter an integer greater than 0. Planet distance from star (kg): \"\n distance = gets.chomp.to_i\n end\n print \"Fun fact: \"\n fact = gets.chomp\n \n new_planet = Planet.new(name, color, mass, distance, fact)\n solar_system.add_planet(new_planet)\nend",
"def add new_planet\n @planets << new_planet\n end",
"def add_planet_from_user\n print \"What is the name of the planet you would like to add? \"\n name = gets.chomp.capitalize\n\n print \"What color is the planet? \"\n color = gets.chomp.downcase\n\n print \"What is the mass of the planet in kilograms? \"\n mass = gets.chomp.to_i\n\n print \"How far away is the planet from the sun in kilometers? \"\n distance = gets.chomp.to_i\n\n print \"Let's add a fun fact about the planet! Complete the sentence. #{name}..\"\n fact = gets.chomp.downcase\n\n new_planet = Planet.new(name, color, mass, distance, fact)\n return new_planet\n end",
"def add_planet(planet_to_add)\n @planets << planet_to_add\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def manual_add_planet(sol)\n puts \"What is the name of the planet? \"\n name = valid_name(gets.chomp)\n puts \"What is the mass(unit: 1e+24 kg) of the planet #{name}?\"\n mass = valid_float(gets.chomp)\n puts \"What is the diameter(unit: km) of the planet #{name}?\"\n diameter = valid_float(gets.chomp).abs\n puts \"How many moons does the planet #{name} have?\"\n number_of_moons = valid_integer(gets.chomp)\n puts \"What is the distance(unit: 1e+6 km) between the sun and the planet #{name}?\"\n distance_from_the_sun = valid_float(gets.chomp).abs\n puts \"What is the rate of the solar rotation for the planet #{name} in Earth hours?\"\n rate_of_solar_rotation = valid_float(gets.chomp)\n puts \"What is the orbital period for the planet #{name} in Earth days?\"\n orbital_period = valid_float(gets.chomp)\n\n sol.add_planet(\n Planet.new(\n {\n name: name,\n mass: mass,\n diameter: diameter,\n number_of_moons: number_of_moons,\n distance_from_the_sun: distance_from_the_sun,\n rate_of_solar_rotation: rate_of_solar_rotation,\n orbital_period: orbital_period\n }\n )\n )\n return sol\nend",
"def add_a_planet(solar_system)\n print \"Please enter the planet name: \"\n name = gets.chomp\n print\"What is #{name}'s color? \"\n color = gets.chomp\n print \"What is the mass of #{name}? \"\n mass_kg = gets.chomp\n print \"What is the #{name}'s distance from the sun? \"\n distance_from_sun_km = gets.chomp\n print \"What's a fun fact about #{name}? \"\n fun_fact = gets.chomp\n new_planet = Planet.new(name, color, mass_kg, distance_from_sun_km, fun_fact)\n solar_system.add_planet(new_planet)\n puts\n return \"Here is the info you entered about this new planet: \\n\" + new_planet.summary\n end",
"def add_new_planet(new_planet)\n @planets.push(new_planet)\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(new_planet)\n new = 0\n @array_of_planets.each do |each_planet|\n if each_planet.name == new_planet.name\n new += 1\n end\n end\n if new == 0\n @array_of_planets << new_planet\n else\n puts \"That planet is already in the solar system!\"\n end\n end",
"def add_planet(new_planet)\n return @planets << new_planet\n end",
"def add_planets\n get_list_of_planets.each {|planet| Planet.new(planet)} \n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def users_created_planet(solar_system)\n puts \"Let's add your planet! We need some information first.\"\n puts \"Please enter the name of your planet.\"\n user_planet = gets.chomp.capitalize\n puts \"What is the color of #{user_planet}?\"\n user_color = gets.chomp.capitalize\n puts \"#{user_color}, how glorious!\"\n puts \"What is the mass, or size of #{user_planet}?\"\n user_planet_size = gets.chomp.to_i\n puts \"Now that we know #{user_planet}'s color, and size, can you tell me how far away it is from you right now?\"\n user_distance = gets.chomp.to_i\n puts \"Perfect. Last info I need to create your planet: what is a fun fact about your planet?\"\n user_fun_fact = gets.chomp\n \n # added new instance of user's planet, along with details\n user_new_planet = Planet.new(user_planet, user_color, user_planet_size, user_distance, user_fun_fact)\n \n # added user's new planet to the solar_system\n solar_system.add_planet(user_new_planet)\nend",
"def user_create_planet(solar_system)\n\tputs \"What is the name of the planet?\"\n\tuser_planet_name = gets.chomp.capitalize\n\n\tputs \"What color is #{user_planet_name}?\"\n\tuser_planet_color = gets.chomp.downcase\n\n\tputs \"What is its mass in kilograms?\"\n\tuser_planet_mass = verify_number(gets.chomp)\n\n\tputs \"What distance is the planet from the sun (in kilometers)?\"\n\tuser_planet_distance = verify_number(gets.chomp)\n\n\tputs \"Can you share a fun fact about #{user_planet_name}?\"\n\tuser_planet_fun_fact = gets.chomp.capitalize\n\n\tuser_planet = Planet.new(user_planet_name,user_planet_color, user_planet_mass,user_planet_distance,user_planet_fun_fact)\n\tsolar_system.add_planet(user_planet)\nend",
"def add_planets(planets)\n planets.each do |planet|\n @planets.push(planet)\n end\n end",
"def add_planet(planet)\n\t\t@planets << planet\n\tend",
"def create_planet\n puts \"\\nPlease input the following information about your new planet:\"\n\n puts \"Name of Planet:\"\n new_planet_name = gets.chomp.capitalize\n\n puts \"Distance from sun (in million km):\"\n new_planet_distance_from_sun = gets.chomp.to_i\n\n puts \"Year length (in days):\"\n new_planet_year_length = gets.chomp.to_i\n\n puts \"Diameter (in km):\"\n new_planet_diameter = gets.chomp.to_i\n\n puts \"Affiliated Zodiac Sign\"\n new_planet_zodiac = gets.chomp.capitalize\n\n puts \"Number of moons:\"\n new_planet_num_moons = gets.chomp.to_i\n\n return Planet.new(new_planet_name, new_planet_distance_from_sun, new_planet_year_length, new_planet_diameter, new_planet_zodiac, new_planet_num_moons)\nend",
"def add_planet(planet)\n # planets = @planets.map { |i| i.name.downcase }\n if @planets.include?(planet.name.downcase)\n raise ArgumentError.new(\"Planet already exists. A solar system cannot have duplicate planets\")\n end\n @planets.push(planet)\n end",
"def add_planet(planet_obj)#parameter\n @planets_list.push(planet_obj)#push method with argument of \"planet_object\"\n puts \"You just added the planet #{planet_obj.name} to the #{\"Juice Box Solar System\"}.\" #what is planet_obj here? hwhere is it pointing?\n end",
"def add_planet(planet)\n @planet << planet\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet_object(new_planet_object)\n @planets_collection.push(new_planet_object)\n end",
"def add_planet(new_planet)\n @planets.push(new_planet)\n return @planets\n end",
"def tk_add\n \"add planet #{id} - 10 #{x} #{y} 0\\n\" +\n \"param #{id} 0 #{size}\\n\" +\n \"param #{id} 1 #{-size}\\n\" +\n \"param #{id} 2 #{color}\\n\" +\n \"param #{id} 3 #{name}\"\n end",
"def add_initial_planets(solar_system)\n earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e16, 'Only planet known to support life')\n cyborg = Planet.new('Cyborg', 'neon green', 10.993e24, 2.496e90, 'Humans have not yet discovered this planet' )\n mars = Planet.new('Mars', 'red', 9.972e24, 2.496e16, 'This planet was named after the Roman god of war')\n solar_system.add_planet(earth)\n solar_system.add_planet(cyborg)\n solar_system.add_planet(mars)\nend",
"def add_item\n\t\tputs \"Welcome to the Jones market\"\n\t\tputs \" \"\n\t\tputs \"please input product name\"\n\t\tproduct_name = gets.chomp\n\t\tputs \"please input the price\"\n\t\tprice = gets.chomp.to_i\n\n\t\tproduct_type(product_name, price)\n\tend",
"def main\n moon = Planet.new('Moon','white', 3.972e24, 1.212e8, 'water-ice on surface')\n earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e8, 'Only planet known to support life')\n mars = Planet.new('Mars', 'red-yellow', 9.972e24, 2.496e8, 'The second largest planet in this solar system')\n solar_system = SolarSystem.new('Sol')\n solar_system.add_planet(earth)\n solar_system.add_planet(moon)\n solar_system.add_planet(mars)\n\n puts \"Welcome to solar_system.\"\n puts \"What to do next?\\n1. List the planet\\n2. Planet details\\n3. Add Planet\\n4. Exit\\n\\n\"\n user_input = gets.chomp.to_i\n\n while user_input != 4\n if user_input == 1\n puts solar_system.list_planets\n puts \"\"\n elsif user_input == 2\n planet_details(solar_system)\n puts \"\"\n elsif user_input == 3\n solar_system = add_planet(solar_system)\n else\n puts \"Invalid input, please enter 1-4 to do the selection.\"\n end\n puts \"What to do next?\\n1. List the planet\\n2. Planet details\\n3. Add Planet\\n4. Exit\\n\\n\"\n user_input = gets.chomp.to_i\n end\nend",
"def build_planet()\n puts \"\\nAdding planet. Please tell me more about this planet.\"\n \n print \"Enter the planet name: \"\n name = gets.chomp.capitalize\n \n print \"\\nEnter the planet color: \"\n color = gets.chomp.downcase\n \n print \"\\nEnter planet mass in kg: \"\n mass_kg = gets.chomp.to_f\n \n print \"\\nEnter planet's distance from the sun in km: \"\n distance_from_sun_km = gets.chomp.to_f\n \n print \"\\nEnter a fun fact about the planet: \"\n fun_fact = gets.chomp\n \n return Planet.new(name, color, mass_kg, distance_from_sun_km, fun_fact)\n end",
"def main\n solar_system = SolarSystem.new('Sol')\n pluto = Planet.new(\"Pluto\", \"Blue\", 1.309e22, 4.67e9,\n \"It's not really a planet!\")\n solar_system.add_planet(pluto)\n earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e8,\n 'Only planet known to support life')\n solar_system.add_planet(earth)\n mars = Planet.new(\"Mars\", \"Red\", 6.39e23, 2.279e8,\n \"We may live on it someday\")\n solar_system.add_planet(mars)\n\n puts \"\\nWould you like to do:\\\n \\n(1) list the planets\\\n \\n(2) learn about planet details\\\n \\n(3) add a planet to the solar system\\\n \\n(4) exit?\"\n action = gets.chomp.downcase\n\n until action == \"exit\" || action.include?(\"4\")\n if action.include?(\"list\") || action.include?(\"1\")\n puts solar_system.list_planets\n elsif action.include?(\"details\") || action.include?(\"2\")\n puts \"\\nName a planet you wish to learn about.\"\n found_planet = solar_system.find_planet_by_name(gets.chomp.capitalize)\n if found_planet == nil\n puts \"This planet is not currently in our system. \" <<\n \"Consider adding this planet.\"\n else\n puts found_planet.summary\n end\n elsif action.include?(\"add\") || action.include?(\"3\")\n puts \"\\nPlease answer the following information:\"\n print \"Name:\"\n name = gets.chomp\n print \"Color:\"\n color = gets.chomp\n print \"Mass in km:\"\n mass = gets.chomp.to_f\n print \"Distance from sun in km:\"\n distance = gets.chomp.to_f\n print \"Fun fact:\"\n fun_fact = gets.chomp\n\n new_planet = Planet.new(name, color, mass, distance, fun_fact)\n solar_system.add_planet(new_planet)\n end\n\n puts \"\\nWould you like to do:\\\n \\n(1) list the planets\\\n \\n(2) learn about planet details\\\n \\n(3) add a planet to the solar system\\\n \\n(4) exit?\"\n action = gets.chomp.downcase\n end\n\nend",
"def create_planet(array_of_planets)\n puts \"Tell us some information about your planet.\"\n print \"Name: \"\n name = gets.chomp\n print \"Length of Year: \"\n year_length = gets.chomp\n print \"Distance from the Sun: \"\n distance_from_sun = gets.chomp\n puts \"We have found that most planets known to humankind share certain characteristics. If the given information is true of your planet, type YES. If its not, give us the correct information for your planet.\"\n puts \"Language: Meowish\"\n language = gets.chomp\n if language == \"YES\"\n language = \"Meowish\"\n else\n language = language\n end\n puts \"Inhabitants: Cats\"\n inhabitants = gets.chomp\n if inhabitants == \"YES\"\n inhabitants = \"Cats\"\n else\n inhabitants = inhabitants\n end\n puts \"Primary Export: Catnip\"\n primary_export = gets.chomp\n if primary_export == \"YES\"\n primary_export = \"Catnip\"\n else\n primary_export = primary_export\n end\n array_of_planets << Planet.new(name, year_length, distance_from_sun, language: language, inhabitants: inhabitants, primary_export: primary_export)\nend",
"def user_planet(solar_system)\n puts \"Your new planet will need a name: \"\n name = gets.chomp\n puts \"Tell me more about planet #{name}! Just hit return (enter) on your keyboard if don't know the value.\"\n puts \"Position from its star (star is position 0): \"\n position = gets.chomp\n puts \"Mass: \"\n mass = gets.chomp\n puts \"Radius: \"\n radius = gets.chomp\n puts \"Orbital Period (days to get around the star once): \"\n orbital_period = gets.chomp\n star = solar_system\n\n user_planet = Planet.new(name, position, mass, radius, orbital_period, star)\n end",
"def define_new_planet\n print \"\\nWhat is the name of the planet? \"\n planet_name = gets.chomp.capitalize\n print \"What is the diameter of #{planet_name} (in miles)? \"\n planet_diameter = gets.chomp.to_i\n print \"What is #{planet_name}'s distance from the sun (in millions of miles): \"\n planet_distance_from_sun = gets.chomp.to_f\n print \"What is the #{planet_name}'s year length (in Earth years)? \"\n planet_year_length = gets.chomp.to_f\n print \"How many moon's does #{planet_name} have? \"\n planet_moons = gets.chomp.to_i\n return new_planet = Planet.new(planet_name, planet_diameter, planet_distance_from_sun, planet_year_length, planet_moons)\nend",
"def add_planet\n planet = Planet.new(get_planet_name, get_planet_distance, get_planet_rotation, get_planet_moons)\n return planet\nend",
"def main\n solar_system = SolarSystem.new('Sol')\n loop do\n # collects input from user\n puts \"Hello, you can choose to list planets, see planet details, add a planet or exit?\"\n puts \"Choose what you would like to do (list / details / exit / add): \"\n input = gets.chomp\n # stop if user decides to exit the program\n break if input == \"exit\"\n # prints a list of planets if the user chooses list -\n # This is where we use instance of solar system using list_planets method\n if input == \"list\"\n planet_list = solar_system.list_planets\n puts planet_list\n\n elsif input == \"details\"\n # This is where we collect name of planet from user\n print \"Name a planet: \"\n planet = gets.chomp.downcase\n # We use find_planet_by_name instance method of Solar System to find planet and print details\n found_planet = solar_system.find_planet_by_name(planet)\n if found_planet\n puts found_planet.summary\n else\n puts \"Planet not found.\"\n end\n end\n # Here we collect new information to add an imaginary new planet\n if input == \"add\"\n print \"Create an imaginary planet. Give your planet a name: \"\n new_planet_name = gets.chomp\n print \"Give your planet a color: \"\n color = gets.chomp\n print \"Give your planet a mass in kg (i.e 6 or 9 ): \"\n mass_kg = gets.chomp.to_i\n print \"Give your planet distance from sun in km (i.e 10 or 8): \"\n distance_from_sun_km = gets.chomp.to_i\n print \"Provide fun fact about your new planet: \"\n fun_fact = gets.chomp\n # adds an imaginary planet to planet list in solar system using the Planet and SolarSystem classes.\n new_planet = Planet.new(new_planet_name, color, mass_kg, distance_from_sun_km, fun_fact)\n solar_system.add_planet(new_planet)\n puts \"#{new_planet.name} has been added to list\"\n end\n end\n\nend",
"def add_list_of_planets(list_of_planets)\n list_of_planets.each do |planet|\n @planets.push(planet)\n end\n end",
"def main\n solar_system = SolarSystem.new('Women of Code')\n\n earth = Planet.new(\"Earth\", \"Green\", 1000, 430, \"It's hot\")\n solar_system.add_planet(earth)\n\n bay = Planet.new(\"Bay\", \"Purple\", 4000, 342, \"Largest flea market capitol of the world\")\n solar_system.add_planet(bay)\n\n sasquatch = Planet.new(\"Sasquatch\", \"Brown\", 3400, 234, \"It's really fuzzy\")\n solar_system.add_planet(sasquatch)\n\n hammock = Planet.new(\"Hammock\", \"Rainbow\", 5646, 642, \"Everyone lives on a Hammock\")\n solar_system.add_planet(hammock)\n\n santa = Planet.new(\"Santa\", \"Ocean\", 1040, 378, \"The fountain of youth lives here\")\n solar_system.add_planet(santa)\n\n #test to check if planet exisist in solar_system\n # santaCruz = Planet.new(\"SantaCruz\", \"Dummy\", 4839, 034, \"There is no place like home\")\n # solar_system.add_planet(santaCruz)\n\n # found_planet = solar_system.find_planet_by_name(\"sdf\")\n # puts found_planet\n # # => #<Planet:0x00007fe7c2868ee8>\n # puts found_planet.summary\n\n #prompt user for what they would like to do in the SolarSystem program\n puts \"Please select what you would like to learn about Women of Code Solar System by number ex.(1)\"\n puts \"1. List Planets\\n2. Add Your Own Planet\\n3. Exit\"\n print \"Number: \"\n user_input = gets.chomp.to_i\n puts\n\n #selections of option based on user reponse\n #The number 3 will exit the program\n until user_input == 3\n\n #slection 1 prints the planets listed in solar_system\n if user_input == 1\n list = solar_system.list_planets\n puts list\n\n #prompt user to type the planet they are intersted in looking up\n #if planet is found the summary of the planet will be printed\n #reprompt user is the there input does not match a planet in the solar_system\n puts \"What Planet would you like to learn about? Please type your planet ex(Earth).\\n\\n\"\n print \"Planet: \"\n planet = gets.chomp\n found_planet = solar_system.find_planet_by_name(planet)\n if found_planet.class == Planet\n puts found_planet.summary\n end\n\n #user adds a planet to the solar_system program\n elsif user_input == 2\n puts \"What would you like to name your planet?\"\n name = gets.chomp\n puts \"What color(s) is your planet?\"\n color = gets.chomp\n puts \"Your planet Mass in Kg:\"\n mass_kg = gets.chomp\n puts \"Distance from the Sun\"\n distance_from_sum_km = gets.chomp\n puts \"Fun Facts\"\n fun_fact = gets.chomp\n\n new_planet = Planet.new(name, color, mass_kg, distance_from_sum_km, fun_fact)\n #stores planet in solar_system program for user to recall until they exit\n solar_system.add_planet(new_planet)\n end\n\n #reprompt user until they exit\n puts \"\\nPlease select what you would like to learn about Women of Code Solar System\"\n puts \"1. List Planets\\n2. Add Your Own Planet\\n3. Exit\"\n print \"Number: \"\n user_input = gets.chomp.to_i\n end\nend",
"def planet_add(planet)\n @planets.push(planet)\n return @planets\n end",
"def planet_add(planet)\n @planets.push(planet)\n return @planets\n end",
"def add_planet_object(new_planet_object)\n @solar_system.push(new_planet_object)\n end",
"def add_planets(planet)\n @planets << planet\n return @planets\n end",
"def create_user_planet\n puts \"What do you call your planet?:\"\n user_planet_name = gets.chomp\n\n puts \"What is the radius of your planet?:\"\n user_planet_radius = gets.chomp\n\n puts \"What is the length of day for #{user_planet_name}?:\"\n user_planet_lod = gets.chomp\n\n puts \"How far away is #{user_planet_name} from the sun?:\"\n user_planet_distance_sun = gets.chomp\n\n puts \"What is the year length?:\"\n user_planet_year_length = gets.chomp\n\n\n puts \"What is the mass for #{user_planet_name}?:\"\n user_planet_mass = gets.chomp\n\n user_planet = Planets.new(user_planet_name, user_planet_radius, user_planet_lod, user_planet_distance_sun, user_planet_year_length, user_planet_mass)\nreturn user_planet\nend",
"def create\n\n new_hash = params.require(:planet).permit(:name, :image_url, :diameter, :mass, :life)\n new_planet = Planet.create(new_hash)\n redirect_to \"/planets/#{new_planet.id}\"\n end",
"def new_planet(planet)\n @planets[planet.name] = planet\n end",
"def main\n xandar = Planet.new(\"XANDAR\",\"aquamarine powder blue\", 6.39e23, 2.279e8,\n \"It's been known to host living creatures that are closely related to smurfs\")\n onurb = Planet.new(\"ONURB\", \"shades of lemon, light salmon, and honeydew\",\n 1.898e27, 7.785e8, \"It does not have a true surface, as the planet is mostly swirling gases and liquids\")\n\n solar_system = SolarSystem.new(\"Anirtak\")\n solar_system.add_planet(xandar)\n solar_system.add_planet(onurb)\n\n # loop until user quits\n user_play = \"Y\"\n while user_play == \"Y\"\n print \"Enter A, B, C, D or Q: \"\n user_input = gets.chomp.strip.upcase\n while user_input !='A' &&\n user_input != 'B' &&\n user_input != 'C' &&\n user_input != 'D' &&\n user_input != 'Q'\n print \"EEP. Please try again: \"\n user_input = gets.chomp.strip.upcase\n end\n list = solar_system.list_planets\n\n if user_input == 'A'\n puts list\n\n elsif user_input == 'B'\n puts \"Let's begin our wild adventure! \"\n puts \"What planet would you like to learn about?\"\n puts list\n print \"Please enter the name of the planet: \"\n user_planet = gets.chomp.strip.upcase\n found_planet = solar_system.find_planet_by_name(user_planet)\n\n if found_planet\n puts \"Your choice is OUT OF THIS WORLD! Here's everything you need to know about #{found_planet.name}\"\n puts found_planet.summary\n end\n\n elsif user_input == 'C'\n puts \"Let's make a planet!\"\n print \"What is the name of the planet? \"\n new_planet_name = gets.chomp.strip.upcase\n\n print \"What is #{new_planet_name}'s color: \"\n new_planet_color = gets.chomp.strip\n\n print \"What is #{new_planet_name}'s mass in kg? \"\n new_planet_mass = gets.chomp.strip.to_f\n while new_planet_mass <= 0 || new_planet_mass.to_s == \"0.0\"\n puts \"Invalid, please enter a positive number\"\n print \"What is #{new_planet_name}'s mass in kg? \"\n new_planet_mass = gets.chomp.strip.to_f\n end\n\n print \"What is #{new_planet_name}'s distance from the sun in km? \"\n new_planet_distance_sun = gets.chomp.strip.to_f\n while new_planet_distance_sun <= 0 || new_planet_distance_sun.to_s == \"0.0\"\n puts \"Invalid, please enter a positive number\"\n print \"What is #{new_planet_name}'s distance from the sun in km? \"\n new_planet_distance_sun = gets.chomp.strip.to_f\n end\n\n print \"What is a fun fact about #{new_planet_name}? \"\n new_planet_fact = gets.chomp.strip\n\n new_planet = Planet.new(new_planet_name, new_planet_color, new_planet_mass,\n new_planet_distance_sun, new_planet_fact)\n solar_system.add_planet(new_planet)\n\n elsif user_input == 'D'\n puts list\n puts \"Please choose two planets from the above list\"\n print \"Please enter the name of the first planet: \"\n user_first_planet = gets.chomp.strip.upcase\n print \"Please enter the name of the second_planet: \"\n user_second_planet = gets.chomp.strip.upcase\n\n first_user_planet_found = solar_system.find_planet_by_name(user_first_planet)\n second_user_planet_found = solar_system.find_planet_by_name(user_second_planet)\n\n if first_user_planet_found && second_user_planet_found\n puts solar_system.distance_between(first_user_planet_found, second_user_planet_found)\n end\n\n elsif user_input == 'Q'\n puts \"Thank you for playing! Come back again for another adventure!\"\n puts\n exit\n end\n\n puts \"Would you like to keep exploring (Y/N)?\"\n user_play = gets.chomp.upcase\n end\n\n puts \"Thank you for playing! Come back again for another adventure!\"\n exit\nend",
"def cli_planet_details (solar_system)\n print\"Enter a planet name: \"\n planet_name = gets.chomp # ask them for the name of the planet they wish to learn about\n planet = solar_system.find_planet_by_name(planet_name)\n if planet.nil?\n puts \"This planet isn't in our system, if you want to add you it, chooe the option 3 below!\"\n else\n puts planet.summary\n end\nend",
"def generate_planet\n puts \"\\nLet's create a planet from scratch.\"\n print \"Please enter its name first: \"\n name = gets.chomp\n print \"What's its diameter of this planet in km? \"\n diameter = gets.chomp.to_f\n print \"What's its mass in kg? (example of input format: 3.30 x 10^23 ) \"\n mass = gets.chomp\n print \"What's the year length of this planet in days? \"\n yr_length = gets.chomp.to_f\n print \"What's the distance from the sun to this planet in km? \"\n dis_from_sun = gets.chomp.to_f\n print \"How many moons does this planet have? Enter 0 if there is none. \"\n moons = gets.chomp.to_i\n planet = Planet.new({\"name\" => name, \"diameter\" => diameter, \"mass\" => mass, \"yr_length\" => yr_length, \"dis_from_sun\" => dis_from_sun, \"moons\" => moons})\n return planet\nend",
"def add_to_trolley(trolley, product_to_add)\n trolley << product_to_add\n puts \"\\n#{input[0]} (x#{input_qty}) successfully added to trolley!\"\nend",
"def add_planet_by_name(name)\n planet = get_space_body_by_name(name)[0]\n Planet.new(planet)\n end",
"def initialize(input_planets)\n puts input_planets\n @planets = input_planets\n # input_planets is the parameter\n # these thinsg don't have to be the same\n end",
"def planet_params\n params.require(:planet).permit(:name)\n end",
"def planets; end",
"def create\n @planet = Planet.new(planet_params)\n\n respond_to do |format|\n if @planet.save\n format.html { redirect_to @planet, notice: 'Planet was successfully created.' }\n format.json { render :show, status: :created, location: @planet }\n else\n format.html { render :new }\n format.json { render json: @planet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @planet = Planet.new(planet_params)\n\n respond_to do |format|\n if @planet.save\n format.html { redirect_to @planet, notice: 'Planet was successfully created.' }\n format.json { render :show, status: :created, location: @planet }\n else\n format.html { render :new }\n format.json { render json: @planet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_planet\n new_planet ={}\n\n print \"\\nWhat is the name of the planet? \"\n new_planet[:name] = gets.chomp.downcase\n\n print \"How old is #{new_planet[:name].each_first_letters} in Earth years? \"\n new_planet[:age] = gets.chomp.to_i\n\n print \"What is the size of #{new_planet[:name].each_first_letters}? \"\n new_planet[:size] = gets.chomp\n\n print \"How many visitors does #{new_planet[:name].each_first_letters} get? \"\n new_planet[:visitor_count] = gets.chomp\n\n print \"Who or what are #{new_planet[:name].each_first_letters} inhabitants? \"\n new_planet[:inhabitants] = gets.chomp\n\n new_planet = Planet.new(new_planet)\n\n return new_planet\nend",
"def create\n @backend_planet = Backend::Planet.new(params[:backend_planet])\n\n respond_to do |format|\n if @backend_planet.save\n format.html { redirect_to @backend_planet, notice: 'Planet was successfully created.' }\n format.json { render json: @backend_planet, status: :created, location: @backend_planet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @backend_planet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def users_planet\n\n puts \"Please enter the name of your planet.\"\n user_planet_name = gets.chomp\n\n puts \"Please enter its volume.\"\n user_planet_volume = gets.chomp\n\n puts \"Is your planet solid?\"\n user_planet_solid = gets.chomp\n\n puts \"Please enter its diameter.\"\n user_planet_diameter = gets.chomp\n\n puts \"Please enter the time it takes to orbit its sun.\"\n user_planet_orbit_time = gets.chomp\n\nend",
"def create\n @planet_type = PlanetType.new(planet_type_params)\n\n respond_to do |format|\n if @planet_type.save\n format.html { redirect_to @planet_type, notice: 'Planet type was successfully created.' }\n format.json { render :show, status: :created, location: @planet_type }\n else\n format.html { render :new }\n format.json { render json: @planet_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n Planet.create(\n name: params[:name],\n image: params[:image],\n orbit: params[:orbit],\n diameter: params[:diameter],\n mass: params[:mass],\n moons: params[:moons]\n )\n\n # Create actions have no template of their own, and we also\n # want to avoid accidental form resubmission; so we redirect\n redirect_to( planets_path ) # /planets\n\n end",
"def main\n solar_system = SolarSystem.new('Sun')\n\n earth = Planet.new('Earth', 'blue-green', 5.972e24, '149.6 mil', 'Only planet known to support life')\n solar_system.add_planet(earth)\n\n mars = Planet.new('Mars', 'red', 6.39e23, '227.9 mil', 'Second smallest planet in the solar system')\n solar_system.add_planet(mars)\n\n venus = Planet.new('Venus', 'red-brown', 4.867e24, '108.2 mil', 'Second brightest object in the night sky')\n solar_system.add_planet(venus)\n\n\n options = [\"add planet\", \"planet details\", \"list planets\", \"exit\"]\n\n puts \"What would you like to do?\"\n puts \"Please choose from the following options:\"\n puts options\n command = gets.chomp.downcase\n\n while options.include? command\n case command\n when \"add planet\"\n puts solar_system.new_planet\n when \"planet details\"\n puts solar_system.planet_details.summary\n when \"list planets\"\n puts solar_system.list_planets\n when \"exit\"\n exit\n end\n\n puts \"What would you like to do next?\"\n command = gets.chomp.downcase\n end\nend",
"def pick_a_planet\n display_planet = nil\n puts \"\\nPlease choose from the following list of planets.\"\n planet_names = []\n @planets.each do |planet| # gets the names of the planets that currently exist in solar system\n planet_names << planet.name\n end\n puts planet_names\n\n # get planet choice and validate\n print \"\\nWhich planet would you like to \\\"learn\\\" more about? \"\n planet_choice = gets.chomp.capitalize\n planet_choice = planet_choice.gsub(\" \", \"\")\n while !planet_names.include? planet_choice\n print \"Sorry, which planet? \"\n planet_choice = gets.chomp.capitalize\n end\n\n # print the planet info for the chosen planet\n @planets.each do |planet|\n if planet.name == planet_choice\n puts planet.print_planet_data\n end\n end\n\n continue_or_quit\n end",
"def planet_params\n params.require(:planet).permit(:name, :distance_from_earth, :nearest_star)\n end",
"def valid_entry(solar_system)\n print 'Select a planet: '\n planet_number = gets.chomp\n\n # If user does not enter a valid name or number they will be prompted to enter again.\n until (planet_number.to_i.to_s == planet_number) && (planet_number.to_i <= solar_system.planets.length && planet_number.to_i > 0)\n print 'Please select a valid number to represent a planet: '\n planet_number = gets.chomp\n end\n planet_number = planet_number.to_i - 1\n planet_number\nend",
"def main \n\tsolar_system = SolarSystem.new('Sol')\n\n\tearth = Planet.new('Earth', 'blue-green', 5.972e24, 4.769e9, 'Only planet known to support life')\n\tsolar_system.add_planet(earth)\n\n\tvenus = Planet.new('Venus', 'White', 6.392e24, 2.982e9, 'Sister planet to Earth')\n\tsolar_system.add_planet(venus)\n\n\tputs \"What action would you like to take?\"\n\tuser_control = gets.chomp.downcase\n\t\n\t# Prompts user for options until they choose to exit\n\tuntil user_control == 'exit'\n\t\tcase user_control\n\t\twhen 'list planets'\n\t\t\tputs solar_system.list_planets\n\t\twhen 'planet details'\n\t\t\tdisplay(solar_system)\n\t\twhen 'add planet'\n\t\t\tuser_create_planet(solar_system)\n\t\twhen 'find distance'\n\t\t\tdisplay_distance_between(solar_system)\n\t\telse\n\t\t\tputs \"Please enter a valid option.\"\n\t\tend\n\t\t\n\t\tputs \"What action would you like to take next?\"\n\t\tuser_control = gets.chomp.downcase\n\tend\n\nend",
"def planet_params\n params.require(:planet).permit(:name, :rotation_period, :orbital_period, :diameter, :climate, :gravity, :terrain, :surface_water, :population)\n end",
"def planet_details(solar_system)\n solar_names = []\n solar_system.planets.each_with_index do |item, i|\n puts \"#{i+1}. #{item.name}\"\n solar_names.push(item.name.downcase)\n end\n\n print \"Please enter the name of the planet you to know the details: \"\n planet_picked = gets.chomp.downcase\n\n while !solar_names.include?(planet_picked)\n puts \"Invalid planet name. \"\n print \"Please enter the name of the planet you to know the details: \"\n planet_picked = gets.chomp.downcase\n end\n\n result = solar_system.find_planet_by_name(planet_picked).summary\n puts result\nend",
"def add\n\t\tputs \"\\nEnter the name of the item you would like to add:\"\n\t\tnew_item = gets.chomp\n\t\tputs \"\\nHow many #{new_item} would you like?\"\n\t\tnew_qty = gets.chomp\n\t\t@grocery_list.add(new_item, new_qty)\n\t\tputs \"\\nAdding #{new_item} to list...\"\n\t\tputs \"#{new_qty} #{new_item} were added to your Grocery List!\"\n\tend",
"def planet_params\n params.require(:planet).permit(:name, :life, :moons, :image, :star_id, :galaxy_id, :description, :category)\n end",
"def addProduct\n p = Product.new\n\n print \"\\n\\nEnter Product Name : \"\n p.name = gets.chomp\n\n print \"Enter per unit Price of #{p.name} : \"\n p.price = gets.to_i\n\n print \"Enter initial Number of units of #{p.name} to Add : \"\n p.units = gets.to_i\n\n print \"Enter Minimum Stock units for #{p.name} : \"\n p.min_stock = gets.to_i\n \n print \"Enter Maximum Stock units for #{p.name} : \"\n p.max_stock = gets.to_i\n\n if (p.min_stock <= p.units) and (p.units <= p.max_stock) and (p.min_stock < p.max_stock)\n @@products << p\n puts \"\\n Cool. Product details have been saved Successfully.\\n\\n\"\n p.getProdbyName(p.name)\n else\n puts \"\\n Oops! Something went wrong while Registering the Product.\"\n puts \"Looks like initial no. of Units dont fall in the range of Min and Max Stocks or Min Stock units exceed the Max Stock units.\"\n puts \" Please give it a retry with Proper entries.\"\n end\n end",
"def show_planets our_solar_system\n all_planets = our_solar_system.planets\n puts \"Choose which planet:\"\n all_planets.length.times do |index|\n puts \"#{index+1}: #{all_planets[index].name}\"\n end\n puts \"Which planet info you want\"\n planet_choice = gets.chomp.to_i\n if planet_choice >=1 && planet_choice <= all_planets.length\n # Display all the planet objects in array.\n puts all_planets[planet_choice - 1].print_planet_info\n # Local variable which is assigned the planet that is selected\n choosen_planet = all_planets[planet_choice -1]\n all_planets.length.times do |index|\n # Skips the selected planet\n if planet_choice - 1 != index\n # Output the distance from other planet.\n puts \"✹ The distance from #{all_planets[index].name} is #{choosen_planet.distance_from_the_planet(all_planets[index])} km.\".bold\n puts \"\"\n end\n end\n end\nend",
"def add_new_input(db)\n\tputs \"-\" * 50\n\tputs \"Add New Horse Information: \"\n\tprint \"Name: \"\n\thorse_name = gets.split.map(&:capitalize).join(' ')\n\tprint \"Breed: \"\n\thorse_breed = gets.split.map(&:capitalize).join(' ')\n\tprint \"Color: \"\n\thorse_color = gets.split.map(&:capitalize).join(' ')\n\tprint \"Age: \"\n\thorse_age = gets.to_i\n\tprint \"Rideable (y/n): \"\n\thorse_rideable_input = gets.chomp.downcase\n\tif horse_rideable_input == \"y\"\n\t\thorse_rideable = \"true\"\n\telse\n\t\thorse_rideable = \"false\"\n\tend\n\tadd_new(db, horse_name, horse_breed, horse_color, horse_age, horse_rideable)\nend",
"def run_solar_system_program(solar_system)\n # method outside of any class that takes user input to create a new planet\n # then add it to the solar system\n def create_planet(solar_system)\n puts \"Alright! What is the name of your planet?\"\n name = gets.chomp.capitalize\n puts \"How many moons does #{name} have?\"\n moons = gets.chomp\n puts \"How many Earth years does it take to revolve around its star?\"\n year_length = gets.chomp\n puts \"How far is #{name} from its star in million miles? Please enter a number.\"\n distance_from_sun = gets.chomp\n puts \"How much mass does the planet have in kg?\"\n mass = gets.chomp\n puts \"What is the diameter measured in miles?\"\n diameter = gets.chomp\n puts \"Finally, does its name relate to any mythological dieties?\"\n diety = gets.chomp\n new_planet = {name: name, moons: moons, year_length: year_length, distance_from_sun: distance_from_sun, mass: mass, diameter: diameter, diety: diety}\n solar_system.add_planet(Planet.new(new_planet))\n end\n # method to select planet then print its attributes\n def planet_choice_and_details(the_solar_system)\n puts \"What planet would you like to learn about? Please enter the name.\"\n puts the_solar_system.return_planets\n planet_name = gets.chomp\n decoration\n puts the_solar_system.planet_information(planet_name)\n end\n\n # method to confirm user interest to continue\n # and give them opportunity to do another action\n def continue?\n decoration\n puts \"Do you want to learn about another planet? y or n?\"\n puts \"Or would you like to add your own planet? Enter any other key.\"\n yes_or_no = gets.chomp.downcase\n decoration\n return yes_or_no\n end\n\n # start of program that introduces the solar system and prompt user\n puts \"Welcome to this program about the #{solar_system.name}.\"\n puts \"The #{solar_system.name} is #{solar_system.solar_age} billion Earth years old.\"\n puts decoration\n puts \"Are you ready to learn about some planets? y or n\"\n puts \"Or would you like to add your own planet? Enter any other key.\"\n start_learning = gets.chomp.downcase\n decoration\n # loop the determines what the program does:\n # 1. presents list of planets and a chosen planets detailed_summary\n # 2. add a new planet to solar system\n # 3. ends program\n until start_learning == \"n\"\n if start_learning == \"y\"\n planet_of_choice = planet_choice_and_details(solar_system)\n start_learning = continue? # calling method to determine next step in program\n decoration\n elsif start_learning != \"n\"\n create_planet(solar_system)\n start_learning = continue? # calling method again\n decoration\n end\n end\n puts \"Bye now, go out and discover the stars.\"\nend",
"def add_item\n\t puts \"What is the name of the item you'd like to add?\"\n\t\t@item_name = gets.chomp\n\t\tputs \"And how many?\"\n\t\t@quantity = gets.chomp.to_i\n\t\tif @quantity <= 0\n\t\t puts \"Please enter a number higher than 0.\"\n\t\t puts \"(Also, must be '1' not 'one'.)\"\n\t\telse\n\t\t @grocery_list[@item_name] = @quantity\n\t\tend\n\t\tget_item\n\tend",
"def planet_type_params\n params.require(:planet_type).permit(:name)\n end",
"def have_planets(options={})\n options.assert_valid_keys(:count)\n\n options.reverse_merge! :count => 1\n @objectives.push([\n Objective::HavePlanets,\n {:key => PLANET_KEY, :count => options[:count]}\n ])\n end",
"def create(data)\n @planet_model.create(data)\n end",
"def create\n @galaxy = Galaxy.find_by(params[:galaxy_id])\n @star = Star.find_by(id: params[:star_id])\n @planet = @star.planets.new(planet_params)\n\n respond_to do |format|\n if @planet.save\n format.html { redirect_to galaxy_star_path(@galaxy, @star), notice: 'Planet was successfully created.' }\n format.json { render :show, status: :created, location: @planet }\n else\n format.html { render :new }\n format.json { render json: @planet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n curr_planet = Planet.find(params[:id])\n curr_planet.update(params.require(:planet).permit(:name, :image_url, :diameter, :mass, :life))\n redirect_to \"/planets/#{curr_planet.id}\"\n end",
"def add_new_item(current_list)\r\n puts \"Enter a new item: \"\r\n new_item = gets.chomp\r\n \r\n puts \"Enter quantity: \"\r\n new_item_qty = gets.chomp\r\n \r\n if new_item_qty.is_a? Integer\r\n new_item_qty = new_item_qty.to_i\r\n elsif new_item_qty == nil\r\n new_item_qty = 0\r\n else\r\n puts \"Not a number! Enter a digit: \"\r\n new_item_qty = gets.chomp\r\n new_item_qty = new_item_qty.to_i \r\n end\r\n \r\n current_list[new_item] = new_item_qty\r\n \r\n current_list\r\nend",
"def create\n @planets_exoplanet = Planets::Exoplanet.new(params[:planets_exoplanet])\n\n respond_to do |format|\n if @planets_exoplanet.save\n format.html { redirect_to @planets_exoplanet, :notice => 'Exoplanet was successfully created.' }\n format.json { render :json => @planets_exoplanet, :status => :created, :location => @planets_exoplanet }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @planets_exoplanet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_pet_to_stock(pet_shop, new_pet)\n num_of_pets = pet_shop[:pets].length\n if num_of_pets < 7\n pet_shop[:pets] << {\n name: \"Seventh One\",\n pet_type: :elephant,\n breed: \"Big eared one\",\n price: 500\n }\n end\nend",
"def spAdd\n provider_name = $prompt.ask('Provider Name:')\n provider_phone = $prompt.ask('Provider Phone Number:')\n $all_sp.push(ServiceProvider.new(provider_name, provider_phone, [], {}, []))\n successPrint()\n end",
"def initialize(some_planets, name, solar_age)\n @planets = some_planets\n @name = name\n @solar_age = solar_age\n end",
"def createCarpool\n puts \"Create a New Carpool\"\n print \"Name: \"\n name = gets.strip\n\n print \"Type (school, personal, work): \"\n type = gets.strip\n\n puts \"\\n\\n\"\n @carpools << Carpool.new(name, type)\n puts \"Creating carpool #{name}\"\n\n # Back to Main Menu\n mainMenu()\nend",
"def add_computer\n puts(\"Enter a unique player name.\")\n name = gets.chomp\n @player_list.append(Player.new(\"Computer\"))\n @player_list.append(Player.new(name))\n\n end"
] | [
"0.77926093",
"0.7662715",
"0.7625709",
"0.7587153",
"0.75847554",
"0.75192356",
"0.7412618",
"0.73809373",
"0.7355027",
"0.731311",
"0.731311",
"0.731311",
"0.731311",
"0.72560114",
"0.7239589",
"0.717869",
"0.70506656",
"0.6970573",
"0.6950583",
"0.6935959",
"0.6913078",
"0.6913078",
"0.6913078",
"0.6913078",
"0.6913078",
"0.6900558",
"0.6886533",
"0.68730223",
"0.6870911",
"0.68364096",
"0.68309486",
"0.68084",
"0.67372715",
"0.67364",
"0.67364",
"0.67364",
"0.67364",
"0.66860825",
"0.6669845",
"0.6610284",
"0.6607562",
"0.6600954",
"0.65936756",
"0.6582723",
"0.65540594",
"0.6547486",
"0.6528887",
"0.6503378",
"0.64941126",
"0.6483636",
"0.6473442",
"0.6461563",
"0.6458898",
"0.6458898",
"0.6449741",
"0.641039",
"0.63756067",
"0.62950325",
"0.6216187",
"0.6214849",
"0.61963487",
"0.6193697",
"0.6170567",
"0.6095571",
"0.607223",
"0.60562044",
"0.6040249",
"0.60336953",
"0.60336953",
"0.60253227",
"0.6019508",
"0.60130787",
"0.5972736",
"0.59669775",
"0.59620285",
"0.5900902",
"0.58888084",
"0.5866416",
"0.585961",
"0.58394223",
"0.5831891",
"0.58305264",
"0.58134437",
"0.5800565",
"0.5799014",
"0.57927984",
"0.57865155",
"0.5727395",
"0.5705131",
"0.56984013",
"0.5681527",
"0.56689674",
"0.5667596",
"0.5659308",
"0.5638955",
"0.5625091",
"0.5597825",
"0.5577024",
"0.5575384",
"0.5572169"
] | 0.56150377 | 96 |
optional user input section, can be expanded to condiational loops for all planet info | def add_planet
puts "Would you like to add a planet? Enter Y/N".colorize(:blue)
answer = gets.chomp.downcase
if answer == "y"
puts "Great! Please enter the name of planet."
name = gets.chomp
puts "Now enter the diameter of your planet."
diameter = gets.chomp
puts "What is the mass of your new planet?"
mass = gets.chomp
puts "How many moons?"
moons = gets.chomp
puts "Is there life on your planet? Please enter \"Y\" or \"N\"."
life = gets.chomp.downcase
if life == "y"
life = true
else
life = false
end
puts "Finally, what is the solar rotation of your planet?"
rotation = gets.chomp
@new_planet = Planet.new(name: name, diameter: diameter, mass: mass, moons: moons, life: life, rotation: rotation)
@planets.push(new_planet)
puts "Great! #{name} is born!".colorize(:blue)
else
puts "Fine. I didn't want your planets anyway.".colorize(:blue)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_planet\n puts \"Hello! What planet do you want to learn about?\"\n puts \"Select 1:Mercury, 2:Venus, 3:Earth, 4:Mars, 5:Jupiter, 6: Saturn, 7:Uranus, 8:Neptune, 9:Pluto, 10:Exit\"\n while user_input = gets.chomp.downcase\n if user_input == \"1\"\n puts \"Mercury, Mass: 0.330 e24 kg, Diameter: 4879 km, Distance_from_Sun: 57.9 e6 km, Num_Moons: 0, Gravity: 3.7, Year_Length: 88.0 days\"\n elsif user_input == \"2\"\n puts \"Venus: Mass: 4.87 10e24kg, Diameter: 12,104 km, Distance_from_Sun: 108.2 e6km, Num_Moons:0, Gravity: 8.9, Year_Length: 224.7\"\n elsif user_input == \"3\"\n puts \"Earth: Mass: 5.97 e24kg, Diameter: 12,756 km, Distance_from_Sun: 149.6 e6km, Num_Moons:1, Gravity: 9.8, Year_Length: 365.2 days\"\n elsif user_input == \"4\"\n puts \"Mars: Mass: 0.642 e24kg, Diameter: 6792 km, Distance_from_Sun: 227.9 e6km, Num_Moons:2, Gravity: 1.6, Year_length: 687.0 days\"\n elsif user_input == \"5\"\n puts \"Jupiter: Mass: 1898 e24kg, Diameter: 142,984 km, distance_from_Sun: 778.6 e6km, Num_Moons:67, Gravity: 23.1, Year_length: 4331 days\"\n elsif user_input == \"6\"\n puts \"Saturn: Mass: 568 e24kg, Diameter: 120536 km, Distance_from_Sun: 1433.5 e6km, Num_Moons:62, Gravity: 9.0, Year_length: 10747 days.\"\n elsif user_input == \"7\"\n puts \"Uranus: Mass: 86.8 e24kg, Diameter: 511 km, Distance_from_Sun: 2872.5 e6km, Num_Moons:27, Gravity: 8.7, Year_Length: 30589 days\"\n elsif user_input == \"8\"\n puts \"Neptune: Mass: 102 e24kg, Diameter: 49528 km, Distance_from_Sun: 4495.1 e6km, Num_Moons:14, Gravity: 11.0, Year_Length: 59800 days\"\n elsif user_input == \"9\"\n puts \"Pluto: Mass: 0.014 6e24kg, Diameter: 2370 km, Distance_from_Sun: 5906.4 e6km, Num_Moons:5, Gravity: 0.7, Year_Length: 90560 days\"\n elsif\n user_input == \"10\"\n puts \"Hope you enjoyed learning about planets, GOOD-BYE\"\n break\n end\n end\n end",
"def cli_planet_details (solar_system)\n print\"Enter a planet name: \"\n planet_name = gets.chomp # ask them for the name of the planet they wish to learn about\n planet = solar_system.find_planet_by_name(planet_name)\n if planet.nil?\n puts \"This planet isn't in our system, if you want to add you it, chooe the option 3 below!\"\n else\n puts planet.summary\n end\nend",
"def planet_choice_and_details(the_solar_system)\n puts \"What planet would you like to learn about? Please enter the name.\"\n puts the_solar_system.return_planets\n planet_name = gets.chomp\n decoration\n puts the_solar_system.planet_information(planet_name)\n end",
"def show_planet_info(planets)\n done = false\n until done == true\n puts \"Here are the available planets.\"\n planets.each_with_index do |element, index|\n puts \"#{index + 1}. #{element.name}\"\n end\n puts \"#{planets.length + 1}. Exit\"\n puts \"\\nWhich # would you like to learn more about?\"\n input = gets.chomp.to_i\n if (1..planets.length).include? input\n info = planets[input - 1].get_planet_info\n puts info\n puts \"\\nWhat next?\"\n elsif input == planets.length + 1\n puts \"Sorry to see you go! Goodbye!\"\n done = true\n else\n puts \"Invalid selection. Please try again.\"\n end\n end\nend",
"def main\n moon = Planet.new('Moon','white', 3.972e24, 1.212e8, 'water-ice on surface')\n earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e8, 'Only planet known to support life')\n mars = Planet.new('Mars', 'red-yellow', 9.972e24, 2.496e8, 'The second largest planet in this solar system')\n solar_system = SolarSystem.new('Sol')\n solar_system.add_planet(earth)\n solar_system.add_planet(moon)\n solar_system.add_planet(mars)\n\n puts \"Welcome to solar_system.\"\n puts \"What to do next?\\n1. List the planet\\n2. Planet details\\n3. Add Planet\\n4. Exit\\n\\n\"\n user_input = gets.chomp.to_i\n\n while user_input != 4\n if user_input == 1\n puts solar_system.list_planets\n puts \"\"\n elsif user_input == 2\n planet_details(solar_system)\n puts \"\"\n elsif user_input == 3\n solar_system = add_planet(solar_system)\n else\n puts \"Invalid input, please enter 1-4 to do the selection.\"\n end\n puts \"What to do next?\\n1. List the planet\\n2. Planet details\\n3. Add Planet\\n4. Exit\\n\\n\"\n user_input = gets.chomp.to_i\n end\nend",
"def show_planets our_solar_system\n all_planets = our_solar_system.planets\n puts \"Choose which planet:\"\n all_planets.length.times do |index|\n puts \"#{index+1}: #{all_planets[index].name}\"\n end\n puts \"Which planet info you want\"\n planet_choice = gets.chomp.to_i\n if planet_choice >=1 && planet_choice <= all_planets.length\n # Display all the planet objects in array.\n puts all_planets[planet_choice - 1].print_planet_info\n # Local variable which is assigned the planet that is selected\n choosen_planet = all_planets[planet_choice -1]\n all_planets.length.times do |index|\n # Skips the selected planet\n if planet_choice - 1 != index\n # Output the distance from other planet.\n puts \"✹ The distance from #{all_planets[index].name} is #{choosen_planet.distance_from_the_planet(all_planets[index])} km.\".bold\n puts \"\"\n end\n end\n end\nend",
"def user_planet_pick(solar_system)\n puts \"Which planet are you interested in learning about?\"\n your_planet = gets.chomp.capitalize\n puts \"Great, you want to learn about #{your_planet}.\"\n puts \"Here are planet details about #{solar_system.find_planet_by_name(your_planet).summary}\"\nend",
"def planet_query(solar_system)\n puts solar_system.list_planets(:num)\n\n puts \"Enter the number of a planet to learn more about it: \"\n planet_index = gets.chomp.to_i - 1\n # catches invalid index numbers and strings\n planets = solar_system.instance_variable_get(:@planets)\n while planets[planet_index] == nil || planet_index < 0\n puts \"That is an invalid number. Please enter a number from the list\"\n solar_system.list_planets(:num)\n planet_index = gets.chomp.to_i - 1\n end\n puts planets[planet_index].info\n\n puts \"Enter \\\"M\\\" to see the planet list again. Enter \\\"X\\\" to return to the previous menu.\"\n again = gets.chomp.upcase\n until again == \"M\" || again == \"X\"\n puts \"Invalid entry. Enter \\\"M\\\" to return the planet list. Enter \\\"X\\\" to exit.\"\n again = gets.chomp.upcase\n end\n if again == \"M\"\n planet_query(solar_system)\n elsif again == \"X\"\n solar_query(solar_system)\n end\n end",
"def main\n xandar = Planet.new(\"XANDAR\",\"aquamarine powder blue\", 6.39e23, 2.279e8,\n \"It's been known to host living creatures that are closely related to smurfs\")\n onurb = Planet.new(\"ONURB\", \"shades of lemon, light salmon, and honeydew\",\n 1.898e27, 7.785e8, \"It does not have a true surface, as the planet is mostly swirling gases and liquids\")\n\n solar_system = SolarSystem.new(\"Anirtak\")\n solar_system.add_planet(xandar)\n solar_system.add_planet(onurb)\n\n # loop until user quits\n user_play = \"Y\"\n while user_play == \"Y\"\n print \"Enter A, B, C, D or Q: \"\n user_input = gets.chomp.strip.upcase\n while user_input !='A' &&\n user_input != 'B' &&\n user_input != 'C' &&\n user_input != 'D' &&\n user_input != 'Q'\n print \"EEP. Please try again: \"\n user_input = gets.chomp.strip.upcase\n end\n list = solar_system.list_planets\n\n if user_input == 'A'\n puts list\n\n elsif user_input == 'B'\n puts \"Let's begin our wild adventure! \"\n puts \"What planet would you like to learn about?\"\n puts list\n print \"Please enter the name of the planet: \"\n user_planet = gets.chomp.strip.upcase\n found_planet = solar_system.find_planet_by_name(user_planet)\n\n if found_planet\n puts \"Your choice is OUT OF THIS WORLD! Here's everything you need to know about #{found_planet.name}\"\n puts found_planet.summary\n end\n\n elsif user_input == 'C'\n puts \"Let's make a planet!\"\n print \"What is the name of the planet? \"\n new_planet_name = gets.chomp.strip.upcase\n\n print \"What is #{new_planet_name}'s color: \"\n new_planet_color = gets.chomp.strip\n\n print \"What is #{new_planet_name}'s mass in kg? \"\n new_planet_mass = gets.chomp.strip.to_f\n while new_planet_mass <= 0 || new_planet_mass.to_s == \"0.0\"\n puts \"Invalid, please enter a positive number\"\n print \"What is #{new_planet_name}'s mass in kg? \"\n new_planet_mass = gets.chomp.strip.to_f\n end\n\n print \"What is #{new_planet_name}'s distance from the sun in km? \"\n new_planet_distance_sun = gets.chomp.strip.to_f\n while new_planet_distance_sun <= 0 || new_planet_distance_sun.to_s == \"0.0\"\n puts \"Invalid, please enter a positive number\"\n print \"What is #{new_planet_name}'s distance from the sun in km? \"\n new_planet_distance_sun = gets.chomp.strip.to_f\n end\n\n print \"What is a fun fact about #{new_planet_name}? \"\n new_planet_fact = gets.chomp.strip\n\n new_planet = Planet.new(new_planet_name, new_planet_color, new_planet_mass,\n new_planet_distance_sun, new_planet_fact)\n solar_system.add_planet(new_planet)\n\n elsif user_input == 'D'\n puts list\n puts \"Please choose two planets from the above list\"\n print \"Please enter the name of the first planet: \"\n user_first_planet = gets.chomp.strip.upcase\n print \"Please enter the name of the second_planet: \"\n user_second_planet = gets.chomp.strip.upcase\n\n first_user_planet_found = solar_system.find_planet_by_name(user_first_planet)\n second_user_planet_found = solar_system.find_planet_by_name(user_second_planet)\n\n if first_user_planet_found && second_user_planet_found\n puts solar_system.distance_between(first_user_planet_found, second_user_planet_found)\n end\n\n elsif user_input == 'Q'\n puts \"Thank you for playing! Come back again for another adventure!\"\n puts\n exit\n end\n\n puts \"Would you like to keep exploring (Y/N)?\"\n user_play = gets.chomp.upcase\n end\n\n puts \"Thank you for playing! Come back again for another adventure!\"\n exit\nend",
"def users_planet\n\n puts \"Please enter the name of your planet.\"\n user_planet_name = gets.chomp\n\n puts \"Please enter its volume.\"\n user_planet_volume = gets.chomp\n\n puts \"Is your planet solid?\"\n user_planet_solid = gets.chomp\n\n puts \"Please enter its diameter.\"\n user_planet_diameter = gets.chomp\n\n puts \"Please enter the time it takes to orbit its sun.\"\n user_planet_orbit_time = gets.chomp\n\nend",
"def pick_a_planet\n display_planet = nil\n puts \"\\nPlease choose from the following list of planets.\"\n planet_names = []\n @planets.each do |planet| # gets the names of the planets that currently exist in solar system\n planet_names << planet.name\n end\n puts planet_names\n\n # get planet choice and validate\n print \"\\nWhich planet would you like to \\\"learn\\\" more about? \"\n planet_choice = gets.chomp.capitalize\n planet_choice = planet_choice.gsub(\" \", \"\")\n while !planet_names.include? planet_choice\n print \"Sorry, which planet? \"\n planet_choice = gets.chomp.capitalize\n end\n\n # print the planet info for the chosen planet\n @planets.each do |planet|\n if planet.name == planet_choice\n puts planet.print_planet_data\n end\n end\n\n continue_or_quit\n end",
"def main\n solar_system = SolarSystem.new('Sol')\n pluto = Planet.new(\"Pluto\", \"Blue\", 1.309e22, 4.67e9,\n \"It's not really a planet!\")\n solar_system.add_planet(pluto)\n earth = Planet.new('Earth', 'blue-green', 5.972e24, 1.496e8,\n 'Only planet known to support life')\n solar_system.add_planet(earth)\n mars = Planet.new(\"Mars\", \"Red\", 6.39e23, 2.279e8,\n \"We may live on it someday\")\n solar_system.add_planet(mars)\n\n puts \"\\nWould you like to do:\\\n \\n(1) list the planets\\\n \\n(2) learn about planet details\\\n \\n(3) add a planet to the solar system\\\n \\n(4) exit?\"\n action = gets.chomp.downcase\n\n until action == \"exit\" || action.include?(\"4\")\n if action.include?(\"list\") || action.include?(\"1\")\n puts solar_system.list_planets\n elsif action.include?(\"details\") || action.include?(\"2\")\n puts \"\\nName a planet you wish to learn about.\"\n found_planet = solar_system.find_planet_by_name(gets.chomp.capitalize)\n if found_planet == nil\n puts \"This planet is not currently in our system. \" <<\n \"Consider adding this planet.\"\n else\n puts found_planet.summary\n end\n elsif action.include?(\"add\") || action.include?(\"3\")\n puts \"\\nPlease answer the following information:\"\n print \"Name:\"\n name = gets.chomp\n print \"Color:\"\n color = gets.chomp\n print \"Mass in km:\"\n mass = gets.chomp.to_f\n print \"Distance from sun in km:\"\n distance = gets.chomp.to_f\n print \"Fun fact:\"\n fun_fact = gets.chomp\n\n new_planet = Planet.new(name, color, mass, distance, fun_fact)\n solar_system.add_planet(new_planet)\n end\n\n puts \"\\nWould you like to do:\\\n \\n(1) list the planets\\\n \\n(2) learn about planet details\\\n \\n(3) add a planet to the solar system\\\n \\n(4) exit?\"\n action = gets.chomp.downcase\n end\n\nend",
"def main\n solar_system = SolarSystem.new('Women of Code')\n\n earth = Planet.new(\"Earth\", \"Green\", 1000, 430, \"It's hot\")\n solar_system.add_planet(earth)\n\n bay = Planet.new(\"Bay\", \"Purple\", 4000, 342, \"Largest flea market capitol of the world\")\n solar_system.add_planet(bay)\n\n sasquatch = Planet.new(\"Sasquatch\", \"Brown\", 3400, 234, \"It's really fuzzy\")\n solar_system.add_planet(sasquatch)\n\n hammock = Planet.new(\"Hammock\", \"Rainbow\", 5646, 642, \"Everyone lives on a Hammock\")\n solar_system.add_planet(hammock)\n\n santa = Planet.new(\"Santa\", \"Ocean\", 1040, 378, \"The fountain of youth lives here\")\n solar_system.add_planet(santa)\n\n #test to check if planet exisist in solar_system\n # santaCruz = Planet.new(\"SantaCruz\", \"Dummy\", 4839, 034, \"There is no place like home\")\n # solar_system.add_planet(santaCruz)\n\n # found_planet = solar_system.find_planet_by_name(\"sdf\")\n # puts found_planet\n # # => #<Planet:0x00007fe7c2868ee8>\n # puts found_planet.summary\n\n #prompt user for what they would like to do in the SolarSystem program\n puts \"Please select what you would like to learn about Women of Code Solar System by number ex.(1)\"\n puts \"1. List Planets\\n2. Add Your Own Planet\\n3. Exit\"\n print \"Number: \"\n user_input = gets.chomp.to_i\n puts\n\n #selections of option based on user reponse\n #The number 3 will exit the program\n until user_input == 3\n\n #slection 1 prints the planets listed in solar_system\n if user_input == 1\n list = solar_system.list_planets\n puts list\n\n #prompt user to type the planet they are intersted in looking up\n #if planet is found the summary of the planet will be printed\n #reprompt user is the there input does not match a planet in the solar_system\n puts \"What Planet would you like to learn about? Please type your planet ex(Earth).\\n\\n\"\n print \"Planet: \"\n planet = gets.chomp\n found_planet = solar_system.find_planet_by_name(planet)\n if found_planet.class == Planet\n puts found_planet.summary\n end\n\n #user adds a planet to the solar_system program\n elsif user_input == 2\n puts \"What would you like to name your planet?\"\n name = gets.chomp\n puts \"What color(s) is your planet?\"\n color = gets.chomp\n puts \"Your planet Mass in Kg:\"\n mass_kg = gets.chomp\n puts \"Distance from the Sun\"\n distance_from_sum_km = gets.chomp\n puts \"Fun Facts\"\n fun_fact = gets.chomp\n\n new_planet = Planet.new(name, color, mass_kg, distance_from_sum_km, fun_fact)\n #stores planet in solar_system program for user to recall until they exit\n solar_system.add_planet(new_planet)\n end\n\n #reprompt user until they exit\n puts \"\\nPlease select what you would like to learn about Women of Code Solar System\"\n puts \"1. List Planets\\n2. Add Your Own Planet\\n3. Exit\"\n print \"Number: \"\n user_input = gets.chomp.to_i\n end\nend",
"def build_planet()\n puts \"\\nAdding planet. Please tell me more about this planet.\"\n \n print \"Enter the planet name: \"\n name = gets.chomp.capitalize\n \n print \"\\nEnter the planet color: \"\n color = gets.chomp.downcase\n \n print \"\\nEnter planet mass in kg: \"\n mass_kg = gets.chomp.to_f\n \n print \"\\nEnter planet's distance from the sun in km: \"\n distance_from_sun_km = gets.chomp.to_f\n \n print \"\\nEnter a fun fact about the planet: \"\n fun_fact = gets.chomp\n \n return Planet.new(name, color, mass_kg, distance_from_sun_km, fun_fact)\n end",
"def control_loop_options(solar_system)\n user_answer = verify_user_answer(gets.chomp)\n case user_answer\n when \"1\"\n puts\n puts \"Here are some \" + solar_system.list_planets\n puts\n puts \"Which planet would you like to see info on?\"\n user_choice = verify_planet_choice(gets.chomp)\n found_planet = solar_system.find_planet_by_name(user_choice)\n puts\n puts found_planet\n\n when \"2\"\n puts\n puts add_a_planet(solar_system)\n\n when \"3\"\n puts\n puts \"You are exiting the program. Thanks for playing!\"\n exit\n end\n end",
"def planet_details(solar_system)\n solar_names = []\n solar_system.planets.each_with_index do |item, i|\n puts \"#{i+1}. #{item.name}\"\n solar_names.push(item.name.downcase)\n end\n\n print \"Please enter the name of the planet you to know the details: \"\n planet_picked = gets.chomp.downcase\n\n while !solar_names.include?(planet_picked)\n puts \"Invalid planet name. \"\n print \"Please enter the name of the planet you to know the details: \"\n planet_picked = gets.chomp.downcase\n end\n\n result = solar_system.find_planet_by_name(planet_picked).summary\n puts result\nend",
"def user_planet(solar_system)\n puts \"Your new planet will need a name: \"\n name = gets.chomp\n puts \"Tell me more about planet #{name}! Just hit return (enter) on your keyboard if don't know the value.\"\n puts \"Position from its star (star is position 0): \"\n position = gets.chomp\n puts \"Mass: \"\n mass = gets.chomp\n puts \"Radius: \"\n radius = gets.chomp\n puts \"Orbital Period (days to get around the star once): \"\n orbital_period = gets.chomp\n star = solar_system\n\n user_planet = Planet.new(name, position, mass, radius, orbital_period, star)\n end",
"def main \n\tsolar_system = SolarSystem.new('Sol')\n\n\tearth = Planet.new('Earth', 'blue-green', 5.972e24, 4.769e9, 'Only planet known to support life')\n\tsolar_system.add_planet(earth)\n\n\tvenus = Planet.new('Venus', 'White', 6.392e24, 2.982e9, 'Sister planet to Earth')\n\tsolar_system.add_planet(venus)\n\n\tputs \"What action would you like to take?\"\n\tuser_control = gets.chomp.downcase\n\t\n\t# Prompts user for options until they choose to exit\n\tuntil user_control == 'exit'\n\t\tcase user_control\n\t\twhen 'list planets'\n\t\t\tputs solar_system.list_planets\n\t\twhen 'planet details'\n\t\t\tdisplay(solar_system)\n\t\twhen 'add planet'\n\t\t\tuser_create_planet(solar_system)\n\t\twhen 'find distance'\n\t\t\tdisplay_distance_between(solar_system)\n\t\telse\n\t\t\tputs \"Please enter a valid option.\"\n\t\tend\n\t\t\n\t\tputs \"What action would you like to take next?\"\n\t\tuser_control = gets.chomp.downcase\n\tend\n\nend",
"def planet_details(solarsystem)\n puts \"which planet would you like to know more about?\"\n planet = gets.chomp.downcase\n solarsystem.planets.each do |planetlist|\n if planetlist.name.downcase == planet\n puts planetlist.summary\n else puts \"this planet is not in this solar system! try a different planet!\"\n end\n end\nend",
"def main\n solar_system = SolarSystem.new('Sun')\n\n earth = Planet.new('Earth', 'blue-green', 5.972e24, '149.6 mil', 'Only planet known to support life')\n solar_system.add_planet(earth)\n\n mars = Planet.new('Mars', 'red', 6.39e23, '227.9 mil', 'Second smallest planet in the solar system')\n solar_system.add_planet(mars)\n\n venus = Planet.new('Venus', 'red-brown', 4.867e24, '108.2 mil', 'Second brightest object in the night sky')\n solar_system.add_planet(venus)\n\n\n options = [\"add planet\", \"planet details\", \"list planets\", \"exit\"]\n\n puts \"What would you like to do?\"\n puts \"Please choose from the following options:\"\n puts options\n command = gets.chomp.downcase\n\n while options.include? command\n case command\n when \"add planet\"\n puts solar_system.new_planet\n when \"planet details\"\n puts solar_system.planet_details.summary\n when \"list planets\"\n puts solar_system.list_planets\n when \"exit\"\n exit\n end\n\n puts \"What would you like to do next?\"\n command = gets.chomp.downcase\n end\nend",
"def solar_query(solar_system)\n puts \"Welcome to the #{solar_system.name} Solar System!\"\n puts solar_system.info\n\n puts \"Enter \\\"P\\\" to explore the planets. Or, enter \\\"N\\\" to create your own planet!\"\n puts \"You can also enter \\\"X\\\" to return to the previous menu.\"\n menu_opt = gets.chomp.upcase\n until menu_opt == \"P\" || menu_opt == \"N\" || menu_opt == \"X\"\n puts \"Invalid entry. Enter \\\"P\\\" to explore the planets, or \\\"N\\\" to create your own planet.\"\n menu_opt = gets.chomp.upcase\n end\n\n case menu_opt\n when \"P\"\n planet_query(solar_system)\n when \"N\"\n user_planet(solar_system)\n solar_query(solar_system)\n when \"X\"\n user_menu\n end\n end",
"def user_interaction\n found = false\n puts \"What planet would you like to learn about?\"\n learn_about = gets.chomp.downcase.capitalize\n @array_of_planets.each do |search|\n if search.name == learn_about\n found = true\n puts \"Good news! That planet is in the solar system. Let me tell you about it.\"\n puts \"#{search.each_planet_return}\\n\"\n break\n end\n end\n unless found == true\n puts \"Unfortunately, that planet is not in the solar system, so there's nothing to learn\\n\"\n end\n end",
"def display(solar_system)\n\tputs \"Which planet would you like to see?\"\n\tdisplay_planet = gets.chomp.downcase\n\tbegin\n\t\tputs solar_system.find_planet_by_name(display_planet).summary()\n\trescue NoMethodError => e\n\t\tputs \"Planet not in solar systen. Please enter a different planet or add new planet to the solar system.\"\n\tend\nend",
"def main\n solar_system = SolarSystem.new('Sol')\n loop do\n # collects input from user\n puts \"Hello, you can choose to list planets, see planet details, add a planet or exit?\"\n puts \"Choose what you would like to do (list / details / exit / add): \"\n input = gets.chomp\n # stop if user decides to exit the program\n break if input == \"exit\"\n # prints a list of planets if the user chooses list -\n # This is where we use instance of solar system using list_planets method\n if input == \"list\"\n planet_list = solar_system.list_planets\n puts planet_list\n\n elsif input == \"details\"\n # This is where we collect name of planet from user\n print \"Name a planet: \"\n planet = gets.chomp.downcase\n # We use find_planet_by_name instance method of Solar System to find planet and print details\n found_planet = solar_system.find_planet_by_name(planet)\n if found_planet\n puts found_planet.summary\n else\n puts \"Planet not found.\"\n end\n end\n # Here we collect new information to add an imaginary new planet\n if input == \"add\"\n print \"Create an imaginary planet. Give your planet a name: \"\n new_planet_name = gets.chomp\n print \"Give your planet a color: \"\n color = gets.chomp\n print \"Give your planet a mass in kg (i.e 6 or 9 ): \"\n mass_kg = gets.chomp.to_i\n print \"Give your planet distance from sun in km (i.e 10 or 8): \"\n distance_from_sun_km = gets.chomp.to_i\n print \"Provide fun fact about your new planet: \"\n fun_fact = gets.chomp\n # adds an imaginary planet to planet list in solar system using the Planet and SolarSystem classes.\n new_planet = Planet.new(new_planet_name, color, mass_kg, distance_from_sun_km, fun_fact)\n solar_system.add_planet(new_planet)\n puts \"#{new_planet.name} has been added to list\"\n end\n end\n\nend",
"def find_planet_by_name\n puts \"What planet would you like to know more about? \"\n search = \"undefined\" ###\n\n # User input validation for available planets\n until @planets.include? (search.capitalize) do\n print \"Please enter a known planet in our solar system: \"\n search = gets.chomp.downcase\n\n # Iterate over @planets to match input to Planet instance\n @planets.each do |planet|\n if search != planet.name.downcase\n next\n elsif search == planet.name.downcase\n found_planet = planet\n end\n\n return found_planet\n end\n\n end\n end",
"def cli(solar_system) # command line interface\n puts \"**** Welcome do the Planetarium! ****\"\n done = false\n until done\n menu\n user_command = gets.chomp\n case user_command\n when \"4\"\n done = true\n when \"1\"\n puts solar_system.list_planets\n when \"2\"\n cli_planet_details(solar_system)\n when \"3\"\n add_planet(solar_system) # Display details for that planet\n else\n puts \"Invalid number, try again!\"\n end\n end\nend",
"def add_planet(solar_system)\n print \"\\nPlease enter the following details about your planet.\\nPlanet name: \"\n name = gets.chomp\n print \"Planet color: \"\n color = gets.chomp\n print \"Planet mass (kg): \"\n mass = gets.chomp.to_i\n while mass <= 0\n print \"Please enter an integer greater than 0. Planet mass (kg): \"\n mass = gets.chomp.to_i\n end\n print \"Distance from star (km): \"\n distance = gets.chomp.to_i\n while distance <= 0\n print \"Please enter an integer greater than 0. Planet distance from star (kg): \"\n distance = gets.chomp.to_i\n end\n print \"Fun fact: \"\n fact = gets.chomp\n \n new_planet = Planet.new(name, color, mass, distance, fact)\n solar_system.add_planet(new_planet)\nend",
"def define_new_planet\n print \"\\nWhat is the name of the planet? \"\n planet_name = gets.chomp.capitalize\n print \"What is the diameter of #{planet_name} (in miles)? \"\n planet_diameter = gets.chomp.to_i\n print \"What is #{planet_name}'s distance from the sun (in millions of miles): \"\n planet_distance_from_sun = gets.chomp.to_f\n print \"What is the #{planet_name}'s year length (in Earth years)? \"\n planet_year_length = gets.chomp.to_f\n print \"How many moon's does #{planet_name} have? \"\n planet_moons = gets.chomp.to_i\n return new_planet = Planet.new(planet_name, planet_diameter, planet_distance_from_sun, planet_year_length, planet_moons)\nend",
"def verify_planet_choice(user_choice)\n until user_choice == \"earth\" || user_choice == \"jupiter\" || user_choice == \"mars\"\n puts \"That's not a valid planet on this list! Please type the planet name.\"\n user_choice = gets.chomp\n end\n return user_choice\n end",
"def user_input\n puts \"Please enter your planet name, planet year length in days, and distance from the sun separated by commas(,).\\n\"\n user = gets.chomp.strip.split(\",\")\n user_planet = {}\n user.each do |hashify|\n user_planet[:name] = user[0]\n user_planet[:planet_year] = user[1].strip\n user_planet[:distance_from_sun] = user[2].strip\n end\n return user_planet\nend",
"def choose_planet\n\n puts \"Select a planet by number:\"\n print \" > \".blink.colorize(:yellow)\n choice = nil\n while !((1..9).include? choice)\n choice = gets.chomp.to_i\n case choice\n when 1 then planet1 = @mercury\n when 2 then planet1 = @venus\n when 3 then planet1 = @earth\n when 4 then planet1 = @mars\n when 5 then planet1 = @jupiter\n when 6 then planet1 = @saturn\n when 7 then planet1 = @uranus\n when 8 then planet1 = @neptune\n when 9 then planet1 = @pluto\n else\n puts \"Not a choice, please enter a valid number for a planet:\".blink.colorize(:yellow)\n end\n\n end\n return planet1\nend",
"def run_solar_system_program(solar_system)\n # method outside of any class that takes user input to create a new planet\n # then add it to the solar system\n def create_planet(solar_system)\n puts \"Alright! What is the name of your planet?\"\n name = gets.chomp.capitalize\n puts \"How many moons does #{name} have?\"\n moons = gets.chomp\n puts \"How many Earth years does it take to revolve around its star?\"\n year_length = gets.chomp\n puts \"How far is #{name} from its star in million miles? Please enter a number.\"\n distance_from_sun = gets.chomp\n puts \"How much mass does the planet have in kg?\"\n mass = gets.chomp\n puts \"What is the diameter measured in miles?\"\n diameter = gets.chomp\n puts \"Finally, does its name relate to any mythological dieties?\"\n diety = gets.chomp\n new_planet = {name: name, moons: moons, year_length: year_length, distance_from_sun: distance_from_sun, mass: mass, diameter: diameter, diety: diety}\n solar_system.add_planet(Planet.new(new_planet))\n end\n # method to select planet then print its attributes\n def planet_choice_and_details(the_solar_system)\n puts \"What planet would you like to learn about? Please enter the name.\"\n puts the_solar_system.return_planets\n planet_name = gets.chomp\n decoration\n puts the_solar_system.planet_information(planet_name)\n end\n\n # method to confirm user interest to continue\n # and give them opportunity to do another action\n def continue?\n decoration\n puts \"Do you want to learn about another planet? y or n?\"\n puts \"Or would you like to add your own planet? Enter any other key.\"\n yes_or_no = gets.chomp.downcase\n decoration\n return yes_or_no\n end\n\n # start of program that introduces the solar system and prompt user\n puts \"Welcome to this program about the #{solar_system.name}.\"\n puts \"The #{solar_system.name} is #{solar_system.solar_age} billion Earth years old.\"\n puts decoration\n puts \"Are you ready to learn about some planets? y or n\"\n puts \"Or would you like to add your own planet? Enter any other key.\"\n start_learning = gets.chomp.downcase\n decoration\n # loop the determines what the program does:\n # 1. presents list of planets and a chosen planets detailed_summary\n # 2. add a new planet to solar system\n # 3. ends program\n until start_learning == \"n\"\n if start_learning == \"y\"\n planet_of_choice = planet_choice_and_details(solar_system)\n start_learning = continue? # calling method to determine next step in program\n decoration\n elsif start_learning != \"n\"\n create_planet(solar_system)\n start_learning = continue? # calling method again\n decoration\n end\n end\n puts \"Bye now, go out and discover the stars.\"\nend",
"def valid_entry(solar_system)\n print 'Select a planet: '\n planet_number = gets.chomp\n\n # If user does not enter a valid name or number they will be prompted to enter again.\n until (planet_number.to_i.to_s == planet_number) && (planet_number.to_i <= solar_system.planets.length && planet_number.to_i > 0)\n print 'Please select a valid number to represent a planet: '\n planet_number = gets.chomp\n end\n planet_number = planet_number.to_i - 1\n planet_number\nend",
"def manual_add_planet(sol)\n puts \"What is the name of the planet? \"\n name = valid_name(gets.chomp)\n puts \"What is the mass(unit: 1e+24 kg) of the planet #{name}?\"\n mass = valid_float(gets.chomp)\n puts \"What is the diameter(unit: km) of the planet #{name}?\"\n diameter = valid_float(gets.chomp).abs\n puts \"How many moons does the planet #{name} have?\"\n number_of_moons = valid_integer(gets.chomp)\n puts \"What is the distance(unit: 1e+6 km) between the sun and the planet #{name}?\"\n distance_from_the_sun = valid_float(gets.chomp).abs\n puts \"What is the rate of the solar rotation for the planet #{name} in Earth hours?\"\n rate_of_solar_rotation = valid_float(gets.chomp)\n puts \"What is the orbital period for the planet #{name} in Earth days?\"\n orbital_period = valid_float(gets.chomp)\n\n sol.add_planet(\n Planet.new(\n {\n name: name,\n mass: mass,\n diameter: diameter,\n number_of_moons: number_of_moons,\n distance_from_the_sun: distance_from_the_sun,\n rate_of_solar_rotation: rate_of_solar_rotation,\n orbital_period: orbital_period\n }\n )\n )\n return sol\nend",
"def validate_planet_selection(input, names, length)\n until names.include?(input) || (1..length).include?(input.to_i)\n print \"That doesn't look like one of the planets in the system. \\n\\nPlease select a planet (by name or number) from the existing system: \"\n input = gets.chomp.capitalize\n end\n return input\nend",
"def create_planet(array_of_planets)\n puts \"Tell us some information about your planet.\"\n print \"Name: \"\n name = gets.chomp\n print \"Length of Year: \"\n year_length = gets.chomp\n print \"Distance from the Sun: \"\n distance_from_sun = gets.chomp\n puts \"We have found that most planets known to humankind share certain characteristics. If the given information is true of your planet, type YES. If its not, give us the correct information for your planet.\"\n puts \"Language: Meowish\"\n language = gets.chomp\n if language == \"YES\"\n language = \"Meowish\"\n else\n language = language\n end\n puts \"Inhabitants: Cats\"\n inhabitants = gets.chomp\n if inhabitants == \"YES\"\n inhabitants = \"Cats\"\n else\n inhabitants = inhabitants\n end\n puts \"Primary Export: Catnip\"\n primary_export = gets.chomp\n if primary_export == \"YES\"\n primary_export = \"Catnip\"\n else\n primary_export = primary_export\n end\n array_of_planets << Planet.new(name, year_length, distance_from_sun, language: language, inhabitants: inhabitants, primary_export: primary_export)\nend",
"def city_specific_run\n\n puts 'You want city specific details'\n puts 'Type the name of the city that you want'\n city = gets.chomp\n\n # wait till you receive a correct input\n while not @ui_lib.query.city_to_code.has_key?(city)\n puts 'Please try again'\n city = gets.chomp\n end\n\n puts \"You selected #{city}\"\n puts \"What information do you want about #{city}\"\n\n city = @ui_lib.query.city_to_code[city] #changed the string to its code form\n\n @num_to_info_key.each {|num,infoKey| puts \"Type #{num} for #{infoKey}\"}\n command = gets.chomp.to_i\n\n while not @num_to_info_key.has_key?(command)\n puts 'Please try again'\n command = gets.chomp.to_i\n end\n\n if command == 9\n puts \"#{@ui_lib.get_outgoing_routes(city)}\"\n else\n puts \"#{@ui_lib.get_city_info(city, @num_to_info_key[command])}\"\n end\n\n end",
"def user_add_planet(solar_system)\n print \"What planet do you want to add?\"\n name = gets.chomp\n print \"what is the color of the planet?\"\n color = gets.chomp\n print \"what is the mass in kg of the planet? \"\n mass_kg = gets.chomp.to_i\n print \"what is the distance from the sun for the planet?\"\n distance_sun = gets.chomp.to_i\n print \"what is a fun fact about the planet?\"\n fun_fact= gets.chomp\n\n user_planet = Planet.new(name,color,mass_kg,distance_sun,fun_fact)\n solar_system.add_planets(user_planet)\n\nend",
"def user_menu\n # returns an array with SolarSystem objects, creates numbered list of object names\n def star_list\n solar_systems = SolarSystem.all\n solar_systems.each do |star_system|\n num = solar_systems.index(star_system)\n puts \"#{num + 1}. #{star_system.name}\"\n end\n return solar_systems\n end\n # enter Solar System menu\n # recursive loop allows user to continue accessing the menu or exit\n def solar_query(solar_system)\n puts \"Welcome to the #{solar_system.name} Solar System!\"\n puts solar_system.info\n\n puts \"Enter \\\"P\\\" to explore the planets. Or, enter \\\"N\\\" to create your own planet!\"\n puts \"You can also enter \\\"X\\\" to return to the previous menu.\"\n menu_opt = gets.chomp.upcase\n until menu_opt == \"P\" || menu_opt == \"N\" || menu_opt == \"X\"\n puts \"Invalid entry. Enter \\\"P\\\" to explore the planets, or \\\"N\\\" to create your own planet.\"\n menu_opt = gets.chomp.upcase\n end\n\n case menu_opt\n when \"P\"\n planet_query(solar_system)\n when \"N\"\n user_planet(solar_system)\n solar_query(solar_system)\n when \"X\"\n user_menu\n end\n end # end solar_query\n\n # shows planet list\n def planet_query(solar_system)\n puts solar_system.list_planets(:num)\n\n puts \"Enter the number of a planet to learn more about it: \"\n planet_index = gets.chomp.to_i - 1\n # catches invalid index numbers and strings\n planets = solar_system.instance_variable_get(:@planets)\n while planets[planet_index] == nil || planet_index < 0\n puts \"That is an invalid number. Please enter a number from the list\"\n solar_system.list_planets(:num)\n planet_index = gets.chomp.to_i - 1\n end\n puts planets[planet_index].info\n\n puts \"Enter \\\"M\\\" to see the planet list again. Enter \\\"X\\\" to return to the previous menu.\"\n again = gets.chomp.upcase\n until again == \"M\" || again == \"X\"\n puts \"Invalid entry. Enter \\\"M\\\" to return the planet list. Enter \\\"X\\\" to exit.\"\n again = gets.chomp.upcase\n end\n if again == \"M\"\n planet_query(solar_system)\n elsif again == \"X\"\n solar_query(solar_system)\n end\n end # end of planet_query method definition\n # allows user to enter new planet information (no checks)\n def user_planet(solar_system)\n puts \"Your new planet will need a name: \"\n name = gets.chomp\n puts \"Tell me more about planet #{name}! Just hit return (enter) on your keyboard if don't know the value.\"\n puts \"Position from its star (star is position 0): \"\n position = gets.chomp\n puts \"Mass: \"\n mass = gets.chomp\n puts \"Radius: \"\n radius = gets.chomp\n puts \"Orbital Period (days to get around the star once): \"\n orbital_period = gets.chomp\n star = solar_system\n\n user_planet = Planet.new(name, position, mass, radius, orbital_period, star)\n end # end of user_planet method definition\n\n puts \"Welcome to the Interactive Galaxy!\"\n puts \"Please enter the number of a star system to get started: \"\n star_list\n star_index = gets.chomp.to_i - 1\n\n while star_list[star_index] == nil || star_index < 0\n puts \"That is an invalid entry. Please enter a number from the list\"\n star_list\n star_index = gets.chomp.to_i - 1\n end\n # start cascading menu methods\n solar_query(star_list[star_index])\n end",
"def add_planet (solar_system)\n print\"Enter a planet name: \"\n planet_name = gets.chomp # ask them for the name of the planet they wish to learn about\n planet = solar_system.find_planet_by_name(planet_name)\n if planet.nil?\n # Ask the user for details about the planet (W3.3)\n puts\"What is the planet color? \"\n planet_color = gets.chomp #\n\n puts\"What is the planet mass kg?: \"\n planet_mass = gets.chomp.to_i #\n\n puts\"What is the planet distance from sun? \"\n planet_distance = gets.chomp.to_i #\n\n puts\" What is a fun fact about the planet?\"\n planet_fun_fact = gets.chomp #\n # Create a new instance of Planet with that info, and add to solar_system(W3.3)\n new_planet = Planet.new(planet_name, planet_color, planet_mass, planet_distance, planet_fun_fact)\n solar_system.add_planet(new_planet)\n puts \"Planet added with success!\"\n puts new_planet.summary\n else\n puts \"That planet already exists!\"\n puts planet.summary\n end\nend",
"def add_a_planet(solar_system)\n print \"Please enter the planet name: \"\n name = gets.chomp\n print\"What is #{name}'s color? \"\n color = gets.chomp\n print \"What is the mass of #{name}? \"\n mass_kg = gets.chomp\n print \"What is the #{name}'s distance from the sun? \"\n distance_from_sun_km = gets.chomp\n print \"What's a fun fact about #{name}? \"\n fun_fact = gets.chomp\n new_planet = Planet.new(name, color, mass_kg, distance_from_sun_km, fun_fact)\n solar_system.add_planet(new_planet)\n puts\n return \"Here is the info you entered about this new planet: \\n\" + new_planet.summary\n end",
"def add_planet_from_user\n print \"What is the name of the planet you would like to add? \"\n name = gets.chomp.capitalize\n\n print \"What color is the planet? \"\n color = gets.chomp.downcase\n\n print \"What is the mass of the planet in kilograms? \"\n mass = gets.chomp.to_i\n\n print \"How far away is the planet from the sun in kilometers? \"\n distance = gets.chomp.to_i\n\n print \"Let's add a fun fact about the planet! Complete the sentence. #{name}..\"\n fact = gets.chomp.downcase\n\n new_planet = Planet.new(name, color, mass, distance, fact)\n return new_planet\n end",
"def add_new_planet our_solar_system\n puts \"Please enter the planet name\"\n planet_name = gets.chomp.capitalize\n print \"Please enter the length of time the planet takes to go around its star in earth days. ➤ \"\n year_length = gets.chomp.to_f.round(2)\n print \"Please enter how far is the planet from the sun in kilometers. ➤ \"\n distance_from_the_sun = gets.chomp.to_f.round(2)\n print \"Please enter the mass of a planet in kilograms. ➤ \"\n mass = gets.chomp\n print \"Please enter a diameter of the planet in kilometers. ➤ \"\n diameter = gets.chomp.to_f.round(2)\n print \"Please enter what is the composition of the atmosphere. ➤ \"\n atmospheric_components = gets.chomp\n\n new_planet = Planet.new(planet_name, year_length, distance_from_the_sun, mass, diameter, atmospheric_components)\n our_solar_system.add_planet(new_planet)\n puts \"New planet #{planet_name} is added.\".red\nend",
"def input_request\n puts ' row 1, 2, or 3?'\n row = gets.chomp\n puts ' col 1, 2, or 3?'\n col = gets.chomp\n place_marker(row, col)\n end",
"def create_planet\n puts \"\\nPlease input the following information about your new planet:\"\n\n puts \"Name of Planet:\"\n new_planet_name = gets.chomp.capitalize\n\n puts \"Distance from sun (in million km):\"\n new_planet_distance_from_sun = gets.chomp.to_i\n\n puts \"Year length (in days):\"\n new_planet_year_length = gets.chomp.to_i\n\n puts \"Diameter (in km):\"\n new_planet_diameter = gets.chomp.to_i\n\n puts \"Affiliated Zodiac Sign\"\n new_planet_zodiac = gets.chomp.capitalize\n\n puts \"Number of moons:\"\n new_planet_num_moons = gets.chomp.to_i\n\n return Planet.new(new_planet_name, new_planet_distance_from_sun, new_planet_year_length, new_planet_diameter, new_planet_zodiac, new_planet_num_moons)\nend",
"def print_planet_data\n\n if validate_planet\n\n # print the moon info\n print \"#{@name} has #{@moons.length} moon(s) and has\"\n\n # rings information\n if @rings\n puts \" rings!\"\n else\n puts \" no rings.\"\n end\n\n # other data here\n puts \"#{@name} is #{@surface_temp} and is as wide as #{@diameter_in_earths} Earth(s)!\"\n puts \"#{@name}'s rate of solar rotation is #{@rate_of_solar_rotation} Earth days.\"\n puts \"It's #{@distance_from_the_sun_in_miles} miles from the sun!\"\n\n end\n end",
"def generate_planet\n puts \"\\nLet's create a planet from scratch.\"\n print \"Please enter its name first: \"\n name = gets.chomp\n print \"What's its diameter of this planet in km? \"\n diameter = gets.chomp.to_f\n print \"What's its mass in kg? (example of input format: 3.30 x 10^23 ) \"\n mass = gets.chomp\n print \"What's the year length of this planet in days? \"\n yr_length = gets.chomp.to_f\n print \"What's the distance from the sun to this planet in km? \"\n dis_from_sun = gets.chomp.to_f\n print \"How many moons does this planet have? Enter 0 if there is none. \"\n moons = gets.chomp.to_i\n planet = Planet.new({\"name\" => name, \"diameter\" => diameter, \"mass\" => mass, \"yr_length\" => yr_length, \"dis_from_sun\" => dis_from_sun, \"moons\" => moons})\n return planet\nend",
"def get_input_main\n input = gets.chomp.downcase\n case input\n when 'all'\n flight_list \n when 'year'\n year\n when 'rocket'\n rocket\n when 'success'\n success_failure\n when 'number'\n flight_number\n when 'mission'\n mission_name\n when 'random'\n random\n when 'exit'\n exit\n else \n begin\n raise Error\n rescue Error => error\n Error.invalid_input\n get_input_main\n end\n end\n end",
"def start\n main_menu_option = nil\n while main_menu_option != \"exit\"\n puts \"\"\n puts \"For a list of NSW National Parks and information on a park enter 'info'\"\n puts \"To exit the program enter 'exit'\"\n puts \"To see the National Park regions in NSW and choose a park by its region enter 'region'\"\n puts \"To access an interactive map of all National Parks in NSW enter 'map'\"\n puts \"To download a free pocket guide for NSW National Park Regions enter 'guide'\"\n puts \"To visit the website for a National Park enter 'url'\"\n puts \"\"\n main_menu_option = gets.strip\n if main_menu_option == \"info\"\n park_info \n elsif main_menu_option == \"region\"\n park_region \n elsif main_menu_option == \"url\"\n NSWParks::Nsw_parks.park_url\n elsif main_menu_option == \"map\"\n NSWParks::Nsw_parks.park_map \n elsif main_menu_option == \"guide\"\n NSWParks::Nsw_parks.park_guide \n # Validates the user input \n elsif main_menu_option != \"exit\"\n puts \"\"\n puts \"---------------------------------------------\"\n puts \"Please enter one of the options from the list\" # Prompt user to enter again \n puts \"---------------------------------------------\" \n end \n end \n puts \"\"\n puts \"---------------------------------------------------------\"\n puts \"Thank you for using the Unofficial NSW National Parks App\" \n puts \"---------------------------------------------------------\" \n puts \"\" \n end",
"def collect_data(options)\n capsuleers.each do |capsuleer|\n self.planet_inputs[capsuleer.name] = {}\n\n capsuleer.colonies.each do |colony|\n next if options.has_key?(:system) &&\n !colony.name.upcase.include?(options[:system].upcase)\n self.planet_inputs[capsuleer.name][colony.name] = Hash.new(0)\n\n colony.unique_schematics_by_pin.each do |pin|\n self.planet_schematics[pin] = Entity::PlanetSchematic.retrieve(pin, eve_db)\n self.outputs[planet_schematics[pin].name] += 1\n inputs = planet_schematics[pin].inputs.uniq do |input|\n input.name\n end\n\n inputs.each do |input|\n self.inputs[input.name] += 1\n self.planet_inputs[capsuleer.name][colony.name][input.name] += 1\n end\n end\n end\n end\n end",
"def solar_system(system) #parameter is an object of class SolarSystem\n user_done = false\n\n #runs until user says they are done\n until user_done do\n valid_response = false\n\n system.list_all_planets\n puts \"\\nPick a planet for more info. (e.g. Enter 1 for #{ system.all_planets[0].name })\"\n planet = gets.chomp.to_i-1\n #runs the SolarSystem class method calc_planet_age on the solar_revolution method of the selected planet to get the age of the planet.Coudl have just put this into the planet hash, but was good practice for working with classes within classes\n age = system.calc_planet_age(system.all_planets[planet].solar_revolution)\n puts \"\\n#{system.all_planets[planet].print_info}\"\n #print instead of puts b/c the the print_info method called above has a puts inside of it\n print \"#{system.all_planets[planet].name} is #{age.round(2)} Earth years old.\"\n\n puts \"Find out how far #{system.all_planets[planet].name} is from another planet!\\nEnter the number of another planet (see list above) to find out\"\n planet_two = gets.chomp.to_i-1\n #runs SolarSystem class method planets_distance on the two selected planets -- which then outputs a statement about the absolute difference\n system.planets_distance(planet, planet_two)\n #asks if they want to learn about a second planet and makes sure they provide a valid response\n\n until valid_response do\n puts \"Do you want to learn about another planet? (yes/no)?\"\n keep_going = gets.chomp\n if keep_going == \"yes\" || keep_going == \"no\"\n valid_response = true\n\n if keep_going == \"yes\"\n user_done = false\n else\n puts \"Good-bye!\"\n user_done = true\n end\n\n else\n \"Please enter a valid response.\"\n end\n\n end\n\n end\n\nend",
"def planet_info #(there's no parameter here)\n puts \"#{@name} has #{@orbital} days in one of its years, weighs #{@mass} earth, has #{@moons}, and is #{@distance_from_sun} million miles from the sun.\"\n end",
"def create_user_planet\n puts \"What do you call your planet?:\"\n user_planet_name = gets.chomp\n\n puts \"What is the radius of your planet?:\"\n user_planet_radius = gets.chomp\n\n puts \"What is the length of day for #{user_planet_name}?:\"\n user_planet_lod = gets.chomp\n\n puts \"How far away is #{user_planet_name} from the sun?:\"\n user_planet_distance_sun = gets.chomp\n\n puts \"What is the year length?:\"\n user_planet_year_length = gets.chomp\n\n\n puts \"What is the mass for #{user_planet_name}?:\"\n user_planet_mass = gets.chomp\n\n user_planet = Planets.new(user_planet_name, user_planet_radius, user_planet_lod, user_planet_distance_sun, user_planet_year_length, user_planet_mass)\nreturn user_planet\nend",
"def user_create_planet(solar_system)\n\tputs \"What is the name of the planet?\"\n\tuser_planet_name = gets.chomp.capitalize\n\n\tputs \"What color is #{user_planet_name}?\"\n\tuser_planet_color = gets.chomp.downcase\n\n\tputs \"What is its mass in kilograms?\"\n\tuser_planet_mass = verify_number(gets.chomp)\n\n\tputs \"What distance is the planet from the sun (in kilometers)?\"\n\tuser_planet_distance = verify_number(gets.chomp)\n\n\tputs \"Can you share a fun fact about #{user_planet_name}?\"\n\tuser_planet_fun_fact = gets.chomp.capitalize\n\n\tuser_planet = Planet.new(user_planet_name,user_planet_color, user_planet_mass,user_planet_distance,user_planet_fun_fact)\n\tsolar_system.add_planet(user_planet)\nend",
"def add_planet(solar_system)\n# Ask the user for details about the planet\n print \"Enter the name of the planet: \"\n name = gets.chomp\n name = check_String(name)\n print \"Enter the color of the planet: \"\n color = gets.chomp\n color = check_String(color)\n print \"Enter the mass in kg: \"\n mass_kg = gets.chomp.to_i\n mass_kg = check_number(mass_kg)\n\n print \"Enter the distance from sun in km: \"\n distance_from_sun_km = gets.chomp.to_i\n distance_from_sun_km = check_number(distance_from_sun_km)\n print \"Enter a fun fact: \"\n fun_fact = gets.chomp\n fun_fact = check_String(fun_fact)\n# Create a new instance of Planet with that info\n # binding.pry\n planet_added = Planet.new(name, color, mass_kg, distance_from_sun_km,fun_fact)\n# Add it to the SolarSystem\n solar_system.add_planet(planet_added)\n return solar_system\nend",
"def planetaryWelcome(planet)\n\tif [:mercury, :venus, :earth, :mars, :jupiter, :saturn, :uranus, :neptune].include? planet\n\t\tputs \"Welcome to planet #{planet}!\"\n\telse\n\t\tputs \"#{planet} is not a planet!\"\n\t\tif [:moon].include? planet\n\t\t\tputs \"Come to the dark side, we have cake.\"\n\t\telsif [:pluto].include? planet\n\t\t\tputs \"Sorry dude.\"\n\t\tend\n\tend\nend",
"def run\n puts \"\"\n puts Rainbow(\"Please Enter:\").orange\n print Rainbow(\"'All'\").green \n puts \"----- for a list of all SpaceX flights\"\n print Rainbow(\"'Year'\").green \n puts \"---- to see flights by a given year\"\n print Rainbow(\"'Rocket'\").green \n puts \"-- to see all flights with a given rocket type\"\n print Rainbow(\"'Success'\").green \n puts \"- to see all successful or unsuccessful flights\"\n print Rainbow(\"'Number'\").green \n puts \"-- to search a specific flight number\"\n print Rainbow(\"'Mission'\").green \n puts \"- to search by mission name\"\n print Rainbow(\"'Random'\").green \n puts \"-- to see a random launch\"\n print Rainbow(\"Typing \").orange\n print Rainbow('Main ').green\n puts Rainbow(\"at any point will return to this menu\").orange\n get_input_main\n end",
"def selector\n puts ' ____________________________________________________________ '\n puts '| What do you want to show?: |'\n puts '| |'\n puts \"| * Markets Info : 'i' |\"\n puts \"| * Markets Trades Highest : 'h' |\"\n puts \"| * Markets Trades Lowest : 'l' |\"\n puts \"| * Markets Trades Average : 'm' |\"\n puts '|____________________________________________________________|'\n\n input1 = ''\n\n loop do\n puts ''\n input1 = ask ' >> '\n puts ''\n if ['i', 'h', 'l', 'm'].include? input1\n break\n else\n puts ' ____________________________________________________________ '\n puts '| |'\n puts '| Invalid input, please try again... |'\n puts '|____________________________________________________________|'\n end\n end\n\n # If market info is selected, there's no need for a time range\n return input1, 'd' if input1 == 'i'\n\n # If the selection is not market info, the program prompts for a range\n # to be selected by the user\n puts ' ____________________________________________________________ '\n puts '| What time range do you want to use?: |'\n puts '| |'\n puts \"| * Last 24 hours : 'd' |\"\n puts \"| * Last 7 days : 'w' |\"\n puts \"| * Last 30 days : 'm' |\"\n puts \"| * All available : 'a' |\"\n puts '|____________________________________________________________|'\n\n input2 = ''\n\n loop do\n puts ''\n input2 = ask ' >> '\n puts ''\n if ['d', 'w', 'm', 'a'].include? input2\n break\n else\n puts ' ____________________________________________________________ '\n puts '| |'\n puts '| Invalid input, please try again... |'\n puts '|____________________________________________________________|'\n end\n end\n [input1, input2]\nend",
"def provide_options\n puts \"\\nWould you like to:\"\n puts \" A. See some information about a particular planet\"\n puts \" B. Add a new planet to the system\"\n puts \" C. Delete a planet from the system\"\n puts \" D. Exit the program\"\n print \"\\nEnter your selection (A, B, C, or D): \"\n return selection = gets.chomp.upcase\nend",
"def pt;z.gets 'Your choice:'; end",
"def get_station (stops, verb) #local parameters for the function (line 11-46)\n selected_line = -1 #given a value we know it can't be in order to enter the loop\n until selected_line == 'N' or selected_line == 'L' or selected_line == '6' do #this is our for loop pretty much DO THIS UNTIL\n puts Rainbow(\"Which line are you #{verb}? \").red.bright #THIS IS AN EXAMPLE OF VERB\n puts Rainbow(\"[N] - LineN\").green\n puts Rainbow(\"[L] - LineL\").aqua\n puts Rainbow(\"[6] - Line6\").purple.bright\n selected_line = gets.chomp\n if not (selected_line == 'N' or selected_line == 'L' or selected_line == '6') #IF NOT WHAT WE WANT\n puts \"Please try again\"\n end\n end\n selected_station = '' # PUt this here so we are aware i'll be using it coming up.\n until stops[selected_line].include? selected_station do #using selected_line so this is generic - does line[generic line] include the generic line?\n puts \"please select the station you're #{verb}#{stops[selected_line]}\"#using selected_line so this is generic - will show the stations of lines chosen. Can only be N L 6 because of previous filter (if not)\n selected_station = gets.chomp # gets their answer\n end\n return [selected_line, selected_station] #we are going to use plan trip - we need to pass the information to it.\nend",
"def pick_option\n input = get_input\n if input == '1'\n events_array = search_by_city\n display_events_by_city(events_array)\n save_event_or_main_menu(events_array)\n elsif input == '2'\n attractions_array = search_by_keyword\n display_by_keyword(attractions_array)\n save_event_or_main_menu(attractions_array)\n elsif input == '3'\n display_user_events\n elsif input == '4'\n delete_account\n elsif input == '5'\n space(1)\n puts \"#{$logged_in.username}, thanks for checking us out. See ya later!\"\n exit\n else\n space(1)\n invalid_input\n pick_option\n end\nend",
"def print_planet_info\n puts \"☛ Planet #{@name} takes #{@year_length} earth days to go around its star.✰\".bold\n puts \"\"\n puts \"◆ It is #{@distance_from_the_sun} kilometers away from the sun ☀️ and has a mass of #{@mass} kilogram.\".bold\n puts \"\"\n puts \"◆ It's diameter is #{@diameter} kilometer and it has these atmospheric components: #{@atmospheric_components}.\".bold\n puts \"\"\n end",
"def create_planet\n new_planet ={}\n\n print \"\\nWhat is the name of the planet? \"\n new_planet[:name] = gets.chomp.downcase\n\n print \"How old is #{new_planet[:name].each_first_letters} in Earth years? \"\n new_planet[:age] = gets.chomp.to_i\n\n print \"What is the size of #{new_planet[:name].each_first_letters}? \"\n new_planet[:size] = gets.chomp\n\n print \"How many visitors does #{new_planet[:name].each_first_letters} get? \"\n new_planet[:visitor_count] = gets.chomp\n\n print \"Who or what are #{new_planet[:name].each_first_letters} inhabitants? \"\n new_planet[:inhabitants] = gets.chomp\n\n new_planet = Planet.new(new_planet)\n\n return new_planet\nend",
"def get_planet_details(solar_system)\n print \"What is the name of the planet you want to learn about?\"\n planet_name =gets.chomp.strip\n\n # the found planet is an instance of planet class\n found_planet = solar_system.find_planet_by_name(planet_name)\n\n puts found_planet.summary\nend",
"def find_planet(planet_name) # input is a string, returns a Planet object\n planet_names.each_with_index do |planet, i|\n return @planets[i] if planet == planet_name.capitalize\n end\n puts \"#{planet_name.capitalize} is not in my solar system.\\n\\n\"\n return nil\n end",
"def poet_selection_instructions\n puts \"\"\n puts \"Type the number of a poet whose poems you would like to read.\"\n\t\tputs \"Or type menu to go up one menu.\"\n puts \"Or type exit to end the program.\"\n puts \"\"\n end",
"def more_options\n puts Rainbow(\"Specify your additional options for your search: 'release date', 'search history', or go back\").yellow.underline\n input = gets.chomp.downcase\n \n if input == \"release date\"\n option_release_date\n \n elsif input == \"search history\"\n game_history\n\n elsif input == \"go back\"\n continue_or_exit\n \n else \n puts \"Input not recognized please try again\"\n more_options\n end\n end",
"def main_select(pl_options, pl_status, fishing_hole)\n puts 'What would you like to do?'\n puts\n\n pl_options.each do |pl_opt,explanation|\n puts \" #{pl_opt.to_s.capitalize}: #{explanation}\"\n end\n\n pl_input = gets.chomp\n\n if pl_options.has_key?(pl_input.downcase.to_sym)\n case\n when pl_input.downcase == 'status'\n status(pl_status)\n when pl_input.downcase == 'fish'\n fish(pl_status, fishing_hole)\n when pl_input.downcase == 'action'\n action(pl_status)\n end\n else\n puts 'You must choose a valid option. Options are:'\n pl_options.each do |pl_opt|\n print \"#{pl_opt.to_s.capitalize}\" + ' '\n end\n puts\n puts\n end\n return pl_input\nend",
"def get_info\n client_info = {}\n \n puts \"Please enter the name of a client that would like to have an interior designer.\"\n client_info[:name] = gets.chomp\n\n puts \"What is the client's age, in years?\"\n client_info[:age] = gets.chomp.to_i\n\n puts \"How many children does the client have? If none, input '0'\"\n client_info[:children] = gets.chomp.to_i \n\n puts \"What decor theme do you prefer?\"\n client_info[:decor_theme] = gets.chomp.to_s\n\n puts \"What is the budget for this project?\"\n client_info[:budget] = gets.chomp.to_i\n\n puts \"Is it a commercial project? (y/n)\"\n commercial = gets.chomp\n client_info[:is_commercial] = commercial == \"y\"\n\n client_info\nend",
"def outerLoopOrGo()\n puts \"\\n\"\n puts \"----------------------------------------------------------------------------------\"\n puts \"If no more BANDs with -- different start dates -- to enter info for, type 'go' and hit 'Enter'.\"\n puts \"Otherwise, hit 'Enter' to begin submitting a Summer Camp group with different dates.\"\n gets.strip != \"go\"\nend",
"def inputLoop\r\n defaultInfo\r\n printCommands\r\n puts 'Your input:'\r\n input = gets.chomp\r\n while input != 'q'\r\n\r\n if input == 's'\r\n # puts 's selected.'\r\n resolveS\r\n elsif input[0] == 'u'\r\n resolveU(input)\r\n\r\n elsif input == 'v'\r\n resolveV\r\n\r\n elsif input[0] == 'c'\r\n #puts 'c selected.'\r\n resolveC(input)\r\n\r\n\r\n elsif input == 'b'\r\n #puts 'b selected.'\r\n resolveB\r\n elsif input == 'f'\r\n #puts 'f selected.'\r\n resolveF\r\n\r\n elsif input == 'q'\r\n #puts 'q selected. exiting program.'\r\n exit\r\n elsif input == 'z'\r\n defaultInfo\r\n else\r\n puts 'input unknown. try again.'\r\n end\r\n printCommands\r\n puts 'Your input:'\r\n input = gets.chomp\r\n end\r\n\r\n end",
"def users_created_planet(solar_system)\n puts \"Let's add your planet! We need some information first.\"\n puts \"Please enter the name of your planet.\"\n user_planet = gets.chomp.capitalize\n puts \"What is the color of #{user_planet}?\"\n user_color = gets.chomp.capitalize\n puts \"#{user_color}, how glorious!\"\n puts \"What is the mass, or size of #{user_planet}?\"\n user_planet_size = gets.chomp.to_i\n puts \"Now that we know #{user_planet}'s color, and size, can you tell me how far away it is from you right now?\"\n user_distance = gets.chomp.to_i\n puts \"Perfect. Last info I need to create your planet: what is a fun fact about your planet?\"\n user_fun_fact = gets.chomp\n \n # added new instance of user's planet, along with details\n user_new_planet = Planet.new(user_planet, user_color, user_planet_size, user_distance, user_fun_fact)\n \n # added user's new planet to the solar_system\n solar_system.add_planet(user_new_planet)\nend",
"def park_info\n park_list\n park_no = 0\n puts \"\"\n puts \"Enter the number for the park you are interested in:\"\n park_no = gets.strip.to_i\n # Validate user input - input must be an integer and exist in the list\n while !(park_no.is_a? Integer) || park_no < 1 || park_no > NSWParks::Nsw_parks.all.size\n park_list\n park_no = NSWParks::Nsw_parks.valid_input?\n end \n puts \"\"\n puts NSWParks::Nsw_parks.all[park_no - 1].park_name # Gives returned park info a heading of the park name\n puts \"\"\n puts \"----------------------------------------------------------------------------------------\"\n NSWParks::Nsw_parks.park_info(park_no) # Puts out park info using Nsw_parks #park_info\n end",
"def show_planet(number)\n selected = @solar_system[number-1]\n\n # Calculate planet related ages\n age = 4.5e9/(selected.rotation_time/12.0)\n age = age.to_i.to_s\n age = age.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n\n # Calculate the closest neighboring planets\n # Collect names and distances of planets\n distance_and_name = []\n @solar_system.length.times do |i|\n planet_info = {}\n planet_info[:name] = @solar_system[i].name\n planet_info[:distance] = @solar_system[i].distance_from_the_sun\n distance_and_name << planet_info\n end\n # Get only the distances and sort them\n planet_distances = []\n @solar_system.each do |planet|\n planet_distances << planet.distance_from_the_sun\n end\n ordered_planets = planet_distances.sort\n number_index = ordered_planets.index(selected.distance_from_the_sun).to_i\n\n # Find the select planet's distance neighbors (2)\n if (number_index+1) == @solar_system.length\n neighbor1_distance = 0\n neighbor1_difference = 0\n else\n neighbor1_distance = ordered_planets[(number_index+1)]\n neighbor1_difference = (selected.distance_from_the_sun - neighbor1_distance).abs.round(2)\n end\n if (number_index-1) < 0\n neighbor2_distance = 0\n neighbor2_difference = 0\n else\n neighbor2_distance = ordered_planets[(number_index-1)]\n neighbor2_difference = (selected.distance_from_the_sun - neighbor2_distance).abs.round(2)\n end\n neighbor1_name = \"\"\n neighbor2_name = \"\"\n distance_and_name.each do |planet|\n if neighbor1_distance == planet[:distance]\n neighbor1_name << planet[:name]\n end\n if neighbor2_distance == planet[:distance]\n neighbor2_name << planet[:name]\n end\n end\n if neighbor1_distance == 0 && neighbor2_distance == 0\n true_neighbor = \"not to be found\"\n true_distance = \"both infinity and negative infinity\"\n elsif neighbor1_distance == 0 && neighbor2_distance > 0\n true_neighbor = neighbor2_name\n true_distance = neighbor2_difference\n elsif neighbor2_distance == 0 && neighbor1_distance > 0\n true_neighbor = neighbor1_name\n true_distance = neighbor1_difference\n else\n true_neighbor = \"#{neighbor2_name} and #{neighbor1_name}\"\n true_distance = \"#{neighbor2_difference} and #{neighbor1_difference}\"\n end\n\n # Text summary shown to user\n text = \"\\nThe planet \\[#{selected.name}\\] is #{selected.distance_from_the_sun} Astronomical Units from the sun.\n \\rThe closest neighboring planet(s) is/are #{true_neighbor}, which is/are #{true_distance} AU away.\n \\rIt orbits the sun once every #{selected.rotation_time} Earth months, or #{(selected.rotation_time/12.0).round(2)} Earth years.\n \\rSince our sun is 4.5 billion Earth years old, this planet's age is #{age}!\n \\r#{selected.name} also enjoys #{selected.moon_count} moon(s) orbitin' around it.\\n\"\n return text\n end",
"def get_sport_choice(sports_reg_ex)\n print \"Please enter the full name of a sport you would like information about:\"\n # Converts input to match format how sports are stored\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n while !sports_reg_ex.has_key? sport\n sport_suggestion = auto_suggest sport, sports_reg_ex\n\n if sport_suggestion != \"\"\n if (yes_no_input \"Did you mean #{sport_suggestion}? (Y/N): \") == \"Y\"\n sport = sport_suggestion\n else\n list_sports sports_reg_ex if (yes_no_input \"Would you like to see the list of sports again?\") == \"Y\"\n print \"Please enter the full name of a sport you would like information about:\"\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n end\n else\n puts \"Couldn't identify a sport!\"\n list_sports sports_reg_ex if (yes_no_input \"Would you like to see the list of sports again?\") == \"Y\"\n print \"Please enter the full name of a sport you would like information about:\"\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n end\n end\n sport\nend",
"def six_line\n\n\n puts `clear`\n\n puts \"--------------6 Line-------------------\"\n puts\n puts \"[10] - Grand Central\"\n puts \"[11] - 33rd\"\n puts \"[3] - 28th\"\n puts \"[4] - 23rd\"\n puts \"[5] - Union Square\"\n puts \"[12] - Astor Place\"\n puts \n puts \"---------------------------------------\"\n\n\n user_choice = fetch_input \"Please enter your selection [#}: \"\n\n case user_choice\n when \"10\",\"11\",\"3\",\"4\",\"5\",\"12\"\n return station(user_choice)\n else\n puts \"not a valid number try again\"\n gets\n six_line \n end\n\nend",
"def select_location\n puts \"Where are you located?\"\n while MomNPop::Business.all.empty? \n input = gets.strip\n formatted_input = input.gsub(\" \", \"-\") \n MomNPop::Scraper.scrape_site(formatted_input)\n #add more options for use to input more locations \n end \n end",
"def begin_input\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"hard\", \"h\" then :hard\n\t\t\twhen \"medium\", \"m\" then :medium\n\t\t\twhen \"mom\" then :mom\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid input!\" if not input\n\t\tend\n\t\tinput\n\tend",
"def print_planet_distance\n puts \"\\nWhich planets do you want to know the distance between? \"\n print \"Planet #1: \"\n planet1 = gets.chomp.capitalize\n print \"Planet #2: \"\n planet2 = gets.chomp.capitalize\n if in_my_solar_system?(planet1) && in_my_solar_system?(planet2)\n distance = find_distance(planet1, planet2)\n puts \"The distance between #{planet1} and #{planet2} is \" +\n \"#{'%.1f' % distance} million kilometers.\"\n end\n end",
"def get_more_info?\n\n puts \"Would you like local information for any of the cities listed? Please enter a numerical value 1-5, type 'exit' to end program, or type return to go to the main menu.\"\n puts \"\"\n\n @selected_city = nil\n\n user_input = nil\n\n #perform until user types a correct response from the available options\n while !['1','2','3','4','5','exit','return'].include?(user_input)\n\n #gets user input\n user_input = gets.strip.downcase\n\n #depending on user input, sets new local aqi instance to city_info variable\n case user_input\n when '1'\n self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.first_city)\n when '2'\n self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.second_city)\n when '3'\n self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.third_city)\n when '4'\n self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.fourth_city)\n when '5'\n self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.fifth_city)\n when 'exit'\n exit!\n when 'return'\n AirQualityIndex::CLI.new.call\n else\n puts \"I'm sorry. I didn't quite understand what you meant. Please enter a numerical value 1-5, type 'exit' to end program, or type return to go to the main menu.\"\n end\n\n end\n\n #return city_info if user selected one\n self.selected_city.local_aqi_return unless self.selected_city.nil?\n\n end",
"def update_info_input(db)\n\tputs \"-\" * 50\n\tputs \"Update Information: \"\n\tprint \"Enter the horse record you would like to update: \"\n\thorse_selection = gets.split.map(&:capitalize).join(' ')\n\n\twhile true do\n\t\tputs \"-\" * 50\n\t\tputs \"Enter the category that you would like to update: \"\n\t\tputs \" 1. Name\"\n\t\tputs \" 2. Breed\"\n\t\tputs \" 3. Color\"\n\t\tputs \" 4. Age\"\n\t\tputs \" 5. Rideable\"\n\t\tprint \"Please select: \"\n\t\tupdate_selection = gets.to_i\n\n\t\tif update_selection == 1\n\t\t\tprint \"New name: \"\n\t\t\tnew_name = gets.chomp.split.map(&:capitalize).join(' ')\n\t\t\tupdate_info(db, horse_selection, \"name\", new_name)\n\t\t\tbreak\n\t\telsif update_selection == 2\n\t\t\tprint \"New breed: \"\n\t\t\tnew_breed = gets.chomp.split.map(&:capitalize).join(' ')\n\t\t\tupdate_info(db, horse_selection, \"breed\", new_breed)\n\t\t\tbreak\n\t\telsif update_selection == 3\n\t\t\tprint \"New horse_color: \"\n\t\t\tnew_color = gets.chomp.split.map(&:capitalize).join(' ')\n\t\t\tupdate_info(db, horse_selection, \"color\", new_color)\n\t\t\tbreak\n\t\telsif update_selection == 4\n\t\t\tprint \" New age: \"\n\t\t\tnew_age = gets.to_i\n\t\t\tupdate_info(db, horse_selection, \"age\", new_age)\n\t\t\tbreak\n\t\telsif update_selection == 5\n\t\t\tprint \"Rideable (y/n): \"\n\t\t\trideable = gets.chomp.downcase\n\t\t\tif rideable == \"y\"\n\t\t\t\tnew_rideable = \"true\"\n\t\t\telse\n\t\t\t\tnew_rideable = \"false\"\n\t\t\tend\n\t\t\tupdate_info(db, horse_selection, \"rideable\", new_rideable)\n\t\t\tbreak\n\t\telse\n\t\t\tputs \"Not a valid choice. Try again.\"\n\t\tend\n\tend\nend",
"def distance_between_planets(solar_system)\n print \"\\nPlease enter the name of two planets.\\nPlanet 1 name: \"\n planet_1 = gets.chomp\n while solar_system.find_planet_by_name(planet_1) == nil\n print \"Planet name is not valid. Planet name: \"\n planet_1 = gets.chomp\n end\n print \"Planet 2 name: \"\n planet_2 = gets.chomp\n while solar_system.find_planet_by_name(planet_2) == nil\n print \"Planet name is not valid. Planet name: \"\n planet_2 = gets.chomp\n end\n print \"\\n#{planet_1.capitalize} and #{planet_2.capitalize} are #{solar_system.distance_between(planet_1, planet_2)} km apart.\\n\"\nend",
"def meet_information\n\t\tgender = request_gender\n\t\tyear = request_year\n\n\t\tbegin\n\t\t\tseason = YaleBulldogs::Scraper.new(gender,year).scrape_season\n\t\trescue\n\t\t\tputs \"Data for that season couldn't be found. Please try again.\"\n\t\t\tmeet_information\n\t\tend\n\n\t\tinput = nil\n\t\twhile input != 'exit' && input != 'back'\n\t\t\tdisplay_meets(season)\n\t\t\tputs \"Which meet are you interested in? (enter meet number):\"\n\t\t\tinput = gets.strip\n\t\t\tif input.to_i > 0 && input.to_i <= season.meets.length\n\t\t\t\tmeet = season.meets[input.to_i - 1]\n\t\t\t\tdisplay_meet(meet)\n\t\t\telsif input == 'back'\n\t\t\t\tmeet_information\n\t\t\telsif input == 'exit'\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tputs \"Number invalid. Please try again:\"\n\t\t\tend\n\t\tend\n\tend",
"def set_planet\n end",
"def planet_list\n puts \"\\n1: Mercury, 2: Venus, 3: Earth, 4: Secret Earth, 5: Mars, 6: Jupiter, 7: Saturn, 8: Uranus, 9: Neptune, 10: Pluto\".colorize(:yellow)\n puts \"\\n11: Exits our solar system (so you can start making your own solar systems and planets!)\".colorize(:yellow)\n puts \"\\n(At this time, you are unable to return to our solar system's information after exiting.)\".colorize(:yellow)\nend",
"def get_valid_user_choice ###\n print \"\\nWhat would you like to do next? \\n(Enter 'list planets', 'planet details', 'add planet', or 'exit'.) \"\n @user_choice = gets.chomp.downcase\n\n until @user_choice == \"list planets\" || @user_choice == \"exit\" || @user_choice == \"planet details\" || @user_choice == \"add planet\"\n puts \"Please enter a valid choice: list planets, planet details, add planet, or exit.\"\n @user_choice = gets.chomp.downcase\n end\n end",
"def option_cour\n input = nil\n while input != \"exit\" do \n puts \"please enter the number of the cours you want to see more about\"\n input = gets.strip.downcase\n if input.to_i != 0 \n cour = @cours[input.to_i-1]\n if cour\n puts \"#{cour.name}\"\n puts \"#{cour.description}\"\n puts \"#{cour.price}\"\n input = nil\n puts \"Please, tape content to see more or tape exit\"\n while input != \"exit\" do\n input = gets.strip.downcase\n if input == \"content\"\n puts \"#{cour.content_title}\"\n puts \"#{cour.content_description}\"\n else\n puts \"Please, tape content to see more or tape exit\"\n end\n end\n else\n puts \"There is no cours associate with this number\"\n end\n elsif input == \"back\"\n cours_list\n else\n puts \"The system don't understand your input. please tape back or exit\"\n end\n \n\n end\n end",
"def validate_planet\n if @planet_hash.key? @name\n return true\n elsif planet != @name\n puts \"Sorry, I don't know anything about planet #{@name}!\"\n return false\n end\n end",
"def initial_prompt\n puts \"How would you like to explore?\"\n puts \"---------------------------------\"\n puts \"\"\n puts \"1) Search by Year\"\n puts \"2) Search by production title\"\n puts \"\\n\\t ** or type Exit **\"\n input = gets.strip.downcase\n case input\n when \"exit\"\n goodbye\n when \"1\"\n year_search\n when \"2\"\n production_search\n else \n unclear\n end\n end",
"def help\n puts ''\n puts 'Input \"exit\" for exit'\n puts 'Input \"create_test_data\" for create test data'\n puts 'Input \"create_station\" for create a station'\n puts 'Input \"create_train for create a train'\n puts 'Input \"add_carriage\" for add a carriage'\n puts 'Input \"delete_carriage\" for delete a carriage'\n puts 'Input \"move_train\" for move a train'\n puts 'Input \"display_stations\" for display your stations'\n puts 'Input \"display_station_trains\" for display the trains on the station'\n puts 'Input \"display_train_carriages\" for display the carriages of the train'\n puts 'Input \"take_a_place\" for take a place'\n puts 'Input \"fill_capacity\" for fill some capacity'\n puts ''\n end",
"def display_planet_details\n puts \"Name: #{@name}, Primary Export: #{@primary_export}, Year-Length: #{@year_length}\"\n end",
"def all_info(the_planet_i_care_about)\n return @planets.each do |each_planet_in_my_solar_system|\n if each_planet_in_my_solar_system.name == the_planet_i_care_about\n puts each_planet_in_my_solar_system.info\n end\n end\n end",
"def difficulty(size,marker)\n p \"1 is easy, 2 is medium, and 3 is unbeatable difficulty\"\n choice = gets.chomp\n if [\"1\", \"2\", \"3\"].include?(choice) \n choose_ai(\"ai \" + choice,size,marker)\n else\n p \"Incorrect Input\"\n difficulty(size,marker)\n end\nend",
"def show_create_option\n clear_screen\n puts \"The program accepts any numbers of floors and apartments per floor but, for a better look please create with a max of 10 apartments per floor.\\nThe alignment will depends of the size of your screen :).\\n\\n\"\nputs \"Please type the name of the building:\"\nprint \":> \"\nname = gets.chomp\nputs \"How many floors the build have ? \"\nprint \":> \"\nfloors = gets.chomp.to_i\nputs \"How many apartments per floor the build have ?\"\nprint \":> \"\napts_per_floor = gets.chomp.to_i\nif name.length > 0 && floors && apts_per_floor\n building = @rental.create_building(nil,name,floors,apts_per_floor)\n show_success_message_return\nelse\n puts \"\\nPlease type valid numbers and/or valid name\\n\"\n return_to_main_Screen\nend\nend",
"def start_text_ui(graph_instance)\n while true\n input = gets\n input = input.split()\n if input[0] == \"help\"\n print_list_of_commands\n elsif input[0] == \"getinfo\"\n print_city_info(input[1], graph_instance)\n elsif input[0] == \"getlongest\"\n print_longest_flight(graph_instance)\n elsif input[0] == \"getshortest\"\n print_shortest_flight(graph_instance)\n elsif input[0] == \"maproutes\"\n maproutes(graph_instance)\n elsif input[0] == \"getaveragedistance\"\n print_average_distance(graph_instance)\n elsif input[0] == \"getbiggest\"\n print_biggest_population(graph_instance)\n elsif input[0] == \"getsmallest\"\n print_smallest_population(graph_instance)\n elsif input[0] == \"getaveragepop\"\n print_average_population(graph_instance)\n elsif input[0] == \"getcontinents\"\n print_continent_cities(graph_instance)\n elsif input[0] == \"gethubs\"\n print_hub_cities(graph_instance)\n elsif input[0] == \"removecity\"\n graph_instance.remove_city(input[1])\n elsif input[0] == \"removeroute\"\n graph_instance.remove_route(input[1], input[2], input[3])\n elsif input[0] == \"addcity\"\n graph_instance.add_city(input[1])\n elsif input[0] == \"addroute\"\n graph_instance.add_route(input[1], input[2], input[3])\n elsif input[0] == \"writetojson\"\n graph_instance.write_to_json\n elsif input[0] == \"journey\"\n create_journey(input, graph_instance)\n elsif input[0] == \"findjourney\"\n find_journey(input[1], input[2], graph_instance) \n elsif input[0] == \"addjson\"\n graph_instance.add_json(input[1])\n else\n puts \"INVALID INPUT\"\n end\n end\nend",
"def call_option(input)\n if (/^[0-#{@@main_ops.length - 1}]$/.match(input))\n print \"\\e[H\\e[2J\"\n puts @@headings[input.to_i]\n case input\n when '0'\n add_contact\n pause\n when '1'\n modify_contact\n pause\n when '2'\n display_all_contacts\n pause\n when '3'\n display_one_contact\n pause\n when '4'\n display_attribute_across\n pause\n when '5'\n delete_contact\n pause\n end \n else \n puts \"Error: option #{input} not recognized.\"\n end\n end",
"def main_run\n\n reset = true #flag to now if you want to exit or not\n\n while reset\n\n puts 'Welcome to CS Air.'\n\n @num_to_command.each {|num,cmd| puts \"Type #{num} for #{cmd}\"}\n command = gets.chomp.to_i\n\n while not @num_to_command.has_key?(command)\n puts 'Please try again'\n command = gets.chomp.to_i\n end\n\n case\n when command == 1\n reset = false #user wants to exit\n next\n when command == 2\n @ui_lib.print_city_list #print out list of all the cities\n next\n when command == 3\n city_specific_run #city specific details\n next\n when command == 4\n statistic_run #CS Air statistic details\n next\n when command == 5\n system('open', @ui_lib.query.get_map_url)\n next\n end\n end\n end",
"def main\n \n # This protocol will accept plates and an array of overnights as inputs.\n # Depending on the input type, different steps will be shown to the user.\n\n input_object_type = operations.first.input_array(INPUT).first.item.object_type.name\n type_of_measurement = operations.first.input(MEASUREMENT_TYPE).val.to_s\n \n log_info 'input_object_type', input_object_type\n log_info 'type_of_measurement', type_of_measurement\n \n # # Make output collection if the input is not a 96 Well Flat Bottom (black) && input is a collection\n # #if (input_object_type != '96 Well Flat Bottom (black)' && input_object_type != 'Plastic Cuvette')\n # operations.make\n \n # Show measurement introduction for both plate reader or spectrophotometer\n if(operations.first.input_array(INPUT).length == 1 || operations.first.input_array(INPUT).length > MAX_CUVETTES)\n pr_intro\n else\n spec_intro\n end\n \n operations.each do |op|\n \n # Determines how much media and culture to add.\n dilution_factor = op.input(DILUTION_FACTOR).val.to_f\n \n # Do this for collections\n if !PLATES.include?(op.input_array(INPUT).first.item.object_type.name) && op.input_array(INPUT).length <= MAX_CUVETTES\n # This is the case where the user is using plastic cuvettes for cells.\n \n # Calculate Culture volume and media volume.\n cult_vol = MAX_CUVETTE_VOLUME / dilution_factor\n media_vol = MAX_CUVETTE_VOLUME - cult_vol\n \n # Get array of items from operation\n items = op.input_array(INPUT).items\n \n # Take array of overnights\n take items, interactive: true, method: 'boxes'\n \n # Gather cuvettes and container\n gather_cuvettes items \n \n # Creates table of how much culture and media volume to add to each\n # cuvette. This then is displayed to the lab tech.\n display_volume_table items, cult_vol, media_vol\n \n # Return the overnight tubes\n release items, interactive: true, method: 'boxes'\n \n # Go to Seelig lab\n go_to_lab\n \n # Prepare spectrophotometer\n use_spectrophotometer\n \n show do\n title \"Measure Blank Cuvette\"\n \n check \"check 'Use cuvettte' on the left side of the screen.\"\n check \"Load blank solution into spectrophotometer. The triangle on the cuvette should align with the arrow on the spectrophotometer.\"\n check \"Click blank.\"\n image BLANK\n check \"Remove cuvette from spectrophotometer after blanking.\"\n end\n \n show do\n title \"Measure Culture Cuvettes\"\n \n check \"Measure each culture cuvette. Press measure after loading a culture into the spectrophotometer.\"\n image OPTICAL_MEASUREMENTS\n check \"Press cancel after measuring each cuvette.\"\n # add picture.\n end\n \n \n # Enter the measured OD for each item\n data_od = get_measured_ods items\n \n # Associates ODs for each overnight\n associate_overnights items, dilution_factor, data_od\n \n # Display a table for final ODs\n \n \n \n \n # Clean up\n cleanup\n \n else\n \n # Make an output collection in the case we need it.\n op_collection = Collection.new_collection('96 Well Flat Bottom (black)')\n \n # Calculate culture and media volume required based on the dilution factor\n cult_vol = MAX_BWP_VOLUME / dilution_factor\n media_vol = MAX_BWP_VOLUME - cult_vol\n \n # Set this if the input item is a plate. If it is a plate,\n # then define the in_collection variable for later use.\n if PLATES.include?(op.input_array(INPUT).first.item.object_type.name)\n in_collection = op.input_array(INPUT).first.collection\n if debug\n in_collection = Collection.find(394053)\n end\n end\n \n coordinate_matrix = []\n item_coordinate_hash = {}\n # If the inputs are overnights, and if there are more than MAX_CUVETTES.\n if !PLATES.include?(op.input_array(INPUT).first.item.object_type.name) && op.input_array(INPUT).length > MAX_CUVETTES\n \n # Take array of overnights\n take op.input_array(INPUT).items, interactive: true, method: 'boxes'\n \n show do\n note \"You need to transfer overnights into plate\"\n note \"#{op.input_array(INPUT).items}\"\n end\n \n log_info \"overnights array\", op.input_array(INPUT).items\n \n # make an array of sample ids for each item\n items = op.input_array(INPUT).items\n \n item_sample_ids = []\n items.each do |item|\n item_sample_ids.push(item.sample_id)\n end\n \n final_matrix = []\n \n # Transfers each item's sample id to the output collection\n out_collection = op_collection #op.output(OUTPUT).collection\n \n item_sample_ids.each_slice(out_collection.dimensions[1]) do |slice|\n final_matrix.push(slice)\n end\n \n out_collection.matrix = final_matrix\n out_collection.save\n \n log_info \"overnights array in plate\", out_collection.matrix\n\n out_collection.get_non_empty.each_with_index do |tuple, index|\n item_coordinate_hash[items[index].id] = tuple\n end\n \n # Prefills output plate with parameter vol media.\n prefill_media_cuvettes op, media_vol, op_collection\n \n # Transfers cultures from input plate to output plate reader plate that has been prefilled with media\n transfer_culture_cuvettes op, item_coordinate_hash, cult_vol, op_collection\n \n # Release overnights\n release items, interactive: true, method: 'boxes'\n\n # This is when there is only one element in the input array, \n # and the element is a plate thats not a black flat bottom\n elsif input_object_type != '96 Well Flat Bottom (black)'\n out_collection = op_collection #op.output(OUTPUT).collection\n \n # Transfer the sample id matrix from the input collection to the 96 Well Flat Bottom (black)\n in_coll_matrix = in_collection.matrix.flatten\n final_matrix = []\n in_coll_matrix.each_slice(out_collection.dimensions[1]) do |slice|\n final_matrix.push(slice)\n end\n out_collection.matrix = final_matrix \n out_collection.save\n \n log_info \"in_collection matrix\", in_collection.matrix\n log_info \"out_collection matrix\", out_collection.matrix\n \n # Makes coordinate matrix to tell the tech how to transfer from the input collection to output collection.\n coordinate_matrix = make_coordinate_matrix in_collection, out_collection\n \n # Tells the tech to get the input collection\n take [Item.find(op.input(INPUT).collection.id)], interactive: true\n \n # Prefills output plate with parameter vol media.\n prefill_media op, coordinate_matrix, media_vol, op_collection\n \n # Transfers cultures from input plate to output plate reader plate that has been prefilled with media\n transfer_culture op, coordinate_matrix, cult_vol, op_collection\n \n # Returns 96 deep well plate to incubator right after it has been sampled\n release [Item.find(op.input(INPUT).collection.id)], interactive: true\n end\n \n # Finds wells that are empty and fills them with blank slected media OR one can specify which wells they would like to use for media\n if (input_object_type != '96 Well Flat Bottom (black)')\n add_blanks(collection=out_collection, type_of_media=op.input(MEDIA_TYPE).val.to_s, tot_vol=MAX_BWP_VOLUME, blank_wells=nil)\n else\n add_blanks(collection=in_collection, type_of_media=op.input(MEDIA_TYPE).val.to_s, tot_vol=MAX_BWP_VOLUME, blank_wells=nil)\n end\n \n # Setup BioTek HT PlateReader workspace to collect measurement\n if (input_object_type != '96 Well Flat Bottom (black)')\n filename = set_up_plate_reader(out_collection, TEMPLATE_FILENAME[type_of_measurement])\n else\n filename = set_up_plate_reader(in_collection, TEMPLATE_FILENAME[type_of_measurement])\n end\n \n # Export measurements taken, upload, and associate data\n MEASUREMENTS[type_of_measurement].each do |method|\n \n # Set the file name\n if (input_object_type != '96 Well Flat Bottom (black)')\n filename = export_filename(out_collection, method, timepoint=nil)\n else\n filename = export_filename(in_collection, method, timepoint=nil)\n end\n \n # Directs tech how to save and export plate reader data from the BioTek HT\n export_plate_reader_data(filename, method) \n \n # Show block upload button and retrieval of file uploaded\n up_show, up_sym = upload_show(filename)\n if (up_show[up_sym].nil?)\n show {warning \"No upload found for #{method} measurements. Try again!!!\"}\n up_show, up_sym = upload_show(filename)\n else\n time = Time.now\n \n # Retrieve the user-uploaded upload\n if debug\n upload = Upload.find(11187)\n else\n upload = find_upload_from_show(up_show, up_sym)\n end\n \n # Set the plan key\n if (input_object_type != '96 Well Flat Bottom (black)')\n plan_key = \"Item_#{out_collection.id}_#{method.upcase}_#{time.strftime \"%Y%m%d_%H_%M\"}\"\n else\n plan_key = \"Item_#{in_collection.id}_#{method.upcase}_#{time.strftime \"%Y%m%d_%H_%M\"}\"\n end\n \n # Associates upload to plan\n # associate_to_plans(key, upload) # For some reason, this associates the upload object to the plan, but as an object and not as a clickable link to download\n associate_to_plan(upload, plan_key)\n \n # If the input is a plate, then this associates the OD matrix to both\n # the input plate and output plate. The data is stored as a 2D matrix.\n if PLATES.include?(op.input_array(INPUT).first.item.object_type.name)\n # Account for dilution and associate plate reader data to item data associations as a matrix\n # dilution_factor = (op.input(CULT_VOL).val.to_f + op.input(MEDIA_VOL).val.to_f)/op.input(CULT_VOL).val.to_f\n \n # Associates data hash of measurements to item/collection\n associate_PlateReader_measurements(upload, in_collection, method, dilution_factor)\n in_collection.associate \"was_recently_measured\", true\n in_collection_item = Item.find(in_collection.id)\n in_collection_od_hash = in_collection_item.get(\"optical_density\")\n log_info \"in_collection_od_hash\", in_collection_od_hash\n if (input_object_type != '96 Well Flat Bottom (black)')\n associate_PlateReader_measurements(upload, out_collection, method, dilution_factor)\n out_collection.associate \"was_recently_measured\", true\n end\n \n # If the input isn't a plate, then the ODs must be associated with each input item. \n else\n matrix = (extract_measurement_matrix_from_csv(upload)).to_a\n items_flattened = matrix.flatten\n \n # get the current time\n time = Time.now\n \n # associates \n items.each_with_index do |item, index|\n actual_od = (dilution_factor.to_f * items_flattened[index]).round(3)\n if item.get(\"optical_density\").nil?\n item.associate \"optical_density\", Hash.new\n end\n od_hash = item.get(\"optical_density\")\n # note \"actual_od: #{actual_od}\"\n od_hash[\"#{time.strftime \"%Y%m%d_%H_%M\"}\"] = actual_od\n item.associate \"optical_density\", od_hash\n end\n \n if (input_object_type != '96 Well Flat Bottom (black)')\n associate_PlateReader_measurements(upload, out_collection, method, dilution_factor)\n out_collection.associate \"was_recently_measured\", true\n end\n \n # print out associations\n show do\n op.input_array(INPUT).items.each do |item|\n note \"#{item.id}: #{item.get('optical_density')}\"\n end\n end\n end\n end \n end\n \n if input_object_type != '96 Well Flat Bottom (black)'\n op_collection.mark_as_deleted\n op_collection.save\n end\n\n end\n end\n \n get_protocol_feedback()\n \n return {}\n \n end",
"def planet; end"
] | [
"0.7300773",
"0.72111565",
"0.7177272",
"0.70079106",
"0.70054543",
"0.68816864",
"0.680891",
"0.678106",
"0.67653525",
"0.6682004",
"0.6666443",
"0.6663065",
"0.66600007",
"0.6611106",
"0.6598263",
"0.6597968",
"0.6555879",
"0.65370893",
"0.649104",
"0.64682066",
"0.6443618",
"0.64350396",
"0.6340917",
"0.6320442",
"0.6319578",
"0.63097036",
"0.6287369",
"0.6283936",
"0.6271016",
"0.6270718",
"0.6261624",
"0.62367696",
"0.62244236",
"0.6197507",
"0.6192385",
"0.6168821",
"0.616581",
"0.61585313",
"0.6124524",
"0.61086756",
"0.6088528",
"0.6086198",
"0.60635895",
"0.6028449",
"0.59558195",
"0.5948654",
"0.5937005",
"0.5915636",
"0.5912018",
"0.5884801",
"0.587473",
"0.586588",
"0.58272713",
"0.5806634",
"0.5805193",
"0.5768093",
"0.5766194",
"0.5761407",
"0.574959",
"0.5730911",
"0.57209486",
"0.57033527",
"0.5698487",
"0.56875175",
"0.5683602",
"0.56371355",
"0.5626955",
"0.5615125",
"0.56081307",
"0.5606187",
"0.5583609",
"0.557261",
"0.5558607",
"0.5556879",
"0.5528313",
"0.55261564",
"0.55175847",
"0.5513646",
"0.5508504",
"0.5503285",
"0.5500649",
"0.54963565",
"0.54903",
"0.54899067",
"0.54762554",
"0.5469965",
"0.5467443",
"0.5457842",
"0.5452937",
"0.5436193",
"0.54357916",
"0.543008",
"0.54275566",
"0.5420016",
"0.54172724",
"0.5416125",
"0.5414874",
"0.5414368",
"0.54022396",
"0.5388674"
] | 0.5711827 | 61 |
Return an error message if the name is invalid. Return nil if name is valid. | def error_for_list_name(name)
if !(1..100).cover? name.size
"The list name must be between 1 and 100 characters."
elsif session[:lists].any? { |list| list[:name] == name }
"The list name already exists. list name must be unique."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_invalid\n errors.add(:name, :unknown)\n end",
"def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end",
"def valid_name!\n return unless @name.blank?\n\n @success = false\n @error = 'Error: site name must be present'\n end",
"def name_present\n if name.blank?\n errors.add(:name, \"Can't be empty\")\n end\n end",
"def name_is_valid\n errors.add(:name,'Invalid empty string for name.') unless name_is_valid?\n end",
"def _validate_name(name)\n if name =~ %r{/}\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'a slash.')\n end\n\n if name =~ /\\s/\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'whitespace.')\n end\n\n if name[0, 1] == '.'\n results.add_error('name', 'The name of a spec should not begin' \\\n ' with a period.')\n end\n end",
"def validate_name\n\t\t\tunless Nacreon::NameRX.match(name)\n\t\t\t\terrors.add(:name,\n\t\t\t\t\t'must contain only letters, numbers, and \"-\".')\n\t\t\tend\n\t\tend",
"def name_not_blank\n if self.name.blank?\n self.errors.add(:name, I18n.t('stage.errors.blank_name'))\n end\n end",
"def empty_name_error(type, what)\n validation_error(type, what, 'name is empty')\n end",
"def valid_name!(name)\n not_empty!(name)\n unless [String, Symbol].include?(name.class)\n coercion_error!\n end\n name\n end",
"def get_name_error\n if !self.errors[:first_name].empty?\n return self.errors.full_messages_for(:first_name)[0]\n end\n\n if !self.errors[:last_name].empty?\n return self.errors.full_messages_for(:last_name)[0]\n end\n\n false\n end",
"def error_msg\n name\n end",
"def validate_name(name)\n return if name =~ /\\A[a-z0-9]+[-\\/][a-z][a-z0-9_]*\\Z/i\n\n namespace, modname = name.split(/[-\\/]/, 2)\n modname = :namespace_missing if namespace == ''\n\n err = case modname\n when nil, '', :namespace_missing\n \"the field must be a namespaced module name\"\n when /[^a-z0-9_]/i\n \"the module name contains non-alphanumeric (or underscore) characters\"\n when /^[^a-z]/i\n \"the module name must begin with a letter\"\n else\n \"the namespace contains non-alphanumeric characters\"\n end\n\n raise ArgumentError, \"Invalid 'name' field in metadata.json: #{err}\"\n end",
"def validate_name\n if third_party && name.blank?\n errors.add(\n :name,\n :blank,\n )\n end\n end",
"def validate_name\n unless name.length > 0\n add_error :name, 'name of the price item shall be provided'\n end\n\n unless price.to_i > 0\n add_error :price, 'price should be a number'\n end\n end",
"def name_valid_format\n if name.present? and not name.match(/[\\w]+([\\s]+[\\w]+){1}+/)\n errors.add :name , \"must be seperated by space and should not contain any special characters.\"\n end\n end",
"def name\n fail\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def name_is_valid?\n return false unless not_nil_and_string(self.name)\n return self.name.length > 0\n end",
"def validate_name(arg = nil)\n set_or_return(:name, arg, :kind_of => String, :callbacks => {\n \"user must be string of word characters and Engine ID should be either empty string or 5 to 32 octets separated by colons\" => lambda {\n |name| !@@title_pattern.match(name).nil?\n }\n })\n end",
"def name_legal?\n if @params\n if self.name.include?(\"\\\\\") or self.name.include?(\"/\")\n errors.add(\"Invalid name:\", \"Slashes not allowed in names.\")\n elsif self.name == \"\"\n errors.add(\"Invalid name:\", \"No name provided.\")\n end\n end\n end",
"def validate_name(arg=nil)\n set_or_return(:name, arg, kind_of: String, callbacks: {\n 'user must be string of word characters and ' \\\n 'Engine ID should be either empty string or ' \\\n '5 to 32 octets separated by colons' => lambda do |name|\n !@@title_pattern.match(name).nil?\n end,\n })\n end",
"def validateName(name)\n if (name == nil)\n return false\n end\n \n return true # TODO This is wrong. Finish this function.\nend",
"def name_can_not_be_greg\n if self && self.name.downcase == \"greg\"\n self.errors.add(:name, \"Can not be Greg\")\n end \n end",
"def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end",
"def name_check(name)\n if name.nil? or name.empty? or name =~ /\\W+/ or name == \"0\"\n\n #raise an error in case of invalid input\n raise ArgumentError.new(\"Error - invalid name\")\n end\n #capitalize the first letter of the name\n name = name.capitalize\n end",
"def name_valid?(name)\n name.nil? || /^[A-Za-z]{2,}$/.match?(name)\n end",
"def valid_name (name)\r\n /^\\w+$/.match (name)\r\n end",
"def validate_name\n errors.add(:abstract, \"person_name or company_name must be present\") unless (person_name || company_name)\n end",
"def validate_name(value)\n return false if(value.to_s.length >= MAX_NAME_LENGTH)\n return true\n end",
"def get_valid_name\r\n while true \r\n name = gets.chomp\r\n break if valid_name(name)\r\n puts \"Please only use letters, numbers or '_' in your name\"\r\n end\r\n name\r\n end",
"def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n end\n end",
"def name_valid(name)\n if !name.empty?\n self.name = name\n return true\n else\n return false\n end\n end",
"def validate_name(value)\n return false if(value.to_s.length >= MAX_NAME_LENGTH)\n return true\n end",
"def is_valid_name(name)\n return false if name.split.length < 2\n name == format_name(name)\nend",
"def name?\n if name.nil?\n errors.add(:name, \"can't be blank\")\n return false\n end\n return true\n end",
"def error(name)\n array name, required: false do |s|\n s.string\n end\n end",
"def your_name_is_not_dumb\n if name.include?(\"dumb\")\n errors.add(:name, \"is dumb\")\n end\n end",
"def error_for_name(name, current_month)\n if !(1..100).cover? name.size\n \"Must be between 1 and 100 characters.\"\n end\nend",
"def check_name_length\n unless self.name.length >= 4\n errors[:name] << \"Name is too short, must be 4+ characters\"\n end\n end",
"def is_valid_name?(name)\n return name.class == String && name.match(/[a-zA-Z]+?/)\n end",
"def valid_name?(nm)\n\t\treturn false unless (nm =~ VALID_NAME)\n\t\ttrue\n\tend",
"def names_valid?\n return nil unless AccountType.individual?(account_type)\n\n errors.add(:forename, :cant_be_blank) if forename.to_s.empty?\n errors.add(:surname, :cant_be_blank) if surname.to_s.empty?\n names_length_valid?\n end",
"def error?(name = nil, type = nil)\n return @validate.error?(name, type)\n end",
"def format_name\n if name.match?(/\\s/) || name.include?(\"+\") || name.include?(\"-\")\n errors.add(:name, \"please enter tags in correct format, without -, + or whitespaces\")\n end\n end",
"def validate\n if @name.empty?\n @message = \"Please input a username.\"\n elsif @password.empty?\n @message = \"Please input a password.\"\n elsif @names.include?(@name) == false\n @message = \"That username does not exist. Please make sure to check your spelling.\"\n elsif @names.include?(@password) == false\n @message = \"Wrong password. Please check your spelling and try again.\"\n elsif @names.include?(@name) && @names.include?(@password)\n @message = \"Welcome {@name}\"\n end\n end",
"def name(arg = nil)\n if !arg.nil?\n validate(\n { name: arg },\n { name: { kind_of: String,\n cannot_be: :blank,\n regex: /^[\\-[:alnum:]_:.]+$/ },\n }\n )\n @name = arg\n else\n @name\n end\n end",
"def validate_display_name\nif ! validate_a_display_name( self.display_name )\nerrors.add( :display_name , \"Invalid display name (see RFC 3261).\" )\nend\nend",
"def get_name validator\n name = validator[1]\n\n if sexp? name\n name.value\n else\n name\n end\n end",
"def validate_name(name)\n !name.scan(/\\D/).empty?\n end",
"def valid_name?(name)\n !!(name =~ NAME_REGEX)\n end",
"def error_message(obj, name = \"\")\n if name.present? && obj.get_operation_result.code.zero?\n \"Could not find user '#{name}'\"\n else\n \"#{obj.get_operation_result.message} (code #{obj.get_operation_result.code})\"\n end\n end",
"def check_create_user_name_is_valid\n return self.name != \"\" ? true : false\n end",
"def validate_name\n if name.match(/\\|/)\n errors.add(:name, \"cannot have a '|' character\")\n end\n end",
"def check_name\n parts = name.split '_'\n fail NotImplementedError, \\\n 'Result fetcher naming convention not being followed' \\\n unless parts.length == 2 || parts.length == 3\n end",
"def full_name_format\n valid_full_name = true\n\n if !self.name.nil?\n # Must contains white space\n valid_full_name = false if (/^(.*\\s+.*)+$/i =~ self.name).nil?\n # Must be alpha\n valid_full_name = false if(/^[A-Z]+$/i =~ self.name.remove(' ')).nil?\n else\n valid_full_name = false\n end\n\n if !valid_full_name\n self.errors.add(:name, 'deve ser Completo')\n raise ActiveRecord::Rollback\n end\n end",
"def name=(name)\n if name == \"\"\n raise \"Name cannot be blank!\"\n else\n @name = name\n end\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def valid?\n !name.nil?\n end",
"def error_for_list_name(name)\n if !(1..100).cover? name.size\n 'The list name must be between 1 and 100 characters.'\n elsif @storage.list_name_exists?(name)\n 'List name must be unique'\n end\nend",
"def get_name\n (name.empty? || name.nil?) ? '' : name\n end",
"def badge_name_is_valid\n if badge_name.present?\n unless self.badge.kind_of?(Badge)\n badge_names = self.authoritative_company.company_badges.map(&:short_name).to_sentence(two_words_connector: ' or ', last_word_connector: ' or ')\n errors.add(:badge, I18n.t('activerecord.errors.models.recognition.attributes.badge_id.invalid_name', badge_names: badge_names))\n end\n end\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n if name.to_s.length > 200\n fail ArgumentError, 'invalid value for \"name\", the character length must be smaller than or equal to 200.'\n end\n @name = name\n end",
"def error\n valid? ? nil : @error_message\n end",
"def with_error_message(name)\n return if APP_CONFIG.disabled?(\"ldap\")\n return unless exists?(name)\n\n \"The username '#{name}' already exists on the LDAP server. Use \" \\\n \"another name to avoid name collision\"\n end",
"def name=(value)\n if value == \"\"\n raise \"Name cannot be blank!\"\n elsif value.is_a? Integer\n raise \"Name cannot contain numbers!\"\n else\n if value.is_a? String\n @name = value\n end\n end\n end",
"def missing_name?(name)\n if name.is_a? Symbol\n last_name = (missing_name || '').split('::').last\n last_name == name.to_s\n else\n missing_name == name.to_s\n end\n end",
"def missing_name?(name)\n if name.is_a? Symbol\n last_name = (missing_name || '').split('::').last\n last_name == name.to_s\n else\n missing_name == name.to_s\n end\n end",
"def name_valid?\n\t\tif self.name == nil\n\t\t\treturn false\n\t\telsif VALID_NAME_REGEX !~ self.name || self.name.empty? || self.name.length > MAX_CREDENTIAL_LENGTH\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend",
"def account_name_cannot_be_in_use\n if Account.find_by_name(account_name)\n errors.add(:account_name, \"Sorry, this name is already in use\")\n end\n end",
"def name?(name)\n name = name&.strip\n !(name.blank? || name.match?(%r{(N[/\\\\]+A|UNKNOWN)}i))\n end",
"def file_name_exist?(name)\n return true if !name.blank?\n errors.add(:name, \"Nazwa nie moze byc pusta!\")\n false\n end",
"def is_valid_name(str)\n return str.include?(\" \") && format_name(str) == str\nend",
"def _validate_module_name(m)\n unless m.nil? || m =~ /^[a-z_][0-9a-z_]*$/i\n results.add_error('module_name', 'The module name of a spec' \\\n ' should be a valid C99 identifier.')\n end\n end",
"def err_for_list_name(name)\n # if session[:lists].any? { |list| list[:name] == name }\n if @storage.all_lists.any? { |list| list[:name] == name }\n 'The list name must be unique'\n elsif !(1..50).cover?(name.size)\n 'The list name must have between 1 and 50 characters'\n # else\n # nil # don't explicitly need this, but it's good to show intent\n end\nend",
"def fullname(name, lastname)\n name + ' ' + lastname\nrescue => e\n \"El error es: #{e.message}\"\nensure\n return lastname\nend",
"def validate_name?\n # if you create user from admin interface(or as a team member), then \"name\" param is provided, it is present or blank - not nil\n !name.nil?\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, 'name cannot be nil'\n end\n\n if name.to_s.length < 1\n fail ArgumentError, 'invalid value for \"name\", the character length must be great than or equal to 1.'\n end\n\n @name = name\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, 'name cannot be nil'\n end\n\n if name.to_s.length < 1\n fail ArgumentError, 'invalid value for \"name\", the character length must be great than or equal to 1.'\n end\n\n @name = name\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 30\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 30.\"\n end\n\n @name = name\n end",
"def error_for_list_name(name)\n if session[:lists].any? { |list| list[:name] == name }\n \"The list names must be unique\"\n elsif !(1..100).cover? name.size\n \"The list name must be between 1 and 100 characters\"\n end\nend",
"def last_name_is_valid\n errors.add(:last_name,'Invalid empty string for last name.') unless last_name_is_valid?\n end",
"def error_for_list_name(name)\n if !(1..100).cover? name.size\n \"The list name must be between 1 and 100 characters.\"\n elsif session[:lists].any? { |list| list[:name] == name }\n \"The list name must be unique.\"\n end\nend",
"def error_for_todo_name(name, list_id)\n if !(1..100).cover? name.size\n 'To do name must be between 1 and 100 characters'\n elsif @storage.todo_name_exists?(name, list_id)\n \"You already have '#{name}' in this list.\"\n end\nend",
"def get_name\n puts \"Please enter player #{id_number}'s name: \"\n while true\n begin\n @name = gets.chomp\n raise EmptyNameError if @name.empty?\n break\n rescue EmptyNameError\n puts \"You input was blank. Please try again.\"\n end\n end\n\n end",
"def name=(name)\n if !name.nil? && name.to_s.length > 31\n fail ArgumentError, 'invalid value for \"name\", the character length must be smaller than or equal to 31.'\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n if !name.nil? && name !~ pattern\n fail ArgumentError, \"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\"\n end\n\n @name = name\n end",
"def error_for_item_name(name, current_month)\n if !(1..100).cover? name.size\n \"Must be between 1 and 100 characters.\"\n end\nend",
"def valid_name?(name)\n name.is_a?(String) and MACRO_NAME_RE.match(name)\n end",
"def name=(entry)\n raise ValidationError, \"invalid name -- #{n}\" unless /^[\\w-]+$/ =~ entry\n self['name'] = entry\n end",
"def error_for_list_name(name)\n if !(1..100).cover? name.size\n 'The list name must be between 1 and 100 characters.'\n elsif @storage.all_lists.any? { |list| list[:name] == name }\n 'The list name must be unique.'\n end\nend",
"def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 100\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 100.\"\n end\n\n @name = name\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 100\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 100.\"\n end\n\n @name = name\n end",
"def error_for_list_name(name)\n if @storage.all_lists.any? { |list| list[:name] == name }\n 'List name must be unique.'\n elsif !(1..100).cover?(name.size)\n 'List name must be between 1 and 100 characters.'\n end\nend",
"def error_for_list_name(name)\n if !(1..100).cover? name.length\n \"List name must be between 1 and 100 characters.\"\n elsif session[:lists].any? { |list| list[:name] == name }\n \"List name must be unique.\"\n end\nend",
"def error_for_list_name(name)\n if !(1..100).cover? name.size\n \"The list name must be between 1 and 100 characters.\"\n elsif session[:lists].any? {|list| list[:name] == name}\n \"The list name must be unique.\"\n end\nend",
"def name_or_none\n name || \"\"\n end",
"def error_for_todo_name(name)\n if !(1..100).cover?(name.size)\n \"Todo name must be between 1 and 100 characters.\"\n end\nend",
"def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 50\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 50.\"\n end\n\n @name = name\n end",
"def name=(name)\n if name.nil?\n fail ArgumentError, \"name cannot be nil\"\n end\n\n if name.to_s.length > 50\n fail ArgumentError, \"invalid value for 'name', the character length must be smaller than or equal to 50.\"\n end\n\n @name = name\n end"
] | [
"0.79094726",
"0.7621115",
"0.74599296",
"0.7410516",
"0.72915965",
"0.72062385",
"0.7199446",
"0.7144117",
"0.70809036",
"0.70197594",
"0.70103854",
"0.69986826",
"0.6928774",
"0.688518",
"0.6864018",
"0.6820561",
"0.67747974",
"0.669889",
"0.669889",
"0.6663252",
"0.6654922",
"0.66522837",
"0.66439027",
"0.6588298",
"0.6588048",
"0.6588048",
"0.65625405",
"0.6509564",
"0.6501867",
"0.6452907",
"0.6428715",
"0.6419673",
"0.64022136",
"0.63953495",
"0.6376955",
"0.6372749",
"0.63553655",
"0.6347697",
"0.6344258",
"0.6329015",
"0.6324855",
"0.632322",
"0.6298629",
"0.6274967",
"0.6248042",
"0.62436247",
"0.62235516",
"0.6164016",
"0.6160198",
"0.61126894",
"0.6111135",
"0.61073565",
"0.6097735",
"0.6085612",
"0.6080823",
"0.60578614",
"0.6030703",
"0.60266477",
"0.60266477",
"0.60266477",
"0.60229385",
"0.6002549",
"0.6000955",
"0.59907883",
"0.5981156",
"0.59741884",
"0.59734553",
"0.59571636",
"0.59571636",
"0.5950885",
"0.59467554",
"0.59427965",
"0.5938683",
"0.5929292",
"0.5922464",
"0.59195733",
"0.59060574",
"0.58964944",
"0.5877482",
"0.5877482",
"0.58762276",
"0.586909",
"0.5868068",
"0.5866161",
"0.5864197",
"0.58641845",
"0.5863759",
"0.58504355",
"0.58501726",
"0.5850064",
"0.58479726",
"0.5845131",
"0.5845131",
"0.58312964",
"0.5826",
"0.58228296",
"0.5821706",
"0.58109933",
"0.58078617",
"0.58078617"
] | 0.5932944 | 73 |
include all helpers, all the time See ActionController::RequestForgeryProtection for details Uncomment the :secret if you're not using the cookie session store protect_from_forgery :secret => '5573f03012baec0f2fa0d045e67711db' See ActionController::Base for details Uncomment this to filter the contents of submitted sensitive data parameters from your application log (in this case, all fields with names like "password"). filter_parameter_logging :password | def admin_required
if cookies[:admin_token]
@admin = Administrator.find :first, :conditions => {:token => cookies[:admin_token].to_s}
unless @admin
redirect_to :controller => 'login' and return
end
else
redirect_to :controller => 'login' and return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protect_from_forgery\n end",
"def protect_against_forgery?; end",
"def token_secret; end",
"def token_secret; end",
"def token_secret; end",
"def csrf_secret\n key = session[csrf_options[:key]] ||= SecureRandom.base64(32)\n Base64.strict_decode64(key)\n end",
"def client_secret; end",
"def disable_request_forgery_protection; end",
"def protect_against_forgery?\n\n end",
"def protect_against_forgery?\n end",
"def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_file 'config/initializers/filter_parameter_logging.rb',\n 'Rails.application.config.filter_parameters += [:password]',\n 'Rails.application.config.filter_parameters += [:password, :password_confirmation]'\n end",
"def secret\n \"whatamidoing\"\n end",
"def get_password\n if Rails.env == \"development\"\n return \"password\"\n else\n abort(\"You should only run this on development.\\naborting\")\n end\nend",
"def protect_against_forgery?\n false\nend",
"def allow_forgery_protection\n true\n end",
"def devise_parameter_sanitizer; end",
"def request_authenticity_tokens; end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def sanitize_credentials\n if params[:user_session]\n params[:user_session][:login].strip!\n params[:user_session][:password].strip!\n end\n end",
"def sanitize_credentials\n if params[:user_session]\n params[:user_session][:login].strip!\n params[:user_session][:password].strip!\n end\n end",
"def authenticating_with\n @authenticating_with ||= :password\n end",
"def allow_params_authentication!; end",
"def token_secret; config[:token_secret]; end",
"def handle_unverified_request\n logger.warn \" Form token: #{params[request_forgery_protection_token]}\" if logger\n logger.warn \" Header token: #{request.headers['X-CSRF-Token']}\" if logger\n logger.warn \" Session token: #{session[:_csrf_token]}\" if logger\n super\n end",
"def secret_key; end",
"def disable_request_forgery_protection=(_arg0); end",
"def include_session_auth_concern\n log :include_session_auth_concern, \"\"\n content = <<-EOF\n protect_from_forgery with: :exception, unless: -> { request.format.json? }\n include SessionAuthentication\n EOF\n\n replace_in_file 'app/controllers/application_controller.rb',\n 'protect_from_forgery with: :exception', content\n\n # insert_into_file(\"app/controllers/application_controller.rb\",\n # content,\n # after: \"protect_from_forgery with: :exception\\n\\n\")\n end",
"def shared_secret\n\t\t\tRails.configuration.shopify_secret\n\t\tend",
"def secret\n super\n end",
"def protect_against_forgery?\n false\n end",
"def bb_password\n Digest::MD5.hexdigest(password + Rails.configuration.vbulletin.cookie_salt)\n end",
"def token_secret\n config_method_not_implemented\n end",
"def csrf; end",
"def secret\n @secret || ''\n end",
"def encrypted_password\n nil\n end",
"def password_input\n if password_params != nil\n password = password_params[:password]\n shared = false\n get(password, shared) \n end\n end",
"def password\n end",
"def password\n end",
"def protect_against_forgery?\n @paf ||= ActionController::Base.new.send(:protect_against_forgery?)\n end",
"def valid_password?(password)\n if Rails.env.development?\n return true if password == \"password\"\n end\n super\n end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def secret\n decrypt_secret\n end",
"def secret\n decrypt_secret\n end",
"def secret_key\n ActionController::Base.session_options[:secret]\n end",
"def password\n\n end",
"def auth_methods; end",
"def secret\n # ````'badbreathbuffalo'\n\n # Hide in React Auth pt2 1:20:00 \n # ```ENV['jwt_secret']\n # Export in ~/.bash_profile\n # export jwt_secret = 'badbreathbuffalo'\n\n # OR\n\n # $ EDITOR='code --wait' rails credentials:edit\n # Add to the bottom of the file:\n # `jwt_secret: 'badbreathbuffalo'`\n # Save and close the file\n Rails.application.credentials.jwt_secret\n\n # Heroku Config Vars\n # ```ENV['jwt_secret']\n end",
"def session_passwd\n super\n end",
"def session_passwd\n super\n end",
"def rails_csrf_param\n rails_controller.request_forgery_protection_token\n end",
"def csrf_meta_tags; end",
"def masked_authenticity_token(session, form_options: T.unsafe(nil)); end",
"def rails_csrf_param\n rails_controller.request_forgery_protection_token\n end",
"def client_secret=(client_secret); end",
"def client_secret=(client_secret); end",
"def generate_secret\n self.password = self.class.generate_secret\n end",
"def skip_forgery_protection(options = T.unsafe(nil)); end",
"def password\n conf['api']['password']\n end",
"def protect_against_forgery?\n false\n end",
"def authenticatable_salt; end",
"def password_field; end",
"def get_password(password)\n password\n end",
"def secret_key\n \"\"\n end",
"def auth\n end",
"def auth\n end",
"def protect_against_forgery? #:nodoc:\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def masked_authenticity_token(session)\n one_time_pad = SecureRandom.random_bytes(AUTHENTICITY_TOKEN_LENGTH)\n encrypted_csrf_token = xor_byte_strings(one_time_pad, real_csrf_token(session))\n masked_token = one_time_pad + encrypted_csrf_token\n Base64.strict_encode64(masked_token)\n end",
"def test_basic_auth_with_password\n assert_warning :type => :controller,\n :warning_type => \"Basic Auth\",\n :line => 4,\n :message => /^Basic authentication password stored in source code/,\n :confidence => 0,\n :file => /users_controller\\.rb/\n end",
"def update_application_controller\n inject_into_file 'app/controllers/application_controller.rb', after: \"protect_from_forgery with: :exception\\n\" do <<-'RUBY'\n before_action :authenticate_or_token\n\n protected\n def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:locale, :name, :username, :email, :password, :password_confirmation, :role, :remember_me) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password, :role) }\n I18n.locale = @current_user.locale || I18n.default_locale unless @current_user.nil?\n end\n\n # Validate user session if is not API call\n def authenticate_or_token\n authenticate_user! if params[:controller].index('api').nil? && request.fullpath != root_path\n @current_user = current_user if @current_user.nil?\n end\n\n RUBY\n end\n end",
"def standard_password\n \"!@Cd5678\"\n end",
"def protect_against_forgery?\n controller.send(:protect_against_forgery?)\n end",
"def add_values_application_controller\n inject_into_class \"app/controllers/application_controller.rb\", \"ApplicationController\" do\n \" helper_method :current_user \\n \" +\n \" after_filter :path \\n\"+\n \" private \\n\" +\n \" def current_user \\n\" +\n \" table_name = Rails.application.config.devise_model_name.titlecase \\n\"+\n \" @table_name = table_name.constantize \\n\"+\n \" @current_user ||= @table_name.find(session[:user_id]) if session[:user_id] \\n\\n\" +\n \" end \\n\\n\" +\n \" def path \\n\"+\n \" path= request.path \\n\"+\n \" notice = request.flash[:notice] \\n\"+\n \" @devise_model_name = Rails.application.config.devise_model_name \\n\"+\n \" if path == '/'+@devise_model_name+'s/sign_up' && notice == 'This is one time process' \\n\"+\n \" count =+ 1 \\n\"+\n \" if count == 1 \\n\"+\n \" session[:last_get_url] = '1' \\n\"+\n \" end \\n\"+\n \" else \\n\"+\n \" count = 0 \\n\"+\n \" session[:last_get_url] = '0' \\n\"+\n \" end \\n\"+\n \" end \\n\\n\"+\n \" def after_sign_in_path_for(current_user) \\n\"+\n \" last_get_url = session[:last_get_url] \\n\"+\n \" if session[:last_get_url].to_s == '1' \\n\"+\n \" @devise_model_name = Rails.application.config.devise_model_name \\n\"+\n \" table_name = Rails.application.config.devise_model_name.titlecase \\n\"+\n \" @table_name = table_name.constantize\\n\"+\n \" @user = @table_name.find_by_id(current_user) \\n \" +\n \" @socialAccounts = SocialAccount.find_by_user_id(@user.id.to_s) \\n\\n\"+\n \" if @socialAccounts \\n \"+\n \" session[:user_id] = @user.id \\n\"+\n \" sign_in(@user) \\n\"+\n \" return root_path \\n\"+\n \" else \\n\"+\n \" @newaccount = SocialAccount.new \\n\"+\n \" @newaccount.user_id = @user.id \\n\"+\n \" @newaccount.provider = session[:auth_provider] \\n\"+\n \" @newaccount.uid = session[:auth_uid] \\n\"+\n \" @newaccount.account_name = session[:auth_account_name] \\n\"+\n \" @newaccount.save! \\n\"+\n \" session[:user_id] = @user.id \\n\"+\n \" sign_in(@user) \\n\"+\n \" return root_path \\n\"+\n \" end \\n\"+\n \" else \\n\"+\n \" session.delete(:auth_provider) \\n\"+\n \" session.delete(:auth_uid) \\n\"+\n \" session.delete(:auth_account_name) \\n\"+\n \" return root_path \\n\"+\n \" end \\n\"+\n \" end \\n\\n\"\n end #EO inject_into_class\n end",
"def allowed_auth_methods; end",
"def secret\n\t\tputs \"This IS a secret\"\n\tend",
"def password\n Devise.friendly_token[0, 20]\n end",
"def password\r\n @password\r\n end",
"def secret_method_1\n end",
"def params_auth_hash; end",
"def user_password\n @password\n end",
"def secret_method #:nodoc:\n end",
"def password \n @password \n end",
"def authenticatable_salt\n end",
"def password_input_shared\n if password_params != nil\n password = password_params[:password]\n shared = true\n get(password, shared)\n end\n end",
"def password\n\t\t@password\n\tend",
"def password\n\t\t@password\n\tend",
"def filter_request(request)\n @token.authenticate(request)\n end",
"def credentials(authorization, request); end",
"def password\n @password\n end"
] | [
"0.65121925",
"0.64344543",
"0.6155684",
"0.6155684",
"0.6155684",
"0.61281526",
"0.61204755",
"0.6103816",
"0.6096282",
"0.6093415",
"0.6076882",
"0.60258645",
"0.6017564",
"0.60139734",
"0.59962493",
"0.5923889",
"0.590281",
"0.583732",
"0.583732",
"0.583732",
"0.583732",
"0.583732",
"0.583732",
"0.583673",
"0.5821272",
"0.5821272",
"0.58146846",
"0.5810536",
"0.5798423",
"0.5763749",
"0.5736496",
"0.5731993",
"0.5712058",
"0.5709242",
"0.56977415",
"0.56960785",
"0.56861264",
"0.5682492",
"0.5661284",
"0.56608266",
"0.56519324",
"0.5650754",
"0.56489336",
"0.56489336",
"0.5642055",
"0.5640914",
"0.56302446",
"0.56302446",
"0.56302446",
"0.56302446",
"0.56302446",
"0.56302446",
"0.5618887",
"0.5618887",
"0.5616112",
"0.5613534",
"0.56081206",
"0.5605115",
"0.5595683",
"0.5595683",
"0.55805504",
"0.55774426",
"0.55755126",
"0.55732936",
"0.5563121",
"0.5563121",
"0.55570287",
"0.55466175",
"0.55420685",
"0.5541534",
"0.55351156",
"0.55311346",
"0.55164135",
"0.5513274",
"0.55099803",
"0.55099803",
"0.5499611",
"0.5499151",
"0.5499151",
"0.54909885",
"0.54854083",
"0.5485275",
"0.5484805",
"0.5484788",
"0.5480467",
"0.54796904",
"0.54747087",
"0.54742336",
"0.54726505",
"0.547172",
"0.5455998",
"0.54548615",
"0.5454386",
"0.54541755",
"0.5447021",
"0.5446635",
"0.54428005",
"0.54428005",
"0.5441659",
"0.54380924",
"0.5436634"
] | 0.0 | -1 |
the empty queue will be represented by an empty array katz_deli = [] build the line method showing everyone their current place in line if nobody is in line puts "The line is currently empty." | def line(katz_deli)
if katz_deli.length == 0
puts "The line is currently empty."
else
current_line = []
katz_deli.each.with_index(1) do |name,index|
current_line << "#{index}. #{name}"
end
puts "The line is currently: #{current_line.join(" ")}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line(katz_deli)\n current_position = []# current position is to show the line is empty.\n if katz_deli.empty?# if the line is currently empty\n puts \"The line is currently empty.\"#print the phrase\n else\n !katz_deli.empty?# If the line is not empty. this line is not required in the code but helps me understand it easier\n counter = 1# there is now 1 person in line\n katz_deli.each do |customer|\n current_position << \"#{counter}. #{customer}\"# to display the current position of the elements of the array\n counter += 1\n end\n puts \"The line is currently: #{current_position.join(\" \")}\"# display the current position in a linear way.\n end\nend",
"def line(katz_deli)\n if(katz_deli == [])\n puts \"The line is currently empty.\"\n else\n line = [];\n katz_deli.each_with_index {|name, index| line.push(\"#{index + 1}. #{name}\")};\n puts \"The line is currently: #{line.join(\" \")}\";\n end\nend",
"def line(katz_deli)\n\t# If the line is empty.\n\tif katz_deli.size == 0\n\t\tputs \"The line is currently empty.\"\n\telse\n\t\t# Someone is in line. Display them in order.\n\t\tcounter = 1\n\t\tcustomer_array = []\n\t\tkatz_deli.each do |customer|\n\t\t\tcustomer_array << \"#{counter} #{customer}\"\n\t\t\tcounter += 1\n\t\tend\n\t\treturn \"The line is currently: #{customer_array}\"\n\tend\nend",
"def line(katz_deli)\n if katz_deli.size == 0\n puts \"The line is currently empty.\"\n elsif katz_deli.size > 0\n num_line = []\n i = 0\n while i < katz_deli.size\n num_line.push(\"#{i + 1}. #{katz_deli[i]}\")\n i += 1\n end\n puts \"The line is currently: #{num_line.join(\" \")}\"\n end\nend",
"def line(katz_deli)\n deli = []\n counter = 1\n if katz_deli == []\n puts \"The line is currently empty.\"\n else\n katz_deli.each do |n|\n deli.push(\"#{counter}. #{n}\")\n counter += 1\n end\n deli = deli.join(\", \")\n deli = deli.delete(\",\")\n puts \"The line is currently: \"+ deli\n end\nend",
"def line (katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n str= \"The line is currently:\"\n katz_deli.each_with_index do |item,index|\n str+= \" #{index+1}. #{item}\"\n end\n puts str\n end\nend",
"def line(katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n current_line = \"The line is currently:\"\n katz_deli.each.with_index(1) do |customer, position|\n current_line << \" #{position}. #{customer}\"\n end\n end\n puts current_line\nend",
"def line(queue)\n if queue.empty?\n puts \"The line is currently empty.\"\n else\n q_string = \"The line is currently:\"\n queue.each_with_index { |name, i| q_string += \" #{i + 1}. #{name}\" }\n puts q_string\n end\nend",
"def line(katz_deli)\n\t# If the line is empty.\n\tif katz_deli.size == 0\n\t\tputs \"The line is currently empty.\"\n\telse\n\t\t# Someone is in line. Display them in order.\n\t\tline_message = \"The line is currently:\"\n\t\tkatz_deli.each do |customer|\n\t\t\tcounter = katz_deli.index(customer) + 1\n\t\t\tline_message += \" \" + String(counter) + \". \" + customer\n\t\tend\n\t\tputs line_message\n\tend\nend",
"def line(katz_deli)\nn = 0\n\ncurrent_line = \"The line is currently: \"\n if katz_deli == []\n puts(\"The line is currently empty.\")\n return []\n end\n while katz_deli.length > n\n current_line = current_line + (n + 1).to_s + \". \" + katz_deli[n] + \" \"\n n +=1\n end\n current_line = current_line.chop\n puts(current_line)\n return current_line\nend",
"def line(katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n current_line = []\n katz_deli.each_with_index do |customer, index|\n current_line.push( \"#{index + 1}. #{customer}\")\n end\n puts \"The line is currently: \" + current_line.join(\" \")\n end\nend",
"def line(katz_deli)\n if katz_deli.length >= 1\n array = []\n counter = 1 \n katz_deli.each do |name|\n array.push(\"#{counter}. #{name}\")\n counter += 1 \n end\n puts \"The line is currently: #{array.join(\" \")}\"\n else\n puts \"The line is currently empty.\"\n end \nend",
"def now_serving(katz_deli) # The now_serving method calls out the next person in line.\n if katz_deli.empty? == true\n puts \"There is nobody waiting to be served!\" # If nobody is in line, now_serving calls out/puts the message \"There is nobody waiting to be served!\"\n elsif katz_deli.empty? == false\n puts \"Currently serving #{katz_deli.shift}.\" #katz_deli.shift removes the first element of self and returns it (shifting all other elements down by one.) Effectively those waiting in line are served in the seqeuence of the queue at katz_deli. Removing the first element in the array so that the next can be served.\n end\nend",
"def line(katz_deli)\n line_position = []\n if katz_deli == []\n puts \"The line is currently empty.\"\n else katz_deli != []\n katz_deli.each_with_index { |name, index|\n line_position << \"#{index+1}. #{name}\" } ##make the array the way you want the texts to display*\n puts \"The line is currently: #{line_position.join(\" \")}\" #convert into string*\n end\nend",
"def line(katz_deli)\n if katz_deli.size == 0\n puts \"The line is currently empty.\"\n else\n in_line = \"The line is currently:\"\n \n katz_deli.each do |name|\n in_line = in_line + \" \" + (katz_deli.index(name)+1).to_s + \". \" + name \n end\n puts in_line \n end\nend",
"def line(katz_deli)\n if katz_deli == []\n puts \"The line is currently empty.\"\n elsif katz_deli != []\n intro = \"The line is currently:\"\n count = 0\n while count <= katz_deli.length-1\n intro.concat(\" #{count + 1}. #{katz_deli[count]}\")\n count += 1\n end\n puts intro\n end\nend",
"def line(katz_deli)\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n message=\"The line is currently:\"\n\n katz_deli.each_with_index do |value, index|\n message += \" #{index.to_i+1}. #{value}\"\n end\n\n puts \"#{message}\"\n end\nend",
"def line(katz_deli)
\n counter = 1\n statement = \"The line is currently: \"\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n katz_deli.each do |name|\n statement << \"#{counter}. #{name}\"\n counter += 1\n end\n puts statement\n end\n\nend",
"def line(katz_deli)\n if katz_deli.size == 0 \n puts \"The line is currently empty.\"\n else\n order_string = \"\"\n katz_deli.each_with_index do |person, index| \n order_string << \" #{index + 1}. #{person}\"\n end\n puts \"The line is currently:#{order_string}\"\n end\nend",
"def line(katz_deli)\n size = katz_deli.size\n if size == 0\n puts \"The line is currently empty.\"\n else\n counter = 1\n string_line = \"The line is currently:\"\n katz_deli.each do |name|\n string_line << \" #{counter}. #{name}\"\n counter += 1\n end\n puts string_line\n\n end\nend",
"def line(katz_deli)\n current_line = \"The line is currently:\"\n if katz_deli == []\n current_line = \"The line is currently empty.\"\n else\n katz_deli.map.with_index do |name, place|\n current_line << \" #{place + 1}. #{name}\"\n end\n end\n puts current_line\nend",
"def line(katz_deli)\n\nline_array = []\n if katz_deli != []\n katz_deli.each.with_index(1) do |person, index| \n line_array << (\"#{index}. #{person} \")\n end\n \n line_array_last = line_array.pop ## removes last element with extra space\n line_array_last[line_array_last.length-1] = \"\" ## determines length to elminiate extra space\n line_array << line_array_last ## shovels last element without extra space to the array\n puts \"The line is currently: #{line_array.join}\"\n else\n puts \"The line is currently empty.\" \n end \nend",
"def line(katz_deli)\n\n line_string = \"The line is currently:\"\n if katz_deli[0] == \"\" || katz_deli[0] == \" \" || katz_deli[0] == nil\n line_string = \"The line is currently empty.\"\n else\n katz_deli.each_with_index do |name, index|\n line_string << \" #{index + 1}. #{name}\"\n end\n end\n puts line_string\nend",
"def line(katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n current_line = katz_deli.collect.with_index do |person, index|\n \"#{index + 1}. #{person}\"\n end\n string = current_line.join(\" \")\n puts \"The line is currently: #{string}\"\n end\nend",
"def line(katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n current_line = \"The line is currently:\"\n line_count = 1\n katz_deli.each do |person|\n current_line << \" #{line_count}. #{person}\"\n line_count += 1\n end\n puts current_line\n end\nend",
"def line (katz_deli)\n if katz_deli == [] #If there are no names in the array, desired output string is sent\n puts \"The line is currently empty.\"\n else\n output = \"The line is currently:\" #Establish the stem of the output string for when the line is occupied\n i = 1 #Initialize a counter so that the place in line can be added to output string\n katz_deli.each do |person| #Iterate through the name array for each name\n output = output + \" \" + \"#{i}\" + \". #{person}\" #Append current iteration number and index value to the output string, following desired format.\n i += 1 #increment counter to keep track of the number of entries\n end\n puts output #Send the compiled output string\n end\nend",
"def line(katz_deli)\n if katz_deli.empty? \n # .empty? returns true if the array has no elements\n puts \"The line is currently empty.\"\n else\n lineup = \"The line is currently:\"\n katz_deli.each_with_index do |customer, index| \n # .each_with_index returns the element and its index\n lineup << \" #{index + 1}. #{customer}\" \n # << appends the the succeeding term to the preceeding one\n end\n puts lineup\n end\nend",
"def line(deli_array) #define line method referring to katz_deli array\n if deli_array.length >= 1 #if statment wants to find if there is anything in the array. Then interpolate on each element (number in line and name)\n storage_array = [] #creating a space to store the new output of this method\n counter = 1 #create counter for each element (>=1) starting at 1.\n deli_array.each do |guest| #here we interpolate over each element of katz_deli array.\n storage_array.push(\"#{counter}. #{guest}\") #call .push on the new array to fill with interpolated operations\n counter += 1\n end\n puts \"The line is currently: #{storage_array.join(\" \")}\"\n else\n puts \"The line is currently empty.\"\n end #if there is no one in the line, meaning the katz_deli array is empty, puts \"the line is empty\".\nend",
"def line(katz_deli)\n # we are defining the method line thats take the arguement of katz_deli\n\n if(katz_deli.length == 0)\n# if the above statment is true than it will run the code below\n\n puts \"The line is currently empty.\"\n#what will be out put if the if statment = true\n\n else\nline_with_guest = \"The line is currently:\"\n\nkatz_deli.each_with_index {|name, index| line_with_guest += \" #{index + 1}. #{name}\"}\n# what we are doing is creating a variable line_with_guest that is the greeting\n# after the gretting its just a list of the people name and their number on line\n# so this each operator is going to take each element in the deli (the name) and also take a index number as a paramter\n# it will take the variable line_with_guest and for each element in the katz_deli array\n# it will add index number + 1 and the name to the variable line_with_guest\n# if you wanted it with the do loop look below\n# katz_deli.each_with_index do |name, index|\n# line_with_guest += \" #{index +1}. #{name}\"\n# once it has done this for all the elements in the array it will now put the finsihed line_with_guest\n\nputs line_with_guest\n# once the each operator is finished we will out put that variable that would give us our list\n\nend\n# end the if statement\nend",
"def line(katz_deli)\n\n #The line_string variable contains a string\n #We will add to this string in the each_with_index block below\n\n line_string = \"The line is currently:\"\n\n #If the line is empty, the method outputs \"The line is currently empty.\"\n #Otherwise, we iterate through the katz_deli array\n #During each iteration, we add a string to line_string containing the line number & name of each element\n #We calculate the line number by adding 1 to the index number\n\n if katz_deli == []\n puts \"The line is currently empty.\"\n else\n katz_deli.each_with_index do |person, index|\n line_string += \" #{index+1}. #{person}\"\n end\n\n #Lastly, we output the newly modified line_string\n\n puts line_string\n end\nend",
"def line(katz_deli)\n if katz_deli.empty? #if the line is empty\n puts \"The line is currently empty.\"\n else\n new_array = [] #this is a variable to hold the output string for the #line method\n katz_deli.each_with_index { |name, index| new_array.push(\"#{index+1}. #{name}\")} #note: name can be called anything\n final_sentence = \"The line is currently: \" + new_array.join(\" \") #.join(\" \") adds a space between each 'index. name' pair (.to_s was giving me the wrong output, with \"quotes\" around 'index. name' pairs)\n puts final_sentence\n end #end if..elsif statement\nend",
"def line(deli)\nif deli == []\n puts \"The line is currently empty.\"\nelse\n output = \"The line is currently:\"\n deli.each_with_index do |name, index|\n output << \" #{index+1}. #{name}\"\n end\n puts output\nend\nend",
"def line(line)\n que = \"The line is currently:\"\n if line.size == 0\n que = que.chomp(que[que.size-1]) #to remove ':' from que\n que += \" empty.\"\n else\n for i in 0...line.size\n que += \" #{i+1}. #{line[i]}\"\n end\n end\n puts que\nend",
"def line(deli)\n if deli.empty?\n puts \"The line is currently empty.\"\n else\n currentLine = \"The line is currently:\"\n deli.each_with_index do |name, index|\n currentLine << \" #{index+1}. #{name}\"\n end\n puts currentLine\n end\nend",
"def now_serving(katz_deli)\n# line is empty\n if katz_deli.empty?\n puts \"There is nobody waiting to be served!\"\n else\n # announce who is next to be served\n puts \"Currently serving #{katz_deli.at(0)}.\"\n # remove currently served person\n katz_deli.shift\n end\nend",
"def line(deli)\n if deli.length>0\n string = \"The line is currently:\"\n counter = 1\n deli.each do |customer|\n string << \" #{counter}. #{customer}\" # 1. Ada\n counter += 1\n end\n puts string\n else #no one in line\n puts \"The line is currently empty.\"\n end\nend",
"def line(deli)\n if deli.empty? then\n puts \"The line is currently empty.\"\n else\n output = \"The line is currently:\"\n deli.each_with_index{ |customer, index|\n output += \" #{index + 1}. #{customer}\"\n }\n\n puts output\n end\nend",
"def empty_line\n end",
"def line(other_deli)\n if(other_deli.length == 0)\n puts \"The line is currently empty.\"\n else\n result = \"The line is currently: \"\n other_deli.each_with_index do |name, index|\n result += \"#{index + 1}. #{name}\"\n if(index != other_deli.length - 1)\n result += \" \"\n end\n end\n puts result\n end\nend",
"def line(ppl)\n \n # If the line is empty...\n if ppl.length == 0\n\n # Tell us the line is empty.\n puts \"The line is currently empty.\"\n\n # If there are people in line... \n else\n crnt_ln = []\n \n ppl.each_with_index do |nm, ndx|\n ln = ndx + 1\n crnt_ln << \" #{ln}. #{nm}\"\n end\n \n crnt_ln.unshift(\"The line is currently:\")\n puts crnt_ln.join\n end\nend",
"def line(people_in_line = [])\n if (people_in_line.size == 0)\n puts \"The line is currently empty.\"\n return\n end\n line_message = \"The line is currently:\"\n people_in_line.each_index do |current_spot|\n line_message << \" #{current_spot + 1}. #{people_in_line[current_spot]}\"\n end\n puts line_message\nend",
"def line(array)\n if array.empty?\n puts \"The line is currently empty.\"\n else\n string = \"The line is currently:\"\n array.each.with_index(1) { |name, index| string << \" #{index}. #{name}\"}\n puts string\n end\nend",
"def separar_Bloques(bloque)\n bloques_lista = []\n auto_instruccion = \"\"\n salto_de_linea = 0\n saltos_de_linea = bloque.count(@@separador_linea)\n while (bloque!=\"\")\n fin_de_linea = bloque.index(@@separador_linea)\n if (fin_de_linea==nil)\n if (auto_instruccion!=\"\")\n cantidad_de_separadores = bloque.count(\",\") + bloque.count(\" \")\n if (cantidad_de_separadores == 2)\n bloques_lista.push(auto_instruccion)\n auto_instruccion = \"\"\n bloques_lista.push(bloque)\n end\n if (cantidad_de_separadores == 0)\n bloques_lista.push(auto_instruccion+@@separador_linea+bloque)\n auto_instruccion = \"\"\n end\n else\n bloques_lista.push(bloque) \n end\n bloque=\"\"\n next\n end\n linea = bloque[0..fin_de_linea-1]\n cantidad_de_separadores = linea.count(\",\") + linea.count(\" \")\n if (cantidad_de_separadores == 2)\n if (auto_instruccion!=\"\")\n bloques_lista.push(auto_instruccion)\n auto_instruccion = \"\"\n end\n auto_instruccion = linea\n end\n if (cantidad_de_separadores == 0)\n auto_instruccion = auto_instruccion+ ((auto_instruccion!=\"\")? @@separador_linea : '') + linea\n bloques_lista.push(auto_instruccion)\n auto_instruccion = \"\"\n end\n bloque = bloque[fin_de_linea+(@@separador_linea.length())..bloque.length()] \n end\n\n auto_instruccion = auto_instruccion+ ((auto_instruccion!=\"\")? @@separador_linea : '') + bloque\n bloques_lista.push(auto_instruccion)\n return bloques_lista\nend",
"def line(list)\n list_order = \"The line is currently: \"\n if list.length == 0\n puts \"The line is currently empty.\"\n else list.each_index {|index| list_order += \"#{index + 1}. #{list[index]} \"}\n puts list_order.strip\n end\nend",
"def line(array)\n arr = []\n if array.length == 0\n puts \"The line is currently empty.\"\n else\n array.each.with_index(1) do |name, index|\n arr.push(\"#{index}. #{name}\")\n end\n puts \"The line is currently: #{arr.join(\" \")}\"\n end\nend",
"def line(the_line)\n if the_line.empty?\n puts \"The line is currently empty.\"\n else\n current_line = \"The line is currently:\"\n the_line.each_with_index do |customer, index|\n current_line << \" #{index + 1}. #{customer}\"\n end\n puts current_line\n end \nend",
"def empty!\n @line_items = []\n end",
"def line arr\n if arr.empty? == true\n puts \"The line is currently empty.\"\n else\n #for i in (0...arr.length)\n # puts \"Line is currently: #{i + 1}. #{arr[i]}\"\n #end\n string_array = []\n arr.each_with_index do |val, idx|\n string_array.push(\"#{idx + 1}. #{val}\")\n end\n puts \"The line is currently: #{string_array.join(\" \")}\"\n end\nend",
"def line(katz_deli)\n length = \"The line is currently:\"\n#i'm using a string class method (.length) here to calculate the character length of the array \"katz_deli.\"\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n#I'm enumerating the katz_deli array to get the name of the customer and index to calculate the customer's position on line.\n katz_deli.each_with_index do |name, index|\n#I'm using shorthand operator += to signify my variable \"length\" is equal to variable \"length\" variable \"index+1 + name\"\n#Additionally, I'm interpolating my variables below to make my code clean, and legible.\n length += \" #{index+1}. #{name}\"\n end\n puts \"#{length}\"\n end\nend",
"def take_a_number (katz_deli, name)\n katz_deli << name\n if katz_deli == 0\n puts \"The line is currently empty.\"\n else\n# .length returns number of names in katz_deli array.\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\n end\nend",
"def line(array)\n if array == []\n puts \"The line is currently empty.\"\n elsif\n new_line = []\n array.each_with_index do |val, index|\n new_line.push(\"#{index +1}. #{val}\")\n end\n new_line = new_line.join(' ').to_s\n puts \"The line is currently: #{new_line}\"\n end\nend",
"def line(array)\n if array.length == 0\n puts \"The line is currently empty.\"\n else\n string = \"The line is currently:\"\n array.each_with_index do |name, index|\n string.concat(\" #{index+1}. #{name}\")\n end\n puts string\n end\nend",
"def line(array)\n if array.length == 0\n puts \"The line is currently empty.\"\n else\n new_array=[]\n for i in 0...array.length\n new_array.push(\"#{i+1}. #{array[i]}\")\n end\n puts \"The line is currently: #{new_array.join(\" \")}\"\n end\nend",
"def line(array)\n if array.size >0\n str = \"The line is currently:\"\n array.each_with_index do |name,index|\n str += \" #{index+1}. #{name}\"\n end\n puts str\n else\n puts \"The line is currently empty.\"\n end\n\nend",
"def empty_line\r\n puts \"\\n\"\r\n end",
"def take_a_number(katz_deli, name) #defines the take_a_number method using an array's (katz_deli) coorindnates with an assosicated sequence of names.\n katz_deli.push(name) # .push takes the names and adds them to end of the array (katz_deli), pushing forward the next person in line.\n position = katz_deli.index(name) # .index takes the names' positions within the array to to create a queue of people waiting in line. Ascribing the names to position within the array katz_deli.\n puts \"Welcome, #{name}. You are number #{katz_deli.index(name)+1} in line.\" #\"puts\" sends a message with the name of the ticket taker and their ticket number, which is their place within the array and adds 1 (Ruby array indexing starts at 0.) Also, an index of -1 indicates the last element of the array, -2 is the next to last element in the array, and so on.\n return name, position #returns the name and position of the following person to move the line.\nend",
"def empty?\n line.empty?\n end",
"def _EmptyLine\n\n _save = self.pos\n while true # sequence\n _tmp = scan(/\\G(?-mix:^)/)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_Nl)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_Comment)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_EofComment)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_EmptyLine unless _tmp\n return _tmp\n end",
"def empty?\n line_items.length == 0\n end",
"def now_serving(katz_deli)\n if katz_deli.length == 0\n puts \"There is nobody waiting to be served!\"\n else\n puts \"Currently serving #{katz_deli[0]}.\"\n katz_deli.shift\n end\nend",
"def doing_verified_unique_researches # adjustable line length filter\n consumer = Fiber.new do |producer, queue|\n a = File.readlines(\"./tmp/insert_researches.txt\")\n @megadata = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n @megadata_unique = @megadata.uniq\n f = open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n #IO.foreach(\"./tmp/database_doings/doing_uniques/uniques_todo.txt\") do |line|\n queue = \"\"\n puts queue\n @megadata_unique.each do |line|\n sequence_text = line.to_textual.de_comma\n if sequence_text.length < 52 # adjustable\n puts \"line ignored due to length\"\n elsif Sequence.find_by_sequence_text(sequence_text)\n puts \"line ignored as it is already in database : \" + \"#{sequence_text}\"\n else\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n description = \"research\"\n reference = \"literoti\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n created_at = \"2011-12-21 12:12:00\"\n #line = \"#{sequence_text}\\n\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n end\n end\n raise StopIteration\n end",
"def knight_path(from, to)\r\n\topen_queue = [PositionPath.new( from, [copy(from)] )]\r\n\tputs open_queue.inspect\r\n\tputs open_queue.empty?\r\n\tdiscovered = [from]\r\n\r\n\tuntil open_queue.empty?\r\n\t\tcurrent = open_queue.shift\r\n\t\tputs current.inspect\r\n\r\n\t\treturn current.path if current.position == to\r\n\t\tvalid_moves(current.position).each do |move|\r\n\t\t\tputs \"ruch #{move} jest ok\"\r\n\t\t\tunless discovered.include?(move)\r\n\t\t\t\tputs \"tego ruchu jeszce nie bylo = #{move}\"\r\n\t\t\t\tdiscovered << move\r\n\t\t\t\topen_queue.push(make_position_path(current, move)) \r\n\t\t\t\tputs \"open_queue = #{open_queue.size}\"\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\t\r\nend",
"def now_serving(katz_deli)\n if katz_deli.empty?\n puts \"There is nobody waiting to be served!\"\n else\n puts \"Currently serving #{katz_deli[0]}.\"\n katz_deli.shift\n # shift to removes the first element of the nextinline array and returns it (shifting all other elements down by one). Returns nil if the array is empty.\n end\nend",
"def display\n puts\n puts \" 1 2 3 4 5 6 7 8\"\n puts\n $board.each_with_index do |line, index|\n unless line == []\n print index + 1\n print \" \"\n line.each do |cell|\n if cell == -1\n print \"- \"\n elsif cell == 0\n print \"X \"\n else\n print \"O \"\n end\n end\n print \" \"\n print index + 1\n puts\n end\n end\n puts\n puts \" 1 2 3 4 5 6 7 8\"\n puts\nend",
"def join_lines_into_one\n\t\t@complete_letter = Array.new\n\t\t@master = 0\n\t\tmaster_comp = @top_line.length\n\t\tuntil @master == master_comp\n\t\t\ttheory_case\n\t\tend\n\tend",
"def line(customers)\n \tif customers.empty?\n \tputs \"The line is currently empty.\"\n else output = \"The line is currently:\"\n \tcustomers.each_with_index do |customer, index|\n \tline_number = index + 1\n \toutput << \" #{line_number}. #{customer}\"\n \tend\n \tputs output\n end\n end",
"def now_serving(katz_deli)\nif katz_deli.length < 1\n puts \"There is nobody waiting to be served!\"\nelse\n puts \"Currently serving #{katz_deli.first}.\"\n katz_deli.shift\n end\nend",
"def now_serving(katz_deli)\n if katz_deli == []\n puts \"There is nobody waiting to be served!\"\n else\n puts \"Currently serving #{katz_deli[0]}.\"\n katz_deli.shift\n end\nend",
"def line(array)\n line_status_string = \"The line is currently:\"\n if array == []\n puts \"The line is currently empty.\"\n elsif array != []\n array.each_with_index {|person, place_number|\n line_status_string += \" #{place_number+1}. #{person}\"\n }\n puts line_status_string\n end\nend",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def line; end",
"def space()\n # pocitanie riadkov\n self.line.push position if /\\n/ === data[position]\n /\\s/ === data[position]\n\n end",
"def now_serving(katz_deli)\n if katz_deli.empty?\n puts \"There is nobody waiting to be served!\"\n else\n puts \"Currently serving #{katz_deli[0]}.\"\n katz_deli.shift\n end\nend",
"def lines; end",
"def lines; end",
"def mostrar_matriz(matriz, fila_letra, oculto)\n# recibe fila_letra como punto de inicio de las letras\n# para las filas '@' para comenzar desde 'A' y 'J'\n# para comenzar desde 'K'\n espacios=\" \"*20\n\n if oculto == true\n imprimir_leyenda_1\n puts \" *Has hundido #{contar_algo(matriz,Barco_Hundido)} de los barcos enemigos,\"\n puts \" hay todavía al menos #{contar_algo(matriz,Barco )}\"\n end\n\n print_cintillo_numerico(matriz.length)\n for i in 0..matriz.length-1\n print \"#{espacios}#{fila_letra=fila_letra.next}\"\n print \"|\"\n for x in 0..matriz[0].length-1\n if oculto== true\n print \"#{ocultar_informacion(matriz[i][x])}|\"\n else\n print \"#{mostrar_informacion(matriz[i][x])}|\"\n end\n end\n print fila_letra\n puts\n\n\n end\n print_cintillo_numerico(matriz.length)\n\n if oculto == false\n imprimir_leyenda_2\n puts \" *El enemigo ha hundido #{contar_algo(matriz,Barco_Hundido)} de tus barcos,\"\n puts \" aun cuentas con #{contar_algo(matriz,Barco)} de ellos. \"\n end\nend",
"def doing_phrase_lines\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line|\n queue = \"\"\n puts queue\n sequence_text = line.to_textual.de_comma\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n sequence_lense = \"\"\n description = \"\"\n reference = \"\"\n anagram = 0\n name = 0\n phrase = 1\n research = 0\n external = 0\n internal = 0\n created_at = \"2011-12-12 12:12:00\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{sequence_lense}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end",
"def now_serving(katz_deli)\n if katz_deli.size == 0\n puts \"There is nobody waiting to be served!\"\n else\n ur_up = katz_deli.shift\n puts \"Currently serving #{ur_up}.\"\n end\nend",
"def level_order_traversal_line_by_line_sol1(root_node)\n queue = Queue.new\n queue.enq root_node\n while(!queue.empty?)\n node_count = queue.size\n while(node_count > 0)\n node = queue.deq\n print node.value\n print \"\\s\"\n\n queue.enq node.left unless node.left.nil?\n queue.enq node.right unless node.right.nil?\n node_count -= 1\n end\n puts \"\\n\"\n end \n end",
"def now_serving(katz_deli)\n if katz_deli.length == 0\n puts \"There is nobody waiting to be served!\"\n else\n puts \"Currently serving #{(katz_deli[0])}.\"\n katz_deli.shift()\n end\nend",
"def now_serving(deli)\n if deli.length > 0\n puts \"Currently serving #{deli.first}.\"\n deli.shift\n else #no one in line\n puts \"There is nobody waiting to be served!\"\n end\nend",
"def line\n end",
"def line\n end",
"def lines_or_empty\n\t\tlines\n\trescue Rush::DoesNotExist\n\t\t[]\n\tend",
"def lineL_stations \n puts \"The list of stations for line L: \"\n puts \"[0] - 8th\"\n puts \"[1] - 6th\"\n puts \"[2] - Union Square\"\n puts \"[3] - 3rd\"\n puts \"[4] - 1st\"\nend",
"def now_serving(katz_deli)\n if katz_deli.empty?\n puts \"There is nobody waiting to be served!\"\n else\n puts \"Currently serving #{katz_deli.first}.\"\n katz_deli.shift\n end\nend",
"def now_serving(katz_deli)\n if katz_deli.empty?\n puts \"There is nobody waiting to be served!\"\n else\n puts \"Currently serving #{katz_deli.first}.\"\n katz_deli.shift\n end\nend"
] | [
"0.73385406",
"0.7319243",
"0.7079681",
"0.70733166",
"0.7047779",
"0.6982036",
"0.69818467",
"0.69634646",
"0.69307137",
"0.69243515",
"0.69175434",
"0.6915717",
"0.68882",
"0.6868713",
"0.6867419",
"0.68508756",
"0.6806643",
"0.6786489",
"0.678612",
"0.6775239",
"0.6761315",
"0.6756544",
"0.67376727",
"0.67095155",
"0.65841204",
"0.6553533",
"0.655164",
"0.6471855",
"0.6460727",
"0.63336426",
"0.63239366",
"0.6292854",
"0.60698366",
"0.60471946",
"0.6036799",
"0.58676213",
"0.58195955",
"0.5782291",
"0.5717093",
"0.56196433",
"0.56088316",
"0.5595395",
"0.55940086",
"0.55802625",
"0.55762947",
"0.55677277",
"0.5539995",
"0.55183196",
"0.5484824",
"0.5386617",
"0.5364154",
"0.5345135",
"0.5293125",
"0.5285896",
"0.52438515",
"0.5235637",
"0.523246",
"0.5224399",
"0.52153957",
"0.5155171",
"0.51434535",
"0.5076925",
"0.50672823",
"0.5051136",
"0.5049734",
"0.5042316",
"0.50414556",
"0.50289917",
"0.50242597",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5016728",
"0.5015595",
"0.5013723",
"0.5006618",
"0.5006618",
"0.5006612",
"0.5001352",
"0.5000705",
"0.4975125",
"0.49688983",
"0.4964143",
"0.49543363",
"0.49543363",
"0.49498227",
"0.49299684",
"0.49193153",
"0.49193153"
] | 0.7315305 | 2 |
build the take_a_number method for new customers entering the deli the take_a_number methods takes two arguments new costumer will use whenentering the deli array for current people in line (katz_deli) and a string containingthe name of the person joining the end of the line | def take_a_number(katz_deli, name)
#the take_a_number method should puts the person's name along with their postion in line --use .push(element) to add a person's name to the line
katz_deli.push(name)
puts "Welcome, #{name}. You are number #{katz_deli.length} in line."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_a_number(katz_deli, name) # Takes deli line and a new customer name as input.\n katz_deli.push(name) # Add new customer to deli line.\n puts \"Welcome, #{name}. You are number #{katz_deli.size} in line.\" # Returns the required string.\nend",
"def take_a_number(katz_deli, customer)\n katz_deli.push(customer)\n puts \"Welcome, #{customer}. You are number #{katz_deli.length} in line.\"\n end",
"def take_a_number(deli,customer)\n deli << customer\n line_number = deli.length\n puts \"Welcome, #{customer}. You are number #{line_number} in line.\"\nend",
"def take_a_number(katz_deli, name) #defines the take_a_number method using an array's (katz_deli) coorindnates with an assosicated sequence of names.\n katz_deli.push(name) # .push takes the names and adds them to end of the array (katz_deli), pushing forward the next person in line.\n position = katz_deli.index(name) # .index takes the names' positions within the array to to create a queue of people waiting in line. Ascribing the names to position within the array katz_deli.\n puts \"Welcome, #{name}. You are number #{katz_deli.index(name)+1} in line.\" #\"puts\" sends a message with the name of the ticket taker and their ticket number, which is their place within the array and adds 1 (Ruby array indexing starts at 0.) Also, an index of -1 indicates the last element of the array, -2 is the next to last element in the array, and so on.\n return name, position #returns the name and position of the following person to move the line.\nend",
"def take_a_number(katz_deli, customer_name)\n if katz_deli == []\n katz_deli << customer_name\n katz_deli.map.with_index do |name, place|\n puts \"Welcome, #{name}. You are number #{place + 1} in line.\"\n end\n else\n katz_deli << customer_name\n katz_deli.map.with_index do |name, place|\n end\n last_customer = katz_deli.last\n last_place = katz_deli.index(last_customer)\n puts \"Welcome, #{last_customer}. You are number #{last_place + 1} in line.\"\n end\n #line(katz_deli)\nend",
"def take_a_number(katz_deli, person)\n katz_deli.push(person)\n new_person_in_line = \" \"\n katz_deli.each_with_index do |item,index|\n new_person_in_line = \"Welcome, #{item}. You are number #{index + 1} in line.\"\n end\n puts new_person_in_line\n end",
"def take_a_number(katz_deli, name)\n # add person to end of line\n katz_deli << name\n # call out (`puts`) the person's name along with their position in line\n puts \"Welcome, #{name}. You are number #{katz_deli.size} in line.\"\nend",
"def take_a_number(katz_deli, new_customer)\nkatz_deli<<(new_customer)\n puts \"Welcome, #{new_customer}. You are number #{katz_deli.length} in line.\"\nend",
"def take_a_number(katz_deli, name)\n puts \"Welcome, #{name}. You are number #{katz_deli.length + 1} in line.\";\n katz_deli.push(name);\nend",
"def take_a_number(katz_deli, name)\n katz_deli.push(name)\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\nend",
"def take_a_number(katz_deli, name)\n katz_deli.push(name)\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\nend",
"def take_a_number(katz_deli, name)\n katz_deli << name\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\nend",
"def take_a_number(katz_deli, name)\n katz_deli << name\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\nend",
"def take_a_number(katz_deli, name)\n katz_deli << name\n puts \"Welcome, #{name}. You are number #{katz_deli.size} in line.\"\n return katz_deli\nend",
"def take_a_number(katz_deli, name)\n katz_deli.push(name)\n# return the person's name along with their position in line by using the hashtag, swingly brackets to call every arguement's iteration\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\nend",
"def take_a_number(katz_deli, person)\n katz_deli << person\n puts \"Welcome, #{person}. You are number #{katz_deli.length} in line.\"\nend",
"def take_a_number(katz_deli, name)\n puts \"Welcome, #{name}. You are number #{katz_deli.size + 1} in line.\"\n katz_deli.push(name)\nend",
"def take_a_number(the_line, customer)\n the_line << customer\n puts \"Welcome, #{customer}. You are number #{the_line.size} in line.\"\nend",
"def take_a_number(deli, name)\n deli.push(name)\n puts \"Welcome, #{name}. You are number #{deli.count} in line.\"\nend",
"def take_a_number (deli, name)\n deli << name\n puts \"Welcome, #{name}. You are number #{deli.length} in line.\"\n return deli\nend",
"def take_a_number(the_deli, name)\n the_deli << \"#{name}\" #names to be added into the_deli array\n puts \"Welcome, #{name}. You are number #{the_deli.length} in line.\"\nend",
"def line(katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n current_line = []\n katz_deli.each_with_index do |customer, index|\n current_line.push( \"#{index + 1}. #{customer}\")\n end\n puts \"The line is currently: \" + current_line.join(\" \")\n end\nend",
"def take_a_number(deli,name)\n deli << name\n puts \"Welcome, #{name}. You are number #{deli.length} in line.\"\n\nend",
"def take_a_number(katz_deli, new)\n if(katz_deli.length == 0)\n katz_deli << new\n puts \"Welcome, #{new}. You are number 1 in line.\"\n else\n katz_deli << new\n puts \"Welcome, #{new}. You are number #{katz_deli.length} in line.\"\n end\nend",
"def take_a_number(katz_deli, name)\n katz_deli << name\n\n# katz_deli.each_with_index do |name, index|\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\n# end\nend",
"def take_a_number(katz_deli, name)\n \n \n people_waiting = katz_deli.count\n\n katz_deli << name\n \n \n while people_waiting > 0\n \n \n puts \"#{name} your place in line is #{people_waiting+1}\"\n \n \n break\n \n \n\n end\n \n end",
"def line(katz_deli)\n\t# If the line is empty.\n\tif katz_deli.size == 0\n\t\tputs \"The line is currently empty.\"\n\telse\n\t\t# Someone is in line. Display them in order.\n\t\tcounter = 1\n\t\tcustomer_array = []\n\t\tkatz_deli.each do |customer|\n\t\t\tcustomer_array << \"#{counter} #{customer}\"\n\t\t\tcounter += 1\n\t\tend\n\t\treturn \"The line is currently: #{customer_array}\"\n\tend\nend",
"def take_a_number(deli, name)\n deli << name\n puts \"Welcome, #{name}. You are number #{deli.length} in line.\"\nend",
"def take_a_number (katz_deli, name)\n katz_deli << name\n if katz_deli == 0\n puts \"The line is currently empty.\"\n else\n# .length returns number of names in katz_deli array.\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\n end\nend",
"def line(katz_deli)\n length = \"The line is currently:\"\n#i'm using a string class method (.length) here to calculate the character length of the array \"katz_deli.\"\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n#I'm enumerating the katz_deli array to get the name of the customer and index to calculate the customer's position on line.\n katz_deli.each_with_index do |name, index|\n#I'm using shorthand operator += to signify my variable \"length\" is equal to variable \"length\" variable \"index+1 + name\"\n#Additionally, I'm interpolating my variables below to make my code clean, and legible.\n length += \" #{index+1}. #{name}\"\n end\n puts \"#{length}\"\n end\nend",
"def take_a_number(customers, customer)\n customers.push(customer)\n puts \"Welcome, #{customer}. You are number #{customers.index(customers.last) + 1} in line.\"\nend",
"def line(katz_deli)\n if katz_deli.empty? \n # .empty? returns true if the array has no elements\n puts \"The line is currently empty.\"\n else\n lineup = \"The line is currently:\"\n katz_deli.each_with_index do |customer, index| \n # .each_with_index returns the element and its index\n lineup << \" #{index + 1}. #{customer}\" \n # << appends the the succeeding term to the preceeding one\n end\n puts lineup\n end\nend",
"def line(deli)\n if deli.empty? then\n puts \"The line is currently empty.\"\n else\n output = \"The line is currently:\"\n deli.each_with_index{ |customer, index|\n output += \" #{index + 1}. #{customer}\"\n }\n\n puts output\n end\nend",
"def line(deli)\n if deli.length>0\n string = \"The line is currently:\"\n counter = 1\n deli.each do |customer|\n string << \" #{counter}. #{customer}\" # 1. Ada\n counter += 1\n end\n puts string\n else #no one in line\n puts \"The line is currently empty.\"\n end\nend",
"def line (katz_deli)\n if katz_deli == [] #If there are no names in the array, desired output string is sent\n puts \"The line is currently empty.\"\n else\n output = \"The line is currently:\" #Establish the stem of the output string for when the line is occupied\n i = 1 #Initialize a counter so that the place in line can be added to output string\n katz_deli.each do |person| #Iterate through the name array for each name\n output = output + \" \" + \"#{i}\" + \". #{person}\" #Append current iteration number and index value to the output string, following desired format.\n i += 1 #increment counter to keep track of the number of entries\n end\n puts output #Send the compiled output string\n end\nend",
"def line(katz_deli)\n\t# If the line is empty.\n\tif katz_deli.size == 0\n\t\tputs \"The line is currently empty.\"\n\telse\n\t\t# Someone is in line. Display them in order.\n\t\tline_message = \"The line is currently:\"\n\t\tkatz_deli.each do |customer|\n\t\t\tcounter = katz_deli.index(customer) + 1\n\t\t\tline_message += \" \" + String(counter) + \". \" + customer\n\t\tend\n\t\tputs line_message\n\tend\nend",
"def line(katz_deli)\n if katz_deli.size == 0\n puts \"The line is currently empty.\"\n elsif katz_deli.size > 0\n num_line = []\n i = 0\n while i < katz_deli.size\n num_line.push(\"#{i + 1}. #{katz_deli[i]}\")\n i += 1\n end\n puts \"The line is currently: #{num_line.join(\" \")}\"\n end\nend",
"def line(katz_deli)\n\n #The line_string variable contains a string\n #We will add to this string in the each_with_index block below\n\n line_string = \"The line is currently:\"\n\n #If the line is empty, the method outputs \"The line is currently empty.\"\n #Otherwise, we iterate through the katz_deli array\n #During each iteration, we add a string to line_string containing the line number & name of each element\n #We calculate the line number by adding 1 to the index number\n\n if katz_deli == []\n puts \"The line is currently empty.\"\n else\n katz_deli.each_with_index do |person, index|\n line_string += \" #{index+1}. #{person}\"\n end\n\n #Lastly, we output the newly modified line_string\n\n puts line_string\n end\nend",
"def line(katz_deli)\n # we are defining the method line thats take the arguement of katz_deli\n\n if(katz_deli.length == 0)\n# if the above statment is true than it will run the code below\n\n puts \"The line is currently empty.\"\n#what will be out put if the if statment = true\n\n else\nline_with_guest = \"The line is currently:\"\n\nkatz_deli.each_with_index {|name, index| line_with_guest += \" #{index + 1}. #{name}\"}\n# what we are doing is creating a variable line_with_guest that is the greeting\n# after the gretting its just a list of the people name and their number on line\n# so this each operator is going to take each element in the deli (the name) and also take a index number as a paramter\n# it will take the variable line_with_guest and for each element in the katz_deli array\n# it will add index number + 1 and the name to the variable line_with_guest\n# if you wanted it with the do loop look below\n# katz_deli.each_with_index do |name, index|\n# line_with_guest += \" #{index +1}. #{name}\"\n# once it has done this for all the elements in the array it will now put the finsihed line_with_guest\n\nputs line_with_guest\n# once the each operator is finished we will out put that variable that would give us our list\n\nend\n# end the if statement\nend",
"def line(katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n current_line = \"The line is currently:\"\n line_count = 1\n katz_deli.each do |person|\n current_line << \" #{line_count}. #{person}\"\n line_count += 1\n end\n puts current_line\n end\nend",
"def line(katz_deli)\n if katz_deli.size == 0\n puts \"The line is currently empty.\"\n else\n in_line = \"The line is currently:\"\n \n katz_deli.each do |name|\n in_line = in_line + \" \" + (katz_deli.index(name)+1).to_s + \". \" + name \n end\n puts in_line \n end\nend",
"def take_a_number(array, new_customer)\n \n array << new_customer\n customer_index = array.find_index(new_customer)\n \n customer_status = \"Welcome, #{new_customer}. You are number #{customer_index + 1} in line.\"\n \n puts customer_status\n \nend",
"def line(katz_deli)\n current_position = []# current position is to show the line is empty.\n if katz_deli.empty?# if the line is currently empty\n puts \"The line is currently empty.\"#print the phrase\n else\n !katz_deli.empty?# If the line is not empty. this line is not required in the code but helps me understand it easier\n counter = 1# there is now 1 person in line\n katz_deli.each do |customer|\n current_position << \"#{counter}. #{customer}\"# to display the current position of the elements of the array\n counter += 1\n end\n puts \"The line is currently: #{current_position.join(\" \")}\"# display the current position in a linear way.\n end\nend",
"def line(deli_array) #define line method referring to katz_deli array\n if deli_array.length >= 1 #if statment wants to find if there is anything in the array. Then interpolate on each element (number in line and name)\n storage_array = [] #creating a space to store the new output of this method\n counter = 1 #create counter for each element (>=1) starting at 1.\n deli_array.each do |guest| #here we interpolate over each element of katz_deli array.\n storage_array.push(\"#{counter}. #{guest}\") #call .push on the new array to fill with interpolated operations\n counter += 1\n end\n puts \"The line is currently: #{storage_array.join(\" \")}\"\n else\n puts \"The line is currently empty.\"\n end #if there is no one in the line, meaning the katz_deli array is empty, puts \"the line is empty\".\nend",
"def line(katz_deli)\n if katz_deli.length >= 1\n array = []\n counter = 1 \n katz_deli.each do |name|\n array.push(\"#{counter}. #{name}\")\n counter += 1 \n end\n puts \"The line is currently: #{array.join(\" \")}\"\n else\n puts \"The line is currently empty.\"\n end \nend",
"def line(katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n current_line = katz_deli.collect.with_index do |person, index|\n \"#{index + 1}. #{person}\"\n end\n string = current_line.join(\" \")\n puts \"The line is currently: #{string}\"\n end\nend",
"def line(katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n current_line = \"The line is currently:\"\n katz_deli.each.with_index(1) do |customer, position|\n current_line << \" #{position}. #{customer}\"\n end\n end\n puts current_line\nend",
"def generate_number(isofferte)\n return id if isofferte.to_i == 1\n\n # TODO: scope per firm here!\n last_invoice = Invoice.order('number').last\n\n self.number = if last_invoice\n last_invoice.number + 1\n else\n # generate invoice nr based on year+month\n \"#{Time.new.strftime('%Y%m')}0001\".to_i\n end\n end",
"def line(katz_deli)\n if(katz_deli == [])\n puts \"The line is currently empty.\"\n else\n line = [];\n katz_deli.each_with_index {|name, index| line.push(\"#{index + 1}. #{name}\")};\n puts \"The line is currently: #{line.join(\" \")}\";\n end\nend",
"def line(katz_deli)\n if katz_deli.size == 0 \n puts \"The line is currently empty.\"\n else\n order_string = \"\"\n katz_deli.each_with_index do |person, index| \n order_string << \" #{index + 1}. #{person}\"\n end\n puts \"The line is currently:#{order_string}\"\n end\nend",
"def line(katz_deli)\n size = katz_deli.size\n if size == 0\n puts \"The line is currently empty.\"\n else\n counter = 1\n string_line = \"The line is currently:\"\n katz_deli.each do |name|\n string_line << \" #{counter}. #{name}\"\n counter += 1\n end\n puts string_line\n\n end\nend",
"def line(customers)\n \tif customers.empty?\n \tputs \"The line is currently empty.\"\n else output = \"The line is currently:\"\n \tcustomers.each_with_index do |customer, index|\n \tline_number = index + 1\n \toutput << \" #{line_number}. #{customer}\"\n \tend\n \tputs output\n end\n end",
"def line(katz_deli)\n if katz_deli.empty? #if the line is empty\n puts \"The line is currently empty.\"\n else\n new_array = [] #this is a variable to hold the output string for the #line method\n katz_deli.each_with_index { |name, index| new_array.push(\"#{index+1}. #{name}\")} #note: name can be called anything\n final_sentence = \"The line is currently: \" + new_array.join(\" \") #.join(\" \") adds a space between each 'index. name' pair (.to_s was giving me the wrong output, with \"quotes\" around 'index. name' pairs)\n puts final_sentence\n end #end if..elsif statement\nend",
"def line(katz_deli)\n deli = []\n counter = 1\n if katz_deli == []\n puts \"The line is currently empty.\"\n else\n katz_deli.each do |n|\n deli.push(\"#{counter}. #{n}\")\n counter += 1\n end\n deli = deli.join(\", \")\n deli = deli.delete(\",\")\n puts \"The line is currently: \"+ deli\n end\nend",
"def line (katz_deli)\n if katz_deli.empty?\n puts \"The line is currently empty.\"\n else\n str= \"The line is currently:\"\n katz_deli.each_with_index do |item,index|\n str+= \" #{index+1}. #{item}\"\n end\n puts str\n end\nend",
"def create_line_item_for_per_person_charge qty, vendor_id, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n new_line_items = create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\")\n line_items.push(new_line_items)\n new_line_items\n end",
"def name_bill\n \"#{name}:#{endNumber}\"\n end",
"def line(katz_deli)\n current_line = \"The line is currently:\"\n if katz_deli == []\n current_line = \"The line is currently empty.\"\n else\n katz_deli.map.with_index do |name, place|\n current_line << \" #{place + 1}. #{name}\"\n end\n end\n puts current_line\nend",
"def line(deli)\nif deli == []\n puts \"The line is currently empty.\"\nelse\n output = \"The line is currently:\"\n deli.each_with_index do |name, index|\n output << \" #{index+1}. #{name}\"\n end\n puts output\nend\nend",
"def create_train_selection\n puts 'Provide new train number in format NNN-NN or NNNNN (N - number or letter): '\n train_number = gets.chomp\n puts 'Select cargo (1) or passenger(2) train: '\n type = gets.chomp.to_i\n create_train(type, train_number)\n end",
"def line(katz_deli)\n\n line_string = \"The line is currently:\"\n if katz_deli[0] == \"\" || katz_deli[0] == \" \" || katz_deli[0] == nil\n line_string = \"The line is currently empty.\"\n else\n katz_deli.each_with_index do |name, index|\n line_string << \" #{index + 1}. #{name}\"\n end\n end\n puts line_string\nend",
"def line(katz_deli)\n\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n current_line = []\n katz_deli.each.with_index(1) do |name,index|\n current_line << \"#{index}. #{name}\"\n end\n puts \"The line is currently: #{current_line.join(\" \")}\"\n\n\n end\n end",
"def line(deli)\n if deli.empty?\n puts \"The line is currently empty.\"\n else\n currentLine = \"The line is currently:\"\n deli.each_with_index do |name, index|\n currentLine << \" #{index+1}. #{name}\"\n end\n puts currentLine\n end\nend",
"def line(katz_deli)\n\nline_array = []\n if katz_deli != []\n katz_deli.each.with_index(1) do |person, index| \n line_array << (\"#{index}. #{person} \")\n end\n \n line_array_last = line_array.pop ## removes last element with extra space\n line_array_last[line_array_last.length-1] = \"\" ## determines length to elminiate extra space\n line_array << line_array_last ## shovels last element without extra space to the array\n puts \"The line is currently: #{line_array.join}\"\n else\n puts \"The line is currently empty.\" \n end \nend",
"def create_client\n puts \"CREATE NEW CLIENT ACCOUNT\"\n print \"Name of client: \"\n client_name = gets.chomp.split.map(&:capitalize).join(\" \") # capitalize first letter of every word\n print \"Starting balance: $\"\n balance = gets.chomp.to_f\n @brokerage.add_client(client_name, balance)\nend",
"def line(katz_deli)\nn = 0\n\ncurrent_line = \"The line is currently: \"\n if katz_deli == []\n puts(\"The line is currently empty.\")\n return []\n end\n while katz_deli.length > n\n current_line = current_line + (n + 1).to_s + \". \" + katz_deli[n] + \" \"\n n +=1\n end\n current_line = current_line.chop\n puts(current_line)\n return current_line\nend",
"def create_line_item_for_per_person_charge qty, vendor_id, include_price_in_expense, include_price_in_revenue, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end",
"def chooseCustomer (customers)\n\tputs \"Now it's time to see how Charity Cents would work.\"\n\tcustomers.each_with_index do |customer, index|\n\t\tputs \"#{index.to_i+1}: #{customer[\"first_name\"]} #{customer[\"last_name\"]}\"\n\t\tcustomer[\"selection_number\"] = index + 1\n\tend\n\t\n\tputs \"It's time to simulate a purchase and donation. Pick a user and let's get started.\"\n\tbegin\n\t\tputs \"Enter a number from 1 to #{customers.count} to pick corresponding person.\"\n\t\tcustomer_number = gets.strip.to_i\n\tend until customer_number >= 1 && customer_number <= customers.count\n\tif customers[customer_number-1][\"charity_cents\"] != true\n\t\tputs \"This customer is not willing to donate. I'm sorry.\"\n\t\treturn false\n\tend\n\treturn customers[customer_number-1]\nend",
"def line(katz_deli)\n line_position = []\n if katz_deli == []\n puts \"The line is currently empty.\"\n else katz_deli != []\n katz_deli.each_with_index { |name, index|\n line_position << \"#{index+1}. #{name}\" } ##make the array the way you want the texts to display*\n puts \"The line is currently: #{line_position.join(\" \")}\" #convert into string*\n end\nend",
"def create_listing_number\n return unless self.listing_number.nil?\n\n number = Counter.get_next\n self.listing_number = self.account.country_short.upcase + number.to_s\n end",
"def run\n puts \"Yo give me your CC digits:\"\n number = gets.chomp\n puts \"Yo when do you expire?\"\n expiration = gets.chomp.split('/')\n do_charge(number, expiration.first, expiration.last)\nend",
"def create_line(num)\n '-' * num\nend",
"def line(katz_deli)\n if katz_deli == []\n puts \"The line is currently empty.\"\n elsif katz_deli != []\n intro = \"The line is currently:\"\n count = 0\n while count <= katz_deli.length-1\n intro.concat(\" #{count + 1}. #{katz_deli[count]}\")\n count += 1\n end\n puts intro\n end\nend",
"def line(the_line)\n if the_line.empty?\n puts \"The line is currently empty.\"\n else\n current_line = \"The line is currently:\"\n the_line.each_with_index do |customer, index|\n current_line << \" #{index + 1}. #{customer}\"\n end\n puts current_line\n end \nend",
"def line(katz_deli)
\n counter = 1\n statement = \"The line is currently: \"\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n katz_deli.each do |name|\n statement << \"#{counter}. #{name}\"\n counter += 1\n end\n puts statement\n end\n\nend",
"def take_a_number(katz_deli,y)\nkatz_deli.push(y)\nwelcome_message = \"Welcome, \" + y + \". You are number \" + katz_deli.length.to_s + \" in line.\"\nputs welcome_message\nreturn y, katz_deli.length\nend",
"def line(katz_deli)\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n message=\"The line is currently:\"\n\n katz_deli.each_with_index do |value, index|\n message += \" #{index.to_i+1}. #{value}\"\n end\n\n puts \"#{message}\"\n end\nend",
"def premium_service_number\n FFaker.numerify('1900 ### ####')\n end",
"def consume_number; end",
"def chinese_restaurant_process(num_customers, alpha)\n return [] if num_customers <= 0\n\n table_assignments = [1] # first customer sits at table 1\n next_open_table = 2 # index of the next empty table\n\n # Now generate table assignments for the rest of the customers.\n 1.upto(num_customers - 1) do |i|\n if rand < alpha.to_f / (alpha + i)\n # Customer sits at a new table.\n table_assignments << next_open_table\n next_open_table += 1\n else\n # Customer sits at an existing table.\n # He chooses which table to sit at by giving equal weight to each\n # customer already sitting at a table. \n which_table = table_assignments[rand(table_assignments.size)]\n table_assignments << which_table\n end\n end\n\n table_assignments\nend",
"def chinese_restaurant_process(num_customers, alpha)\n return [] if num_customers <= 0\n\n table_assignments = [1] # first customer sits at table 1\n next_open_table = 2 # index of the next empty table\n\n # Now generate table assignments for the rest of the customers.\n 1.upto(num_customers - 1) do |i|\n if rand < alpha.to_f / (alpha + i)\n # Customer sits at a new table.\n table_assignments << next_open_table\n next_open_table += 1\n else\n # Customer sits at an existing table.\n # He chooses which table to sit at by giving equal weight to each\n # customer already sitting at a table. \n which_table = table_assignments[rand(table_assignments.size)]\n table_assignments << which_table\n end\n end\n\n table_assignments\nend",
"def entry!\n description = customer_or_supplier \\\n proc { customer.name },\n proc { supplier.name }\n\n unless e = self.entry\n e = business_account.add_entry amount, \\\n commodity_account, amount_net,\n tax_account, amount_tax\n e.description = description\n e.code = number.to_s\n e.flag = '!'\n end\n\n e\n end",
"def create\n init = params[:distrik][:name][0]\n distributor = Distributor.find_by_name(params[:distributor_id])\n distrik_number = Distrik.create_number(params)\n @distrik = Distrik.new(distrik_params.merge(:distributor_id => (distributor.id rescue nil)))\n if @distrik.save\n flash[:notice] = t(:successfully_created)\n redirect_to distriks_path\n else\n flash[:error] = @distrik.errors.full_messages.join('<br/>')\n render \"new\"\n end\n end",
"def add_loan\n @number = params[:number]\n @loan_form_number = params[:loan_form_number]\n @delete_number = (@number.to_i - 1).to_s\n end",
"def directorio(nombre, pais_c, numero)\n puts \" #{make_phone_call(numero,pais_c)}\n The phone number belongs to #{nombre}.\"\nend",
"def customerOrder\r\n @cocktailNumber = 3\r\n @waterNumber = 2\r\n @beerNumber = 6\r\n puts \"What type of drink would you like? We sell cocktails, beers, and water.\\n\\n\"\r\n drink = gets.chomp\r\n drink.downcase!\r\n \r\n #Asks the user what drink they want, how many, adds this to the total\r\n #Add if / else conditions for what the user types in.\r\n \r\n\r\n #If the \r\n if\r\n drink.include? \"cocktail\"\r\n system('clear')\r\n puts \"How many cocktails do you want?\\n\\n\"\r\n @cocktailNumber += gets.to_i\r\n system('clear')\r\n \r\n elsif\r\n drink.include? \"water\"\r\n system('clear')\r\n puts \"How many waters do you want?\\n\\n\"\r\n @waterNumber += gets.to_i\r\n system('clear')\r\n \r\n elsif\r\n drink.include? \"beer\"\r\n system('clear')\r\n puts \"How many beers do you want?\\n\\n\"\r\n @beerNumber += gets.to_i\r\n system('clear')\r\n \r\n else \r\n drink != \"water\" or \"beer\" or \"cocktail\"\r\n system('clear')\r\n puts \"We don't sell that, we only sell cocktails, beers, or waters.\\n\\n\"\r\n end\r\n \r\n return \"You have #{@cocktailNumber} cocktails, #{@waterNumber} waters and #{@beerNumber} beers to make.\"\r\n \r\n end",
"def dyslexic_accounting(number)\n # code goes here\nend",
"def generate_number\n return if !self.number.blank? || !self.isic?\n\n range = self.club.card_range_for :isic\n current_max = Card.where(\n :members => {:club_id => self.club.id},\n :number => range\n ).maximum(:number)\n self.number = current_max.try(:succ) || range.begin\n end",
"def number!(theDot = '.')\n theDot = '.' if theDot.length == 0\n theDot = theDot.delete(\"\\n\")\n l = @theLines.length\n nums = Array.new\n 1.upto(l) { |i| nums << sprintf('%d%s ', i, theDot) }\n w = nums[l-1].length\n nums.each_index { |i| nums[i] = nums[i].rjust(w) + @theLines[i] }\n @theLines = nums\n return self\n end",
"def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end",
"def new_flight_info\n new_flight = []\n puts \"Introduce la información del vuelo a crear\"\n puts \"-\"*80\n puts \"Coloca el numero de vuelo\"\n new_flight << gets.chomp\n puts \"Coloca la fecha en la que sera el vuelo en el siguiente formatoYYYY-MM-DD\"\n new_flight << gets.chomp\n puts \"Coloca la hora en la que saldra el vuelo en el siguiente formato HH:MM:SS\"\n new_flight << gets.chomp\n puts \"Coloca la ciudad de la que saldra el vuelo\"\n new_flight << gets.chomp\n puts \"Coloca la ciudad de destino\"\n new_flight << gets.chomp\n puts \"Coloca la duracion del vuelo en el siguiente formato '1 hora 30 minutos'\"\n new_flight << gets.chomp\n puts \"Establece el precio para este vuelo\"\n new_flight << gets.chomp\n puts \"Coloca el numero asientos disponibles para este vuelo\"\n new_flight << gets.chomp\n new_flight\n end",
"def linkwizard_crm_num_field\n $tracer.trace(__method__)\n return ToolTag.new(input.className(\"/ats-enter_subscriber_number_field/\") ,__method__)\n end",
"def initialize(number, building, is_rented = false)\n self.tenants = []\n @number = number\n @building = building\n building.apartments << self\n self.is_rented = is_rented\n\n @@num_apartments += 1\n end",
"def increment_customers\n self.num_customers += 1\n end",
"def customer_name\n puts \"Whats your name?\"\n\n #customer = gets.chomp\n $drink[:customer_name] = gets.chomp\n #puts\nend",
"def tenders_num(num)\n\nend",
"def create_new_customer \n ForestOperations.link_parent_child_nodes_return_parent(\n ForestOperations.create_node(\n line_content[:sent_or_accepted_by],\n :accepted),\n ForestOperations.create_node(\n line_content[:recived_by]\n ) \n )\n end",
"def customer_management()\n puts %x{clear}\n puts \"Welcome to customer Management\"\n puts \"Enter Customer name\"\n customer_name = gets.chomp\n if validate_name(customer_name) == nil\n puts \"Customer not found, please enter valid name\"\n gets.chomp\n customer_management\n end\n puts \"Here are you're options for #{customer_name}\"\n puts \"1. View #{customer_name}'s' Tab and take payments\"\n puts \"2. Checkout\"\n puts \"9. Return to MAIN-MENU\"\n input = gets.chomp.to_i\n\n case input\n when 1\n room_ids = 0\n for room in @rooms\n unless room.find_index_of_someone_in_room(customer_name) == nil\n index_of_guest = room.find_index_of_someone_in_room(customer_name)\n room_ids = room.room_id\n end\n end\n room = @rooms[room_ids]\n puts \"#{customer_name}'s tab stands at £#{room.guests_array[index_of_guest].guest_tab.tab_amount}\"\n\n puts \"Please enter payment amount\"\n print \"£\"\n payment_amount = gets.chomp.to_i\n room.guests_array[index_of_guest].guest_tab.take_payment(payment_amount)\n\n gets.chomp\n when 2\n check_out(customer_name)\n when 9\n menu_selection()\n end\n menu_selection()\n end",
"def create_train\n puts 'What type of train do you want to create: 1 - passenger or 2 - cargo:'\n type = gets.chomp.to_i\n puts 'Enter the number of train: '\n number = gets.chomp\n\n case type\n when 1\n self.trains << PassengerTrain.new(number)\n puts \"Passenger train was created with number: #{number}\"\n when 2\n self.trains << CargoTrain.new(number)\n puts \"Cargo train was created with number: #{number}\"\n else\n puts 'Something goes wrong..'\n end\n end",
"def initialize(name, addr)\n @cust_id = @@no_of_customers\n @cust_name = name\n @cust_addr = addr\n @@no_of_customers += 1\n end"
] | [
"0.78277344",
"0.76995254",
"0.7348603",
"0.69303256",
"0.69198495",
"0.6896787",
"0.6736563",
"0.67131376",
"0.6689049",
"0.66882133",
"0.66882133",
"0.66144294",
"0.66144294",
"0.6606437",
"0.6602855",
"0.6578228",
"0.65700084",
"0.65516794",
"0.653228",
"0.6458751",
"0.6441681",
"0.6411162",
"0.6363411",
"0.6360531",
"0.63531053",
"0.6326818",
"0.62870854",
"0.6278521",
"0.6185679",
"0.61608845",
"0.61250734",
"0.6102827",
"0.60832536",
"0.60008425",
"0.59647083",
"0.59550416",
"0.5943329",
"0.5923319",
"0.5913295",
"0.58834547",
"0.5857939",
"0.58280665",
"0.5826013",
"0.57970023",
"0.5745966",
"0.57363343",
"0.5732491",
"0.57322896",
"0.57280654",
"0.57213914",
"0.5700314",
"0.5691606",
"0.56681293",
"0.5579031",
"0.5539835",
"0.55188644",
"0.5495024",
"0.54508764",
"0.5426537",
"0.5402559",
"0.53898233",
"0.53824353",
"0.5375042",
"0.5372394",
"0.5341647",
"0.53099364",
"0.52904093",
"0.5282567",
"0.527811",
"0.5273251",
"0.5267683",
"0.5245748",
"0.52364093",
"0.52353936",
"0.5209595",
"0.5181653",
"0.5169429",
"0.51621",
"0.51429856",
"0.5076901",
"0.5076901",
"0.5075345",
"0.5031102",
"0.50140274",
"0.501275",
"0.5006269",
"0.50023043",
"0.500006",
"0.49867138",
"0.49845862",
"0.498199",
"0.49674866",
"0.49654078",
"0.49596897",
"0.49564013",
"0.49492848",
"0.49492636",
"0.4940431",
"0.4930331",
"0.49213654"
] | 0.6850672 | 6 |
Iteriate through the array to see if the index_target is in it If it is in it print the index number for the number in the array If not print nill | def search(array, index_target)
index = 0
while index < array.length
if array[index] == index_target
return index
else
nil
end
index += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slow_dance(target, array)\n\n array.each.with_index do |phrase, i|\n return i if array[i] == target \n end \n end",
"def search(nums, target)\n nums.each_with_index do |num, index|\n return index if num == target\n end\n -1\nend",
"def search_array2(ary, target)\n i = 0\n match = nil\n ary.each do |x|\n case\n when x == target then match = i\n else i += 1\n end\n end\n p match\nend",
"def search_array(integers, target)\n idx = 0\n\n while idx < integers.length\n if integers[idx] == target\n return idx\n elsif idx == integers.length\n nil\n else\n idx += 1\n end\n end\nend",
"def find_index(array, target)\n index = 0\n found_index = nil\n\n array.each do |element|\n if element == target\n found_index = index\n end\n index += 1\n end\n\n found_index\nend",
"def slow_dance(target, tiles_array)\n tiles_array.each_with_index do |tile, idx|\n return idx if tile == target\n end\nend",
"def find_a_number_in_sorted_array(target_num, array, start_index, end_index)\n \n if end_index < start_index or start_index > end_index\n return nil\n end\n \n middle_index = ((start_index + end_index)/2).floor\n found_target_index = nil \n \n if target_num < array[middle_index]\n found_target_index = find_a_number_in_sorted_array(target_num, array, start_index, middle_index - 1)\n elsif target_num > array[middle_index]\n found_target_index = find_a_number_in_sorted_array(target_num, array, middle_index + 1, end_index)\n else\n found_target_index = middle_index\n end\n \n return found_target_index\nend",
"def search_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n mid = (start_ind + last_ind) / 2\n\n #having condition as start_ind + 1 < last_ind will be helpful in find first/last position in function\n #also avoid infinite loop when the array only has two elements\n while start_ind + 1 < last_ind do \n mid = start_ind + (last_ind - start_ind) / 2\n if (nums[mid] == target)\n last_ind = mid\n elsif nums[mid] > target\n last_ind = mid\n else\n start_ind = mid\n end\n end\n\n #find first position\n #if we wanna find the last position, check last_ind first\n if nums[start_ind] == target\n return start_ind\n end\n\n if nums[last_ind] == target\n return last_ind\n end\n\n return -1\nend",
"def search1(num)\n @numbers.each_with_index do |number, i|\n if @hash[number]\n puts \"Indexes: #{@hash[number]}, #{i}\"\n break\n else\n @hash[num - number] = i\n end\n puts 'loop'\n end\n end",
"def find(array, target)\n array.each_with_index do |element,index|\n return index if (element == target)\n end\n nil\nend",
"def get_index_of_id(target_id, ary)\n ary.each_index do |i|\n current_id = ary[i][0]\n if current_id == target_id\n return i\n end\n end\n end",
"def arr_search(arr, num)\r\n\tindex = 0\r\n\tarr.each do |search|\r\n\t\tif (index < arr.length && search == num)\r\n\t\t puts index\r\n\t\tend \r\n\t\tindex += 1\r\n\tend \r\nend",
"def search_array (array, number)\n counter = 0\n index = []\n array.each do |value|\n index << counter if value == number\n counter += 1\n end\n index.empty? ? nil : index\n end",
"def get_index_of_position(target_position, ary)\n ary.each_index do |i|\n current_position = ary[i][1]\n if current_position == target_position\n return i\n end\n end\n end",
"def linear_search(array, target)\n for i in 0...array.length\n if array[i] == target\n return i\n end\n end\n\n return -1\nend",
"def slow_dance(target_tile, tiles_array)\n tiles_array.each_with_index do |tile, index|\n return index if target_tile == tile\n end\n\n nil\nend",
"def search_array(arr, num)\n\n\tarr.length.times do |x|\n\t\tif arr[x] == num\n\t\t\tputs x\n\t\tend\n\tend\n\n\nend",
"def search_array(array, search_int)\n # have an empty array to store the index array numbers\n index_array = []\n\n length_of_array = array.length - 1\n\n # convert array and index to string\n array_string = array.map {|x| x.to_s}\n index_string = search_int.to_s\n\n # make a counter for 0 to array lenght numbers\n for x in 0..length_of_array\n index_array << x.to_s\n end\n\n # make the two arrays into a hash\n p array_index = Hash[index_array.zip(array_string.map {|i| i.split})]\n\n # convert back to an integer\n\n if array_index[index_string] == nil\n p nil\n else\n p array_index[index_string].map {|i| i.to_i}\n end\n\n\nend",
"def search(target)\n i = @array.bsearch_index { |ele| ele >= target }\n !!i && @array[i] == target\n end",
"def search_array(array, interger)\n\t index = 0 \n while index < array.length\n\n \tif array[index] == interger\n p index\n end \n index += 1\n end\nend",
"def search_integers(array, x)\n result = nil\n index = 0\n \tarray.each do |integer|\n \t#does the argument i pass in equal any of the items in the array\n \tif integer == x \n \t\tputs index \n \telse\n \tend\n \tindex += 1\n \tend\n result\nend",
"def index_match(array)\n # write your code here\n array.each_with_index do |num, index|\n if num == index \n return num\n end\n end\n -1\nend",
"def linear_search(array, target)\n for i in 0..(array.length - 1)\n if array[i] == target\n return i\n end\n end\n return -1\nend",
"def search_array(array, integer)\r\n # Search array for given integer\r\n array.each_with_index do |item, index|\r\n\r\n if item.eql? integer\r\n p index\r\n elsif !item.eql? integer\r\n nil\r\n else puts \"nil\"\r\n end\r\n \r\n end\r\nend",
"def search_array(array, num)\n answer = nil\n (array.length+1).times do | index |\n if array[index] == num\n answer = index\n end\n end\n answer\nend",
"def search_array(array, integer)\n index = 0\n array.each do |int|\n if int == integer\n puts \"#{integer} was found in the array! It's index is #{index}.\"\n else\n nil\n end\n index += 1\n end\nend",
"def find_item(array, target)\n array.select do |elem| elem== target\n return array.index(target)+1\n end\n\n\n\n\nend",
"def two_sum_indices?(arr, target_sum)\n summands = {}\n\n arr.each_with_index do |num, i|\n summand = target_sum - num\n return [target_sum[summand], i] if summands.key?(summand)\n\n summands[num] = i\n end\n\n false\nend",
"def search_range(nums, target)\n emp = []\n if nums.include?(target)\n nums.each_with_index do |n,i|\n if n == target\n emp.push(i)\n end\n end\n\n emp.map {|n| [emp[0], emp[emp.length - 1]] }[0]\n\n else\n [-1,-1]\n end\nend",
"def search_matrix(matrix, target)\n (0..matrix[0].length).each do |num|\n p num\n end\nend",
"def search_insert(nums, target)\n nums.each_with_index do |num, index|\n return index if num >= target\n end\n \n return nums.size\nend",
"def binary_index(array, target)\n upper = array.size - 1\n lower = 0\n\n while upper >= lower\n center = lower + (upper - lower) / 2\n\n case @comparator.call(target, array[center])\n when 0\n return center\n when 1\n lower = center + 1\n when -1\n upper = center - 1\n end\n end\n lower\n end",
"def simple_search(arr, number)\n\tmatching_index = nil\n\tcurrent_index = 0\n\tarr.each do |num|\n\t\tif num == number\n\t\t\tmatching_index = current_index\n\t\tend\n\t\tcurrent_index += 1\n\tend \n\tmatching_index\nend",
"def two_sum(nums, target)\n result = []\n nums.each_with_index do |num, idx|\n find_num = target - num\n result = [idx, nums.index(find_num)] if nums.include?(find_num) && nums.index(find_num) != idx\n return result if result.length > 0\n end\n\n if result.length == 0\n return \"Target sum not found in array\"\n end\nend",
"def target_idx\n @target_idx\n end",
"def iteration_counter(array, target)\n counter = 0\n for el in array\n counter += 1\n if el == target\n return counter\n end\n end\n counter\n end",
"def search_insert(nums, target)\r\n\r\n # iterate over array until target's position is found\r\n (0..nums.length-1).each do |i|\r\n if nums[i] >= target\r\n return i\r\n end\r\n end\r\n\r\n # if target is bigger than all elements in array, target belongs at the end\r\n return nums.length\r\n\r\nend",
"def slow_dance(tile, tiles_array)\n tiles_array.each_with_index do |direction, idx|\n return idx if direction == tile\n end\nend",
"def findIndex(target)\r\n\r\n i = 0\r\n while(i < @Declarations.length)\r\n if(target == @Declarations[i])\r\n return i\r\n end\r\n i += 1\r\n end\r\n return -1\r\n end",
"def search_array(array, integer)\n index = 0\n result = nil # variable to store result\n\n array.each do |number| # for each item in the array, check whether it is equal to the integer.\n if number == integer\n result = index # save current index as result when integer is found in array.\n break\n end\n index += 1 # each time the number does not match, increment the index.\n end\n return result\nend",
"def sortAndSearch(arr, target)\n arr = arr.sort_by(&:to_i)\n\n startIndex = 0;\n endIndex = arr.size-1\n\n if (target < arr[startIndex] || target > arr[endIndex])\n return 'target is not in array'\n elsif (target === arr[startIndex])\n return startIndex\n elsif (target === arr[endIndex])\n return endIndex\n end\n\n while (startIndex < endIndex - 1)\n midIndex = (startIndex + endIndex) / 2\n\n if (arr[midIndex] === target)\n return midIndex\n elsif (target < arr[midIndex])\n endIndex = midIndex\n elsif (target > arr[midIndex])\n startIndex = midIndex\n end\n end\n\n return 'target is not in array'\nend",
"def solve(nums, target)\n nums.each_with_index do |e, i|\n nums.each_with_index do |e_, i_|\n return [i, i_] if ((e + e_ == target) && (i != i_))\n end\n end\nend",
"def find_index(array, target, root = build_tree(array))\n return root.index if target == root.val\n if target < root.val\n if root.left\n find_index(array, target, root.left)\n else\n -1\n end\n else target > root.val\n if root.right\n find_index(array, target, root.right)\n else\n -1\n end\n end\nend",
"def search_range(nums, target)\n return [-1,-1] if nums.empty? || !nums.include?(target)\n output = [*nums.each_with_index]\n all_targets = output.find_all do |tuple|\n tuple[0] == target\n end\n [all_targets.first[1], all_targets.last[1]]\nend",
"def bsearch(array, target)\nend",
"def search_insert(nums, target)\n idx = nums.index(target)\n return idx unless idx.nil?\n first = nums.first\n last = nums.last\n return nums.size if target > last\n return 0 if target < first\n target.downto(first).to_a.each do |e|\n idx = nums.index(e)\n return idx + 1 unless idx.nil?\n end\n return 'Not found'\nend",
"def nameri arr, query \n len = arr.length\n for idx in 0 .. len - 1 do\n if query == arr[idx]\n return idx \n else \n end\n end\nend",
"def search_array(a, b) # Defined method takes two parameters\n flag = false # Assign flag variable to false\n arr_end = a.length # Assign arr_end variable to array's length\n counter = 0 # Starts at the 0 array index position and will increase by 1 each loop iteration\n\n until counter == arr_end #loop will continue until this condition is met\n\n position = arr_end - counter #the current index position\n\n if a[position] == b #if the integer equals the item at current index position then print position to the console\n p position\n flag = true #reassign variable flag value to true\n elsif a[0] == b #if interger at array[0] equals search integer print array[0]\n p 0\n flag = true #change variable flag value to true\n break # Search complete exit method\n else\n end # Close if elsif else statement\n\n counter += 1 # Increase counter by 1 to begin next loop iteration\n\nend\n\n if flag == false # Print nil to console if flag value equals false\n p \"nil\"\n else\n end # Close if else statement\nend",
"def linear_search(array, n, x)\n answer_index = 'NOT-FOUND'\n array.each_with_index do |a, i|\n if a == x\n answer_index = i\n end\n end\n answer_index\nend",
"def slow_dance(tile, array)\n array.each_with_index do |el, i|\n return i if el == tile\n end\nend",
"def two_sum(numbers, target)\n arr = numbers\n num = target\n index_array = []\n return_array = []\n current_index = 0\n\n loop do\n idx_counter = current_index\n current_element = arr[current_index]\n\n loop do\n break if idx_counter >= arr.length - 1\n next_index = idx_counter + 1\n next_element = arr[next_index]\n if current_element + next_element == num\n index_array << current_index << next_index\n end\n idx_counter += 1\n end\n\n if return_array == []\n current_index += 1\n end\n break if return_array.reduce(:+) == num\n end\n\n p index_array\nend",
"def search(nums, target)\n nums.sort.uniq.rotate(rand(0..9))\n .include?(target)\nend",
"def search_array(arr, num)\n\tindex = 0\n\tarr.each do |value|\n\t\tif value == num\n\t\t\treturn index\n\t\tend\n\tindex +=1\n\tend\n\treturn nil\nend",
"def good_two_sum?(arr, target)\n input_hash = Hash.new\n \n arr.each.with_index do |el, i|\n input_hash[el]=i\n end\n arr.each.with_index do |el, i|\n var = input_hash[target - el]\n return true if var && var !=i\n end\n false\nend",
"def search_insert(arr, target)\n arr.each_with_index do |element, index|\n return index if element >= target\n end\n arr.length\nend",
"def slow_dance(target, tiles)\n tiles.each_with_index do |dir, idx|\n return idx if dir == target\n end\nend",
"def binary_search(target, array)\r\n\t#Your code here\r\n\tindex = array.length / 2\r\n\tlo = 0\r\n\thi = array.length - 1\r\n\twhile array[index] != target && array.include?(target)\r\n\t\tif array[index] > target\r\n\t\t\thi = index - 1\r\n\t\t index = (lo + hi) / 2\r\n\t\telsif array[index] < target\r\n\t\t\tlo = index + 1\r\n\t\t\tindex = (lo + hi) / 2\r\n\t\tend\r\n\tend\r\n\tif array[index] == target\r\n\t\treturn index\r\n\telse\r\n\t\treturn -1\r\n\tend \r\nend",
"def summer (array, target_number)\n\t#tracks number position in array \n\tindex = 0\n\t#array of two element arrays that is returned by function\n\tanswer_array = []\n\twhile index <= array.length\n\t \tarray.each do |number|\n\t\t\tif (((array[index].to_i + array[number].to_i) == target_number) && index != number)\n\t\t\t\tanswer_array.push([array[index], array[number]])\n\t\t\tend \n end\n index += 1 \n end \t\n answer_array\nend",
"def search_array(favorite_nums,num)\n # loop containing a conditional statement\n iteration = 0\n while iteration < favorite_nums.length\n if num == favorite_nums[iteration]\n return iteration\n end\n iteration += 1\n end\nend",
"def search_array(input_array, searched_elt)\n # Examples \n # arr = [42, 89, 23, 1]\n #p search_array(arr, 1)\n #=> 3\n #p search_array(arr, 24)\n #=> nil\n #= end \n \n # loop on the array 'array_of_integers'\n # if 'searched_integer' is found, take the index \n result = 0\n tab_index = 0 \n input_array.each do |i|\n if (i == searched_elt)\n result = tab_index\n end \n tab_index += 1\n end\n\n if result == 0 \n puts \"Element not found\"\n else\n return (result)\n end \n\nend",
"def index_of(target)\n current = @head\n index = 0\n until current.nil?\n return index if current.value == target\n\n current = current.next\n index += 1\n end\n -1\n end",
"def check_target_in_exon(exon_id,strand_target,strand,len_bioseq,exones_site)\r\n #we are going to keep the exon_id, the strand and the location of the target for the gff file\r\n target_in_exon = Hash.new\r\n strand_target.each do |pos|\r\n #c=[]--> vector auxiliar \r\n c=[]\r\n pos.zip(exones_site).map { |x, y| c << x-y}\r\n if c[0] >=0 && c[1] <= 0\r\n if strand == 'reverse'\r\n #the target is in the exon\r\n #for the format of ebi we have to change again our start and final points \r\n e_start = len_bioseq - pos[1].to_i\r\n e_final = len_bioseq - pos[0].to_i\r\n target_in_exon[[e_start,e_final]] = [exon_id,'-']\r\n else\r\n target_in_exon[[pos[0],pos[1]]] = [exon_id,'+']\r\n end\r\n end\r\n end\r\n if not target_in_exon.empty? # We check there are targets inside the exon\r\n return target_in_exon\r\n end\r\nend",
"def contains(target)\n index_of(target) > -1\n end",
"def search_array(array, x)\n i = 0\n\n array.each do | y |\n if y == x\n return i\n end\n i += 1\n end\n return nil\nend",
"def two_sum(nums, target)\n target_indexes = []\n nums.each_with_index do |primary, index|\n nums.each_with_index do |num, i|\n if primary + num == target && index != i\n target_indexes << index\n target_indexes << i\n end\n end\n end\n return target_indexes.uniq\nend",
"def slow_dance(direction, array)\n array.each_with_index do |tile, idx|\n return idx if tile == direction\n end\nend",
"def two_sum(nums, target)\n hash_idx_nums = {}\n index_result_array = []\n for index in (0...nums.length)\n hash_idx_nums[index] = nums[index]\n end\n\n # nums.each do |num|\n # result = target - num\n # if hash_idx_nums.value?(result)\n # index_result_array << hash_idx_nums.key(result)\n # end\n # end\n for index in (0...nums.length)\n result = target - nums[index]\n \n if hash_idx_nums.value?(result) && hash_idx_nums.key(result) != index\n index_result_array << hash_idx_nums.key(result)\n end\n end\n p index_result_array\n return index_result_array[0], index_result_array[1]\nend",
"def search_insert(nums, target)\n return 0 if nums.length == 0 \n if nums.include?(target)\n nums.each_with_index do |val ,index| \n if val == target\n return index\n end\n end\n else\n if target > nums[-1] \n return (nums.length - 1) + 1\n elsif target < nums[0]\n return 0\n elsif target.between?(nums[0],nums[-1])\n i = 0 \n j = 1\n while i < nums.length - 1 do \n if target.between?(nums[i],nums[j])\n return i + 1\n end\n i += 1\n j += 1\n end\n end\n end\nend",
"def get_position_of_id(target_id, ary)\n ary.each_index do |i|\n current_id = ary[i][0]\n if current_id == target_id\n return ary[i][1]\n end\n end\n end",
"def search_array (array, integer)\n\tarray.length.times do |index|\n\t if array[index] == integer\n\t return index\n\t end\n\tend\n\tnil\nend",
"def search_array(array, integer)\nindex = 0\n\twhile index < array.length \n\t\tif array[index] == integer \n\t\t\treturn index\n\t\tend \n\t\tindex += 1\n\tend\n\tputs \"This integer is not included.\" \nend",
"def slow_dance(direction, array)\n array.each_with_index do |tile, idx|\n return idx if tile == direction\n end\n\n nil\nend",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n if val === index\n return index\n end\n end\nend",
"def two_sum_big_gun(array, target)\n nums = Hash.new(0)\n\n array.each do |el|\n nums[el] += 1\n end\n\n array.any? do |el|\n wing = target - el\n nums[wing] > 0\n end\n\nend",
"def search_array(arr, x)\r\n index = 0 \r\n default = nil\r\n arr.each do if x == arr[index]\r\n return index\r\n # default = index\r\n end\r\n index += 1\r\n end\r\n return default \r\nend",
"def includ_answer(array,value)\n\t!!array.find_index(value)\nend",
"def search_insert (nums, target)\n\ti, j, m = 0, nums.length - 1, 0\n\twhile i <= j\n\t\tm = (i + j) / 2\n\t\tif nums[m] == target then return m\n\t\telsif nums[m] < target then i = m + 1\n\t\telse j = m - 1 end\n\tend\n\treturn i\nend",
"def slow_dance(direction, tiles_array)\n tiles_array.each_with_index do |tile, idx|\n return idx if tile == direction\n end\nend",
"def slow_dance(direction, tiles_array)\n tiles_array.each_with_index do |string_tile, i|\n return i if direction == string_tile\n end\nend",
"def match_array(array)\n matching_array = []\n\n array.each_with_index do |num, i|\n if num == array[i + 1]\n matching_array << num\n end\n end\n\n matching_array\nend",
"def matching_indexes(str, target)\n (0..str.length-1).select { |i| str[i] == target}\n end",
"def search_array (array, integer)\n array.each_with_index do |item, index|\n if item == integer\n return index\n end\n end\nend",
"def binary_search(arry, target)\n return \"Empty Array\" if arry.size < 1\n lower_limit = 0\n upper_limit = arry.size - 1\n search_string = binary_search_with_limits(arry, target, lower_limit, upper_limit)\nend",
"def okay_two_sum?(arr, target)\n sorted = quick_sort(arr)\n\n arr.each_with_index do |el, idx|\n p current = target - el\n bruh = bsearch(arr, current)\n next if bruh == idx\n return true unless bruh.nil?\n end\n\n return false\nend",
"def slow_dance_in_a_burning_room(direction, tiles_array)\n tiles_array.each_with_index do |dir, index|\n return index if dir == direction\n end\nend",
"def brute_force_two_sum(array, target)\n indexes = []\n array.each.with_index do |n1, index1|\n array.each.with_index do |n2, index2|\n indexes.push(index1) if target - n1 == n2 && index1 != index2\n end\n end\n indexes\nend",
"def find_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n\n while (start_ind + 1 < last_ind) do\n mid = start_ind + (last_ind - start_ind) / 2\n\n if nums[mid] == target\n return mid\n end\n\n if nums[start_ind] < nums[mid]\n if nums[start_ind] <= target && target <= nums[mid]\n last_ind = mid\n else\n start_ind = mid\n end\n else\n if nums[mid] <= target && target <= nums[last_ind]\n start_ind = mid\n else\n last_ind = mid\n end\n end\n end\n\n return start_ind if nums[start_ind] == target\n return last_ind if nums[last_ind] == target\n return -1\nend",
"def linear_search(object, array)\n\t\tputs \"nil\" if array.empty? == true\n\t\tputs \"nil\" if array.include?(object) == false\n\t\n\t\t\ti = 0\n\t\tuntil array[i] == object\n\t\t\ti +=1\n\t\tend\n\t\nreturn i if array[i] = object\n\t\nend",
"def awesome(arr, target)\n hash = Hash.new(0)\n i = 0\n j = i + 1\n while i < arr.size\n hash[arr[i] + arr[j]] += 1 \n if j < arr.size\n j += 1\n else\n i += 1\n if j = i + 1 > arr.length\n j = i \n else\n j = i + 1\n \n end\n\n end\n \n end\n return true if hash[target] >= 1\n false\nend",
"def two_sum(numbers, target)\n\n numbers.each_with_index do |num, index|\n \n looking_for = target - num\n answer_2 = binary_search(numbers, index + 1, numbers.length - 1, looking_for)\n if !!answer_2\n return [index + 1, answer_2 + 1] \n end\n end\nend",
"def two_sum(array, target)\n num_hash = {}\n \n array.each_with_index do |num, index|\n difference = target - num\n if num_hash[difference]\n return [num_hash[difference], index]\n else\n num_hash[num] = index\n end\n end\nend",
"def do_search(target_value, array)\n min = 0\n max = array.length - 1\n\n binary_search(target_value, array, min, max)\nend",
"def solve(nums)\n nums.each_with_index do |n, i|\n if nums[i] == i\n return i\n end\n end\n return -1\nend",
"def test_index_array\r\n\t\tarr = [\"a\", \"b\", \"c\", \"a\", \"b\", \"d\", \"c\"]\r\n\t\tassert_equal({\"a\"=>[0,3], \"b\"=>[1,4], \"c\"=>[2,6], \"d\"=>[5]}, arr.find_values_index())\r\n\tend",
"def nums(target, *array)\n\tarray.each_with_index do |a, x|\n\t\tarray.each_with_index do |b, y|\n\t\t\tif x > y\n\t\t\t\tif a + b == target\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn false\nend",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend",
"def slow_dance(direction, tiles_array)\n tiles_array.each_with_index do |tile, index|\n return index if tile == direction\n end\nend",
"def slow_dance(dir, arr)\n arr.each_with_index do |tile, index|\n return index if tile == dir\n end\nend",
"def pbFirstTarget(idxBattler,target_data)\r\n case target_data.id\r\n when :NearAlly\r\n @battle.eachSameSideBattler(idxBattler) do |b|\r\n next if b.index==idxBattler || [email protected]?(b,idxBattler)\r\n next if b.fainted?\r\n return b.index\r\n end\r\n @battle.eachSameSideBattler(idxBattler) do |b|\r\n next if b.index==idxBattler || [email protected]?(b,idxBattler)\r\n return b.index\r\n end\r\n when :NearFoe, :NearOther\r\n indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)\r\n indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) && [email protected][i].fainted? }\r\n indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) }\r\n when :Foe, :Other\r\n indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)\r\n indices.each { |i| return i if [email protected][i].fainted? }\r\n indices.each { |i| return i }\r\n end\r\n return idxBattler # Target the user initially\r\n end",
"def search_insert_position(nums, target)\n\nend"
] | [
"0.6865924",
"0.6762055",
"0.6740984",
"0.6730617",
"0.6705163",
"0.64897907",
"0.6388038",
"0.6355746",
"0.63256085",
"0.63026637",
"0.63014174",
"0.62558657",
"0.6234249",
"0.6189509",
"0.61868083",
"0.6184662",
"0.617837",
"0.6175081",
"0.6173761",
"0.6172494",
"0.61543906",
"0.6141134",
"0.6131416",
"0.61265856",
"0.61148626",
"0.60674727",
"0.6064823",
"0.6013536",
"0.60134566",
"0.5987171",
"0.5980621",
"0.596618",
"0.5957287",
"0.59347683",
"0.59315395",
"0.5907984",
"0.5898939",
"0.5864039",
"0.5832886",
"0.58226484",
"0.5816329",
"0.5812576",
"0.58059967",
"0.579103",
"0.57905406",
"0.5787836",
"0.5780242",
"0.5779378",
"0.5776144",
"0.5775652",
"0.5772735",
"0.57725275",
"0.5740273",
"0.57329214",
"0.572806",
"0.5725343",
"0.57218796",
"0.5721165",
"0.5716327",
"0.5674091",
"0.5667265",
"0.5658746",
"0.5658561",
"0.56488734",
"0.56255245",
"0.5623303",
"0.5621824",
"0.5619847",
"0.56023794",
"0.55899906",
"0.55839777",
"0.55754054",
"0.5572899",
"0.55713063",
"0.556167",
"0.55525446",
"0.55522686",
"0.5551235",
"0.55488366",
"0.5538408",
"0.5537335",
"0.5537033",
"0.55339974",
"0.55334675",
"0.55332106",
"0.55328155",
"0.553123",
"0.55306995",
"0.552907",
"0.552662",
"0.55252993",
"0.55147785",
"0.55138826",
"0.5509293",
"0.55032563",
"0.55020845",
"0.5499336",
"0.54937863",
"0.5489998",
"0.5481592"
] | 0.663969 | 5 |
Method that takes a number If number is 1 or 0 number is equal to 1 Using that number 1 and number 2 those being the two numbers for the number add those together Add together using method Put results in an array | def the_fib(number)
fib_array = Array.new
if number == 0
return fib_array = []
elsif number == 1
return fib_array = [0]
elsif number == 2
return fib_array = [0, 1]
else
fib_array = [0, 1]
end
while fib_array.length < number
fib_array[fib_array.length] = fib_array[-1] + fib_array[-2]
end
return fib_array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_binary(a,b)\r\n sum = a + b\r\n arr = []\r\n if sum == 1\r\n p \"1\"\r\n else #if sum != 1\r\n arr.push(sum % 2) \r\n while sum / 2 != 0\r\n sum = sum / 2\r\n arr.push(sum % 2)\r\n end\r\n p arr.reverse.join\r\n end\r\nend",
"def add_numbers(num_array)\n num_array.count > 1 ? num_array.first + add_numbers(num_array.drop(1)) : num_array.first\n end",
"def two1 a; a[0] + a[1] end",
"def add(*nums) \r\n p @result.class\r\n for num in nums\r\n if num.class == Array\r\n #loop through the array and sum the elements\r\n for x in num\r\n @result += x.to_f\r\n end\r\n else\r\n @result += num.to_f# @result = @result + num\r\n end\r\n end\r\n self\r\n end",
"def plus\n\n\t\t# we have to make sure we have enough elements to perform the operation by calling empty\n\t\tempty?\n\n\t\t# pop the num1 and num2 in order to take them from the back of the array as needed\n\t\tnum_1 = @calculator.pop\n\t\tnum_2 = @calculator.pop\n\n\t\t# the result of adding the nums are pushed into the @calc array\n\t\t@calculator << num_2 + num_1\n\tend",
"def add_numbers(arr)\n return nil if arr.length < 1\n return arr[0] if arr.length == 1\n arr[0] += add_numbers(arr[1..-1])\n end",
"def sum1(array)\r\n sum = 0\r\n array.each do |number|\r\n sum += number\r\n end\r\n sum\r\nend",
"def adds_up(array1, array2, array3)\n result = []\n sum = 0\n\n comb = (array1 + array2).combination(2).to_a\n\n comb.each do |y|\n array3.each do |z|\n if y[0] + y[1] == z\n result.push(y.push(y[0] + y[1]))\n end\n end\n end\n\nreturn result\n\nend",
"def add_and_subtract_array(n1, n2)\n add = n1 + n2\n sub = n1 - n2\n [add, sub]\nend",
"def numbers_sum(input_array)\n output = input_array[0] + input_array[1] # Sums the first array's input with the second array's input\n return output\nend",
"def return_array(array1, array2)\nfor num in array2\n if num%2 == 0\n array1.push(num)\n end\nend\nreturn array1\nend",
"def add(numbers)\n numbers.inject { |sum, n| sum + n }\n end",
"def add_numbers(array)\n#add first in array to next in array. replace next in array\n#until array.length < 1\n return array[0] if array.length <= 1\n num1, num2 = array.pop, array.pop\n sum = num1.to_i + num2.to_i\n array.unshift(sum)\n add_numbers(array)\nend",
"def running_total(array1)\n array2 = []\n sum = 0\n array1.each do |num|\n array2 << sum += num \n end\n puts \"running_total(#{array1}) == #{array2}\"\nend",
"def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend",
"def sum_array(numbers)\n return numbers.sum()\nend",
"def add_numbers(number1, number2)\n return sum\nend",
"def add_all_numbers(array)\n array.inject(:+)\nend",
"def running_total1(array)\n array_new = []\n loop do\n break if array.empty?\n array_new << array[0]\n array[1] = array[0] + array[1] if array.size >= 2\n array.shift\n end\n array_new\nend",
"def sum_values2(ints, value)\n arr = ints\n sum_up = [arr.shift]\n\n while arr.length > 0\n arr.each do |num|\n next unless sum_up[0] + num == value\n sum_up << num\n return p sum_up\n end\n sum_up = [arr.shift]\n end\nend",
"def SimpleAdding(num\n total = 1.upto(num).reduce(&:+)\n total \nend",
"def two_sum\n i = 0\n return_array = []\n (i...self.count - 1).each do |index_one|\n (i + 1...self.count).each do |index_two|\n el_one = self[index_one]\n el_two = self[index_two]\n if el_one != 0 && el_two != 0\n return_array << [index_one, index_two] if el_one + el_two == 0\n end\n end\n end\n return_array\n end",
"def doubler(numbers)\n # Write your code here\n array=[]\n numbers.each do |num|\n array << num *= 2\n end\n array\nend",
"def summer (array, target_number)\n\t#tracks number position in array \n\tindex = 0\n\t#array of two element arrays that is returned by function\n\tanswer_array = []\n\twhile index <= array.length\n\t \tarray.each do |number|\n\t\t\tif (((array[index].to_i + array[number].to_i) == target_number) && index != number)\n\t\t\t\tanswer_array.push([array[index], array[number]])\n\t\t\tend \n end\n index += 1 \n end \t\n answer_array\nend",
"def two_sum_to_zero?(array)\nend",
"def oddball_sum(numbers)\n\nend",
"def sum_array(array_num)\n\nend",
"def two_sum(nums)\nend",
"def sum\n turn[0] + turn[1]\n end",
"def add_nums(num_1,num_2)\n\treturn num_1.to_i + num_2.to_i\nend",
"def add\n\t number_1 + number_2\n end",
"def add_numbers(arr)\n return nil if arr.empty?\n return arr[0] if arr.length == 1\n arr.shift + add_numbers(arr)\nend",
"def add_numbers(num_array)\n return num_array[0] if num_array.length <= 1\n sum = num_array[0]\n sum += add_numbers(num_array[1..-1])\nend",
"def oddball_sum(numbers) \n result = 0 \n numbers.each { |n| result += n if n % 2 != 0}\n \n return result \nend",
"def sum_array(a1,a2)\n\t\ta3_0 = a1[0] + a2[0]\n\t\ta3_1 = a1[1] + a2[1]\n\t\treturn [a3_0, a3_1]\n end",
"def two_sum(num)\n\n i = 0\n arr = []\n \n while i < num.length\n \t\n num.each do |a|\n \n if a + num[i] == 0\n \t arr.push(num.index(a))\n end\n \n end\n \t\n i += 1\nend\n\t if arr.length > 0\n \t return arr.reverse\n else\n \t return nil\n end\n \nend",
"def plus \n\t\tif @calculator.empty?\n\t\t\traise \"calculator is empty\"\n\t\telse\n\t\t\tsum = 0\n\t\t\tif @calculator.length == 2\n\t\t\t\twhile @calculator.length != 0 do\n\t\t\t\t\t\tsum += @calculator.last.to_f\n\t\t\t\t\t\[email protected]\n\t\t\t\tend\n\t\t\telse\n\t\t\t\twhile @calculator.length != 1 do\n\t\t\t\t\t\tsum += @calculator.last.to_f\n\t\t\t\t\t\[email protected]\n\t\t\t\tend\n\t\t\tend\n\t\t\[email protected](sum)\n\t\tend\n\tend",
"def add_nums number\n i = number.digits.count - 1\n j = 0\n sum = 0\n array = number.digits\n p i\n loop do\n p array[i]\n sum += array[i]\n i -= 1\n j += 1\n break if i < 0 || j == 2\n end\n sum\nend",
"def multipleSum(num1)\n sumArray = []\n\n num1.times do |i|\n if (i % 3) == 0\n sumArray.push(i)\n i = i - 1\n elsif (i % 5) == 0\n sumArray.push(i)\n i = i - 1 \n else\n i = i -1\n end\n end\n\n a = sumArray.inject(:+)\n\n puts a.to_s\n\nend",
"def binary_integer_addition(b1, b2)\n\tr = []\n\tcarry = 0\n\t(b1.length-1).downto(0).each { |i|\n\t\tif b1[i] + b2[i] == 0\n\t\t\tr << 0 + carry\n\t\t\tcarry = 0\n\t\telsif b1[i] + b2[i] == 1\n\t\t\tcarry == 0 ? r << 1 : (r << 0; carry = 1)\n\t\telsif b1[i] + b2[i] == 2\n\t\t\tcarry == 0 ? r << 0 : r << 1\n\t\t\tcarry = 1\n\t\tend\n\t}\n\tif carry == 1\n\t\tr << 1\n\tend\n\tr.reverse\nend",
"def add_array_numbers(array)\n result = array.sum\n # .sum cannot be used on a string, only integars and floats\n return result\nend",
"def SimpleAdding(num)\n answer = (1..num).to_a.inject(:+)\nend",
"def check_array(nums)\n if(nums.length >= 2)\n\t\treturn (nums[0] + nums[1])\n\tend\n\tif(nums.length == 1)\n\t\treturn nums[0];\n\tend\n\treturn 0;\n\nend",
"def two_sum\n output = []\n \n i = 0\n while i < self.length - 1\n j = i + 1\n while j < self.length\n output << [i, j] if self[i] + self[j] == 0\n j += 1 \n end\n i += 1\n end\n\n output.empty? ? nil : output\n end",
"def sum(array_of_integers)\n # TODO\nend",
"def add_binary a, b\n return_arr = con_to_binary(a + b)\n return_arr.shift if return_arr[0] == \"0\"\n return_arr.join\nend",
"def sum(numbers)\n\tresult = 0\n\tnumbers.collect do |i|\n\tresult += i if i.is_a? Integer\n\tend\n\tresult\nend",
"def sum_array(add)\n add.inject {|num, n| num + n}\nend",
"def compute_sum(num1,num2)\n while num2>0 #increment the first number until the second number hits zero\n num1+=1\n num2-=1\n end\n num1 #return the first number\n end",
"def summing_method\n @summed_array = @single_digit_array.sum\n end",
"def add_two(number)\n if number.respond_to? :+\n if number.respond_to? :push\n if number.respond_to? (:to_str)\n number.push 2\n else\n number + 2\n end\n end\n end\nend",
"def answer\r\n add(*@values)\r\n end",
"def add_numbers(nums_array)\n\treturn nil if nums_array.length == 0\n\n\treturn nums_array.first if nums_array.length == 1\n\n\treturn nums_array.shift + add_numbers(nums_array)\nend",
"def add_numbers(nums_array)\n return nums_array.first if nums_array.length <= 1\n nums_array.shift + add_numbers(nums_array)\nend",
"def sum_of_2\n array = Array.new\n puts \"Give me an array\"\n array = gets.chomp\n puts array\n length = array.length\n case length\n when 0\n puts \"Sum = 0\"\n when 1\n puts \"Sum = #{array[0]}\"\n else\n sum = array[0].to_i+array[1].to_i\n puts \"Sum = #{sum}\"\n end\nend",
"def total ( numbers )\r\n\r\n\treturn numbers.reduce(:+);\r\n\r\nend",
"def sum_of_even(input_array)\n\teven_array = []\n\tinput_array.each do |number|\n\t\tif number%2 == 0\n\t\t\teven_array.push(number)\n\t\tend\n\tend\n\treturn even_array.inject(:+)\nend",
"def addition(n1,n2)\r\n\tnumbers1= n1+5\r\n\tnumbers2= n2+5\r\n\treturn numbers1+numbers2+n2\r\n\t#returns(numbers1+numbers2+n2),\"hello\"#multiple value can returns.it will sent backas an array\r\n\t\"hello\"\r\nend",
"def add_nums(num_1, num_2)\n return num_1.to_i + num_2.to_i\nend",
"def add_nums(num_1, num_2)\n return num_1.to_i + num_2.to_i\nend",
"def sum(numbers)\n numbers.reduce(&:+)\n end",
"def add_numbers(nums_array)\n return 0 if nums_array.length == 0\n\n first = nums_array.shift\n\n first + add_numbers(nums_array)\nend",
"def two_sum(numbers, target)\n ##set hash\n hash = {}\n ##set array\n arr = []\n\n numbers.each_with_index do |val, idx|\n if hash.key?(target - val)\n arr.push(hash[target - val])\n arr.push(idx + 1)\n break\n else\n hash[val] = idx + 1\n end\n end\n\n arr\nend",
"def add_sub(n1=0,n2=0)\n add = n1+n2\n sub = n1-n2\n return [add,sub] # Return can be an array and hash etc.\nend",
"def add(first_num, second_num)\n @result = (first_num + second_num)\nend",
"def total(numbers)\n\tnumbers.inject(:+)\nend",
"def sum_array(arry)\n sum = 0\n arry.each do |num|\n # if num = num.to_i\n sum += num\n\n\n end\n sum\nend",
"def sumoftwonumbers(number1, number2)\n return number1 + number2\nend",
"def sum_array(integers)\n integers.sum\nend",
"def add_numbers(nums_array)\n return nil if nums_array.empty?\n return nums_array.pop if nums_array.length == 1\n return nums_array.pop + add_numbers(nums_array)\nend",
"def add_numbers(arr)\n return arr[0] if arr.length == 1\n return nil if arr.length == 0\n tot = arr.pop + add_numbers(arr)\nend",
"def sum_numbers(numbers)\r\n # Your code here\r\n #initalize the sum\r\n sum = 0\r\n #iterate through every element of a given array\r\n numbers.each do |number|\r\n #add the previous sum and next number in the array\r\n sum += number\r\n end\r\n \r\n return sum\r\nend",
"def sum_upon_sums(array)\n\nend",
"def add_num(arr, num)\r\n\t# Your code here\r\nend",
"def ary_add(array)\n if array.length.even?\n ary_couples = array.each_slice(2)\n final_ary = []\n ary_couples.each do |duo|\n ary_sum = duo[0] + duo[-1]\n final_ary << ary_sum \n end\n return final_ary\n else\n last_obj = array.pop\n ary_couples = array.each_slice(2)\n final_ary = []\n ary_couples.each do |duo|\n ary_sum = duo[0] + duo[-1]\n final_ary << ary_sum \n \n end\n return final_ary << last_obj\n end \nend",
"def sumTwo(array, sum)\n returnarray = []\n i = 0\n j = 1\n for i in (0..array.length-1) do\n for j in (1..array.length-1) do\n if array[i] + array[j] == sum\n returnarray << array[i]\n returnarray << array[j]\n return returnarray\n end\n end\n end\n return \"no pairs sum to this input\"\nend",
"def calculate(arr1, arr2)\n result = []\n arr1.each_with_index do |num, index|\n result << num + arr2[index]\n end\n result\nend",
"def add_numbers(arr_of_ints)\n return arr_of_ints[0] if arr_of_ints.length <= 1\n arr_of_ints[0] + add_numbers(arr_of_ints[1..-1])\nend",
"def sum (array)\n y=array.inject(:+).to_i\nend",
"def add_elements(decimal_array)\n total = 0\n decimal_array.each do |number|\n total += number\n end\n return total\nend",
"def total(numbers)\n return numbers.reduce(:+)\nend",
"def add_numbers(arr)\n if arr == []\n return nil\n elsif arr[0] == arr[-1]\n return arr[0]\n end\n arr[-1] + add_numbers(arr[0...-1])\nend",
"def add_numbers(num_array = nil)\n return nil if num_array.nil?\n return num_array[0] if num_array.length == 1\n num_array[0] + add_numbers(num_array[1..-1])\nend",
"def sum_machine(input_array)\n\toutput = input_array[0] + input_array[1]\n\treturn output\nend",
"def sum_array a\n t = 0\n a.each{|i|t+=i.to_i}\n [a,t]\nend",
"def addition(number)\n (1..number).reduce(:+)\nend",
"def add(*numbers)\n numbers.inject(0) { |sum, number| sum + number } \nend",
"def add_numbers(nums_array)\n return nil if nums_array.empty?\n return nums_array.pop if nums_array.length == 1\n return nums_array.pop + add_numbers(nums_array)\nend",
"def sum_of_array(array)\n sum = 0\n array.each do |item|\n if item.is_a?(Integer) == true\n sum = sum + item\n else\n sum = sum + num_value(item)\n end\n end\n sum\nend",
"def total(array1)\n sum=0.0\n array1.each do|i|\n sum+=i\n end\n return sum\n end",
"def sum_consecutives(numbers)\n\tarray = []\n\ti = 0\n\tsum = 0\n\twhile i < numbers.length\n\t\tif numbers[i] == numbers[i + 1]\n\t\t\tsum += numbers[i]\n\t\telsif numbers[i] != numbers[i +1]\n\t\t \tarray.push(numbers[i] + sum )\n\t\t \tsum = 0 \n\t\t end\n\t\t i += 1 \n\tend\n\treturn array\nend",
"def sum_array(numbers)\n total = 0\n for number in numbers\n total = total + number\n end\n return total\nend",
"def add_numbers(n)\n return nil if n.length == 0\n return n[0] if n.length == 1\n adder = n.pop\n adder + add_numbers(n)\n\nend",
"def summing_method(single_digit_array)\n summed_array = single_digit_array.sum\nend",
"def add(*numbers)\n numbers.inject(0) { |sum, number| sum + number }\nend",
"def array_sum_additive(array)\n sum = array.reduce(&:+)\n test_num = sum / 2 if sum\n if array.include?(test_num)\n array.delete(test_num)\n return [[test_num], array]\n end\n []\nend",
"def total(numbers)\n numbers.reduce(:+)\nend",
"def total(array)\n\ttoats = 0\n\tarray.each do |i|\n\t\ttoats = toats + i\nend\nreturn toats\nend",
"def add (first_number , second_number)\n return first_number + second_number\nend",
"def add_numbers(nums_array)\n # Base Case: Is the array empty?\n return nums_array[0] if nums_array.length <= 1\n nums_array.shift + add_numbers(nums_array)\nend",
"def sum(numbers)\n\ttotal = 0\n\tnumbers.each do |number|\n\t\ttotal += number if number.is_a? Integer\n\tend\n\ttotal\nend"
] | [
"0.65721047",
"0.638382",
"0.6352161",
"0.6332787",
"0.6292354",
"0.6289748",
"0.62592745",
"0.6249493",
"0.6236138",
"0.62356275",
"0.62122947",
"0.621155",
"0.6196082",
"0.6183608",
"0.617591",
"0.6169475",
"0.6161633",
"0.6148501",
"0.61147755",
"0.6111805",
"0.6095814",
"0.6075374",
"0.6075367",
"0.6074621",
"0.60683835",
"0.60667837",
"0.60647553",
"0.60579556",
"0.60504776",
"0.60341257",
"0.6022389",
"0.6019007",
"0.6009858",
"0.600381",
"0.60015565",
"0.6001392",
"0.59959626",
"0.59918904",
"0.59859",
"0.59795177",
"0.5976121",
"0.5963467",
"0.5962368",
"0.59562635",
"0.5947217",
"0.5945019",
"0.593137",
"0.5923551",
"0.5921102",
"0.5919575",
"0.59174055",
"0.5913178",
"0.59060127",
"0.59006774",
"0.58937186",
"0.5892713",
"0.58901966",
"0.58874863",
"0.5875056",
"0.5875056",
"0.587488",
"0.5867362",
"0.58670735",
"0.58599985",
"0.5858367",
"0.5857895",
"0.5847014",
"0.5838235",
"0.58337986",
"0.5830812",
"0.5829624",
"0.5826044",
"0.58254176",
"0.5825215",
"0.58241713",
"0.5822399",
"0.5819746",
"0.581929",
"0.58115155",
"0.5811367",
"0.58044314",
"0.57981586",
"0.5796579",
"0.579184",
"0.57897925",
"0.5785896",
"0.5782518",
"0.5782178",
"0.5778528",
"0.57763547",
"0.57750016",
"0.5774689",
"0.5772148",
"0.5770687",
"0.57703644",
"0.5770231",
"0.57691777",
"0.5767539",
"0.5762662",
"0.5760638",
"0.57591504"
] | 0.0 | -1 |
Initializes a new CloudLB::ConnectionThrottle object | def initialize(load_balancer)
@connection = load_balancer.connection
@load_balancer = load_balancer
@lbmgmthost = @connection.lbmgmthost
@lbmgmtpath = @connection.lbmgmtpath
@lbmgmtport = @connection.lbmgmtport
@lbmgmtscheme = @connection.lbmgmtscheme
populate
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(params={})\n @throttle = params[:throttle] || 1\n end",
"def initialize(conn = nil)\n self.conn = conn || self.class.default_conn\n @system_profiler = SystemProfiler.new\n @last_request_metrics = nil\n end",
"def initialize(host, load_balancer, port: nil)\n @host = host\n @port = port\n @load_balancer = load_balancer\n @pool = load_balancer.create_replica_connection_pool(\n load_balancer.configuration.pool_size,\n host,\n port\n )\n @online = true\n @last_checked_at = Time.zone.now\n\n interval = load_balancer.configuration.replica_check_interval\n @intervals = (interval..(interval * 2)).step(0.5).to_a\n end",
"def initialize_connection(conn)\n conn.comm_inactivity_timeout = config.timeout.to_i\n conn.start_tls(config.ssl ? config.ssl.serializable_hash : {}) if ssl?\n # Create a new request\n req = new_request(conn)\n # Connected event\n connect!(req, conn)\n end",
"def initialize(migration, connection = nil, options = {})\n @migration = migration\n @connection = connection\n if @throttler = options[:throttler]\n @throttler.connection = @connection if @throttler.respond_to?(:connection=)\n end\n @start = options[:start] || select_start\n @limit = options[:limit] || select_limit\n @printer = options[:printer] || Printer::Percentage.new\n @retry_on_deadlock = retry_on_deadlock(options.with_indifferent_access)\n @retry_attempts = retry_attempts(options.with_indifferent_access)\n @retry_wait_time = retry_wait_time(options.with_indifferent_access)\n end",
"def initialize( connection, log, buffers, type )\n @connection = connection\n @log = log\n @buffers = buffers\n @type = type\n @local_id = @connection.allocate_channel_id\n @local_window_size = 0x20000\n @local_maximum_packet_size = 0x10000\n end",
"def initialize(opts)\n super()\n\n connection_opts = opts.dup\n @checkout_timeout = opts.delete(:checkout_timeout) || 5\n @size = opts.delete(:pool) || 5\n @auto_connect = opts.delete(:auto_connect) || true\n\n @connection_options = connection_opts\n\n # The cache of reserved connections mapped to threads\n @reserved_connections = ThreadSafe::Cache.new(initial_capacity: @size)\n\n @connections = []\n\n @available = Queue.new self\n end",
"def initialize(connection, host, port, opts={})\n @connection = connection\n\n @host, @port = host, port\n\n # Pool size and timeout.\n @size = opts[:size] || 1\n @timeout = opts[:timeout] || 5.0\n\n # Operations to perform on a socket\n @socket_ops = Hash.new { |h, k| h[k] = [] }\n\n @all = []\n @reserved = {} # map of in-progress connections\n @available = [] # pool of free connections\n @pending = [] # pending reservations (FIFO)\n\n setup_pool!(host, port)\n end",
"def initialize(opts = {})\n @config = DEFAULTS.merge(opts)\n @buffer = Buffer.new\n @mutex = Mutex.new\n reconnect!\n end",
"def initialize\n @polling_frequency = Aeternitas::PollingFrequency::DAILY\n @before_polling = []\n @after_polling = []\n @guard_options = {\n key: ->(obj) { return obj.class.name.to_s },\n timeout: 10.minutes,\n cooldown: 5.seconds\n }\n @deactivation_errors = []\n @ignored_errors = []\n @queue = 'polling'\n @sleep_on_guard_locked = true\n end",
"def initialize(config = {})\n @connection = nil\n init_config(config)\n end",
"def initialize(migration, connection = nil, options = {})\n @migration = migration\n @connection = connection\n if @throttler = options[:throttler]\n @throttler.connection = @connection if @throttler.respond_to?(:connection=)\n end\n @start = options[:start] || select_start\n @limit = options[:limit] || select_limit\n @printer = options[:printer] || Printer::Percentage.new\n end",
"def initialize(connection = nil)\n self.connection ||= connection || ParcelApi::Client.connection\n end",
"def initialize(connection=nil)\n @connection ||= connection || ParcelApi::Client.connection\n end",
"def initialize(connection=nil)\n @connection ||= connection || ParcelApi::Client.connection\n end",
"def initialize(host)\n @host = host\n @sync_record = init_sync_record(host)\n @processed = 0\n @counters = AvailabilityCounters.new(0, 0)\n end",
"def initialize\n @throttlers = {}\n @whitelisters = {}\n @blacklisters = {}\n end",
"def initialize\n bootstrap_connections unless File.exist?(connections_file)\n load_connections\n end",
"def initialize_for_connect\n @initial_post = true\n @http_requests = 1\n @pending_requests = 0\n @last_send = Time.at(0)\n @previous_send = Time.at(0)\n @send_buffer = ''\n @stream_mechanisms = []\n @stream_features = {}\n end",
"def initialize(connection,id)\n @connection = connection\n @id = id\n @lbmgmthost = connection.lbmgmthost\n @lbmgmtpath = connection.lbmgmtpath\n @lbmgmtport = connection.lbmgmtport\n @lbmgmtscheme = connection.lbmgmtscheme\n populate\n return self\n end",
"def initialize(connection,id)\n @connection = connection\n @id = id\n @lbmgmthost = connection.lbmgmthost\n @lbmgmtpath = connection.lbmgmtpath\n @lbmgmtport = connection.lbmgmtport\n @lbmgmtscheme = connection.lbmgmtscheme\n populate\n return self\n end",
"def initialize(base_url)\n @base_url = base_url\n @custom_headers = {}\n @read_write_timeout = 8000\n @connection_timeout = 2000\n @use_ssl = false\n end",
"def throttle=(_arg0); end",
"def initialize( connection_string, connection_options = {} )\n\n #Calling super would be inappropriate here \n @connection_string = connection_string\n @connection_options = connection_options\n\n @buckets = { }\n\n end",
"def initialize\n @timeouts = {\n write: 5,\n connect: 5,\n read: 5\n }\n end",
"def initialize(connection)\n @connection = connection\n end",
"def throttle; end",
"def initialize(pool: Puppet::HTTP::Pool.new(Puppet[:http_keepalive_timeout]), ssl_context: nil, system_ssl_context: nil, redirect_limit: 10, retry_limit: 100)\n @pool = pool\n @default_headers = {\n 'X-Puppet-Version' => Puppet.version,\n 'User-Agent' => Puppet[:http_user_agent],\n }.freeze\n @default_ssl_context = ssl_context\n @default_system_ssl_context = system_ssl_context\n @default_redirect_limit = redirect_limit\n @retry_after_handler = Puppet::HTTP::RetryAfterHandler.new(retry_limit, Puppet[:runinterval])\n end",
"def initialize(connection = nil)\n @connection = connection || PayTrace.configuration.connection\n end",
"def initialize(socket, logger, timeout = T.unsafe(nil)); end",
"def initialize(config)\n self.class.raise_if_missing_keys config, :host, :port\n\n @stats = { get: 0, set: 0, delete: 0 }\n @handler = ::Memcached.new \"#{config[:host]}:#{config[:port]}\"\n end",
"def initialize(conn = nil)\n self.conn = conn || self.class.default_conn\n end",
"def initialize(dalli = nil, options = {})\n @pool = dalli || Dalli::Client.new\n\n options = normalize_options options\n\n @key_prefix = options[:key_prefix]\n @max_requests = options[:max_requests]\n @period = options[:period]\n @lock_timeout = options[:lock_timeout]\n end",
"def throttle(wait, onLast, onFirst, interval, timestamps)\n \nend",
"def initialize(args)\n super(args)\n\n @max_clients = args[:max_clients] || DEFAULT_MAX_CLIENTS\n @max_wait = args[:max_wait]\n @pool = Pool.new\n end",
"def initialize(connection)\n super(connection)\n\n @has_request_body = false\n\n @backend = Tresor::Backend::Backend.new(connection)\n end",
"def initialize(address=nil)\n @connection = Connection.new(address)\n end",
"def initialize\n begin\n @neuron_ids = []\n logger.info \"Cerebrum waking...\"\n\n # @status_thread = Thread.new do\n # send_frequent_status_updates(interval: 15, identity: 'cerebrum')\n # end\n rescue Exception => e\n error_message = format_error_message(e)\n logger.fatal \"Rescued in initialize method: creyap...#{error_message}\"\n die!\n end\n end",
"def initialize\n @sleep_time = nil\n @number_of_retries = nil\n end",
"def initialize(capacity, leaf_count, soft_session_cache)\n @capacity = capacity\n @leaf_count = leaf_count\n @key_cache = soft_session_cache\n @connector = nil\n @byte_in_hmac = 20\n end",
"def initialize(options={})\n @connection = Connection.new(options)\n end",
"def initialize(connection)\n @is_cached = false\n @connection = connection\n cache_list\n end",
"def initialize\n ext_initialize\n @headers = {}\n @timeout = 5\n @connect_timeout = 1\n @max_redirects = 5\n @auth_type = :basic\n end",
"def initialize\n @rwlock = ReadWriteLock.new\n \n @rwlock.write {\n @connection = nil\n @specification = nil\n @taskbox = TaskStack.new\n }\n end",
"def balancer\n @balancer ||= RightSupport::Net::RequestBalancer.new(@@hostnames,\n :policy=>RightSupport::Net::Balancing::StickyPolicy)\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/bigtable/v2/bigtable_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @bigtable_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Bigtable::V2::Bigtable::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/monitoring/v3/uptime_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @uptime_check_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Monitoring::V3::UptimeCheckService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize(poller = CZTop::Poller.new)\n @readables = []\n @writables = []\n @poller = poller\n end",
"def initialize(opts={})\n @keyspace = (opts[:keyspace] || raise(\"missing param: keyspace\")).to_s\n @servers = Array(opts[:servers] || '127.0.0.1:9160')\n @options = {}\n @options[:retries] = (opts[:retries] || DEFAULT_RETRIES).to_i\n @options[:timeout] = (opts[:timeout] || DEFAULT_TIMEOUT).to_f\n @options[:connect_timeout] = \n (opts[:connect_timeout] || DEFAULT_CONNECT_TIMEOUT).to_f\n @pool_size = (opts[:pool_size] || DEFAULT_POOL_SIZE).to_i\n @interval = (opts[:interval] || DEFAULT_INTERVAL).to_f\n @started = false\n @processing = false\n @timer = nil\n @queue = nil\n @pool = nil\n @proxy = nil\n @healthy = nil\n @semaphore = Mutex.new\n end",
"def initialize(prefetch: nil, connection_name: nil)\n @configuration = Pwwka.configuration\n connection_options = {automatically_recover: false}.merge(configuration.options)\n connection_options = {client_properties: {connection_name: connection_name}}.merge(connection_options) if connection_name\n\n begin\n @connection = Bunny.new(configuration.rabbit_mq_host, connection_options)\n @connection.start\n rescue => e\n logf \"ERROR Connecting to RabbitMQ: #{e}\", at: :error\n\n @connection.close if @connection\n raise e\n end\n\n begin\n @channel = @connection.create_channel\n @channel.on_error do |ch, method|\n logf \"ERROR On RabbitMQ channel: #{method.inspect}\"\n end\n rescue => e\n logf \"ERROR Opening RabbitMQ channel: #{e}\", at: :error\n @connection.close if @connection\n raise e\n end\n\n if prefetch\n @channel.prefetch(prefetch.to_i)\n end\n end",
"def initialize(connection, logger, config)\n super(connection, logger)\n @config = config\n @transaction = nil\n connect\n end",
"def initialize\r\n @connection = nil\r\n end",
"def start_throttle\n @throttle = 0\n\n EM::Synchrony.add_periodic_timer(1) do\n @throttle = 0\n end\n end",
"def initialize(info = {})\n super\n\n # XXX: Not supported by all modules\n register_advanced_options(\n [\n OptAddress.new(\n 'ReverseListenerBindAddress',\n [ false, 'The specific IP address to bind to on the local system' ]\n ),\n OptBool.new(\n 'ReverseListenerThreaded',\n [ true, 'Handle every connection in a new thread (experimental)', false ]\n )\n ] +\n Msf::Opt::stager_retry_options,\n Msf::Handler::ReverseTcp\n )\n\n self.conn_threads = []\n end",
"def initialize\n @id = self.class.uid\n @connections = Connections.new({}, {}, {})\n @error = Error.new(0.0, 0.0, 0.0)\n @trace = Trace.new({}, {}, {})\n\n @state = @old = @activation = 0.0\n @selfconnection = Synaptical::Connection.new(self, self, 0.0)\n @squash = Synaptical::Squash::Logistic\n @neighbors = {}\n @bias = rand * 0.2 - 0.1\n end",
"def throttle\n 5\n end",
"def set_up_connection # :doc:\n connection_class = Net::HTTP::Proxy @config[:proxy_addr],\n @config[:proxy_port], @config[:proxy_user], @config[:proxy_pass]\n @connection = connection_class.new @config[:host], @config[:port]\n set_up_ssl\n @connection.open_timeout = @config[:timeout]\n @connection.read_timeout = @config[:timeout]\n end",
"def initialize(options = {}, &block)\n @connections, @busy_connections, @queue = [], {},[]\n @connection_proc = block\n @size = options[:size] || 8\n if options[:eager]\n @size.times do\n @connections << @connection_proc.call\n end\n end\n end",
"def new(connection_attributes)\n validate_mandatory_attributes(connection_attributes)\n HwfHmrcApi::Connection.new(connection_attributes)\n end",
"def initialize(routing, client_class)\n super\n WorklingRabbitMQSubscriber.sleep_time = Workling.config[:sleep_time] || 0.2\n end",
"def initialize\n @status = {}\n @last_update = nil\n @server_status = Overwatch::ServerStatus.new skip_query: true\n @mutex = Mutex.new\n\n populate_servers\n end",
"def throttled_response; end",
"def default_options\n { throttle: 'throttle' }\n end",
"def initialize\n @mparams = BasicHttpParams.new\n @cparams = BasicHttpParams.new\n\n @manager_params = ConnManagerParamBean.new( @mparams )\n @client_params = ClientParamBean.new( @cparams )\n @connection_params = HttpConnectionParamBean.new( @cparams )\n\n @client = nil\n @connection_manager = nil\n @retry_handler = nil\n end",
"def initialize(info = {})\n\t\tsuper\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOpt::LPORT(4444),\n\t\t\t\tOptAddress.new('RHOST', [false, 'The target address', '']),\n\t\t\t], Msf::Handler::BindTcp)\n\n\t\tself.conn_threads = []\n\t\tself.listener_threads = []\n\t\tself.listener_pairs = {}\n\tend",
"def initialize *args\n @max_load = $MAX_LOAD\n @max_object_size = $MAX_OBJECT_SIZE\n @current_load = 0\n @cache = Hash.new()\n @semaphor = Mutex.new()\n end",
"def initialize\n @starling_urls = Workling::Starling.config[:listens_on].split(',').map { |url| url ? url.strip : url }\n options = [@starling_urls, Workling::Starling.config[:memcache_options]].compact\n @connection = ::MemCache.new(*options)\n \n raise_unless_connected!\n end",
"def initialize(interval, pool)\n @interval = interval\n @pool = pool\n end",
"def initialize(migration, connection = nil, options = {})\n @migration = migration\n @connection = connection\n @chunk_finder = ChunkFinder.new(migration, connection, options)\n if @throttler = options[:throttler]\n @throttler.connection = @connection if @throttler.respond_to?(:connection=)\n end\n @start = @chunk_finder.start\n @limit = @chunk_finder.limit\n @printer = options[:printer] || Printer::Percentage.new\n end",
"def throttle\n sleep @throttle if @@last_request + @throttle > Time.now\n @@last_request = Time.now\n end",
"def initialize\n self.client_id = nil\n self.timeout = 10\n self.open_timeout = 10\n self.adapter = Faraday.default_adapter\n end",
"def throttle_api\n Rate::Limiter.new(request.env['REMOTE_ADDR'], request.env['REQUEST_PATH']).set\n end",
"def establish_connections\n klass = Struct.new(:ip,:port)\n if t_servers = BackgrounDRb::BDRB_CONFIG[:client]\n connections = t_servers.split(',')\n connections.each do |conn_string|\n ip = conn_string.split(':')[0]\n port = conn_string.split(':')[1].to_i\n @bdrb_servers << klass.new(ip,port)\n end\n end\n @bdrb_servers << klass.new(BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip],BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port].to_i)\n @bdrb_servers.each_with_index do |connection_info,index|\n next if @backend_connections.detect { |x| x.server_info == \"#{connection_info.ip}:#{connection_info.port}\" }\n @backend_connections << Connection.new(connection_info.ip,connection_info.port,self)\n end\n end",
"def throttled_responder=(_arg0); end",
"def initialize(bandwidth)\n @points = []\n @min = 0\n @max = 0\n\n @bandwidth = bandwidth\n\n @cache = {}\n end",
"def initialize(size: 10, timeout: 2.5, &block)\n raise(ArgumentError, \"cannot create connection pool: missing block\") unless block_given?\n\n @size = size\n @timeout = timeout\n @pool = Pool.new(@size, &block)\n end",
"def initialize(options = {})\n options[:Delay] ||= 60\n options[:MaxAge] ||= 86400 * 7\n\n @batch_size = options[:BatchSize]\n @delay = options[:Delay]\n @once = options[:Once]\n @verbose = options[:Verbose]\n @max_age = options[:MaxAge]\n\n @failed_auth_count = 0\n end",
"def initialize(req)\n @clientCount = 0\n @img = self.class.getDaemonParamDef(req, :img, nil)\n super(req)\n @@bw = @config['bandwidth']\n @@mcAddr = @config['mcAddress']\n end",
"def initialize\n @beanstalk_url = \"localhost\"\n @reserve_timeout = nil\n end",
"def initialize(url, &on_reconnect)\n @url = url\n @beanstalk = nil\n @on_reconnect = on_reconnect\n connect!\n end",
"def initialize\n\t@read_q = Queue.new\n\t@conn = nil\n end",
"def initialize(spec)\n super()\n\n @spec = spec\n\n @checkout_timeout = ( spec.config[:checkout_timeout] ||\n spec.config[:wait_timeout] || 5.0 ).to_f # <= 3.2 supports wait_timeout\n @reaper = Reaper.new self, spec.config[:reaping_frequency]\n @reaping = !! @reaper.run\n\n # default max pool size to 5\n if spec.config[:pool]\n @size = spec.config[:pool].to_i\n else\n if defined? Rails.env && ( (! Rails.env.development? && ! Rails.env.test?) rescue nil )\n logger && logger.debug(\"pool: option not set, using default size: 5\")\n end\n @size = 5\n end\n\n # The cache of reserved connections mapped to threads\n @reserved_connections = ThreadSafe::Map.new(:initial_capacity => @size)\n\n @connections = []\n @automatic_reconnect = true\n\n @available = Queue.new self\n\n initial_size = spec.config[:pool_initial] || 0\n initial_size = @size if initial_size == true\n initial_size = (@size * initial_size).to_i if initial_size <= 1.0\n # NOTE: warn on onitial_size > size !\n prefill_initial_connections if ( @initial_size = initial_size.to_i ) > 0\n\n if frequency = spec.config[:validate_frequency]\n require 'active_record/bogacs/validator' unless self.class.const_defined?(:Validator)\n @validator = Validator.new self, frequency, spec.config[:validate_timeout]\n if @validator.run && @reaping\n logger && logger.info(\"pool: validator configured alongside with reaper\")\n end\n end\n end",
"def initialize_connection(lobby, options={})\n options = DEFAULT_CONNECTION_OPTIONS.merge(options)\n url = URI.parse(url_for(lobby, options))\n @connection = {\n :host => url.host,\n :port => url.port,\n :ssl => ssl?(url.scheme)\n }\n self.new(lobby)\n end",
"def initialize(boost = 1.0)\n @boost = boost\n end",
"def initialize(db, opts = OPTS)\n super\n @max_size = Integer(opts[:max_connections] || 4)\n raise(Sequel::Error, ':max_connections must be positive') if @max_size < 1\n @mutex = Mutex.new \n @connection_handling = opts[:connection_handling]\n @available_connections = []\n @allocated = {}\n @allocated.compare_by_identity\n @timeout = Float(opts[:pool_timeout] || 5)\n @waiter = ConditionVariable.new\n end",
"def initialize # rubocop:disable Metrics/MethodLength\n @logfile = nil\n @loglevel = Logger::DEBUG\n @logger = nil\n @daemonize = false\n @pidfile = nil\n @autoload_rails = true\n @bunny = nil\n @before_request = nil\n @rpc_client_timeout = 5\n @rpc_client_response_key_format = :none\n @rpc_client_request_key_format = :none\n @client_test_mode = false\n @server_test_mode = false\n @thread_request_variable = nil\n end",
"def initialize(action, target, options = {})\n @action = action\n @target = target\n @rate = options.fetch(:rate)\n @period = options.fetch(:period)\n @redis = RateLimiter::Redis.new(::Redis.new(url: 'redis://127.0.0.1:6379'))\n end",
"def connection_pool_ramp_increment\n super\n end",
"def initialize server, args={}\n @cur_id = 0\n\n @id = server[:id]\n @host = server[:host]\n @port = server[:port]\n\n @requests = {}\n @timeout = {}\n @queue = []\n\n @buffer_msg = args[:buffer_msg]\n @interval = args[:interval] || Constants::DefaultParams::Interval\n @timeout_value = args[:timeout] || Constants::DefaultParams::Timeout\n\n @connected = false\n @closed = false\n\n @args = args\n end",
"def initialize(config)\n super\n @connection = Faraday.new(url: (config['rest']).to_s) do |builder|\n builder.response :json\n builder.response :logger if config['debug']\n builder.adapter(@adapter)\n unless config['verify_ssl'].nil?\n builder.ssl[:verify] = config['verify_ssl']\n end\n end\n @ping_set = false\n @rest = (config['rest']).to_s\n @ws_url = (config['websocket']).to_s\n end",
"def initialize(mysql_client, limit_tables)\n @mysql_client = mysql_client\n @limit_tables = limit_tables\n end",
"def initialize\n self.relays = Hash.new\n self.rfds = Array.new\n self.rev_chans = Array.new\n self.relay_thread = nil\n self.relay_mutex = Mutex.new\n end",
"def initialize(type, limit = 4096)\n @type = type\n @table = (type == :request) ? REQ_DEFAULTS.dup : RESP_DEFAULTS.dup\n @limit = limit\n @refset = []\n end",
"def create_throttler(name, request_allowed, time_window, &block)\n throttlers[name] = Throttler.new(name, request_allowed, time_window, &block)\n end",
"def initialize(request_info, connection = nil)\n @request_info = request_info\n @connection = connection\n @finished_read = false\n end",
"def initialize(buffer_size)\n super()\n @buffer_size = buffer_size\n end",
"def initialize(type, limit = 4096)\n @type = type\n @table = (type == :request) ? REQ_DEFAULTS.dup : RESP_DEFAULTS.dup\n @limit = limit\n @workset = []\n end",
"def initialize\n super\n\n # defaults:\n self.foreground = false\n self.push_poll = 2\n self.feedback_poll = 60\n self.airbrake_notify = true\n self.check_for_errors = true\n self.batch_size = 5000\n self.queue = nil\n end",
"def initialize(bandwidth: 1.0, max_iter: 500, tol: 1e-4)\n super()\n @params = {\n bandwidth: bandwidth,\n max_iter: max_iter,\n tol: tol\n }\n end",
"def initialize(conn_spec)\n @conn_spec = conn_spec\n end"
] | [
"0.7316389",
"0.63279444",
"0.61783844",
"0.60958725",
"0.5965339",
"0.5951048",
"0.59050643",
"0.58712894",
"0.5819138",
"0.5725264",
"0.57148325",
"0.5713244",
"0.5704391",
"0.56653994",
"0.56653994",
"0.5664847",
"0.56647635",
"0.5661572",
"0.5646782",
"0.56369966",
"0.56369966",
"0.56266445",
"0.56185687",
"0.5615771",
"0.56068164",
"0.5602179",
"0.560182",
"0.5560327",
"0.5526254",
"0.55196583",
"0.5498072",
"0.54973054",
"0.5494939",
"0.54940337",
"0.5484723",
"0.54819983",
"0.5468402",
"0.54670423",
"0.5464529",
"0.54605806",
"0.5459799",
"0.5456565",
"0.5455308",
"0.54544365",
"0.54493797",
"0.54456973",
"0.54347324",
"0.54346234",
"0.54316354",
"0.54283565",
"0.54188734",
"0.5416017",
"0.54144305",
"0.5411268",
"0.5405629",
"0.54035974",
"0.5399531",
"0.5397746",
"0.53956485",
"0.5382025",
"0.5381163",
"0.53735983",
"0.5358422",
"0.5356619",
"0.5350777",
"0.53410923",
"0.5340888",
"0.53389454",
"0.53350914",
"0.53232485",
"0.5319616",
"0.5312089",
"0.531125",
"0.53110397",
"0.5307461",
"0.53011",
"0.5297236",
"0.5290385",
"0.52854675",
"0.5283176",
"0.5279525",
"0.5277169",
"0.52761614",
"0.5274017",
"0.5260032",
"0.5253105",
"0.5251706",
"0.5249982",
"0.5244328",
"0.5242975",
"0.52301365",
"0.5228546",
"0.5228263",
"0.5227935",
"0.52278876",
"0.5224463",
"0.52219045",
"0.52214354",
"0.52188516",
"0.52180547"
] | 0.61185896 | 3 |
Returns true if the health monitor is defined and has data, returns false if not. | def enabled?
@enabled
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitoring?\n if Agent.config[:monitor_mode]\n true\n else\n ::NewRelic::Agent.logger.warn('Agent configured not to send data in this environment.')\n false\n end\n end",
"def healthy?\n @healthy\n end",
"def datadog_monitors?\n all_datadog_monitor_queries.any?\n end",
"def healthy?\n !unhealthy?\n end",
"def data_available?\n true\n end",
"def healthy?\n return true\n end",
"def is_alive\n @health > 0\n end",
"def is_alive\n @health > 0\n end",
"def healthy?\n %w(run sleep).include?(@transmitter.status)\n end",
"def unhealthy?\n @health.value <= 0\n end",
"def valid?\n return false if !@monitor_priority.nil? && @monitor_priority > 5\n return false if !@monitor_priority.nil? && @monitor_priority < 1\n return false if !@tick_every.nil? && @tick_every > 604800\n return false if !@tick_every.nil? && @tick_every < 30\n true\n end",
"def healthy?()\n raw && raw.is_a?(Hash) && (raw_tweet.nil? || raw_tweet.is_a?(Hash))\n end",
"def data?\n dis_data.any?\n end",
"def monitor?\n ENV['monitor'] || ($MONITOR ||= false)\n end",
"def alive?\n\t\t\[email protected]? || @battery > 0\n\t\tend",
"def is_alive?\n if @health > 0\n return true\n else\n return false\n end\n\n end",
"def can_health_check?\n return false if @service_type == 'worker'\n\n true\n end",
"def has_stats\r\n @stats != nil and @stats.length > 0\r\n end",
"def contains_data?\n return false if cells.empty?\n return false if code.nil? || code.empty?\n return false if name.nil? || name.empty?\n\n true\n end",
"def alive?\n cur_health > 0\n end",
"def mon_owned?\n (defined?(@mon_data) ? @mon_data : use_monitor_core).owned?\n end",
"def has_analysis_data?\n sql = \"select count(*) as c from `#{@@analysis_db}`.`#{self.analysis_table_name} - raw`\"\n results = @@client.exec_query(sql)\n return results.present? && results.first['c'] > 0\n end",
"def is_healthy?\n if @real_socket == nil\n logger.debug \"Performing health check for #{self}\"\n begin\n request = Packet.pack_request(\"echo_req\", \"ping\")\n response = send_request(request, 3)\n logger.debug \"Health check response for #{self} is #{response.inspect}\"\n raise ProtocolError unless response[0] == :echo_res and response[1] == \"ping\"\n return true\n rescue NetworkError\n logger.debug \"NetworkError -- unhealthy\"\n return false\n rescue ProtocolError\n logger.debug \"ProtocolError -- unhealthy\"\n return false\n end\n end\n end",
"def public_health?\n has_role?(:public_health)\n end",
"def data?\n self.runner.parameters[:data] || false\n end",
"def metrics?\n public? && @metrics\n end",
"def data_set_exists?\n !BasicInterfaceRegister[@data_lib][@data_set_name].nil?\n end",
"def metadata?\n check_assignment_or_regexp(:metadata, /^\\s*(CLOCK|DEADLINE|START|CLOSED|SCHEDULED):/)\n end",
"def relevant_data?\n @relevant_data\n end",
"def check\n megamgw_health\n #megamceph_health\n overall\n end",
"def metrics?\n @metrics\n end",
"def data_exist?\n\t\tFile.exist? self.data_path\n\tend",
"def host_is_okay\n return false unless @report_data[:host]\n return false unless valid_ip(@report_data[:host])\n return false unless @report_data[:state] == Msf::HostState::Alive\n if @args[:blacklist]\n return false if @args[:blacklist].include?(@report_data[:host])\n end\n return true\n end",
"def data_exist?\n\t\tlocal? || File.exist?(self.data_path)\n\tend",
"def has_check?\n @metadata.has_key?(:has_check) && @metadata[:has_check]\n end",
"def has_check?\n @metadata.has_key?(:has_check) && @metadata[:has_check]\n end",
"def exists?\n !data.empty?\n end",
"def might_have_data?\n @state.to_s =~ /finished|aborted|running/\n end",
"def container_is_healthy?\n if @container.json['State']['Health']\n @container.json['State']['Health']['Status'] == 'healthy'\n else\n @container.json['State']['Status'] == 'running'\n end\n end",
"def occupied_from_sensors\n sensors = sensors_at Time.current\n return true if sensors[:pirxl] && sensors[:pirxl] > 0\n return true if sensors[:motion] && sensors[:motion] > 0\n return true if sensors[:micpower] && sensors[:micpower] > -17.666\n return true if sensors[:opticalflow] && sensors[:opticalflow] > 2\n false\n end",
"def mon_locked?\n (defined?(@mon_data) ? @mon_data : use_monitor_core).locked?\n end",
"def has_data?\n !!self.last_successful_backup_at\n\n # member.activity_stream.items.any? ||\n # BackupJob.find(self.last_backup_job_id).backup_source_jobs.map(&:backup_source).any? do |bs|\n # bs.num_items > 0\n # end\n # rescue \n # false\n # end\n end",
"def exists?\n @property_hash and [:running, :pending].include?(@property_hash[:ensure])\n end",
"def health_status\n data.health_status\n end",
"def full?\r\n buf = [0].pack('L') # dwFull\r\n needed = [0].pack('L')\r\n \r\n unless GetEventLogInformation(@handle, 0, buf, buf.size, needed)\r\n raise 'GetEventLogInformation() failed: ' + get_last_error\r\n end\r\n\r\n buf[0,4].unpack('L').first != 0\r\n end",
"def metric?\n @metric\n end",
"def healthy?()\n\t\tif(calories < 200)\n\t\t\treturn TRUE\n\t\tend\n\tend",
"def healthy?\n return false if status <= 199 || status >= 400\n\n true\n end",
"def metadata?\n [email protected]? && [email protected]?\n end",
"def exists?\n data != {}\n end",
"def has_been_read?\n @data_read\n end",
"def healthy?\n return false if status <= 199 || status >= 400\n true\n end",
"def healthy?\n items && items.is_a?(Array)\n end",
"def has_data?\n @has_data ||= relation.count() > 0\n end",
"def alive?\n @hp > 0\n end",
"def healthy?() raw && raw.is_a?(Hash) end",
"def attached?\n\t\tCommon.device_status(@handle);\n end",
"def has_responsable?\n dreport.has_responsable?\n end",
"def empty?\n #Check whether any hazard exist\n if !hazardRoom\n return true\n end\n return false \n end",
"def periodic_metrics_enabled?\n periodic_metrics_enabled\n end",
"def health\n if new?\n # No health status for new Upstreams\n nil\n else\n health_json = api_client.get(\"#{relative_uri}/health\")\n health_json['data']\n end\n end",
"def loaded?\n !!@data\n end",
"def dpms_screen_is_on?\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n result = `xset -q 2>&1`\n rescue Errno::ENOENT\n return :unknown\n end\n if ($?.exitstatus != 0)\n return :unknown\n end\n if result.include? \"Monitor is On\"\n return true\n elsif result.include? \"Monitor is Off\"\n return false\n else\n return :unknown\n end\n end",
"def loaded?\n !! @data\n end",
"def loaded?\n !! @data\n end",
"def hearing_updated?\n hearing_updates.each_value do |value|\n return true unless [nil, {}, []].include?(value)\n end\n false\n end",
"def check\n request = Grpc::Health::V1::HealthCheckRequest.new\n response = GitalyClient.call(@storage, :health_check, :check, request, timeout: GitalyClient.fast_timeout)\n\n { success: response&.status == :SERVING }\n rescue GRPC::BadStatus => e\n { success: false, message: e.to_s }\n end",
"def exists?\n get_lxd_config_value(resource[:config]) != nil\n end",
"def loaded?\n @data\n end",
"def loaded?\n @data\n end",
"def vacols_hearing_exists?\n begin\n self.class.repository.load_vacols_data(self)\n true\n rescue Caseflow::Error::VacolsRecordNotFound => error\n capture_exception(error)\n false\n end\n end",
"def has_data?(path)\n @local_data.has_key?(path.to_s)\n end",
"def is_reported?\n (report_count > 0)\n end",
"def has_stats?\n !@short_name.nil?\n end",
"def heartbeat_running?\n redis.get(heartbeat_key) == \"running\"\n end",
"def mon_owned?\n @mon_data.mon_owned?\n end",
"def initialized?\n [email protected]?\n end",
"def given?\n return true unless @data.nil? || @data.empty?\n\n false\n end",
"def host_agent_ready?\n # Localhost\n uri = URI.parse(\"http://#{LOCALHOST}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = LOCALHOST\n return true\n end\n\n return false unless @is_linux\n\n # We are potentially running on Docker in bridged networking mode.\n # Attempt to contact default gateway\n uri = URI.parse(\"http://#{@default_gateway}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = @default_gateway\n return true\n end\n false\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return false\n end",
"def status?\n return data.atk_class == 3\n end",
"def contains?(monitor_instance_id)\n @monitors.key?(monitor_instance_id)\n end",
"def informational?\n @status.between?(100, 199) if @status\n end",
"def exists?()\n\t\t\treturn @metadata.exists?\n\t\tend",
"def values_stored?\n sheetcells.exists?(status_id: [2, 3, 4])\n end",
"def isAlive()\n if @hp > 0\n return true\n else\n return false\n end\n end",
"def status_getdata?()\n return true if (@status == TAC_PLUS_AUTHEN_STATUS_GETDATA)\n return false\n end",
"def vacols_hearing_exists?\n begin\n self.class.repository.load_vacols_data(self)\n true\n rescue Caseflow::Error::VacolsRecordNotFound => error\n Raven.capture_exception(error)\n false\n end\n end",
"def monitoring\n data[:monitoring]\n end",
"def online?\n @data[:online]\n end",
"def needed?\n [email protected]? || out_of_date?(timestamp)\n end",
"def public_health_enroller?\n has_role?(:public_health_enroller)\n end",
"def can_view_public_health_dashboard?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end",
"def evaluate_target_health\n false\n end",
"def inside_operating_window?\n CmeFixListener::AvailabilityManager.new(current_time).available?\n end",
"def is_service_healthy?(service_setup_data)\n output = ''\n return true if service_setup_data['deployment']['healthcheck']['perform'] != true\n\n begin\n notify \"healthcheck with #{service_setup_data['deployment']['healthcheck']['command']}\"\n output = run_ssh_command(\"cd /home/bz-app/#{@repository} && #{service_setup_data['deployment']['healthcheck']['command']}\")\n return true, output if output.include? service_setup_data['deployment']['healthcheck']['result']\n rescue StandardError => details\n notify(details)\n return false, output\n end\n [false, output]\n end",
"def status?\n # Is the VNC port open?\n unless system(\"nc -z localhost 5900 > /dev/null\")\n info(\"VNC port not open...\")\n return false\n end\n # Is at least one of the trigger files present?\n components = ['/Library/Preferences/com.apple.RemoteManagement.launchd', '/private/etc/RemoteManagement.launchd']\n components.each do |component|\n\t components.delete(component) if not File.exist?(component)\n end\n return false if components.empty?\n # Is the ARDAgent running?\n # This appears to be the only consistently active process on Leo, Snowy, and Lion.\n unless system(\"ps axc | grep ARDAgent > /dev/null\")\n info(\"ARD agent not running...\")\n return false\n end\n true\n end",
"def valid?\n return false if @monitor_tags.nil?\n return false if @monitor_tags.length < 1\n true\n end",
"def http_metrics?\n http_metrics\n end",
"def is_data_golden\n report.is_data_golden\n end",
"def occupied?\n not @unit.nil?\n end",
"def informational?\n severity == 0\n end"
] | [
"0.666299",
"0.6502841",
"0.6386893",
"0.6342271",
"0.6327593",
"0.6315199",
"0.62654036",
"0.62654036",
"0.6232689",
"0.62026983",
"0.6196804",
"0.6188114",
"0.6174651",
"0.6159554",
"0.6155269",
"0.613572",
"0.6084604",
"0.60260946",
"0.6000993",
"0.5974146",
"0.5973497",
"0.5972336",
"0.5968055",
"0.5958646",
"0.5948543",
"0.5933137",
"0.59321356",
"0.5917203",
"0.5903701",
"0.5891492",
"0.5886532",
"0.5853957",
"0.585354",
"0.5835072",
"0.5824935",
"0.5824935",
"0.5823581",
"0.5790319",
"0.5756563",
"0.57351124",
"0.5734807",
"0.5731339",
"0.5719472",
"0.57083845",
"0.570235",
"0.5701587",
"0.56999904",
"0.5695337",
"0.5678132",
"0.56743515",
"0.56634474",
"0.566296",
"0.5634894",
"0.5633153",
"0.5627032",
"0.5610526",
"0.5609284",
"0.5609058",
"0.56072944",
"0.56018794",
"0.5599218",
"0.559804",
"0.5594305",
"0.55920464",
"0.55920464",
"0.55863404",
"0.55818826",
"0.5574476",
"0.55732495",
"0.55732495",
"0.556861",
"0.5557338",
"0.55529654",
"0.55499744",
"0.5545033",
"0.55375314",
"0.55343974",
"0.5524737",
"0.55226815",
"0.5516056",
"0.5515161",
"0.5513376",
"0.55114824",
"0.5507015",
"0.54976827",
"0.5496678",
"0.54872614",
"0.5483645",
"0.54813033",
"0.5478873",
"0.54675",
"0.5464929",
"0.5459746",
"0.5456096",
"0.54546684",
"0.5450133",
"0.5448936",
"0.5448703",
"0.5446558",
"0.5442434",
"0.54403055"
] | 0.0 | -1 |
Updates (or creates) the health monitor with the supplied arguments To create a health monitor for the first time, you must supply all required options. However, to modify an existing monitor, you need only supply the :type and whatever it is that you want to change. Options include: :type The type of health monitor. Can be CONNECT (simple TCP connections), HTTP, or HTTPS. The HTTP and HTTPS monitors require additional options. required :delay The minimum number of seconds to wait before executing the health monitor. required :timeout Maximum number of seconds to wait for a connection to be established before timing out. required :attempts_before_deactivation Number of permissible monitor failures before removing a node from rotation. required For HTTP and HTTPS monitors, there are additional options. You must supply the :path and either the :status_regex or :body_regex :path The HTTP path that will be used in the sample request. required :status_regex A regular expression that will be used to evaluate the HTTP status code returned in the response :body_regex A regular expression that will be used to evaluate the contents of the body of the response. | def update(options={})
data = Hash.new
data[:type] = options[:type].upcase if options[:type]
data[:delay] = options[:delay] if options[:delay]
data[:timeout] = options[:timeout] if options[:timeout]
data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]
data[:type].upcase! if data[:type]
if ['HTTP','HTTPS'].include?(data[:type])
data[:path] = options[:path] if options[:path]
data['statusRegex'] = options[:status_regex] if options[:status_regex]
data['bodyRegex'] = options[:body_regex] if options[:body_regex]
end
response = @connection.lbreq("PUT",@lbmgmthost,"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor",@lbmgmtport,@lbmgmtscheme,{},data.to_json)
CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)
populate
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_monitor monitor_name, path, up_code, type, interval, timeout\n type = type == 'https-ecv' ? 'HTTPS' : 'HTTP-ECV'\n response = put(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/monitors/#{monitor_name}\",\n {\n :monitor => {\n :name => monitor_name,\n :type => type,\n :send => \"GET #{path}\",\n :rcv => up_code,\n :interval => interval,\n :timeout => timeout,\n :downtime => '12'\n }\n }.to_json)\n raise LBModelException.new \"Expected HTTP 202 but got #{response.code} instead\" unless response.code == 202\n\n parse_jobids response\n end",
"def upsert_monitor(\n mon_name,\n query,\n threshold,\n comparator,\n options = {\n alert_no_data: true,\n mon_type: 'metric alert',\n renotify_interval: 60,\n no_data_timeframe: 20,\n evaluation_delay: nil,\n message: nil\n }\n )\n options[:alert_no_data] = true unless options.key?(:alert_no_data)\n options[:mon_type] = 'metric alert' unless options.key?(:mon_type)\n options[:renotify_interval] = 60 unless options.key?(:renotify_interval)\n options[:no_data_timeframe] = 20 unless options.key?(:no_data_timeframe)\n options[:evaluation_delay] = nil unless options.key?(:evaluation_delay)\n\n msg, esc = generate_messages(mon_name, comparator, options[:mon_type])\n message = if options[:message].nil?\n msg\n else\n options[:message]\n end\n escalation = if options.key?(:escalation_message)\n options[:escalation_message]\n else\n esc\n end\n\n rno = options[:renotify_interval]\n mon_params = params_for_monitor(\n mon_name, message, query, threshold,\n escalation_message: escalation,\n alert_no_data: options[:alert_no_data],\n mon_type: options[:mon_type],\n renotify_interval: rno,\n no_data_timeframe: options[:no_data_timeframe],\n evaluation_delay: options[:evaluation_delay]\n )\n logger.info \"Upserting monitor: #{mon_name}\"\n monitor = get_existing_monitor_by_name(mon_name)\n return create_monitor(mon_name, mon_params) if monitor.nil?\n logger.debug \"\\tfound existing monitor id=#{monitor['id']}\"\n do_update = false\n mon_params.each do |k, _v|\n unless monitor.include?(k)\n logger.debug \"\\tneeds update based on missing key: #{k}\"\n do_update = true\n break\n end\n next unless monitor[k] != mon_params[k]\n logger.debug \"\\tneeds update based on difference in key #{k}; \" \\\n \"current='#{monitor[k]}' desired='#{mon_params[k]}'\"\n do_update = true\n break\n end\n unless do_update\n logger.debug \"\\tmonitor is correct in DataDog.\"\n return monitor['id']\n end\n res = @dog.update_monitor(monitor['id'], mon_params['query'], mon_params)\n if res[0] == '200'\n logger.info \"\\tMonitor #{monitor['id']} updated successfully\"\n return monitor['id']\n else\n logger.error \"\\tError updating monitor #{monitor['id']}: #{res}\"\n end\n end",
"def update!(**args)\n @monitor_interval = args[:monitor_interval] if args.key?(:monitor_interval)\n @monitor_window = args[:monitor_window] if args.key?(:monitor_window)\n end",
"def create_monitor(_mon_name, mon_params)\n res = @dog.monitor(mon_params['type'], mon_params['query'], mon_params)\n if res[0] == '200'\n logger.info \"\\tMonitor #{res[1]['id']} created successfully\"\n return res[1]['id']\n else\n logger.error \"\\tError creating monitor: #{res}\"\n end\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @health_check_allowing_firewall_rules = args[:health_check_allowing_firewall_rules] if args.key?(:health_check_allowing_firewall_rules)\n @health_check_blocking_firewall_rules = args[:health_check_blocking_firewall_rules] if args.key?(:health_check_blocking_firewall_rules)\n @health_check_firewall_state = args[:health_check_firewall_state] if args.key?(:health_check_firewall_state)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def set_health\n @health = Health.find(params[:id])\n end",
"def set_health\n @health = Health.find(params[:id])\n end",
"def params_for_monitor(\n name,\n message,\n query,\n threshold,\n options = {\n escalation_message: nil,\n alert_no_data: true,\n mon_type: 'metric alert',\n renotify_interval: 60,\n no_data_timeframe: 20,\n evaluation_delay: nil\n }\n )\n options[:alert_no_data] = true unless options.key?(:alert_no_data)\n options[:mon_type] = 'metric alert' unless options.key?(:mon_type)\n options[:renotify_interval] = 60 unless options.key?(:renotify_interval)\n options[:no_data_timeframe] = 20 unless options.key?(:no_data_timeframe)\n options[:evaluation_delay] = nil unless options.key?(:evaluation_delay)\n\n # handle threshold hash\n thresh = if threshold.is_a?(Hash)\n threshold\n else\n { 'critical' => threshold }\n end\n\n monitor_data = {\n 'name' => name,\n 'type' => options[:mon_type],\n 'query' => query,\n 'message' => message,\n 'tags' => [],\n 'options' => {\n 'notify_audit' => false,\n 'locked' => false,\n 'timeout_h' => 0,\n 'silenced' => {},\n 'thresholds' => thresh,\n 'require_full_window' => false,\n 'notify_no_data' => options[:alert_no_data],\n 'renotify_interval' => options[:renotify_interval],\n 'no_data_timeframe' => options[:no_data_timeframe]\n }\n }\n unless options[:escalation_message].nil?\n monitor_data['options']['escalation_message'] = \\\n options[:escalation_message]\n end\n unless options[:evaluation_delay].nil?\n monitor_data['options']['evaluation_delay'] = options[:evaluation_delay]\n end\n monitor_data\n end",
"def set_health\n\t @health = Health.find(params[:id])\n\tend",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @disable_monitoring = args[:disable_monitoring] if args.key?(:disable_monitoring)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @monitoring_config = args[:monitoring_config] if args.key?(:monitoring_config)\n @monitoring_stats = args[:monitoring_stats] if args.key?(:monitoring_stats)\n @monitoring_stats_anomalies = args[:monitoring_stats_anomalies] if args.key?(:monitoring_stats_anomalies)\n @name = args[:name] if args.key?(:name)\n @update_time = args[:update_time] if args.key?(:update_time)\n @value_type = args[:value_type] if args.key?(:value_type)\n end",
"def add_check(host, command, args, agent=nil)\n\n host = get_model(host, Host)\n command = get_model(command, Command)\n\n if agent.blank? then\n agent = host.agent\n else\n agent = get_model(agent, Agent)\n end\n\n # create resource name\n # TODO check if command *has* any options - look at defaults, etc\n config = create_spec(command).load_config()\n name = config[\"key\"] || \"\"\n args = nil if args and args.empty?\n if args then\n name += \".\" if not name.empty?\n name += args.values.first\n\n # remove empty args\n args.delete_if{ |k,v| v.nil? or v.empty? }\n end\n\n check = Check.new\n check.host = host\n check.agent = agent\n check.command = command\n check.args = args\n check.normal_interval = 60\n check.retry_interval = 60\n check.plot = true\n check.enabled = true\n check.save!\n\n return check\n end",
"def set_health_status\n @health_status = HealthStatus.find(params[:id])\n end",
"def create\n @health_status = HealthStatus.new(health_status_params)\n\n respond_to do |format|\n if @health_status.save\n format.html { redirect_to @health_status, notice: 'Health status was successfully created.' }\n format.json { render :show, status: :created, location: @health_status }\n else\n format.html { render :new }\n format.json { render json: @health_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @allocated_connections = args[:allocated_connections] if args.key?(:allocated_connections)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @host_type = args[:host_type] if args.key?(:host_type)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def health=(new_health)\n @health = new_health\n end",
"def health=(v) self['Health'] = v end",
"def update!(**args)\n @latency = args[:latency] if args.key?(:latency)\n @num_deadline_exceeded_machines = args[:num_deadline_exceeded_machines] if args.key?(:num_deadline_exceeded_machines)\n @num_ok_machines = args[:num_ok_machines] if args.key?(:num_ok_machines)\n @num_total_machines = args[:num_total_machines] if args.key?(:num_total_machines)\n @num_unreachable_machines = args[:num_unreachable_machines] if args.key?(:num_unreachable_machines)\n @restrict_stats = args[:restrict_stats] if args.key?(:restrict_stats)\n @results = args[:results] if args.key?(:results)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @matched_port_range = args[:matched_port_range] if args.key?(:matched_port_range)\n @matched_protocol = args[:matched_protocol] if args.key?(:matched_protocol)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @target = args[:target] if args.key?(:target)\n @uri = args[:uri] if args.key?(:uri)\n @vip = args[:vip] if args.key?(:vip)\n end",
"def initialize(options={})\n @host = options[:host] or raise ArgumentError, \"#{self.class.name} requires :host\"\n @port = options[:port] or raise ArgumentError, \"#{self.class.name} requires :port\"\n @node_id = options[:node_id]\n @protocol = options[:protocol] || DEFAULT_PROTOCOL\n @logger = options[:logger] || Logger.new($stdout)\n @health = :good\n end",
"def health_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.health ...'\n end\n # resource path\n local_var_path = '/api/v1/health'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#health\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def monitor(*args, &bl)\n result = nil\n took = Benchmark.realtime {\n result = bl.call\n }\n Tools.info(args, op_took: took)\n result\n end",
"def create\n \n # Dynamically add last_updated and health\n @mirror = Mirror.new(mirror_params)\n @mirror.health = true\n\n respond_to do |format|\n if @mirror.save\n format.html { redirect_to @mirror, notice: 'Mirror was successfully created.' }\n format.json { render :show, status: :created, location: @mirror }\n else\n format.html { render :new }\n format.json { render json: @mirror.errors, status: :unprocessable_entity }\n end\n end\n end",
"def describe_health_status(load_balancer_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeHealthStatus'\n\t\targs[:query]['LoadBalancerId'] = load_balancer_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :listener_port\n\t\t\traise ArgumentError, 'listener_port must be equal or greater than 1' unless optional[:listener_port] < 1\n\t\t\traise ArgumentError, 'listener_port must be equal or less than 65535' unless optional[:listener_port] > 65535\n\t\t\targs[:query]['ListenerPort'] = optional[:listener_port]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def activate(options={})\n # either monitorIds or tag is required\n if options.class == Hash\n result = post('activateExternalMonitor', options)\n elsif options.class == Array\n result = post('activateExternalMonitor', monitorIds: options.join(','))\n else\n result = post('activateExternalMonitor', monitorIds: options)\n end\n result\n end",
"def update!(**args)\n @completion_stats = args[:completion_stats] if args.key?(:completion_stats)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_container_logging = args[:disable_container_logging] if args.key?(:disable_container_logging)\n @display_name = args[:display_name] if args.key?(:display_name)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @end_time = args[:end_time] if args.key?(:end_time)\n @error = args[:error] if args.key?(:error)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @generate_explanation = args[:generate_explanation] if args.key?(:generate_explanation)\n @input_config = args[:input_config] if args.key?(:input_config)\n @instance_config = args[:instance_config] if args.key?(:instance_config)\n @labels = args[:labels] if args.key?(:labels)\n @manual_batch_tuning_parameters = args[:manual_batch_tuning_parameters] if args.key?(:manual_batch_tuning_parameters)\n @model = args[:model] if args.key?(:model)\n @model_monitoring_config = args[:model_monitoring_config] if args.key?(:model_monitoring_config)\n @model_monitoring_stats_anomalies = args[:model_monitoring_stats_anomalies] if args.key?(:model_monitoring_stats_anomalies)\n @model_monitoring_status = args[:model_monitoring_status] if args.key?(:model_monitoring_status)\n @model_parameters = args[:model_parameters] if args.key?(:model_parameters)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @name = args[:name] if args.key?(:name)\n @output_config = args[:output_config] if args.key?(:output_config)\n @output_info = args[:output_info] if args.key?(:output_info)\n @partial_failures = args[:partial_failures] if args.key?(:partial_failures)\n @resources_consumed = args[:resources_consumed] if args.key?(:resources_consumed)\n @service_account = args[:service_account] if args.key?(:service_account)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @unmanaged_container_model = args[:unmanaged_container_model] if args.key?(:unmanaged_container_model)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @scale = args[:scale] if args.key?(:scale)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @conditions = args[:conditions] if args.key?(:conditions)\n @container = args[:container] if args.key?(:container)\n @create_time = args[:create_time] if args.key?(:create_time)\n @degraded = args[:degraded] if args.key?(:degraded)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_audit_agent = args[:enable_audit_agent] if args.key?(:enable_audit_agent)\n @encryption_key = args[:encryption_key] if args.key?(:encryption_key)\n @etag = args[:etag] if args.key?(:etag)\n @host = args[:host] if args.key?(:host)\n @idle_timeout = args[:idle_timeout] if args.key?(:idle_timeout)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @persistent_directories = args[:persistent_directories] if args.key?(:persistent_directories)\n @readiness_checks = args[:readiness_checks] if args.key?(:readiness_checks)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @running_timeout = args[:running_timeout] if args.key?(:running_timeout)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @counter = args[:counter] if args.key?(:counter)\n @host = args[:host] if args.key?(:host)\n @num = args[:num] if args.key?(:num)\n end",
"def update!(**args)\n @automated_agent_config = args[:automated_agent_config] if args.key?(:automated_agent_config)\n @display_name = args[:display_name] if args.key?(:display_name)\n @human_agent_assistant_config = args[:human_agent_assistant_config] if args.key?(:human_agent_assistant_config)\n @logging_config = args[:logging_config] if args.key?(:logging_config)\n @name = args[:name] if args.key?(:name)\n @notification_config = args[:notification_config] if args.key?(:notification_config)\n end",
"def monitor(query, set=nil)\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n if set.nil?\n get('actions/monitor', {'query' => query})\n else\n is_valid_with_error(__method__, [:bool], set)\n post('actions/monitor', { 'query' => query, 'status' => set })\n end\n end",
"def update!(**args)\n @elapsed_duration = args[:elapsed_duration] if args.key?(:elapsed_duration)\n @metrics = args[:metrics] if args.key?(:metrics)\n @step_count = args[:step_count] if args.key?(:step_count)\n end",
"def update(name, mon_type, interval, timeout, max_retries,\n method: nil,\n url: nil,\n expect_code: nil,\n port: nil, **opts)\n\n self._set('slb.hm.update', name, mon_type, interval, timeout, max_retries,\n method: method,\n url: url,\n expect_code: expect_code,\n port: port, **opts)\n end",
"def update!(**args)\n @alert_config = args[:alert_config] if args.key?(:alert_config)\n @analysis_instance_schema_uri = args[:analysis_instance_schema_uri] if args.key?(:analysis_instance_schema_uri)\n @objective_configs = args[:objective_configs] if args.key?(:objective_configs)\n @stats_anomalies_base_directory = args[:stats_anomalies_base_directory] if args.key?(:stats_anomalies_base_directory)\n end",
"def health_check_impl(str)\n health_request = SR_HEALTH_CHECK_REQUEST\n if str != nil && str != ''\n health_request += \" #{str}\"\n @health_response = \"#{SR_HEALTH_CHECK_REQUEST}: #{str}\"\n end\n @expected_events << [{source: \"statsd-router\", text: @health_response}]\n EventMachine.connect('127.0.0.1', SR_CONTROL_PORT, HealthClient, self) do |conn|\n conn.send_data(health_request)\n end\n end",
"def update!(**args)\n @authorized_network = args[:authorized_network] if args.key?(:authorized_network)\n @create_time = args[:create_time] if args.key?(:create_time)\n @discovery_endpoint = args[:discovery_endpoint] if args.key?(:discovery_endpoint)\n @display_name = args[:display_name] if args.key?(:display_name)\n @instance_messages = args[:instance_messages] if args.key?(:instance_messages)\n @labels = args[:labels] if args.key?(:labels)\n @memcache_full_version = args[:memcache_full_version] if args.key?(:memcache_full_version)\n @memcache_nodes = args[:memcache_nodes] if args.key?(:memcache_nodes)\n @memcache_version = args[:memcache_version] if args.key?(:memcache_version)\n @name = args[:name] if args.key?(:name)\n @node_config = args[:node_config] if args.key?(:node_config)\n @node_count = args[:node_count] if args.key?(:node_count)\n @parameters = args[:parameters] if args.key?(:parameters)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n @zones = args[:zones] if args.key?(:zones)\n end",
"def set_health1\n @health1 = Health1.find(params[:id])\n end",
"def update!(**args)\n @diagnostics = args[:diagnostics] if args.key?(:diagnostics)\n @fail_condition = args[:fail_condition] if args.key?(:fail_condition)\n @finish_condition = args[:finish_condition] if args.key?(:finish_condition)\n @polling_link = args[:polling_link] if args.key?(:polling_link)\n @target_link = args[:target_link] if args.key?(:target_link)\n end",
"def update!(**args)\n @name = args[:name] unless args[:name].nil?\n @description = args[:description] unless args[:description].nil?\n @initial_node_count = args[:initial_node_count] unless args[:initial_node_count].nil?\n @node_config = args[:node_config] unless args[:node_config].nil?\n @master_auth = args[:master_auth] unless args[:master_auth].nil?\n @logging_service = args[:logging_service] unless args[:logging_service].nil?\n @monitoring_service = args[:monitoring_service] unless args[:monitoring_service].nil?\n @network = args[:network] unless args[:network].nil?\n @cluster_ipv4_cidr = args[:cluster_ipv4_cidr] unless args[:cluster_ipv4_cidr].nil?\n @self_link = args[:self_link] unless args[:self_link].nil?\n @zone = args[:zone] unless args[:zone].nil?\n @endpoint = args[:endpoint] unless args[:endpoint].nil?\n @initial_cluster_version = args[:initial_cluster_version] unless args[:initial_cluster_version].nil?\n @current_master_version = args[:current_master_version] unless args[:current_master_version].nil?\n @current_node_version = args[:current_node_version] unless args[:current_node_version].nil?\n @create_time = args[:create_time] unless args[:create_time].nil?\n @status = args[:status] unless args[:status].nil?\n @status_message = args[:status_message] unless args[:status_message].nil?\n @node_ipv4_cidr_size = args[:node_ipv4_cidr_size] unless args[:node_ipv4_cidr_size].nil?\n @services_ipv4_cidr = args[:services_ipv4_cidr] unless args[:services_ipv4_cidr].nil?\n @instance_group_urls = args[:instance_group_urls] unless args[:instance_group_urls].nil?\n end",
"def health_params\n params.require(:health).permit(:name, :number, :link, :email, :services, :about, :address, :latitude, :longitude, :accepted_documents, :status, images:[])\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @hyperthreading_enabled = args[:hyperthreading_enabled] if args.key?(:hyperthreading_enabled)\n @interactive_serial_console_enabled = args[:interactive_serial_console_enabled] if args.key?(:interactive_serial_console_enabled)\n @labels = args[:labels] if args.key?(:labels)\n @luns = args[:luns] if args.key?(:luns)\n @machine_type = args[:machine_type] if args.key?(:machine_type)\n @name = args[:name] if args.key?(:name)\n @networks = args[:networks] if args.key?(:networks)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @anomaly_detection_threshold = args[:anomaly_detection_threshold] if args.key?(:anomaly_detection_threshold)\n @anomaly_uri = args[:anomaly_uri] if args.key?(:anomaly_uri)\n @distribution_deviation = args[:distribution_deviation] if args.key?(:distribution_deviation)\n @end_time = args[:end_time] if args.key?(:end_time)\n @score = args[:score] if args.key?(:score)\n @start_time = args[:start_time] if args.key?(:start_time)\n @stats_uri = args[:stats_uri] if args.key?(:stats_uri)\n end",
"def set_health_record\n @health_record = HealthRecord.find(params[:id])\n end",
"def set_health_record\n @health_record = HealthRecord.find(params[:id])\n end",
"def update!(**args)\n @challenge_metrics = args[:challenge_metrics] if args.key?(:challenge_metrics)\n @name = args[:name] if args.key?(:name)\n @score_metrics = args[:score_metrics] if args.key?(:score_metrics)\n @start_time = args[:start_time] if args.key?(:start_time)\n end",
"def monitor=(new_monitor)\n if persisted?\n case new_monitor\n when true\n response = service.monitor_instances(identity)\n when false\n response = service.unmonitor_instances(identity)\n else\n raise ArgumentError.new(\"only Boolean allowed here\")\n end\n end\n self.monitoring = new_monitor\n end",
"def update!(**args)\n @base_height_meters_agl = args[:base_height_meters_agl] if args.key?(:base_height_meters_agl)\n @default_display_level = args[:default_display_level] if args.key?(:default_display_level)\n @floors = args[:floors] if args.key?(:floors)\n @floors_metadata = args[:floors_metadata] if args.key?(:floors_metadata)\n @height_meters = args[:height_meters] if args.key?(:height_meters)\n @height_meters_metadata = args[:height_meters_metadata] if args.key?(:height_meters_metadata)\n @level = args[:level] if args.key?(:level)\n @structure = args[:structure] if args.key?(:structure)\n end",
"def create_healthcheck(app_name,\n stack_name,\n fqdn: nil,\n ip_address: nil,\n port: 80,\n type: 'HTTP',\n resource_path: '/',\n request_interval: 30,\n failure_threshold: 3,\n tags: [])\n unless HEALTH_CHECK_TYPE.include?(type)\n fail(\"Route53 healthcheck type can only be one of the following: #{HEALTH_CHECK_TYPE.join(',')}\")\n end\n fail('Route53 healthcheck requires either fqdn or ip address') unless fqdn || ip_address\n\n properties = {\n HealthCheckConfig: {\n IPAddress: ip_address,\n FullyQualifiedDomainName: fqdn,\n Port: port,\n Type: type,\n ResourcePath: resource_path,\n RequestInterval: request_interval,\n FailureThreshold: failure_threshold\n }\n }\n\n properties[:HealthCheckTags] = [\n {\n Key: 'Application',\n Value: app_name\n },\n {\n Key: 'Stack',\n Value: stack_name\n }\n ]\n\n properties[:HealthCheckTags].concat(tags) unless tags.blank?\n\n resource \"#{app_name}Healthcheck\",\n Type: 'AWS::Route53::HealthCheck',\n Properties: properties\n end",
"def update!(**args)\n @host = args[:host] if args.key?(:host)\n @port = args[:port] if args.key?(:port)\n end",
"def health(opts = {})\n data, _status_code, _headers = health_with_http_info(opts)\n data\n end",
"def update!(**args)\n @bot_overhead_ms = args[:bot_overhead_ms] if args.key?(:bot_overhead_ms)\n @client_controlflow_stats = args[:client_controlflow_stats] if args.key?(:client_controlflow_stats)\n @connect_time_ms = args[:connect_time_ms] if args.key?(:connect_time_ms)\n @controlflow_stats = args[:controlflow_stats] if args.key?(:controlflow_stats)\n @down_load_time = args[:down_load_time] if args.key?(:down_load_time)\n @edge_egress_overhead_ms = args[:edge_egress_overhead_ms] if args.key?(:edge_egress_overhead_ms)\n @ssl_connect_time_ms = args[:ssl_connect_time_ms] if args.key?(:ssl_connect_time_ms)\n @server_response_time_ms = args[:server_response_time_ms] if args.key?(:server_response_time_ms)\n @transfer_time_ms = args[:transfer_time_ms] if args.key?(:transfer_time_ms)\n end",
"def create\n @class_monitor = ClassMonitor.new(class_monitor_params)\n\n respond_to do |format|\n if @class_monitor.save\n format.html { redirect_to @class_monitor, notice: 'Monitor de Sala criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @class_monitor }\n else\n format.html { render action: 'new' }\n format.json { render json: @class_monitor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @hosts = args[:hosts] if args.key?(:hosts)\n @http_header_match = args[:http_header_match] if args.key?(:http_header_match)\n @methods_prop = args[:methods_prop] if args.key?(:methods_prop)\n @ports = args[:ports] if args.key?(:ports)\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def to_http_health_params\n {\n port: http_health_port,\n path: http_health_path\n }\n end",
"def update!(**args)\n @args = args[:args] if args.key?(:args)\n @command = args[:command] if args.key?(:command)\n @env = args[:env] if args.key?(:env)\n @health_route = args[:health_route] if args.key?(:health_route)\n @image_uri = args[:image_uri] if args.key?(:image_uri)\n @ports = args[:ports] if args.key?(:ports)\n @predict_route = args[:predict_route] if args.key?(:predict_route)\n end",
"def status(options={})\n # get a snap shot of the jenkins here as we dont want it to change while we are working things out\n jenkins_status = @jenkins_monitor.status.current\n # set the light color, if we dont have a color for the status then turn the light off\n @light_controller.send(STATUS_LIGHT_MAPPING[jenkins_status] || \"do_nothing\")\n # set the blink interval\n @light_controller.blink_interval = current_blink_interval\n # make it blink if jenkins is building or broken, or there is a pull request pending\n @light_controller.blink_please = (jenkins_status == \"building\" || jenkins_status == \"broken\") || (jenkins_status == \"stable\" && @github_monitor.pull_requests?)\n # do nothing for 10 miliseconds\n # if we dont do this, the the software will grap all the cpu capacity it can get\n # just to go round in a loop which mostly does nothing.\n sleep 0.01\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @kind = args[:kind] if args.key?(:kind)\n @resource = args[:resource] if args.key?(:resource)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @resource = args[:resource] unless args[:resource].nil?\n @status = args[:status] unless args[:status].nil?\n @time_nanos = args[:time_nanos] unless args[:time_nanos].nil?\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @error = args[:error] if args.key?(:error)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @reserved_ip_ranges = args[:reserved_ip_ranges] if args.key?(:reserved_ip_ranges)\n @resource_pools = args[:resource_pools] if args.key?(:resource_pools)\n @resource_runtime = args[:resource_runtime] if args.key?(:resource_runtime)\n @resource_runtime_spec = args[:resource_runtime_spec] if args.key?(:resource_runtime_spec)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def create\n respond_to do |format|\n if @health_level.save\n format.html { redirect_to @health_level, notice: 'Health level was successfully created.' }\n format.json { render json: @health_level, status: :created, location: @health_level }\n else\n format.html { render action: \"new\" }\n format.json { render json: @health_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @call_ending_soon_warning_time = args[:call_ending_soon_warning_time] if args.key?(:call_ending_soon_warning_time)\n @call_ending_time = args[:call_ending_time] if args.key?(:call_ending_time)\n @show_upgrade_promos = args[:show_upgrade_promos] if args.key?(:show_upgrade_promos)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @monitoring_config = args[:monitoring_config] if args.key?(:monitoring_config)\n @name = args[:name] if args.key?(:name)\n @offline_storage_ttl_days = args[:offline_storage_ttl_days] if args.key?(:offline_storage_ttl_days)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @control_plane_disconnected = args[:control_plane_disconnected] if args.key?(:control_plane_disconnected)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @progress = args[:progress] if args.key?(:progress)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @type = args[:type] if args.key?(:type)\n @verb = args[:verb] if args.key?(:verb)\n end",
"def setup_monitor(name, info, exclude: [])\n exclude = exclude.map(&:to_s)\n\n kwargs = {}\n kwargs[:\"--rotate\"] = \"normal\"\n kwargs[:\"--#{info[:position]}-of\"] = $config[:internal_monitor_name] if info[:position]\n kwargs[:\"--mode\"] = info[:mode]\n if info[:scale]\n x, y = info[:mode].split(\"x\").map{ |d| d.to_i }\n kwargs[:\"--scale\"] = \"#{info[:scale]}x#{info[:scale]}\"\n scaled_x = (x * info[:scale]).truncate\n scaled_y = (y * info[:scale]).truncate\n kwargs[:\"--panning\"] = \"#{scaled_x}x#{scaled_y}\"\n end\n\n kwargs.reject! { |k, v| exclude.include? k.to_s }\n\n if kwargs.empty?\n \"skipping monitor #{name.as_tok} setup\".pwrn\n else\n xrandr(name, **kwargs)\n end\nend",
"def update!(**args)\n @metric = args[:metric] if args.key?(:metric)\n @options = args[:options] if args.key?(:options)\n end",
"def update!(**args)\n @metric = args[:metric] if args.key?(:metric)\n @options = args[:options] if args.key?(:options)\n end",
"def update!(**args)\n @hostname = args[:hostname] if args.key?(:hostname)\n @ip = args[:ip] if args.key?(:ip)\n end",
"def set_monitor_rule(params)\n pool_name = get_param(params, :pool)\n node_ip = get_ip(params)\n node_port = (params[:port] || 80).to_i\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would set monitor rule for node #{node_ip}:#{node_port} in pool #{pool_name} on load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n else\n notify(:msg => \"[#{@name}] Setting monitor rule for node #{node_ip}:#{node_port} in pool #{pool_name} on load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n if params.has_key?(:monitor_rule)\n ip_port = { 'address' => node_ip,\n 'port' => node_port }\n monitor_ip_port = { 'address_type' => 'ATYPE_EXPLICIT_ADDRESS_EXPLICIT_PORT',\n 'ipport' => ip_port }\n monitor_rule = { 'type' => params[:monitor_rule][:type] || 'MONITOR_RULE_TYPE_SINGLE',\n 'quorum' => params[:monitor_rule][:quorum] || 0,\n 'monitor_templates' => params[:monitor_rule][:templates] || [] }\n monitor_associations = [{ 'member' => monitor_ip_port,\n 'monitor_rule' => monitor_rule }]\n else\n monitor_associations = []\n end\n with_f5('LocalLB.PoolMember') do\n set_monitor_association([ pool_name ], [ monitor_associations ])\n end\n end\n get_member(params)\n end",
"def update!(**args)\n @emergency_level = args[:emergency_level] if args.key?(:emergency_level)\n end",
"def initialize(*args)\n [:name, :color, :monitor].zip(args).each {|pair| store(*pair) }\n end",
"def add_or_update(monitor)\n @monitors[monitor.monitor_instance_id] = monitor\n end",
"def update!(**args)\n @hours = args[:hours] if args.key?(:hours)\n @metadata = args[:metadata] if args.key?(:metadata)\n @range = args[:range] if args.key?(:range)\n end",
"def update!(**args)\n @alarm = args[:alarm] if args.key?(:alarm)\n @response_limits = args[:response_limits] if args.key?(:response_limits)\n @support_sdk_execute = args[:support_sdk_execute] if args.key?(:support_sdk_execute)\n @supported_device_ops = args[:supported_device_ops] if args.key?(:supported_device_ops)\n @supports_multi_response = args[:supports_multi_response] if args.key?(:supports_multi_response)\n @timer = args[:timer] if args.key?(:timer)\n @tts_output = args[:tts_output] if args.key?(:tts_output)\n end",
"def prometheus_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdminApi.prometheus ...'\n end\n # resource path\n local_var_path = '/metrics/prometheus'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"AdminApi.prometheus\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AdminApi#prometheus\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @agent_info = args[:agent_info] if args.key?(:agent_info)\n @agent_timing_info = args[:agent_timing_info] if args.key?(:agent_timing_info)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @run_time = args[:run_time] if args.key?(:run_time)\n @status = args[:status] if args.key?(:status)\n end",
"def update\n respond_to do |format|\n if @health.update(health_params)\n format.html { redirect_to @health, notice: 'Health was successfully updated.' }\n format.json { render :show, status: :ok, location: @health }\n else\n format.html { render :edit }\n format.json { render json: @health.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @blue = args[:blue] if args.key?(:blue)\n @green = args[:green] if args.key?(:green)\n @max_luminance = args[:max_luminance] if args.key?(:max_luminance)\n @min_luminance = args[:min_luminance] if args.key?(:min_luminance)\n @red = args[:red] if args.key?(:red)\n @white_point = args[:white_point] if args.key?(:white_point)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @discovery_spec = args[:discovery_spec] if args.key?(:discovery_spec)\n @discovery_status = args[:discovery_status] if args.key?(:discovery_status)\n @display_name = args[:display_name] if args.key?(:display_name)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @resource_spec = args[:resource_spec] if args.key?(:resource_spec)\n @resource_status = args[:resource_status] if args.key?(:resource_status)\n @security_status = args[:security_status] if args.key?(:security_status)\n @state = args[:state] if args.key?(:state)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @end_time = args[:end_time] if args.key?(:end_time)\n @error = args[:error] if args.key?(:error)\n @labels = args[:labels] if args.key?(:labels)\n @max_failed_trial_count = args[:max_failed_trial_count] if args.key?(:max_failed_trial_count)\n @max_trial_count = args[:max_trial_count] if args.key?(:max_trial_count)\n @name = args[:name] if args.key?(:name)\n @parallel_trial_count = args[:parallel_trial_count] if args.key?(:parallel_trial_count)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @study_spec = args[:study_spec] if args.key?(:study_spec)\n @trial_job_spec = args[:trial_job_spec] if args.key?(:trial_job_spec)\n @trials = args[:trials] if args.key?(:trials)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def create_uptime_check_config project_id: nil, host_name: nil, display_name: nil\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n project_name = client.project_path project: project_id\n config = {\n display_name: display_name.nil? ? \"New uptime check\" : display_name,\n monitored_resource: {\n type: \"uptime_url\",\n labels: { \"host\" => host_name.nil? ? \"example.com\" : host_name }\n },\n http_check: { path: \"/\", port: 80 },\n timeout: { seconds: 10 },\n period: { seconds: 300 }\n }\n new_config = client.create_uptime_check_config \\\n parent: project_name,\n uptime_check_config: config\n puts new_config.name\n new_config\nend",
"def update!(**args)\n @metric_type = args[:metric_type] if args.key?(:metric_type)\n @value_type = args[:value_type] if args.key?(:value_type)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @dry_run = args[:dry_run] if args.key?(:dry_run)\n @duration = args[:duration] if args.key?(:duration)\n @error_message = args[:error_message] if args.key?(:error_message)\n @instance_details_summary = args[:instance_details_summary] if args.key?(:instance_details_summary)\n @instance_filter = args[:instance_filter] if args.key?(:instance_filter)\n @name = args[:name] if args.key?(:name)\n @patch_config = args[:patch_config] if args.key?(:patch_config)\n @patch_deployment = args[:patch_deployment] if args.key?(:patch_deployment)\n @percent_complete = args[:percent_complete] if args.key?(:percent_complete)\n @rollout = args[:rollout] if args.key?(:rollout)\n @state = args[:state] if args.key?(:state)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def health_check_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: HealthCheckApi.health_check ...\"\n end\n # resource path\n local_var_path = \"/healthy\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HealthCheckApi#health_check\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(options, monitoring, cluster)\n @options = options\n @monitoring = monitoring\n @cluster = cluster\n end",
"def set_opts(opts)\n opts.banner = <<END\nUsage: bro [options] [command] [date_string]\n\nCommand is one of the following:\n\n start - starts the monitor process in the background\n stop - stops the monitor process\n status - prints the status of the monitor process\n restart - restarts the monitor process (forces re-reading of config file)\n report - prints out time tracking reports\n \ndate_string is an optional argument for the report command and can be a \nqualified date string, 'today', 'yesterday' or a number representing an\noffset from today's date.\n\neg. 'bro report 2' would print the report for all projects from two days ago.\n\nIf date_string can't be parsed, reporter will default to today's date.\n\nOptions are as follows:\nEND\n\n @options[:config_file] = \"#{ENV[\"HOME\"]}/.babybrorc\"\n @options[:tron] = false\n opts.on('-c', '--config FILE', \"Use this config file. default is #{@options[:config_file]}\") do |config_file|\n @options[:config_file] = config_file\n end\n\n opts.on('-t', '--tron', :NONE, 'Trace on. Show debug output and a full stack trace on error.') do\n @options[:tron] = true\n end\n\n opts.on('-f', '--force', :NONE, 'Force starting of monitor when PID file is stale.') do\n @options[:force_start] = true\n end\n\n opts.on('-b', '--brief', :NONE, \"Ignore inactive projects and display daily totals without individual sessions.\") do\n @options[:brief] = true\n end\n\n opts.on_tail(\"-?\", \"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n opts.on_tail(\"-v\", \"--version\", \"Print version\") do\n puts(\"BabyBro v#{::BabyBro.version}\")\n exit\n end\n end",
"def update!(**args)\n @compliance_regime = args[:compliance_regime] if args.key?(:compliance_regime)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n end",
"def create_snmp_service_action_restart_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.create_snmp_service_action_restart ...\"\n end\n # resource path\n local_var_path = \"/node/services/snmp?action=restart\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeServiceStatusProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#create_snmp_service_action_restart\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @end_time = args[:end_time] if args.key?(:end_time)\n @metrics = args[:metrics] if args.key?(:metrics)\n @stage = args[:stage] if args.key?(:stage)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @machine_drain_status = args[:machine_drain_status] if args.key?(:machine_drain_status)\n end",
"def update!(**args)\n @machine_drain_status = args[:machine_drain_status] if args.key?(:machine_drain_status)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @metrics = args[:metrics] if args.key?(:metrics)\n @metrics_schema_uri = args[:metrics_schema_uri] if args.key?(:metrics_schema_uri)\n @model_explanation = args[:model_explanation] if args.key?(:model_explanation)\n @name = args[:name] if args.key?(:name)\n @slice = args[:slice] if args.key?(:slice)\n end",
"def update!(**args)\n @threshold = args[:threshold] if args.key?(:threshold)\n @value = args[:value] if args.key?(:value)\n end",
"def host( *args )\n props = args.last.is_a?( Hash ) && args.pop || {}\n name = args.first.is_a?( String ) && args.shift\n props = props.merge( name: name ) if name\n raise \"Missing required name parameter\" unless props[ :name ]\n host = @hosts[ props[ :name ] ] ||= Host.new( self )\n host.merge_props( props )\n host.add( *args )\n host\n end",
"def create_snmp_service_action_start_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.create_snmp_service_action_start ...\"\n end\n # resource path\n local_var_path = \"/node/services/snmp?action=start\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeServiceStatusProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#create_snmp_service_action_start\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def prometheus_admin_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.prometheus_admin ...'\n end\n # resource path\n local_var_path = '/api/kratos/admin/metrics/prometheus'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryToken']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.prometheus_admin\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#prometheus_admin\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.57288927",
"0.55282456",
"0.5400732",
"0.5327977",
"0.53158706",
"0.5265992",
"0.5265992",
"0.5171749",
"0.5149279",
"0.51091206",
"0.5098056",
"0.50638926",
"0.49821052",
"0.49805206",
"0.4927622",
"0.48656437",
"0.4865102",
"0.48300874",
"0.48254964",
"0.48219615",
"0.4807459",
"0.47988868",
"0.4796315",
"0.47856233",
"0.47728157",
"0.4770972",
"0.4747401",
"0.47342536",
"0.47319204",
"0.47300994",
"0.47162318",
"0.47026685",
"0.46922633",
"0.46795234",
"0.4673588",
"0.46709457",
"0.46686116",
"0.46611252",
"0.46484676",
"0.4644982",
"0.4643549",
"0.46414152",
"0.46414152",
"0.46284103",
"0.4622042",
"0.46154842",
"0.46095723",
"0.46073225",
"0.46065876",
"0.46059495",
"0.460086",
"0.45921484",
"0.45852986",
"0.45852986",
"0.45852986",
"0.45852986",
"0.4584974",
"0.45845583",
"0.45832035",
"0.45817724",
"0.45726153",
"0.45684472",
"0.4568304",
"0.45655867",
"0.4562227",
"0.456174",
"0.4559097",
"0.455905",
"0.455905",
"0.45547032",
"0.4553048",
"0.45521966",
"0.45393488",
"0.45358953",
"0.4531614",
"0.45308533",
"0.4525333",
"0.45206842",
"0.45204368",
"0.4519359",
"0.4516959",
"0.45149046",
"0.45116228",
"0.45105383",
"0.44986016",
"0.44965708",
"0.44910803",
"0.4484936",
"0.44827217",
"0.44805372",
"0.44780943",
"0.4476497",
"0.44753268",
"0.44649747",
"0.44649747",
"0.4463464",
"0.4453612",
"0.44531173",
"0.44469234",
"0.4443578"
] | 0.6127089 | 0 |
Convenience method to update the delay value for the current type. Returns false if the health monitor is not enabled, the new value if it succeeds, and raises an exception otherwise. | def delay=(value)
return false unless @enabled
update(:type => self.type, :delay => value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delay=(value)\n\t\t\t@delay = value\n\t\tend",
"def delay=(value)\n\t\t\t@delay = value\n\t\tend",
"def delay(value)\n model.delay = value\n end",
"def delay(value)\n model.delay = value\n end",
"def delay=(sec)\n raise ArgumentError, 'Delay sec can not be a negative number.' if sec.to_f < 0\n @delay = sec.to_f\n end",
"def delay\n @delay || initial_delay\n end",
"def delay\n self['Delay'].to_i || 0\n end",
"def set_delay(delay)\n @delay = delay\n end",
"def delay\n @delay ||= 600\n end",
"def delay\n @delay || initial_delay\n end",
"def delay_time=(seconds)\n end",
"def timeout=(value)\n return false unless @enabled\n update(:type => self.type, :timeout => value)\n end",
"def increment_delay!\n @delay = [delay * multiplier, max_delay].min\n end",
"def increment_delay!\n @delay = [delay * multiplier, max_delay].min\n end",
"def delay\n if @delay_den != 0\n @delay_num/@delay_den\n else\n @delay_num/100\n end\n end",
"def delay_ms(ms)\n @delay_ms = ms\n end",
"def with_delay(delay, &block)\n # Delay should be either an integer or a range of integers.\n if (delay.is_a?(Numeric))\n raise(ArgumentError, \"Delay should be a non-negative number; got #{delay}!\") unless delay >= 0\n delay = delay..delay\n elsif delay.is_a?(Range)\n raise(ArgumentError, \"Range members should be numbers; got #{delay}!\") unless delay.first.is_a?(Numeric) && delay.last.is_a?(Numeric)\n raise(ArgumentError, \"Range members should be non-negative; got #{delay}!\") unless delay.first >= 0 && delay.last >= 0\n raise(ArgumentError, \"Range's end should be greater than or equal to range's start; got #{delay}!\") unless delay.first <= delay.last\n else\n raise(ArgumentError, \"Delay should be either an number or a range of numbers; got #{delay}!\")\n end\n raise(ArgumentError, 'Delay policy has already been specified!') if @delay_policy\n @delay_policy = lambda{Kernel.sleep(delay.first + rand(delay.count))}\n\n attempt(block)\n end",
"def watch_delay\n @conn.watch(Web.keys[:delay]) do\n yield if block_given?\n end\n end",
"def delay(input, val=nil)\n raise ArgumentError unless (0..31) === input\n input = input.to_i\n reg = input / DELAYS_PER_REG\n shift = (input % DELAYS_PER_REG) * BITS_PER_DELAY\n regval = send(\"delay_#{reg}\")\n if val\n regval &= ~( DELAY_MASK << shift)\n regval |= ((DELAY_MASK & val) << shift)\n send(\"delay_#{reg}=\", regval)\n self\n else\n (regval >> shift) & DELAY_MASK\n end\n end",
"def default_delay=(v)\n @@default_delay = v\n end",
"def delay=(d)\n raise ArgumentError, 'delay must be greater than or equal to 0' if Integer(d) < 0\n\n @images.each { |f| f.delay = Integer(d) }\n end",
"def sleep\n @property_hash['sleep'] || 0\n end",
"def delay(mode)\n if mode == @mode\n d = @deadline - Time.now\n d = 0 if d < 0 # No negative delays\n @deadline += @delay\n block_given? ? yield(d) : d\n end\n end",
"def delay! seconds\n @delay_received << seconds\n end",
"def pickup_delay=(v) self['PickupDelay'] = v end",
"def set_SleepTimeEnabled(value)\n set_input(\"SleepTimeEnabled\", value)\n end",
"def giveUp(timeDelay)\n @delayTime = timeDelay.abs.to_i\n @timerField = NSTextField.alloc.initWithFrame([[0, 0], [40, 20]])\n .tap do |obj| # origin will be set later\n obj.bordered = false\n obj.drawsBackground = false\n obj.font = NSFont.fontWithName('Menlo Bold', size: 12) # mono-spaced\n obj.editable = false\n obj.selectable = false\n obj.alignment = NSTextAlignmentCenter\n obj.toolTip = 'time remaining'\n end unless defined?(@timerField)\n end",
"def await_event(type=\"Scaleout\", delay=120)\n des = description.desired_capacity\n result = false\n count = 0\n Log.log \"Awaiting #{type}... \", newline: false\n while count < delay && !result\n s = summary\n result = (s[:size] == des && s[:in_service] && s[:healthy])\n sleep 1\n count += 1\n end\n Log.log \"done\", timestamp: false\n Log.log \"Summary: #{summary.inspect}\"\n end",
"def delay_time\n return (self.aggressive == false ? 0 : (15 - self.aggressive) * 3)\n end",
"def delay(seconds); end",
"def delay(seconds); end",
"def sleep_if_set\n sleep_sec = config[:sleep].to_i\n if sleep_sec > 0\n info(\"Sleep #{config[:sleep]} seconds...\")\n sleep sleep_sec\n end\n end",
"def delay_time\n end",
"def set_duration(type, duration)\r\n if $g_os_type == :win32_system\r\n @duration_win[type] = Sound::ASYNC\r\n if duration == :loop\r\n @duration_win[type] = Sound::ASYNC|Sound::LOOP\r\n end\r\n end\r\n if $g_os_type == :linux\r\n @duration_linux[type] = duration\r\n end\r\n \r\n end",
"def delay_sanitize\n \tself.delay ||= 0\n end",
"def delay\n val = (self['min-time']/1000.0/60.0)\n val < 1 ? val.round(1) : val.round\n end",
"def sleep_value\n 20\n end",
"def delayed\n NotImplementedError\n end",
"def default_delay\n @@default_delay ||= 0\n end",
"def setJavascriptDelay(delay)\n if (!(Integer(delay) >= 0))\n raise Error.new(Pdfcrowd.create_invalid_value_message(delay, \"setJavascriptDelay\", \"html-to-image\", \"Must be a positive integer number or 0.\", \"set_javascript_delay\"), 470);\n end\n \n @fields['javascript_delay'] = delay\n self\n end",
"def sleep_for=(seconds)\n seconds ||= 0\n if Integer === seconds && seconds >= 0\n @sleep_for = seconds\n else\n raise ArgumentError, \"argument must be nil or an integer >= 0\"\n end\n end",
"def delayed?\n @delayed\n end",
"def delayed_update\n self.delay.update_metrics!\n end",
"def lock_on_sleep= value\n put_settings(get_settings.tap {|s| s[:lock_on_sleep] = value ? 1 : 0})\n end",
"def sleep? module_name = nil, refresh_delay = 60 # {{{\n\n # Pre-condition check # {{{\n raise ArgumentError, \"Module name cannot be nil, but it is\" if( module_name.nil? )\n raise ArgumentError, \"Module name should be of type string, but it is (#{module_name.class.to_s})\" unless( module_name.is_a?(String) )\n # }}}\n\n # Main\n sleep_time = 60 # make sure we always wait 60 s if we get no valid feedback\n\n website = Website.first( :name => module_name )\n\n # We have never accessed this website so we need to create an initial DB entry\n if( website.nil? )\n new = Website.new\n new.name = module_name\n new.last_access = Time.now\n new.save!\n website = new\n end\n\n last_access = Time.parse( website.last_access.to_s )\n\n raise ArgumentError, \"last_access cannot be nil\" if( last_access.nil? )\n raise ArgumentError, \"last_access needs to be of type Time, but is (#{last_access.class.to_s})\" unless( last_access.is_a?( Time ) )\n\n now = Time.now\n diff = ( now - last_access ).to_i\n\n @log.message :debug, \"Sleep function result is - Now (#{now.to_s}) - Last Access (#{last_access.to_s}) - Mandatori Refresh Delay (#{refresh_delay.to_s}) - Now-Last (#{diff.to_s}) - Sleep (#{diff.to_s})\"\n\n sleep_time = ( diff > refresh_delay ) ? ( 0 ) : ( refresh_delay - diff )\n\n # Post-condition check\n raise ArgumentError, \"Result of this function is supposed to be of type integer, but is (#{sleep_time.class.to_s})\" unless( sleep_time.is_a?(Integer) )\n\n sleep_time\n end",
"def idle_delay(arg = nil)\n set_or_return(:idle_delay, arg, kind_of: Integer)\n end",
"def set_animation_delay(key, delay)\r\n anim = AnimationManager.get_anim key\r\n anim.delay = delay\r\n end",
"def delay\n sleep(2)\n end",
"def set_timeout(value)\n if value.nil?\n @timeout = 2\n else\n return skip_resource 'timeout is not numeric' unless value.to_s =~ /^\\d+$/\n @timeout = value\n end\n end",
"def standbydelay\n return nil unless @property_hash.has_key? 'standbydelay'\n\n @property_hash['standbydelay'].to_i\n end",
"def sleep(dur=0) end",
"def sub_delay _value, _abs=0\n send_cmd(\"sub_delay #{_value} #{_abs}\")\n end",
"def default_delay\n 0.seconds\n end",
"def delay; end",
"def delay; end",
"def delay; end",
"def sleep_for\n @sleep_for ||= 5\n end",
"def ensure=(value)\n debug \"Waiting for host '#{@resource[:name]}' to change status to '#{value}'\"\n @resource[:count].times do\n return if status == value\n sleep @resource[:step]\n end\n fail \"Timeout waiting for host '#{@resource[:name]}' status to become '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def setTimer\n return NSTimer.timerWithTimeInterval( 1.0,\n target: self,\n selector: 'updateCountdown:',\n userInfo: nil,\n repeats: true )\n .tap do |timer|\n @countdown = @delayTime\n @timerField.stringValue = @countdown.to_int.to_s\n end if @delayTime > 1\n nil\n end",
"def operation_delay\n begin\n if $ITEST2_OPERATION_DELAY && $ITEST2_OPERATION_DELAY > 0 &&\n $ITEST2_OPERATION_DELAY && $ITEST2_OPERATION_DELAY < 30000 then # max 30 seconds\n sleep($ITEST2_OPERATION_DELAY / 1000)\n end\n\n while $ITEST2_PAUSE\n debug(\"Paused, waiting ...\")\n sleep 1\n end\n rescue => e\n puts \"Error on delaying: #{e}\"\n # ignore\n end\n end",
"def delay(time)\n @context.backend.delay(time)\n end",
"def [](key)\n delay = data[key]\n delay ? delay.value! : nil\n end",
"def update(options={})\n data = Hash.new\n data[:type] = options[:type].upcase if options[:type]\n data[:delay] = options[:delay] if options[:delay]\n data[:timeout] = options[:timeout] if options[:timeout]\n data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]\n data[:type].upcase! if data[:type]\n if ['HTTP','HTTPS'].include?(data[:type])\n data[:path] = options[:path] if options[:path]\n data['statusRegex'] = options[:status_regex] if options[:status_regex]\n data['bodyRegex'] = options[:body_regex] if options[:body_regex]\n end\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor\",@lbmgmtport,@lbmgmtscheme,{},data.to_json)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n populate\n true\n end",
"def delay(seconds)\n sleep(seconds)\n end",
"def delay_1() sleep(3) end",
"def _libnotify_urgency(type)\n case type\n when 'failed'\n :normal\n else\n :low\n end\n end",
"def wait(per = nil)\n @target += per || @period\n error = @target - Time.now\n sleep error if error > 0\n true\n end",
"def should_delay?\n @class == FaviconParty::Curl::DNSError\n end",
"def set_queue_delay\n new_delay = params[:delay].to_f\n if new_delay == 0\n head :bad_request\n else\n Rails.application.config.queue_delay = new_delay\n render :get_queue_delay\n end\n end",
"def delay\n \"%3d days %2d hours %2d minutes %2d seconds\" % distance_of_time_as_array( timestamp_device, timestamp_server)\n end",
"def setJavascriptDelay(delay)\n if (!(Integer(delay) >= 0))\n raise Error.new(Pdfcrowd.create_invalid_value_message(delay, \"setJavascriptDelay\", \"html-to-pdf\", \"Must be a positive integer number or 0.\", \"set_javascript_delay\"), 470);\n end\n \n @fields['javascript_delay'] = delay\n self\n end",
"def wait_for_settings_update(key, value = true)\n safety = 5\n loop do\n if @user.settings.try(:[], key) == value\n return\n elsif safety > 0\n safety -= 1\n sleep 0.5\n else\n fail \"'#{key}' setting didn't change to '#{value}' (#{value.class.name})\"\n end\n end\n end",
"def persistent_delay\n get_config_value(:persistent_delay, 5)\n end",
"def delay\n puts \"Delaying ...\"\n sleep 1\n end",
"def calculate_sleep\n if @timeouts.empty?\n @sleep_for = DefaultSleepFor\n else\n diff = @timeouts.first.value.timeout_at.to_f - Time.now.to_f\n\n if diff < 0.0\n @sleep_for = 0\n else\n @sleep_for = diff\n end\n end\n end",
"def delay(rtl, val) \n start = rtl.count() \n while rtl.count() < start + val do\n end\nend",
"def delay(rtl, val) \n start = rtl.count() \n while rtl.count() < start + val do\n end\nend",
"def sleep(duration = nil)\n remaining = duration ? duration - elapsed : -elapsed\n\n remaining.tap { |rem| rem.sleep if rem.positive? }\n end",
"def wait_time(value)\n define_singleton_method(:wait_time_value) { value }\n private_class_method :wait_time_value\n end",
"def delay(duration_in_milliseconds)\n append_to_script \"delay \\\"#{duration_in_milliseconds}\\\"\"\n end",
"def minretrydelay=(retry_delay)\r\n\t\t\t`#{BITS::BITSADMIN} /setminretrydelay {#{@id}} #{retry_delay}`\r\n\t\tend",
"def get_delay\n return @retry_timeout unless @retry_timeout.nil?\n\n if !response.nil? && !response.headers['Retry-After'].nil?\n return response.headers['Retry-After'].to_i\n end\n\n return AsyncOperationStatus::DEFAULT_DELAY\n end",
"def update!(**args)\n @effect_duration_ms = args[:effect_duration_ms] if args.key?(:effect_duration_ms)\n @is_enabled = args[:is_enabled] if args.key?(:is_enabled)\n @start_timedelta_ms = args[:start_timedelta_ms] if args.key?(:start_timedelta_ms)\n end",
"def after!(time, &block)\n Delay.new(@native, time, &block)\n end",
"def delay milliseconds\n\n # Do nothing with zero delay\n return if milliseconds == 0.0\n\n # Apply delay to all subtitles\n @subtitles.each do | subtitle |\n subtitle.delay milliseconds\n end\n end",
"def set_EndSleepTime(value)\n set_input(\"EndSleepTime\", value)\n end",
"def change_hp(value, enable_death)\r\n if !enable_death && @hp + value <= 0\r\n self.hp = 1\r\n else\r\n self.hp += value\r\n end\r\n end",
"def wfs_delay\n (datastore['WfsDelay'] || 0).to_i\n end",
"def set_rate_limited(time, new_time_value = true)\n\n self.user.update_attribute(:rate_limited_until, Time.at(time).utc ) if new_time_value\n\n self.update_attributes(rescheduled_at: Time.at(time).utc,\n status: \"DELAYED\",\n sent_at: Time.now.utc)\n end",
"def delay_seconds\n seconds = nil\n if delay = @delay || @config_delay\n min_delay = max_delay = nil\n if delay =~ /([\\d]+)\\.\\.([\\d]+)/\n min_delay = Regexp.last_match[1].to_i\n max_delay = Regexp.last_match[2].to_i\n elsif delay.to_i.to_s == delay\n min_delay = max_delay = delay.to_i\n end\n if min_delay && max_delay\n seconds = rand(max_delay - min_delay + 1) + min_delay\n end\n end\n seconds || 0\n end",
"def update!(**args)\n @timeout = args[:timeout] if args.key?(:timeout)\n end",
"def update!(**args)\n @disabled = args[:disabled] if args.key?(:disabled)\n @max_retries = args[:max_retries] if args.key?(:max_retries)\n @schedule = args[:schedule] if args.key?(:schedule)\n @start_time = args[:start_time] if args.key?(:start_time)\n @type = args[:type] if args.key?(:type)\n end",
"def follow_on_delay\n default_delay\n end",
"def delay(time, &b)\n time = time.to_a.sample unless time.is_a? Integer\n EM.add_timer(time, &b)\n end",
"def resolve_retry_delay(delay)\n if delay.respond_to?(:queue_retry_delay)\n resolve_retry_delay(delay.queue_retry_delay)\n elsif delay.is_a?(Integer) # numerical\n delay\n else # default\n Backburner.configuration.retry_delay\n end\n end",
"def blink(duration, force = false)\n return if @blink && !force\n @blink = true\n @blink_duration = duration\n @blink_current_duration = duration\n @blink_phase = 0\n @blink_opacity = self.opacity\n end",
"def update!(**args)\n @use_elapsed_duration = args[:use_elapsed_duration] if args.key?(:use_elapsed_duration)\n end",
"def update!(**args)\n @use_elapsed_duration = args[:use_elapsed_duration] if args.key?(:use_elapsed_duration)\n end",
"def _delay\n class << self; self; end.module_eval { yield }\n end",
"def sleep(time)\n dt = @clock + time\n\n due_to_clock = dt<=>@clock\n raise 'Time is out of range' if due_to_clock < 0\n\n @clock = dt\n end"
] | [
"0.6375577",
"0.6375577",
"0.62466025",
"0.62466025",
"0.6113928",
"0.5905484",
"0.5884957",
"0.5884759",
"0.58710164",
"0.5836823",
"0.5800068",
"0.5772453",
"0.5683087",
"0.56367815",
"0.5580363",
"0.5548741",
"0.55480635",
"0.55040777",
"0.5486695",
"0.54744035",
"0.5460276",
"0.5350797",
"0.5300798",
"0.52341384",
"0.5212824",
"0.5203922",
"0.5132243",
"0.51248777",
"0.51026165",
"0.50991297",
"0.50991297",
"0.50794685",
"0.5077515",
"0.5062446",
"0.505518",
"0.49833125",
"0.49824005",
"0.49730253",
"0.49719423",
"0.49694034",
"0.495338",
"0.4945826",
"0.49343255",
"0.49267662",
"0.49060208",
"0.49030718",
"0.4890124",
"0.48871544",
"0.48764178",
"0.48726553",
"0.48478043",
"0.48442462",
"0.4828438",
"0.48214385",
"0.48214385",
"0.48214385",
"0.48029387",
"0.47821188",
"0.47770253",
"0.4775189",
"0.47723228",
"0.47614944",
"0.4750992",
"0.4745132",
"0.47421682",
"0.47171462",
"0.47013527",
"0.46987647",
"0.46951413",
"0.46680433",
"0.46654007",
"0.46596858",
"0.46319667",
"0.46210697",
"0.46163404",
"0.45971876",
"0.45971876",
"0.4581819",
"0.45803747",
"0.45768493",
"0.45743826",
"0.4566546",
"0.45634797",
"0.45499253",
"0.4549636",
"0.4542718",
"0.45380482",
"0.45367768",
"0.45205134",
"0.45151988",
"0.4496579",
"0.4489749",
"0.44855145",
"0.44703344",
"0.4462418",
"0.44545862",
"0.44501606",
"0.44501606",
"0.44475898",
"0.44467154"
] | 0.76008743 | 0 |
Convenience method to update the timeout value for the current type. Returns false if the health monitor is not enabled, the new value if it succeeds, and raises an exception otherwise. | def timeout=(value)
return false unless @enabled
update(:type => self.type, :timeout => value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_timeout(value)\n if value.nil?\n @timeout = 2\n else\n return skip_resource 'timeout is not numeric' unless value.to_s =~ /^\\d+$/\n @timeout = value\n end\n end",
"def timeout=(value)\n @timeout = value\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end",
"def timeout=(new_timeout)\n if new_timeout && new_timeout.to_f < 0\n raise ArgumentError, \"Timeout must be a positive number\"\n end\n @timeout = new_timeout.to_f\n end",
"def timeout=(timeout)\n @timeout = timeout.to_f/1000 * 60\n end",
"def timeout?(value)\n value.is_a? Pinglish::TooLong\n end",
"def timeout=(value)\n Curl.set_option(:timeout, value_for(value, :int), handle)\n end",
"def timeout(value)\n fresh.tap do |criteria|\n criteria.timeout_value = value\n end\n end",
"def timeout=(timeout)\n @timeout = timeout\n end",
"def timeout=(value)\n @transfer[:timeout] = value\n end",
"def timeout=(timeout=:default)\n @timeout = TIMEOUTS.member?(timeout) ? TIMEOUTS[timeout] : timeout\n NOTIFICATION[:set_timeout].call @notification, @timeout\n end",
"def timeout?\n @status == :timeout\n end",
"def consider_timeout\n\n do_schedule_timeout(attribute(:timeout))\n end",
"def update!(**args)\n @timeout = args[:timeout] if args.key?(:timeout)\n end",
"def timeout_ms=(value)\n Curl.set_option(:timeout_ms, value_for(value, :int), handle)\n end",
"def lock_timeout=(value)\n raise ArgumentError, 'Numeric value expected as timeout' unless value.is_a?(Numeric)\n value = (value * 1000).to_i\n Mimi::DB.execute('update pg_settings set setting = ? where name = ?', value, :lock_timeout)\n end",
"def timeout?\n @timeout != UndefinedSetting\n end",
"def timeout_raw=(timeout)\n @serial_timer.timeout = timeout\n end",
"def timeout=(timeout)\n @stop_time = timeout.nil? ? nil : current_time + timeout\n end",
"def timeout=(value)\n @connect_timeout, @send_timeout, @receive_timeout = value, value, value\n end",
"def timeout (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_timeout(to_native, value)\n\t\telse\n\t\t\tto_native[:timeout]\n\t\tend\n\tend",
"def os_boot_watchdog_timer_timeout=(os_boot_watchdog_timer_timeout)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"5-minutes\", \"10-minutes\", \"15-minutes\", \"20-minutes\"])\n unless validator.valid?(os_boot_watchdog_timer_timeout)\n fail ArgumentError, \"invalid value for \\\"os_boot_watchdog_timer_timeout\\\", must be one of #{validator.allowable_values}.\"\n end\n @os_boot_watchdog_timer_timeout = os_boot_watchdog_timer_timeout\n end",
"def timeout(arg = nil)\n set_or_return(\n :timeout,\n arg,\n kind_of: Integer\n )\n end",
"def update_timeout_status(timeout, start_time, time_left)\n if timeout\n current_time = Time.new.to_i\n p \"current time = #{current_time}\"\n diff = current_time - start_time\n p \"curr - start = #{diff}\"\n time_out_length = 300\n if diff >= time_out_length\n timeout = false\n return timeout\n else\n time_left = time_out_length - diff\n return time_left\n end\n end\nend",
"def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end",
"def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end",
"def set_timedout_flag (workitem)\n\n workitem.attributes['__timed_out__'] = 'true'\n end",
"def connect_timeout=(new_timeout)\n if new_timeout && new_timeout.to_f < 0\n raise ArgumentError, \"Timeout must be a positive number\"\n end\n\n @connect_timeout = new_timeout.to_f\n end",
"def max_timeout=(timeout)\n self.device.max_timeout = timeout\n end",
"def timeout=(timeout)\n @timeout = timeout\n @socket_timeout = nil\n\n if @timeout.to_f > 0\n secs = @timeout.floor\n usecs = (@timeout - secs).floor * 1_000_000\n @socket_timeout = [secs, usecs].pack(\"l_2\")\n end\n end",
"def timeout\n configuration[:timeout] || DEFAULT_TIMEOUT\n end",
"def timeout\n configuration[:timeout] || DEFAULT_TIMEOUT\n end",
"def setconnectiontimeout(timeout)\r\n setvalue(@@CONNECTION_TIMEOUT, timeout)\r\n end",
"def idle_timeout=(timeout); end",
"def driver_timeout=(value)\n Watir.default_timeout = value\n end",
"def driver_timeout=(value)\n Watir.default_timeout = value\n end",
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def timeout\n @timeout\n end",
"def request_timeout(type, options); end",
"def set_idle_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def set_idle_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def set_idle_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def timeout\n @options[:timeout]\n end",
"def ensure=(value)\n debug \"Waiting for host '#{@resource[:name]}' to change status to '#{value}'\"\n @resource[:count].times do\n return if status == value\n sleep @resource[:step]\n end\n fail \"Timeout waiting for host '#{@resource[:name]}' status to become '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def timeout_after(time); end",
"def timeout\n datastore['Timeout']\n end",
"def timeouts_set=(_arg0); end",
"def timeouts_set; end",
"def set_alert_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def connecttimeout=(value)\n Curl.set_option(:connecttimeout, value_for(value, :int), handle)\n end",
"def timeout_specified\n if respond_to?(:to_hash)\n to_hash.fetch(:timeout) { nil} #\n else\n nil\n end\n end",
"def timeout\n @timeout || Elected.timeout\n end",
"def timeout\n configuration.timeout\n end",
"def timeout(seconds, &block)\n Timeout.timeout seconds, Pinglish::TooLong, &block\n end",
"def default_timeout_class=(_arg0); end",
"def timeout seconds=nil\n if block_given?\n before = @telnet_options[:timeout]\n self.timeout = seconds\n begin\n yield\n ensure\n self.timeout = before\n end\n else\n if seconds\n warn \"Warning: Use EM::P::SimpleTelnet#timeout= to set the timeout.\"\n end\n @telnet_options[:timeout]\n end\n end",
"def connecttimeout_ms=(value)\n Curl.set_option(:connecttimeout_ms, value_for(value, :int), handle)\n end",
"def update(options={})\n data = Hash.new\n data[:type] = options[:type].upcase if options[:type]\n data[:delay] = options[:delay] if options[:delay]\n data[:timeout] = options[:timeout] if options[:timeout]\n data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]\n data[:type].upcase! if data[:type]\n if ['HTTP','HTTPS'].include?(data[:type])\n data[:path] = options[:path] if options[:path]\n data['statusRegex'] = options[:status_regex] if options[:status_regex]\n data['bodyRegex'] = options[:body_regex] if options[:body_regex]\n end\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor\",@lbmgmtport,@lbmgmtscheme,{},data.to_json)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n populate\n true\n end",
"def default_timeout_class; end",
"def set_lock_timeout(timeout)\n @lock_timeout = timeout\n end",
"def write_timeout= sec\n @lock.write_timeout = sec\n end",
"def timed_out?\n @timed_out\n end",
"def api_timeout=(seconds)\n @@api_timeout = seconds.to_i\n end",
"def timeout\n @attributes[:timeout]\n end",
"def add_timeout(opts = {})\n @timeout = opts[:timeout] || @timeout\n opts.delete(:timeout)\n end",
"def timeout\n options[:timeout] || super\n end",
"def timeout!(*args, &block)\n Timeout::timeout(*args, &block)\n end",
"def _timeout? changed_time, timeout\n\t\t@current_time ||= Time.now\n\t\t(@current_time - changed_time - timeout) > 0 ? true : false\n\tend",
"def idle_timeout= idle_timeout\n @agent.idle_timeout = idle_timeout\n end",
"def timeout_in\n if self.admin?\n 10.minutes\n else\n 15.minutes\n end\n end",
"def idle_timeout( new_timeout=nil )\n\t\t\t@idle_timeout = new_timeout if new_timeout\n\t\t\treturn @idle_timeout\n\t\tend",
"def setTriggerTimeout _obj, _args\n \"_obj setTriggerTimeout _args;\" \n end",
"def timeout= seconds\n @telnet_options[:timeout] = seconds\n set_comm_inactivity_timeout( seconds )\n end",
"def lock_timeout(duration:)\n add option: \"-lock-timeout=#{duration}\"\n end",
"def set_EndSleepTime(value)\n set_input(\"EndSleepTime\", value)\n end",
"def settransactiontimeout(timeout)\r\n setvalue(@@TRANSACTION_TIMEOUT, timeout)\r\n end",
"def time=(time, allow_failures=false)\n\n #Create a packet which should set the scanner's current time.\n request = Packets::RequestSetTime.from_time(time)\n \n #Set the time on the scanner, and retrieve the scanner's newly-set reported time.\n new_time = send_request(request).to_time()\n\n #If the time was not correctly set, throw an error...\n unless new_time.tv_sec == time.tv_sec || allow_failures\n raise FailedOperationError.new(\"Tried to set the scanner's time to #{time.inspect}, but got back #{new_time.inspect}.\")\n end\n\n new_time\n end",
"def queue_respond_timeout(ttr=nil)\n if ttr\n @queue_respond_timeout = ttr\n else # accessor\n @queue_respond_timeout\n end\n end",
"def idle_timeout=(idle_timeout); end",
"def dns_cache_timeout=(value)\n Curl.set_option(:dns_cache_timeout, value_for(value, :int), handle)\n end",
"def timeout\n return @timeout\n end",
"def open_timeout= open_timeout\n @agent.open_timeout = open_timeout\n end",
"def timeout\n datastore['TIMEOUT']\n end",
"def set_idle_threshold!(time)\n time = time.to_i\n\n if time != 0 && time < 10\n raise ArgumentError, \"time must be >= 10 minutes\"\n end\n\n if time % 5 != 0\n raise ArgumentError, \"time must be in 5 minute increments\"\n end\n\n !!self.send!(\"+XT:3013,#{time}\")\n end",
"def refresh_timeout\n @refresh_timeout ||= (options[:timeout] || 5)\n end",
"def timeout=(interval)\n @timer = NSTimer.scheduledTimerWithTimeInterval(interval,\n target: self,\n selector: :\"on_timeout_elapsed:\",\n userInfo: nil,\n repeats: false)\n end",
"def lock_timeout\n result = Mimi::DB.execute('select setting from pg_settings where name = ?', :lock_timeout)\n value = result.first['setting'].to_i\n value = value.to_f / 1000 unless value == 0\n value\n end",
"def timeout_at; end",
"def set_timeout(timeout=nil)\n if timeout.class == Fixnum && !block_given?\n @j_del.java_method(:setTimeout, [Java::long.java_class]).call(timeout)\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling set_timeout(timeout)\"\n end",
"def lock_timeout\n @lock_timeout ||= self.class.lock_timeout || 0\n end",
"def get_timeout\n if @valgrind\n return timeout_seconds * TestBase::VALGRIND_TIMEOUT_MULTIPLIER\n elsif has_active_sanitizers\n return timeout_seconds * TestBase::SANITIZERS_TIMEOUT_MULTIPLIER\n else\n return timeout_seconds\n end\n end",
"def ensure=(value)\n debug \"Call: ensure=(#{value})\"\n debug \"Waiting for HAProxy backend: '#{@resource[:name]}' to change its status to: '#{value}'\"\n @resource[:count].times do\n stats_reset\n if self.status == value\n debug get_haproxy_debug_report\n return true\n end\n sleep @resource[:step]\n end\n debug get_haproxy_debug_report\n fail \"Timeout waiting for HAProxy backend: '#{@resource[:name]}' status to become: '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def set_failsafe_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def time_type=(new_time_type)\n write_attribute(:time_type, new_time_type)\n swap_start_finish\n end"
] | [
"0.6387167",
"0.6320286",
"0.6293514",
"0.6293514",
"0.6293514",
"0.6293514",
"0.6293514",
"0.62935054",
"0.62709504",
"0.61344004",
"0.6111855",
"0.6101756",
"0.6014903",
"0.6008131",
"0.598254",
"0.5968755",
"0.5887144",
"0.58627725",
"0.5858353",
"0.58574563",
"0.5796059",
"0.56476605",
"0.5645734",
"0.564098",
"0.55958873",
"0.55943006",
"0.5591726",
"0.5590543",
"0.5570806",
"0.550451",
"0.550451",
"0.54973346",
"0.5489123",
"0.5426574",
"0.53907293",
"0.5377627",
"0.5377627",
"0.5376766",
"0.5370006",
"0.5354714",
"0.5354714",
"0.53296345",
"0.53296345",
"0.53161937",
"0.53030944",
"0.5281407",
"0.5281407",
"0.5281407",
"0.52800846",
"0.52774435",
"0.5268072",
"0.523221",
"0.5230867",
"0.52146804",
"0.5212835",
"0.52021426",
"0.5198076",
"0.519394",
"0.51774424",
"0.51657754",
"0.51609087",
"0.51511335",
"0.51496744",
"0.51342666",
"0.51321673",
"0.5127839",
"0.5121899",
"0.51208925",
"0.51195747",
"0.5109016",
"0.51025575",
"0.50913745",
"0.5090894",
"0.50839645",
"0.5080984",
"0.50787395",
"0.5078014",
"0.50707245",
"0.50677794",
"0.5059234",
"0.50523376",
"0.50408036",
"0.50407046",
"0.5036789",
"0.5024275",
"0.50137055",
"0.49974373",
"0.4992808",
"0.4984291",
"0.4983323",
"0.4977822",
"0.4974166",
"0.49741533",
"0.49695846",
"0.49667802",
"0.4964787",
"0.4959576",
"0.4951514",
"0.49470383",
"0.49457934"
] | 0.7589935 | 0 |
Convenience method to update the attempts before deactivation value for the current type. Returns false if the health monitor is not enabled, the new value if it succeeds, and raises an exception otherwise. | def attempts_before_deactivation=(value)
return false unless @enabled
update(:type => self.type, :attempts_before_deactivation => value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrease_health\n @health.update { |v| v - 1 }\n end",
"def update_failure\n logger.exception(\"Failed to connect to broker #{@alias}\")\n if @last_failed\n @retries += 1\n else\n @last_failed = true\n @retries = 0\n @failure_stats.update\n end\n true\n end",
"def deactivate\n return false if deactivated?\n self.status = 'deactivated'\n save\n end",
"def invalidate\n self.result = Automation::Result::Ignored\n self.save\n end",
"def update_success\n @last_failed = false\n @retries = 0\n true\n end",
"def update!(**args)\n @failure_type = args[:failure_type] if args.key?(:failure_type)\n end",
"def restore_health\n # There can be cases where health is full, but active is false.\n # Once a node has been marked inactive, it stays inactive.\n @health.value = FULL_HEALTH\n end",
"def check_progress\n self.increment_count\n begin\n self.send(\"check_progress_#{self.type}\")\n rescue\n self.update_attributes(:status =>'not yet available')\n end\n end",
"def deactivate\n respond_to do |format|\n if @user_badge.update(active: false)\n format.html { redirect_to team_user_path(@team, @user), notice: 'User badge was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_badge }\n else\n format.html { render :edit }\n format.json { render json: @user_badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status\n\n old_status = self.status\n\n unless self.decided?\n expected_users = self.get_current_expected\n\n if expected_users.nil?\n self.update_attribute(:status, Workflow::STATUS_DENIED)\n last_nak = self.get_last_nak\n unless last_nak.nil?\n self.update_attribute(:decided_at, last_nak.updated_at)\n end\n elsif expected_users.empty?\n self.update_attribute(:status, Workflow::STATUS_ACCEPTED)\n last_ack = self.get_last_ack\n unless last_ack.nil?\n self.update_attribute(:decided_at, last_ack.updated_at)\n end\n end\n end\n\n return (old_status != self.status)\n end",
"def decrement_of_health(user)\n -((user.max_health / 10) + 5 * (4 - difficulty)).round\n end",
"def failed?(backoff = false)\n @status == :failed\n end",
"def set_url_status\n self.update_attribute(:dead, true) unless self.url_active?\n end",
"def after_update(indicator_type)\n expire_cache_for(indicator_type)\n end",
"def update(time_passed)\n @invincibility -= time_passed\n end",
"def inactive!\n self.update_attribute(:status, INACTIVE)\n end",
"def deactivate!\n update(status: false)\n end",
"def change_health(amount)\n self.health += amount\n if(self.health > self.max_health)\n self.health = self.max_health\n end\n self.save!\n self.owner.check_for_death\n end",
"def update_status(type, state)\n if [:auth, :api, :router, :broker].include?(type)\n case state\n when :connected\n if @agent.mode == :http\n # Require connectivity to both API and router to be considered fully connected\n status = @agent.client.status\n if status[:api] == :connected && status[:router] == :connected\n RightScale::Sender.instance.disable_offline_mode\n end\n else\n RightScale::Sender.instance.disable_offline_mode\n end\n when :disconnected\n RightScale::Sender.instance.enable_offline_mode\n when :failed\n RightScale::Log.error(\"RightNet connectivity failure for #{type}, need to re-enroll\")\n # Randomize when re-enroll to prevent possibly having multiple instances do so simultaneously\n EM.add_timer(rand(MAX_REENROLL_DELAY)) { RightScale::ReenrollManager.reenroll! }\n when :authorized, :unauthorized, :expired, :closing\n else\n RightScale::Log.error(\"Unrecognized state for #{type}: #{state}\")\n end\n end\n true\n end",
"def deactivate!\n self.status = 'Inactive'\n nil\n end",
"def _libnotify_urgency(type)\n case type\n when 'failed'\n :normal\n else\n :low\n end\n end",
"def suspend!\n self.update_attribute(:status, SUSPENDED)\n self.registration.update_attribute(:status, SUSPENDED) if self.registration\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_status=(value)\n @health_status = value\n end",
"def health_damage damage, check\n if check\n @health -= damage\n end\n end",
"def reset_failed_attempts!\n if respond_to?(:failed_attempts) && !failed_attempts.to_i.zero?\n self.failed_attempts = 0\n save(validate: false)\n end\n end",
"def ensure=(value)\n debug \"Waiting for host '#{@resource[:name]}' to change status to '#{value}'\"\n @resource[:count].times do\n return if status == value\n sleep @resource[:step]\n end\n fail \"Timeout waiting for host '#{@resource[:name]}' status to become '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def update!(**args)\n @emergency_level = args[:emergency_level] if args.key?(:emergency_level)\n end",
"def deactivate\n if deactivated?\n errors.add(:base, I18n.translate('errors.cannot_method_msg', :method => 'deactivate', :msg => I18n.translate('error_messages.is_deactivated') ) )\n errors.add(:deactivated, I18n.translate('error_messages.is_deactivated') )\n return false\n else\n self.deactivated = DB_TRUE;\n if !self.save\n errors.add(:base, I18n.translate('errors.cannot_method_msg', :method => 'deactivate', :msg => I18n.translate('error_messages.got_error') ) )\n errors.add(:deactivated, I18n.translate('error_messages.got_error') )\n return false\n end\n end\n return true\n end",
"def reset_failed_attempts!; end",
"def update(options={})\n data = Hash.new\n data[:type] = options[:type].upcase if options[:type]\n data[:delay] = options[:delay] if options[:delay]\n data[:timeout] = options[:timeout] if options[:timeout]\n data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]\n data[:type].upcase! if data[:type]\n if ['HTTP','HTTPS'].include?(data[:type])\n data[:path] = options[:path] if options[:path]\n data['statusRegex'] = options[:status_regex] if options[:status_regex]\n data['bodyRegex'] = options[:body_regex] if options[:body_regex]\n end\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor\",@lbmgmtport,@lbmgmtscheme,{},data.to_json)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n populate\n true\n end",
"def update_password\n @user.password = @new_e_password\n if GlobalConstant::User.auto_blocked_status == @user.status\n # if we had blocked a user for more than a threshhold failed login attemps we set status to blocked\n # now we should reset it to active\n @user.status = GlobalConstant::User.active_status\n @user.failed_login_attempt_count = 0\n end\n @user.save!\n end",
"def descriptively_ok=(status)\n self.acceptance = (acceptance & PRESCRIPTIVE) | (status.to_i * DESCRIPTIVE)\n end",
"def munge\n add_status_to_resource_status\n add_missing_metrics\n recalculate_report_status\n self\n end",
"def reconnect_attempts=(val)\n @j_del.setReconnectAttempts(val)\n self\n end",
"def unlock\n if unlocked_status == true\n raise ArgumentError.new(\"The door is already unlocked!\")\n else\n door_hash[:unlocked_status] = true\n end\n end",
"def mark_as_unresponsive\n self.available = STATUS_NONRESPONSIVE\n save!\n end",
"def ensure=(value)\n debug \"Call: ensure=(#{value})\"\n debug \"Waiting for HAProxy backend: '#{@resource[:name]}' to change its status to: '#{value}'\"\n @resource[:count].times do\n stats_reset\n if self.status == value\n debug get_haproxy_debug_report\n return true\n end\n sleep @resource[:step]\n end\n debug get_haproxy_debug_report\n fail \"Timeout waiting for HAProxy backend: '#{@resource[:name]}' status to become: '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def monitor_system\n if @is_fire || @is_power_outage || @is_mechanical_failure\n \n @status = \"offline\"\n for column in @column_list do\n column.status = \"offline\"\n for elevator in column.elevator_list do\n elevator.status = \"offline\"\n end\n end\n puts \"Battery #{@id} has been shut down for maintenance. Sorry for the inconvenience\"\n exit()\n end\n end",
"def status_fail!()\n @status = TAC_PLUS_AUTHEN_STATUS_FAIL\n end",
"def set_health(amount)\n self.health = amount\n if(self.health > self.max_health)\n self.max_health = self.health\n end\n self.owner.check_for_death\n self.save!\n end",
"def ungraded_attempts\n @attempts.select { |x| x.ungraded? }\n end",
"def reactivate\n if deactivated?\n self.deactivated = DB_FALSE;\n if !self.save\n errors.add(:base, I18n.translate('errors.cannot_method_msg', :method => 'reactivate', :msg => I18n.translate('error_messages.got_error') ) )\n errors.add(:deactivated, I18n.translate('error_messages.got_error') )\n return false\n end\n else\n errors.add(:base, I18n.translate('errors.cannot_method_msg', :method => 'reactivate', :msg => I18n.translate('error_messages.is_active') ) )\n errors.add(:deactivated, I18n.translate('error_messages.is_active') )\n return false\n end\n return true\n end",
"def deactivate\n self.activation_code = 'DEACTIVATED'\n self.activated_at = nil\n end",
"def update_status(new_status)\n raise ArgumentError.new\"Invalid Status\" unless new_status == :AVAILABLE || new_status == :UNAVAILABLE\n @status = new_status\n end",
"def change_hp(value, enable_death)\r\n if !enable_death && @hp + value <= 0\r\n self.hp = 1\r\n else\r\n self.hp += value\r\n end\r\n end",
"def update_balance dt\n @off_balance_timer.keys.each do |k|\n if @off_balance_timer[k] && (@off_balance_timer[k] -= dt) <= 0\n hear_line \"You have regained #{k.to_s}\"\n @off_balance_timer[k] = nil\n end\n end\n end",
"def deactivate!\n update!(active: false)\n bank_guarantee.try(:deactivate!)\n end",
"def try_again\n update_attributes({\n :worker_record => nil,\n :attempts => self.attempts + 1\n })\n end",
"def update_status(status)\n @metric_status = status if STATUSES[status] > STATUSES[@metric_status]\n end",
"def reject\n self.update_attributes(:status => REJECTED)\n end",
"def reconnect_attempts(val = nil)\n if val\n @j_del.setReconnectAttempts(val)\n self\n else\n @j_del.getReconnectAttempts\n end\n end",
"def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend",
"def deactivate_on(*error_class)\n @configuration.deactivation_errors |= error_class\n end",
"def suspend!\n self.update_attribute(:activated_at, nil)\n end",
"def reset!\n begin\n update_attributes!(:attempts => 0, :error => nil, :lock => nil, :run_at => Time.now.utc)\n rescue => e\n logger.warn(e)\n end\n end",
"def auto_activate\n adm = Admin.find_by_activation_code(self.activation_code) if !self.activation_code.blank?\n return nil if adm.blank?\n if !adm.username.blank? and !adm.crypted_password.blank? and !adm.activation_code.blank?\n @just_activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n#Interesting stuff happens here:\n# validate_on_update runs, after which this method (activate) runs. In order to save, it has to validate_on_update again.\n# In the first validate_on_update, it has an activation_code present, but after passing through this, it doesn't, so\n# validate_on_update has to find by id instead. This should be reliable, but maybe just touchy if someone changes anything.\n if self.save\n # Log.create(:log_type => 'activate:Admin', :data => {})\n end\n end\n end",
"def wait_for_settings_update(key, value = true)\n safety = 5\n loop do\n if @user.settings.try(:[], key) == value\n return\n elsif safety > 0\n safety -= 1\n sleep 0.5\n else\n fail \"'#{key}' setting didn't change to '#{value}' (#{value.class.name})\"\n end\n end\n end",
"def do_battle\n @health_points = @health_points -= 1\n puts \"Battle! You lost a health point. You're down to #{ @health_points }.\"\n if @health_points <= 0\n @lives = @lives -= 1\n puts \"You lost a life! You now have #{ @lives } lives.\"\n if @lives <= 0\n puts \"You ran out of lives! Restarting game now.\"\n restart\n end #if-lives\n end #if health_points\n end",
"def tpm_check_failed_percentage=(value)\n @tpm_check_failed_percentage = value\n end",
"def forget_value(retractor)\n if @informant == retractor\n @has_value = false\n @value = false\n @informant = false\n @logger.debug(\"#{self} lost value\")\n others = (@constraints - [retractor])\n @logger.debug(\"Notifying #{others}\") unless others == []\n others.each { |c| c.lost_value(self) }\n 'ok'\n else\n @logger.debug(\"#{self} ignored request\")\n end\n end",
"def admin_reactivate\n user = User.find(params[:id])\n authorize! :edit, @user #prevent other users from disabling OTP on another user.\n user.deactivated = false\n user.save!\n flash[:notice] = \"Successfully Reactivated user.\"\n redirect_back(fallback_location: '/')\n end",
"def inactivate!\n self.update_attribute(:status, \"Inactive\")\n end",
"def need_change_password!\n if self.expire_password_after.is_a? Fixnum or self.expire_password_after.is_a? Float\n need_change_password\n self.save(:validate => false)\n end\n end",
"def reactivate\n @administrator.reactivate\n respond_to do |format|\n format.html { redirect_to %i[admin settings root], notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def storage_check_failed_percentage=(value)\n @storage_check_failed_percentage = value\n end",
"def on_failure status\n @failed_attempts += 1\n if @failed_attempts == @retries + 1\n begin\n @result = BulkWriterException.new status\n rescue StandardError => e\n raise BulkWriterOperationError, e\n ensure\n @completion_event.set\n end\n else\n backoff_duration\n end\n end",
"def check_off(verifier)\n if verifier != self.workshifter || verifer.role === 'Workshift Manager' || verifier.role === 'Unit-Level Admin'\n self.verifier = verifier\n self.status = \"complete\"\n self.sign_off_time = Time.zone.now # NEEDS TO BE FIXED PROBABLY\n gen_next_assignment\n self.save!\n end\n end",
"def each_ungraded_attempt(&block)\n ungraded_attempts.each(&block) \n end",
"def powerup(laser, is_shield)\n\t\t\n\t\tif is_shield\n\t\t\t@shields += 1\n\t\telsif laser == \"m\"\n\t\t\t3.times do\n\t\t\t\t@missles += 1\n\t\t\tend\n\t\t\n\t\telse\n\t\t\t#reloads the laser energy\n\t\t\t@laser_timeout = Time.now + $LaserPowerup\n\t\t\t\n\t\t\t#green is the highest you can't upgrade from there\n\t\t\tif @lasers != \"g\"\n\t\t\t\t@lasers = laser\n\t\t\tend\n\t\tend\n\tend",
"def invalid_status\n\t\tinvalid = false\n\t\tif self.status_changed?\n\t\t\tinvalid = self.status_was != \"active\"\n\t\tend\n\tend",
"def hit\n @health -= 1\n end",
"def hit\n @health -= 1\n end",
"def deactivate\n @administrator.deactivate\n respond_to do |format|\n format.html { redirect_to %i[admin settings root], notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def do_hold(last_check)\n if last_check.off?\n # If the status report says the Equipment is offline, try\n # resending the Task. If that doesn't work, fail and punt to the launcher.\n hold_failure! unless send_to_rhizome\n end\n end",
"def heal!\n @health_remaining = @max_health\n end",
"def status_restart!()\n @status = TAC_PLUS_AUTHEN_STATUS_RESTART\n end",
"def attempts=(value)\n doc['attempts'] = value.to_i\n end",
"def update_instance!\n\t\tself.last_attempted = Time.now\n\t\tself.save\n\tend",
"def failed(error = { base: ['lesson.unknown'] })\n return false if deactivated?\n self.status = 'failed'\n self.last_error = error\n notify_observers :after_fail if (suc = save)\n suc\n end",
"def retry_update(x, hash_code, was_uncontended); end",
"def update_usability_enable\n 8.times.each {|i| refresh_icons if @old_usability[i] != @actor.usability[i]}\n end",
"def inactive!\n @active.update { |_| false }\n end",
"def expired\n AssignmentNotifier.expired\n end",
"def update\n unavailable_method\n end",
"def update!(**args)\n @retry = args[:retry] if args.key?(:retry)\n end",
"def update!(**args)\n @retry = args[:retry] if args.key?(:retry)\n end",
"def inactivate\n self.status = \"Inactive\"\n end",
"def auto_update_status\n if self.criminal_date && self.child_abuse_date && self.fbi_date\n if self.status < 2\n self.status = 2\n end\n elsif self.status == 2\n self.status = 1\n end\n end",
"def time_is_up!\n Astute.logger.error \"Puppet agent took too long to run puppet task.\"\\\n \" Mark task as failed. #{task_details_for_log}\"\n self.task_status = 'failed'\n end",
"def mark_as_offensive\n self.update_attribute(:status, 1)\n end",
"def secure_boot_check_failed_percentage=(value)\n @secure_boot_check_failed_percentage = value\n end",
"def mark_as_failed!(error)\n self.error = error\n self.save!\n if error == \"InvalidRegistration\" or error == \"NotRegistered\"\n self.device.update_attribute(:unsubscribed_at, Time.now)\n end\n end",
"def successfull_attack_on(enemy)\n @successful_attacks[enemy.class] ||= 0\n @successful_attacks[enemy.class] += 1\n end",
"def disable_alerting=(value)\n start = Time.now\n debug \"Updating disable_alerting setting for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n resource[:description],\n resource[:properties],\n value)\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def reset!\n begin\n update!(:attempts => 0, :error => nil, :lock => nil, :run_at => Time.now.utc)\n rescue => e\n DataMapper.logger.warn(e)\n end\n end",
"def increment_failure_of(setting_name)\n self[setting_name][:failures] += 1\n\n current_profile = Profile.current\n increment_profile_failure_of(current_profile.name) if current_profile\n\n Sail.reset(setting_name) if self[setting_name][:failures] > Sail.configuration.failures_until_reset\n end",
"def update\n \t\t\t\t\t@active = User.find(session[:user_id]).try :touch\n respond_to do |format|\n if @encounters_type.update(encounters_type_params)\n format.html { redirect_to @encounters_type, notice: 'Encounters type was successfully updated.' }\n format.json { render :show, status: :ok, location: @encounters_type }\n else\n format.html { render :edit }\n format.json { render json: @encounters_type.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.52857697",
"0.52756804",
"0.50676745",
"0.4954168",
"0.49498412",
"0.4931652",
"0.49115565",
"0.48515567",
"0.48400283",
"0.48356387",
"0.48162517",
"0.47837314",
"0.4777499",
"0.47665495",
"0.47601292",
"0.47513783",
"0.4739015",
"0.47219634",
"0.47132018",
"0.47027725",
"0.46946368",
"0.4692861",
"0.46666983",
"0.46666983",
"0.46666983",
"0.46666983",
"0.4665742",
"0.46626562",
"0.46286017",
"0.46237406",
"0.46156496",
"0.46026698",
"0.45967126",
"0.4594121",
"0.4585761",
"0.45809987",
"0.45795864",
"0.4573826",
"0.45731038",
"0.4571318",
"0.45644373",
"0.4557446",
"0.45519763",
"0.45496023",
"0.4541613",
"0.4539354",
"0.4532664",
"0.45259628",
"0.4520754",
"0.45135778",
"0.45008162",
"0.4499273",
"0.44958204",
"0.44929647",
"0.4479511",
"0.44750312",
"0.4473878",
"0.44731608",
"0.44700542",
"0.4464983",
"0.44633916",
"0.4457067",
"0.4451232",
"0.4438282",
"0.44373018",
"0.44348705",
"0.44333225",
"0.44330007",
"0.4426817",
"0.44241014",
"0.44181773",
"0.441614",
"0.44158202",
"0.44149897",
"0.44149897",
"0.44080338",
"0.4403892",
"0.43945774",
"0.43925157",
"0.43872052",
"0.43764183",
"0.43686068",
"0.43629324",
"0.43625274",
"0.43563262",
"0.43494698",
"0.43470606",
"0.43354455",
"0.43354455",
"0.43340498",
"0.43281493",
"0.43151644",
"0.4308134",
"0.43029147",
"0.4302298",
"0.42996866",
"0.42939493",
"0.42866388",
"0.42799452",
"0.4276155"
] | 0.7389904 | 0 |
Convenience method to update the path value for the current type. Returns false if the health monitor is not enabled or not an http monitor, the new value if it succeeds, and raises an exception otherwise. | def path=(value)
return false unless @enabled && ['HTTP','HTTPS'].include?(self.type)
update(:type => self.type, :path => value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path=(new_path)\n super\n if new_path[0..0] != '/' # addressable adds a / but scp-style uris are altered by this behavior\n @path = path.sub(%r|^/+|,'')\n @normalized_path = nil\n validate\n end\n path\n end",
"def path=(new_path)\n location = self.class.new_location(conn_id, new_path, :default => :Root)\n if !location.path.empty?\n @location = location\n location_changed!\n end\n end",
"def path=(v)\n check_path(v)\n set_path(v)\n v\n end",
"def update(path, event_type = nil)\n path = Pathname(path).expand_path\n\n Watchr.debug(\"received #{event_type.inspect} event for #{path.relative_path_from(Pathname(Dir.pwd))}\")\n if path == @script.path && event_type != :accessed\n @script.parse!\n @handler.refresh(monitored_paths)\n else\n @script.action_for(path, event_type).call\n end\n end",
"def update(path, event_type = nil)\n path = Pathname(path).expand_path\n # p path, event_type\n if path == @script.path && ![ :load, :deleted, :moved ].include?(event_type)\n @script.parse!\n handler.refresh(monitored_paths)\n else\n begin\n @script.call_action_for(path, event_type)\n rescue Refresh => refresh\n handler.refresh(monitored_paths)\n end\n end\n end",
"def path=(new_path)\n begin\n self.dev_path = Sys::Filesystem.mount_point new_path\n @dev_stat = nil\n rescue SystemCallError\n self.dev_path = nil\n end\n super\n end",
"def munge(value)\n if value.is_a?(String) && value =~ /[\\\\\\/]$/\n @path_ends_with_slash = true\n end\n super\n end",
"def path=(value)\n @path = value\n end",
"def path=(value)\n @path = value\n end",
"def path=(value)\n @path = value\n end",
"def path=(value)\n @path = value\n end",
"def path=(new_path)\n @path = Pathname.new(new_path).expand_path\n end",
"def update_path!\n update_path(:force => true)\n end",
"def update\n @scan_path = ScanPath.find(params[:id])\n\n respond_to do |format|\n if @scan_path.update_attributes(params[:scan_path])\n format.html { redirect_to @scan_path, notice: 'Scan path was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scan_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @new_path = args[:new_path] if args.key?(:new_path)\n @path = args[:path] if args.key?(:path)\n end",
"def update!(**args)\n @new_path = args[:new_path] if args.key?(:new_path)\n @path = args[:path] if args.key?(:path)\n end",
"def set(path, value)\n\n # Verify.\n path = Path.new(path) unless path.kind_of?(Path)\n meta = meta_walk(path)\n if meta and meta.kind_of?(Hash)\n raise Error.new(Error::WrongType, path) if meta[:dir]\n if (t = meta[:type])\n value = convert_to(value, t, path) unless value.kind_of?(t)\n end\n else\n value = value.to_s\n end\n\n # Perform the set.\n key = path.pop\n mmap, cmap = dir_walk(path, DW_Create)\n oldval = cmap[key]\n if (hook = mmap[:on_change])\n value = hook.call(HookSet, cmap, key, oldval, value) || value\n end\n if oldval.respond_to?(:replace): oldval.replace(value)\n else cmap[key] = value end\n [TypeItem, path, key, value]\n\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n end",
"def []=(path,value)\n set(path, value)\n end",
"def path=(path)\n @path = to_pathname(path)\n end",
"def path=(path)\n @path= path\n end",
"def update(options={})\n data = Hash.new\n data[:type] = options[:type].upcase if options[:type]\n data[:delay] = options[:delay] if options[:delay]\n data[:timeout] = options[:timeout] if options[:timeout]\n data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]\n data[:type].upcase! if data[:type]\n if ['HTTP','HTTPS'].include?(data[:type])\n data[:path] = options[:path] if options[:path]\n data['statusRegex'] = options[:status_regex] if options[:status_regex]\n data['bodyRegex'] = options[:body_regex] if options[:body_regex]\n end\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor\",@lbmgmtport,@lbmgmtscheme,{},data.to_json)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n populate\n true\n end",
"def is_path?(); @type == GRT_PATH; end",
"def set_path(v)\n @path = v\n end",
"def path(v)\n endpoint_info[:path] = v\n end",
"def update_uptime_check_config config_name: nil,\n new_display_name: nil,\n new_http_check_path: nil\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n config = { name: config_name }\n field_mask = { paths: [] }\n unless new_display_name.to_s.empty?\n field_mask[:paths].push \"display_name\"\n config[:display_name] = new_display_name\n end\n unless new_http_check_path.to_s.empty?\n field_mask[:paths].push \"http_check.path\"\n config[:http_check] = { path: new_http_check_path }\n end\n client.update_uptime_check_config uptime_check_config: config,\n update_mask: field_mask\nend",
"def configure path, value, status = 'Unknown'\n if path[0] == \"net\" && path[1] == 'e0'\n @e0 = true\n end\n end",
"def update_current_metric_value\n\n # Find the ID of the most recent metric for this node and path.\n most_recent_metric = Metric.where(:node_id => node_id).where(:path => path).sort(:timestamp.desc).limit(1).first\n if !most_recent_metric.blank? && most_recent_metric.id == id\n\n # We are the most recent metric of this type, create or update the\n # current metric value.\n conditions = { :node_id => node_id, :path => path }\n value = { :node_id => node_id, :path => path, :counter => counter }\n Sherlock::Models::CurrentMetric.collection.update(conditions, value, :upsert => true)\n\n end\n\n end",
"def path=( value )\n self.path_matcher = self.class.compile_matcher value\n super( value )\n end",
"def update(path:, value_type: nil, value: nil, label:nil, name: nil, company_id: nil)\n param = get_by_name(path: path)\n raise \"Undefined params by path #{path}\" unless param.present?\n data = get_inner_by_path path: path, data: param.data\n data_wrapper = get_parent_by_path path: path, data: param.data\n\n unless name.nil?\n old_name = path.split('.').last\n param.name = name if path.split('.').size == 1\n data_wrapper[name] = data\n data_wrapper.delete old_name\n data = data_wrapper[name]\n end\n\n param.company_id = company_id unless company_id.nil?\n\n unless value_type.nil?\n data['value'] = Param.default_value value_type unless data['value_type'] == value_type\n data['value_type'] = value_type\n end\n\n data['value'] = value unless value.nil?\n data['label'] = label unless label.nil?\n param.save!\n end",
"def notify_path(path)\n @blk.call(:path, path, self.class::EXT)\n @path_notified = true\n end",
"def update\n @hdfs_path = HdfsPath.find(params[:id])\n\n respond_to do |format|\n if @hdfs_path.update_attributes(params[:hdfs_path])\n format.html { redirect_to @hdfs_path, notice: 'Hdfs path was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hdfs_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @path_count = args[:path_count] if args.key?(:path_count)\n end",
"def update_path\n update_column :path, file.url unless url?\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n @storage_class = args[:storage_class] if args.key?(:storage_class)\n end",
"def []=(path, value)\n path = Path.new(path) unless path.kind_of?(Path)\n key = path.pop\n mmap, cmap = dir_walk(path, DW_Create)\n oldval = cmap[key]\n hook = mmap[:on_change] and value = hook.call(HookSet, cmap, key, oldval, value) || value\n if oldval.respond_to?(:replace)\n oldval.replace(value)\n oldval\n else\n cmap[key] = value\n value\n end\n end",
"def set_path(path)\n path\n end",
"def set_new_value(path, located_entry)\n aug.set(path, located_entry.entry_value)\n # we need to get new path as path used in aug.set can contains\n # \"[last() + 1]\", so adding subtree to it, adds additional entry.\n # So here, we replace \"[last() + 1]\" with \"[last()]\" so it will match\n # path created by previous aug.set\n match_str = path.gsub(/\\[\\s*last\\(\\)\\s*\\+\\s*1\\]/, \"[last()]\")\n\n new_path = aug.match(match_str).first\n add_subtree(located_entry.entry_tree, new_path)\n end",
"def set_string_for(type) # rubocop:disable AccessorMethodName, AbcSize\n Chef::Log.info \"Update #{new_resource} String '#{type}'\"\n load_balancer.client['LocalLB.Monitor']\n .set_template_string_property([new_resource.monitor_name],\n [{ 'type' => type,\n 'value' => new_resource.user_values[type] }])\n current_resource.user_values(current_resource.user_values.merge(type => new_resource.user_values[type]))\n end",
"def update\n respond_to do |format|\n if @device_type.update(device_type_params)\n format.html { redirect_to browse_url(protocol: redirect_protocol), notice: 'Device type was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_type }\n else\n format.html { render :edit }\n format.json { render json: @device_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @storage_type.update(storage_type_params)\n format.html { redirect_to @storage_type, notice: 'Storage type was successfully updated.' }\n format.json { render :show, status: :ok, location: @storage_type }\n else\n format.html { render :edit }\n format.json { render json: @storage_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set(path, value, repair=false)\n raise WAB::Error, 'path can not be empty.' if path.empty?\n if value.is_a?(WAB::Data)\n value = value.native\n elsif repair\n value = fix_value(value)\n else\n validate_value(value)\n end\n node = @root\n Utils.set_value(node, path, value)\n end",
"def update\n @path = Path.find(params[:id])\n\n respond_to do |format|\n if @path.update_attributes(params[:path])\n format.html { redirect_to([@layer, @path], :notice => 'Path was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @path.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def path=(path)\n @path = File.expand_path(path)\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n @state = args[:state] if args.key?(:state)\n end",
"def path(path = nil, &block)\n return @path unless path\n @path = path\n if PATH_PARAMETER_REGEX.match path\n set_path_parameters(path, &block)\n elsif block_given?\n raise 'A path block was provided but no URL parameter was found.'\n end\n end",
"def path= x\n case x\n when XPath\n when String\n x = XPath.new(:string => x)\n else\n raise TypeError, \"path=: expected XPath or String, given #{x.class.name}\"\n end\n @path = x\n end",
"def path=(p)\n @path = p\n end",
"def monitor\n was_changed = false\n new_state = nil\n self_stat = File.lstat(@path) rescue nil\n if self_stat == nil\n new_state = FileStatEnum::NON_EXISTING\n @files = nil\n @dirs = nil\n @cycles = 0\n elsif @files == nil\n new_state = FileStatEnum::NEW\n @files = Hash.new\n @dirs = Hash.new\n @cycles = 0\n update_dir\n elsif update_dir\n new_state = FileStatEnum::CHANGED\n @cycles = 0\n else\n new_state = FileStatEnum::UNCHANGED\n @cycles += 1\n if @cycles >= @stable_state\n new_state = FileStatEnum::STABLE\n end\n end\n\n # The assignment\n self.state= new_state\n end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def is_pathport?(); @type == GRT_PATHPORT; end",
"def path= (input_path)\n @path = input_path\n update_files\n @path\n end",
"def update!(**args)\n @mount_point = args[:mount_point] if args.key?(:mount_point)\n @path = args[:path] if args.key?(:path)\n @server = args[:server] if args.key?(:server)\n end",
"def path_is?(path)\n @location.path_is?(path)\n end",
"def update_path(path)\n return path_nodes(path).insert(1, \"data\").join(\"/\") if path_nodes(path)[1] != \"data\"\n\n path\n end",
"def set!(path, value)\n setProperty path, value\n save if respond_to? :save # Only Configuration can save\n value\n end",
"def is_pathtype?(); @type == GRT_PATHTYPE; end",
"def set_path(path)\n @path = path\n end",
"def update\n respond_to do |format|\n if @health_level.update_attributes(params[:health_level])\n format.html { redirect_to @health_level, notice: 'Health level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @health_level.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invalidate_path\n @path_calculated = false\n @path = nil\n @path_index = 0\n end",
"def update!(**args)\n @visited_type = args[:visited_type] if args.key?(:visited_type)\n end",
"def path=(path)\n path = \"#{path}/\" unless path[path.size - 1, 1] == '/'\n @paths = { :default => path }\n end",
"def update\n if @low_type.update(low_type_params)\n render :show, status: :ok, location: @low_type\n else\n render json: @low_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @health_status.update(health_status_params)\n format.html { redirect_to @health_status, notice: 'Health status was successfully updated.' }\n format.json { render :show, status: :ok, location: @health_status }\n else\n format.html { render :edit }\n format.json { render json: @health_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @location_type = args[:location_type] if args.key?(:location_type)\n end",
"def update!(**args)\n @path = args[:path] if args.key?(:path)\n @port = args[:port] if args.key?(:port)\n end",
"def update\n respond_to do |format|\n if @route_type.update(route_type_params)\n format.html { redirect_to @route_type, notice: 'Route type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setstat(path, attrs)\n send_request(FXP_SETSTAT, :string, path, :raw, attribute_factory.new(attrs).to_s)\n end",
"def update\n @title = t('view.hierarchies.edit_title')\n @hierarchy = Hierarchy.find(params[:id])\n\n if @hierarchy.update_attributes(params[:hierarchy])\n redirect_to [:configs, @hierarchy],\n notice: t('view.hierarchies.correctly_updated')\n else\n render action: 'edit'\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_configs_hierarchy_url(@hierarchy),\n alert: t('view.hierarchies.stale_object_error')\n end",
"def update_path_and_ip\n raise ArgumentError, \"container handle must not be nil\" unless @handle\n\n request = ::Warden::Protocol::InfoRequest.new(:handle => @handle)\n response = call(:info, request)\n\n raise RuntimeError, \"container path is not available\" unless response.container_path\n @path = response.container_path\n @host_ip = response.host_ip\n\n response\n end",
"def set_integer_for(type, value)\n load_balancer.client['LocalLB.Monitor']\n .set_template_integer_property([new_resource.monitor_name],\n [{ 'type' => type, 'value' => value }])\n end",
"def []=(path, value)\n path = path.split('/')\n hash = dsearch(path[0..-2])\n\n hash[path[-1]] = value\n end",
"def update\n respond_to do |format|\n if @type_report.update(type_report_params)\n format.html { redirect_to @type_report, notice: 'Type report was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_report }\n else\n format.html { render :edit }\n format.json { render json: @type_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_path(path)\n raise NotImplementedError, \"Implement in each subclass\"\n end",
"def apply(remaining_path, enum, resolved_path)\n raise NotImplementedError\n end",
"def update\n @media_path = MediaPath.find(params[:id])\n\n respond_to do |format|\n if @media_path.update_attributes(params[:media_path])\n flash[:notice] = 'MediaPath was successfully updated.'\n format.html { redirect_to({:controller=>:rmedial_settings, :action=>:index}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @media_path.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_status(new_status)\n raise ArgumentError.new\"Invalid Status\" unless new_status == :AVAILABLE || new_status == :UNAVAILABLE\n @status = new_status\n end",
"def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"def update\n respond_to do |format|\n if @type_of_value.update(type_of_value_params)\n format.html { redirect_to @type_of_value, notice: 'Type of value was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_of_value }\n else\n format.html { render :edit }\n format.json { render json: @type_of_value.errors, status: :unprocessable_entity }\n end\n end\n end",
"def config_path=(value)\n @config_path = value\n end",
"def changes_at_path?(path)\n raise NotImplementedError\n end",
"def http_prop_patch(request, response)\n path = request.path\n\n begin\n prop_patch = @server.xml.expect('{DAV:}propertyupdate', request.body)\n rescue Tilia::Xml::ParseException => e\n raise Exception::BadRequest, e.message, nil, e\n end\n\n new_properties = prop_patch.properties\n\n result = @server.update_properties(path, new_properties)\n\n prefer = @server.http_prefer\n response.update_header('Vary', 'Brief,Prefer')\n\n if prefer['return'] == 'minimal'\n # If return-minimal is specified, we only have to check if the\n # request was succesful, and don't need to return the\n # multi-status.\n ok = true\n result.each do |_prop, code|\n ok = false if code.to_i > 299\n end\n\n if ok\n response.status = 204\n return false\n end\n end\n\n response.status = 207\n response.update_header('Content-Type', 'application/xml; charset=utf-8')\n\n # Reorganizing the result for generateMultiStatus\n multi_status = {}\n result.each do |property_name, code|\n if multi_status.key?(code)\n multi_status[code][property_name] = nil\n else\n multi_status[code] = { property_name => nil }\n end\n end\n multi_status['href'] = path\n\n response.body = @server.generate_multi_status([multi_status])\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end",
"def setstat!(path, attrs, &callback)\n wait_for(setstat(path, attrs, &callback))\n end",
"def []=(path, value)\n ffi_delegate.put(path.to_s, value.to_s)\n end",
"def path(value = nil)\n @path = value if value\n\n return @path if @path\n\n superclass.respond_to?(:path) ? superclass.path : nil\n end",
"def update\n @image_path = ImagePath.find(params[:id])\n\n respond_to do |format|\n if @image_path.update_attributes(params[:image_path])\n flash[:notice] = 'ImagePath was successfully updated.'\n format.html { redirect_to(@image_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image_path.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @metric_type = MetricType.find(params[:id])\n\n respond_to do |format|\n if @metric_type.update_attributes(params[:metric_type])\n format.html { redirect_to(@metric_type, :notice => 'Metric type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @metric_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def path?\n !!@path\n end",
"def path?\n !!@path\n end",
"def update!(**args)\n @subpath = args[:subpath] if args.key?(:subpath)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n @url = args[:url] if args.key?(:url)\n end"
] | [
"0.5558059",
"0.54584795",
"0.5338232",
"0.53381765",
"0.5329982",
"0.5273695",
"0.5248962",
"0.522556",
"0.51991975",
"0.51991975",
"0.51991975",
"0.5161691",
"0.5122184",
"0.50500774",
"0.50167704",
"0.50167704",
"0.50096226",
"0.49993393",
"0.49993393",
"0.49993393",
"0.49993393",
"0.49973878",
"0.49910194",
"0.49678156",
"0.49673814",
"0.49542382",
"0.49509928",
"0.49495563",
"0.49468407",
"0.4936477",
"0.492299",
"0.49103183",
"0.48994082",
"0.48925376",
"0.48800248",
"0.48618278",
"0.48606175",
"0.48446298",
"0.4776365",
"0.47499824",
"0.47372663",
"0.47227088",
"0.47098237",
"0.46906874",
"0.46893764",
"0.46789533",
"0.46764258",
"0.46736002",
"0.46605045",
"0.46597505",
"0.46559837",
"0.46513015",
"0.4647094",
"0.4647094",
"0.4647094",
"0.4647094",
"0.4647094",
"0.4647094",
"0.46296388",
"0.46277156",
"0.46270728",
"0.46260428",
"0.46088555",
"0.46044514",
"0.4597882",
"0.45977044",
"0.4587552",
"0.45690808",
"0.45608985",
"0.45517293",
"0.45447147",
"0.4540974",
"0.45406616",
"0.4520018",
"0.45167348",
"0.44900593",
"0.44870776",
"0.44867256",
"0.44829375",
"0.44800153",
"0.44747782",
"0.4474715",
"0.44703504",
"0.44652495",
"0.44587418",
"0.44497007",
"0.44497007",
"0.44464585",
"0.44460943",
"0.44412524",
"0.4438244",
"0.44296366",
"0.4426111",
"0.44193467",
"0.44174036",
"0.44149125",
"0.44100302",
"0.44100302",
"0.44081157",
"0.44065246"
] | 0.65689397 | 0 |
Convenience method to update the delay value for the current type. Returns false if the health monitor is not enabled or is not an http monitor, the new value if it succeeds, and raises an exception otherwise. | def status_regex=(value)
return false unless @enabled && ['HTTP','HTTPS'].include?(self.type)
update(:type => self.type, :status_regex => value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delay=(value)\n return false unless @enabled\n update(:type => self.type, :delay => value)\n end",
"def delay=(value)\n\t\t\t@delay = value\n\t\tend",
"def delay=(value)\n\t\t\t@delay = value\n\t\tend",
"def delay(value)\n model.delay = value\n end",
"def delay(value)\n model.delay = value\n end",
"def delay=(sec)\n raise ArgumentError, 'Delay sec can not be a negative number.' if sec.to_f < 0\n @delay = sec.to_f\n end",
"def delay\n @delay ||= 600\n end",
"def delay_time=(seconds)\n end",
"def delay\n @delay || initial_delay\n end",
"def set_delay(delay)\n @delay = delay\n end",
"def watch_delay\n @conn.watch(Web.keys[:delay]) do\n yield if block_given?\n end\n end",
"def delay\n self['Delay'].to_i || 0\n end",
"def delay\n @delay || initial_delay\n end",
"def delay_ms(ms)\n @delay_ms = ms\n end",
"def default_delay=(v)\n @@default_delay = v\n end",
"def timeout=(value)\n return false unless @enabled\n update(:type => self.type, :timeout => value)\n end",
"def increment_delay!\n @delay = [delay * multiplier, max_delay].min\n end",
"def delay\n if @delay_den != 0\n @delay_num/@delay_den\n else\n @delay_num/100\n end\n end",
"def delay(input, val=nil)\n raise ArgumentError unless (0..31) === input\n input = input.to_i\n reg = input / DELAYS_PER_REG\n shift = (input % DELAYS_PER_REG) * BITS_PER_DELAY\n regval = send(\"delay_#{reg}\")\n if val\n regval &= ~( DELAY_MASK << shift)\n regval |= ((DELAY_MASK & val) << shift)\n send(\"delay_#{reg}=\", regval)\n self\n else\n (regval >> shift) & DELAY_MASK\n end\n end",
"def increment_delay!\n @delay = [delay * multiplier, max_delay].min\n end",
"def delay=(d)\n raise ArgumentError, 'delay must be greater than or equal to 0' if Integer(d) < 0\n\n @images.each { |f| f.delay = Integer(d) }\n end",
"def set_timeout(value)\n if value.nil?\n @timeout = 2\n else\n return skip_resource 'timeout is not numeric' unless value.to_s =~ /^\\d+$/\n @timeout = value\n end\n end",
"def with_delay(delay, &block)\n # Delay should be either an integer or a range of integers.\n if (delay.is_a?(Numeric))\n raise(ArgumentError, \"Delay should be a non-negative number; got #{delay}!\") unless delay >= 0\n delay = delay..delay\n elsif delay.is_a?(Range)\n raise(ArgumentError, \"Range members should be numbers; got #{delay}!\") unless delay.first.is_a?(Numeric) && delay.last.is_a?(Numeric)\n raise(ArgumentError, \"Range members should be non-negative; got #{delay}!\") unless delay.first >= 0 && delay.last >= 0\n raise(ArgumentError, \"Range's end should be greater than or equal to range's start; got #{delay}!\") unless delay.first <= delay.last\n else\n raise(ArgumentError, \"Delay should be either an number or a range of numbers; got #{delay}!\")\n end\n raise(ArgumentError, 'Delay policy has already been specified!') if @delay_policy\n @delay_policy = lambda{Kernel.sleep(delay.first + rand(delay.count))}\n\n attempt(block)\n end",
"def sleep\n @property_hash['sleep'] || 0\n end",
"def update(options={})\n data = Hash.new\n data[:type] = options[:type].upcase if options[:type]\n data[:delay] = options[:delay] if options[:delay]\n data[:timeout] = options[:timeout] if options[:timeout]\n data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]\n data[:type].upcase! if data[:type]\n if ['HTTP','HTTPS'].include?(data[:type])\n data[:path] = options[:path] if options[:path]\n data['statusRegex'] = options[:status_regex] if options[:status_regex]\n data['bodyRegex'] = options[:body_regex] if options[:body_regex]\n end\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor\",@lbmgmtport,@lbmgmtscheme,{},data.to_json)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n populate\n true\n end",
"def sleep? module_name = nil, refresh_delay = 60 # {{{\n\n # Pre-condition check # {{{\n raise ArgumentError, \"Module name cannot be nil, but it is\" if( module_name.nil? )\n raise ArgumentError, \"Module name should be of type string, but it is (#{module_name.class.to_s})\" unless( module_name.is_a?(String) )\n # }}}\n\n # Main\n sleep_time = 60 # make sure we always wait 60 s if we get no valid feedback\n\n website = Website.first( :name => module_name )\n\n # We have never accessed this website so we need to create an initial DB entry\n if( website.nil? )\n new = Website.new\n new.name = module_name\n new.last_access = Time.now\n new.save!\n website = new\n end\n\n last_access = Time.parse( website.last_access.to_s )\n\n raise ArgumentError, \"last_access cannot be nil\" if( last_access.nil? )\n raise ArgumentError, \"last_access needs to be of type Time, but is (#{last_access.class.to_s})\" unless( last_access.is_a?( Time ) )\n\n now = Time.now\n diff = ( now - last_access ).to_i\n\n @log.message :debug, \"Sleep function result is - Now (#{now.to_s}) - Last Access (#{last_access.to_s}) - Mandatori Refresh Delay (#{refresh_delay.to_s}) - Now-Last (#{diff.to_s}) - Sleep (#{diff.to_s})\"\n\n sleep_time = ( diff > refresh_delay ) ? ( 0 ) : ( refresh_delay - diff )\n\n # Post-condition check\n raise ArgumentError, \"Result of this function is supposed to be of type integer, but is (#{sleep_time.class.to_s})\" unless( sleep_time.is_a?(Integer) )\n\n sleep_time\n end",
"def delay_time\n return (self.aggressive == false ? 0 : (15 - self.aggressive) * 3)\n end",
"def pickup_delay=(v) self['PickupDelay'] = v end",
"def get_delay\n return @retry_timeout unless @retry_timeout.nil?\n\n if !response.nil? && !response.headers['Retry-After'].nil?\n return response.headers['Retry-After'].to_i\n end\n\n return AsyncOperationStatus::DEFAULT_DELAY\n end",
"def ensure=(value)\n debug \"Waiting for host '#{@resource[:name]}' to change status to '#{value}'\"\n @resource[:count].times do\n return if status == value\n sleep @resource[:step]\n end\n fail \"Timeout waiting for host '#{@resource[:name]}' status to become '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def delay_sanitize\n \tself.delay ||= 0\n end",
"def default_delay\n @@default_delay ||= 0\n end",
"def should_delay?\n @class == FaviconParty::Curl::DNSError\n end",
"def idle_delay(arg = nil)\n set_or_return(:idle_delay, arg, kind_of: Integer)\n end",
"def delay_time\n end",
"def sleep_if_set\n sleep_sec = config[:sleep].to_i\n if sleep_sec > 0\n info(\"Sleep #{config[:sleep]} seconds...\")\n sleep sleep_sec\n end\n end",
"def delay! seconds\n @delay_received << seconds\n end",
"def set_queue_delay\n new_delay = params[:delay].to_f\n if new_delay == 0\n head :bad_request\n else\n Rails.application.config.queue_delay = new_delay\n render :get_queue_delay\n end\n end",
"def sleep_value\n 20\n end",
"def delayed_update\n self.delay.update_metrics!\n end",
"def _libnotify_urgency(type)\n case type\n when 'failed'\n :normal\n else\n :low\n end\n end",
"def delay(seconds); end",
"def delay(seconds); end",
"def await_event(type=\"Scaleout\", delay=120)\n des = description.desired_capacity\n result = false\n count = 0\n Log.log \"Awaiting #{type}... \", newline: false\n while count < delay && !result\n s = summary\n result = (s[:size] == des && s[:in_service] && s[:healthy])\n sleep 1\n count += 1\n end\n Log.log \"done\", timestamp: false\n Log.log \"Summary: #{summary.inspect}\"\n end",
"def setJavascriptDelay(delay)\n if (!(Integer(delay) >= 0))\n raise Error.new(Pdfcrowd.create_invalid_value_message(delay, \"setJavascriptDelay\", \"html-to-image\", \"Must be a positive integer number or 0.\", \"set_javascript_delay\"), 470);\n end\n \n @fields['javascript_delay'] = delay\n self\n end",
"def delay(mode)\n if mode == @mode\n d = @deadline - Time.now\n d = 0 if d < 0 # No negative delays\n @deadline += @delay\n block_given? ? yield(d) : d\n end\n end",
"def set_duration(type, duration)\r\n if $g_os_type == :win32_system\r\n @duration_win[type] = Sound::ASYNC\r\n if duration == :loop\r\n @duration_win[type] = Sound::ASYNC|Sound::LOOP\r\n end\r\n end\r\n if $g_os_type == :linux\r\n @duration_linux[type] = duration\r\n end\r\n \r\n end",
"def standbydelay\n return nil unless @property_hash.has_key? 'standbydelay'\n\n @property_hash['standbydelay'].to_i\n end",
"def default_delay\n 0.seconds\n end",
"def operation_delay\n begin\n if $ITEST2_OPERATION_DELAY && $ITEST2_OPERATION_DELAY > 0 &&\n $ITEST2_OPERATION_DELAY && $ITEST2_OPERATION_DELAY < 30000 then # max 30 seconds\n sleep($ITEST2_OPERATION_DELAY / 1000)\n end\n\n while $ITEST2_PAUSE\n debug(\"Paused, waiting ...\")\n sleep 1\n end\n rescue => e\n puts \"Error on delaying: #{e}\"\n # ignore\n end\n end",
"def delay\n val = (self['min-time']/1000.0/60.0)\n val < 1 ? val.round(1) : val.round\n end",
"def lock_on_sleep= value\n put_settings(get_settings.tap {|s| s[:lock_on_sleep] = value ? 1 : 0})\n end",
"def delay\n sleep(2)\n end",
"def sleep_for\n @sleep_for ||= 5\n end",
"def delay\n \"%3d days %2d hours %2d minutes %2d seconds\" % distance_of_time_as_array( timestamp_device, timestamp_server)\n end",
"def calculate_sleep\n if @timeouts.empty?\n @sleep_for = DefaultSleepFor\n else\n diff = @timeouts.first.value.timeout_at.to_f - Time.now.to_f\n\n if diff < 0.0\n @sleep_for = 0\n else\n @sleep_for = diff\n end\n end\n end",
"def update(name, mon_type, interval, timeout, max_retries,\n method: nil,\n url: nil,\n expect_code: nil,\n port: nil, **opts)\n\n self._set('slb.hm.update', name, mon_type, interval, timeout, max_retries,\n method: method,\n url: url,\n expect_code: expect_code,\n port: port, **opts)\n end",
"def wfs_delay\n (datastore['WfsDelay'] || 0).to_i\n end",
"def set_SleepTimeEnabled(value)\n set_input(\"SleepTimeEnabled\", value)\n end",
"def minretrydelay=(retry_delay)\r\n\t\t\t`#{BITS::BITSADMIN} /setminretrydelay {#{@id}} #{retry_delay}`\r\n\t\tend",
"def sleep_for=(seconds)\n seconds ||= 0\n if Integer === seconds && seconds >= 0\n @sleep_for = seconds\n else\n raise ArgumentError, \"argument must be nil or an integer >= 0\"\n end\n end",
"def sub_delay _value, _abs=0\n send_cmd(\"sub_delay #{_value} #{_abs}\")\n end",
"def check(type)\n if config[type]\n send(type, \"Unix socket backlog value (#{@data}) [#{config[:socket]}]\") if (below?(type) || above?(type))\n end\n end",
"def resolve_retry_delay(delay)\n if delay.respond_to?(:queue_retry_delay)\n resolve_retry_delay(delay.queue_retry_delay)\n elsif delay.is_a?(Integer) # numerical\n delay\n else # default\n Backburner.configuration.retry_delay\n end\n end",
"def delay(time)\n @context.backend.delay(time)\n end",
"def delay; end",
"def delay; end",
"def delay; end",
"def delayed?\n @delayed\n end",
"def delay_1() sleep(3) end",
"def delayed\n NotImplementedError\n end",
"def giveUp(timeDelay)\n @delayTime = timeDelay.abs.to_i\n @timerField = NSTextField.alloc.initWithFrame([[0, 0], [40, 20]])\n .tap do |obj| # origin will be set later\n obj.bordered = false\n obj.drawsBackground = false\n obj.font = NSFont.fontWithName('Menlo Bold', size: 12) # mono-spaced\n obj.editable = false\n obj.selectable = false\n obj.alignment = NSTextAlignmentCenter\n obj.toolTip = 'time remaining'\n end unless defined?(@timerField)\n end",
"def stale(value)\n unless (['ok', 'update_after'].include?(value.to_s))\n raise \"View#stale can only be set with 'ok' or 'update_after'.\"\n end\n update_query(:stale => value.to_s)\n end",
"def timeout_ms=(value)\n Curl.set_option(:timeout_ms, value_for(value, :int), handle)\n end",
"def persistent_delay\n get_config_value(:persistent_delay, 5)\n end",
"def set_animation_delay(key, delay)\r\n anim = AnimationManager.get_anim key\r\n anim.delay = delay\r\n end",
"def wait_time(value)\n define_singleton_method(:wait_time_value) { value }\n private_class_method :wait_time_value\n end",
"def timeout?(value)\n value.is_a? Pinglish::TooLong\n end",
"def update_uptime_check_config config_name: nil,\n new_display_name: nil,\n new_http_check_path: nil\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n config = { name: config_name }\n field_mask = { paths: [] }\n unless new_display_name.to_s.empty?\n field_mask[:paths].push \"display_name\"\n config[:display_name] = new_display_name\n end\n unless new_http_check_path.to_s.empty?\n field_mask[:paths].push \"http_check.path\"\n config[:http_check] = { path: new_http_check_path }\n end\n client.update_uptime_check_config uptime_check_config: config,\n update_mask: field_mask\nend",
"def sleep(dur=0) end",
"def setTimer\n return NSTimer.timerWithTimeInterval( 1.0,\n target: self,\n selector: 'updateCountdown:',\n userInfo: nil,\n repeats: true )\n .tap do |timer|\n @countdown = @delayTime\n @timerField.stringValue = @countdown.to_int.to_s\n end if @delayTime > 1\n nil\n end",
"def update!(**args)\n @not_after_sec = args[:not_after_sec] if args.key?(:not_after_sec)\n @status_code = args[:status_code] if args.key?(:status_code)\n end",
"def retry_delay\n 30\n end",
"def set_url_status\n self.update_attribute(:dead, true) unless self.url_active?\n end",
"def keep_alive_rate=(value)\n @keep_alive_rate = validate!(:keep_alive_rate, value)\n end",
"def [](key)\n delay = data[key]\n delay ? delay.value! : nil\n end",
"def delay(seconds)\n sleep(seconds)\n end",
"def delay_seconds\n seconds = nil\n if delay = @delay || @config_delay\n min_delay = max_delay = nil\n if delay =~ /([\\d]+)\\.\\.([\\d]+)/\n min_delay = Regexp.last_match[1].to_i\n max_delay = Regexp.last_match[2].to_i\n elsif delay.to_i.to_s == delay\n min_delay = max_delay = delay.to_i\n end\n if min_delay && max_delay\n seconds = rand(max_delay - min_delay + 1) + min_delay\n end\n end\n seconds || 0\n end",
"def timeout=(value)\n @transfer[:timeout] = value\n end",
"def set_integer_for(type, value)\n load_balancer.client['LocalLB.Monitor']\n .set_template_integer_property([new_resource.monitor_name],\n [{ 'type' => type, 'value' => value }])\n end",
"def page_delay\n if $TESTWISE_PAGE_DELAY && $TESTWISE_PAGE_DELAY.to_i > 0 && $TESTWISE_PAGE_DELAY.to_i < 100\n sleep $TESTWISE_PAGE_DELAY.to_i\n end \n end",
"def ensure=(value)\n debug \"Call: ensure=(#{value})\"\n debug \"Waiting for HAProxy backend: '#{@resource[:name]}' to change its status to: '#{value}'\"\n @resource[:count].times do\n stats_reset\n if self.status == value\n debug get_haproxy_debug_report\n return true\n end\n sleep @resource[:step]\n end\n debug get_haproxy_debug_report\n fail \"Timeout waiting for HAProxy backend: '#{@resource[:name]}' status to become: '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def os_boot_watchdog_timer=(os_boot_watchdog_timer)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(os_boot_watchdog_timer)\n fail ArgumentError, \"invalid value for \\\"os_boot_watchdog_timer\\\", must be one of #{validator.allowable_values}.\"\n end\n @os_boot_watchdog_timer = os_boot_watchdog_timer\n end",
"def os_boot_watchdog_timer_timeout=(os_boot_watchdog_timer_timeout)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"5-minutes\", \"10-minutes\", \"15-minutes\", \"20-minutes\"])\n unless validator.valid?(os_boot_watchdog_timer_timeout)\n fail ArgumentError, \"invalid value for \\\"os_boot_watchdog_timer_timeout\\\", must be one of #{validator.allowable_values}.\"\n end\n @os_boot_watchdog_timer_timeout = os_boot_watchdog_timer_timeout\n end",
"def gateway_retry_delay\n delay = @options &&\n (\n @options[:gateway_retry_delay] ||\n @options['gateway_retry_delay']\n )\n delay.nil? ? 1.0 : delay.to_f\n end",
"def gateway_retry_delay\n delay = @options &&\n (\n @options[:gateway_retry_delay] ||\n @options['gateway_retry_delay']\n )\n delay.nil? ? 1.0 : delay.to_f\n end",
"def update_status(type, state)\n if [:auth, :api, :router, :broker].include?(type)\n case state\n when :connected\n if @agent.mode == :http\n # Require connectivity to both API and router to be considered fully connected\n status = @agent.client.status\n if status[:api] == :connected && status[:router] == :connected\n RightScale::Sender.instance.disable_offline_mode\n end\n else\n RightScale::Sender.instance.disable_offline_mode\n end\n when :disconnected\n RightScale::Sender.instance.enable_offline_mode\n when :failed\n RightScale::Log.error(\"RightNet connectivity failure for #{type}, need to re-enroll\")\n # Randomize when re-enroll to prevent possibly having multiple instances do so simultaneously\n EM.add_timer(rand(MAX_REENROLL_DELAY)) { RightScale::ReenrollManager.reenroll! }\n when :authorized, :unauthorized, :expired, :closing\n else\n RightScale::Log.error(\"Unrecognized state for #{type}: #{state}\")\n end\n end\n true\n end",
"def update!(**args)\n @timeout = args[:timeout] if args.key?(:timeout)\n end",
"def follow_on_delay\n default_delay\n end",
"def sleep_time\n\t\t\t# TODO: Hard-coded for now. See doc/app_manager.rdoc for some\n\t\t\t# thoughts on this.\n\t\t\t1\n\t\tend",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end"
] | [
"0.6881016",
"0.60747814",
"0.60747814",
"0.58633035",
"0.58633035",
"0.5763408",
"0.5615827",
"0.5606361",
"0.56048846",
"0.559388",
"0.55915123",
"0.5565341",
"0.5530756",
"0.53681034",
"0.5338312",
"0.5326239",
"0.53157055",
"0.5288863",
"0.52751464",
"0.5271809",
"0.524035",
"0.5239089",
"0.5208068",
"0.51461947",
"0.51343435",
"0.51033723",
"0.4965779",
"0.4962296",
"0.49607956",
"0.49056527",
"0.48917484",
"0.48844063",
"0.48639974",
"0.48635828",
"0.4854043",
"0.48527047",
"0.4851292",
"0.48198846",
"0.48172802",
"0.4796337",
"0.47853142",
"0.47576928",
"0.47576928",
"0.47500327",
"0.4749988",
"0.4746711",
"0.47390896",
"0.4737015",
"0.47202095",
"0.47157803",
"0.46811286",
"0.4661988",
"0.4650697",
"0.4630392",
"0.46237257",
"0.46175706",
"0.46167982",
"0.4616169",
"0.46140805",
"0.4606505",
"0.45972076",
"0.45680162",
"0.4565486",
"0.45538554",
"0.45388106",
"0.4530619",
"0.4530619",
"0.4530619",
"0.45251477",
"0.4524622",
"0.45107827",
"0.45101047",
"0.45071447",
"0.4507061",
"0.45020494",
"0.45002493",
"0.44955432",
"0.4489111",
"0.4485019",
"0.4484245",
"0.44622877",
"0.44577575",
"0.44551647",
"0.44473392",
"0.44450417",
"0.4444519",
"0.44256112",
"0.44132495",
"0.4413234",
"0.4407972",
"0.44070294",
"0.43877494",
"0.43822446",
"0.43791705",
"0.4375901",
"0.4375901",
"0.43705148",
"0.43649492",
"0.4358859",
"0.43576992",
"0.43502402"
] | 0.0 | -1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.